Skip to content

Commit 8981ebb

Browse files
made some window files add extension
1 parent cc20d50 commit 8981ebb

File tree

21 files changed

+60889
-46
lines changed

21 files changed

+60889
-46
lines changed

sacCer3_200bp.bed

Lines changed: 60826 additions & 0 deletions
Large diffs are not rendered by default.

sacCer3_200bp.bed.gz

474 KB
Binary file not shown.

src/main/java/scriptmanager/scripts/Coordinate_Manipulation/BED_Manipulation/SortBED.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package scriptmanager.scripts.Coordinate_Manipulation.BED_Manipulation;
22

3-
import java.io.BufferedOutputStream;
43
import java.io.BufferedReader;
54
import java.io.File;
6-
import java.io.FileOutputStream;
75
import java.io.IOException;
86
import java.io.PrintStream;
97
import java.util.ArrayList;
108
import java.util.Collections;
119
import java.util.HashMap;
12-
import java.util.zip.GZIPOutputStream;
1310

1411
import scriptmanager.objects.CoordinateObjects.BEDCoord;
1512
import scriptmanager.util.GZipUtilities;
@@ -61,11 +58,8 @@ public static void sortBEDbyCDT(String outbase, File bed, File cdt, int START_IN
6158

6259
PrintStream OUT;
6360
// Initialize output writer
64-
if (gzOutput) {
65-
OUT = new PrintStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(outbase + ".cdt.gz"))));
66-
} else {
67-
OUT = new PrintStream(new BufferedOutputStream(new FileOutputStream(outbase + ".cdt")));
68-
}
61+
String suffix = ".cdt" + (gzOutput? ".gz": "");
62+
OUT = GZipUtilities.makePrintStream(new File(outbase + suffix), gzOutput);
6963
// Output sorted CDT File
7064
OUT.println(CDTHeader);
7165
for (int x = 0; x < SORT.size(); x++) {
@@ -91,11 +85,8 @@ public static void sortBEDbyCDT(String outbase, File bed, File cdt, int START_IN
9185
br.close();
9286

9387
// Initialize output writer
94-
if (gzOutput) {
95-
OUT = new PrintStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(outbase + ".bed.gz"))));
96-
} else {
97-
OUT = new PrintStream(new BufferedOutputStream(new FileOutputStream(outbase + ".bed")));
98-
}
88+
suffix = ".bed" + (gzOutput? ".gz": "");
89+
OUT = GZipUtilities.makePrintStream(new File(outbase + suffix), gzOutput);
9990
// Output sorted BED File
10091
for (int x = 0; x < SORT.size(); x++) {
10192
OUT.println(BEDFile.get(SORT.get(x).getName()));

src/main/java/scriptmanager/scripts/Peak_Analysis/FilterBEDbyProximity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public FilterBEDbyProximity(File input, int cutoff, String outputBase, PrintStre
3434
if(outputBase == null) {
3535
outputBase = ExtensionFileFilter.stripExtensionIgnoreGZ(input) + "_" + Integer.toString(CUTOFF) + "bp";
3636
}
37-
OUT_Filter = GZipUtilities.makePrintStream(new File(outputBase + "-FILTER" + ".bed"), gzOutput);
38-
OUT_Cluster = GZipUtilities.makePrintStream(new File(outputBase + "-CLUSTER" + ".bed"), gzOutput);
37+
OUT_Filter = GZipUtilities.makePrintStream(new File(outputBase + "-FILTER.bed" + (gzOutput? ".gz": "")), gzOutput);
38+
OUT_Cluster = GZipUtilities.makePrintStream(new File(outputBase + "-CLUSTER.bed" + (gzOutput? ".gz": "")), gzOutput);
3939
}catch (FileNotFoundException e) { e.printStackTrace(); }
4040
}
4141

src/main/java/scriptmanager/scripts/Read_Analysis/AggregateData.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ public void run() throws IOException {
9898

9999
String name = "ALL_SCORES.out";
100100
if (OUT_PATH == null) {
101-
OUT = GZipUtilities.makePrintStream(new File(name), OUTPUT_GZIP);
101+
OUT = GZipUtilities.makePrintStream(new File(name + (OUTPUT_GZIP? ".gz": "")), OUTPUT_GZIP);
102102
} else if (!OUT_PATH.isDirectory()) {
103103
OUT = GZipUtilities.makePrintStream(OUT_PATH, OUTPUT_GZIP);
104104
} else {
105-
OUT = GZipUtilities.makePrintStream(new File(OUT_PATH.getCanonicalPath() + File.separator + name), OUTPUT_GZIP);
105+
OUT = GZipUtilities.makePrintStream(new File(OUT_PATH.getCanonicalPath() + File.separator + name + (OUTPUT_GZIP? ".gz": "")), OUTPUT_GZIP);
106106
}
107107

108108
// Check all arrays are the same size
@@ -142,11 +142,11 @@ public String getMessage() {
142142
}
143143

144144
public void outputFileScore(File IN) throws FileNotFoundException, IOException {
145-
String NEWNAME = ExtensionFileFilter.stripExtension(IN);
145+
String NEWNAME = ExtensionFileFilter.stripExtension(IN) + "_SCORES.out";
146146
if (OUT_PATH != null) {
147-
OUT = GZipUtilities.makePrintStream(new File(OUT_PATH.getAbsolutePath() + File.separator + NEWNAME + "_SCORES.out"), OUTPUT_GZIP);
147+
OUT = GZipUtilities.makePrintStream(new File(OUT_PATH.getAbsolutePath() + File.separator + NEWNAME + (OUTPUT_GZIP? ".gz": "")), OUTPUT_GZIP);
148148
} else {
149-
OUT = GZipUtilities.makePrintStream(new File(NEWNAME + "_SCORES.out"), OUTPUT_GZIP);
149+
OUT = GZipUtilities.makePrintStream(new File(NEWNAME + (OUTPUT_GZIP? ".gz": "")), OUTPUT_GZIP);
150150
}
151151
outputFileScore(IN, OUT);
152152
}

src/main/java/scriptmanager/window_interface/BAM_Format_Converter/BAMtoBEDOutput.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public BAMtoBEDOutput(File b, File out_dir, int s, int pair_status, int min_size
6161
public void run() throws IOException, InterruptedException {
6262
// Open Output File
6363
String OUTPUT = BAM.getName().split("\\.")[0] + "_" + READ + ".bed";
64+
OUTPUT = OUTPUT + (OUTPUT_GZIP? ".gz": "");
6465
if (OUT_DIR != null) {
6566
OUTPUT = OUT_DIR.getCanonicalPath() + File.separator + OUTPUT;
6667
}

src/main/java/scriptmanager/window_interface/BAM_Format_Converter/BAMtoGFFOutput.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public void run() throws IOException, InterruptedException {
6464
if (OUT_DIR != null) {
6565
OUTPUT = OUT_DIR.getCanonicalPath() + File.separator + OUTPUT;
6666
}
67+
OUTPUT = OUTPUT + (OUTPUT_GZIP? ".gz": "");
6768

6869
// Call script here, pass in ps and OUT
6970
PrintStream PS = new PrintStream(new CustomOutputStream(textArea));

src/main/java/scriptmanager/window_interface/BAM_Format_Converter/BAMtoscIDXOutput.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public void run() throws IOException, InterruptedException {
6262
if (OUT_DIR != null) {
6363
OUTPUT = OUT_DIR.getCanonicalPath() + File.separator + OUTPUT;
6464
}
65+
OUTPUT = OUTPUT + (OUTPUT_GZIP? ".gz": "");
6566

6667
// Call script here, pass in ps and OUT
6768
PrintStream PS = new PrintStream(new CustomOutputStream(textArea));

src/main/java/scriptmanager/window_interface/Coordinate_Manipulation/BED_Manipulation/BEDtoGFFWindow.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,22 @@ public class BEDtoGFFWindow extends JFrame implements ActionListener, PropertyCh
7070
class Task extends SwingWorker<Void, Void> {
7171
@Override
7272
public Void doInBackground() throws IOException {
73+
boolean GZIP = chckbxGzipOutput.isSelected();
7374
setProgress(0);
7475
LogItem old_li = new LogItem("");
7576
for (int x = 0; x < BEDFiles.size(); x++) {
7677
File XBED = BEDFiles.get(x);
7778
// Set outfilepath
78-
String OUTPUT = ExtensionFileFilter.stripExtensionIgnoreGZ(XBED) + ".gff";
79+
String OUTPUT = ExtensionFileFilter.stripExtensionIgnoreGZ(XBED) + ".gff" + (GZIP? ".gz": "");
7980
if (OUT_DIR != null) {
8081
OUTPUT = OUT_DIR + File.separator + OUTPUT;
8182
}
8283
// Initialize LogItem
83-
String command = BEDtoGFFCLI.getCLIcommand(new File(OUTPUT), XBED, chckbxGzipOutput.isSelected());
84+
String command = BEDtoGFFCLI.getCLIcommand(new File(OUTPUT), XBED, GZIP);
8485
LogItem new_li = new LogItem(command);
8586
firePropertyChange("log", old_li, new_li);
8687
// Execute conversion and update progress
87-
BEDtoGFF.convertBEDtoGFF(new File(OUTPUT), XBED, chckbxGzipOutput.isSelected());
88+
BEDtoGFF.convertBEDtoGFF(new File(OUTPUT), XBED, GZIP);
8889
// Update log item
8990
new_li.setStopTime(new Timestamp(new Date().getTime()));
9091
new_li.setStatus(0);

src/main/java/scriptmanager/window_interface/Coordinate_Manipulation/BED_Manipulation/ExpandBEDWindow.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public Void doInBackground() throws IOException {
7979
if (SIZE < 1) {
8080
JOptionPane.showMessageDialog(null, "Invalid Expansion Size!!! Must be larger than 0 bp");
8181
} else {
82+
boolean GZIP = chckbxGzipOutput.isSelected();
8283
setProgress(0);
8384
for (int x = 0; x < BEDFiles.size(); x++) {
8485
// Save current BED to temp variable
@@ -90,10 +91,10 @@ public Void doInBackground() throws IOException {
9091
OUTPUT = OUT_DIR + File.separator + OUTPUT;
9192
}
9293
// Add suffix
93-
OUTPUT += "_" + Integer.toString(SIZE) + "bp.bed";
94+
OUTPUT += "_" + Integer.toString(SIZE) + "bp.bed" + (GZIP? ".gz": "");
9495

9596
// Execute expansion and update progress
96-
ExpandBED.expandBEDBorders(new File(OUTPUT), XBED, SIZE, rdbtnExpandFromCenter.isSelected(), chckbxGzipOutput.isSelected());
97+
ExpandBED.expandBEDBorders(new File(OUTPUT), XBED, SIZE, rdbtnExpandFromCenter.isSelected(), GZIP);
9798
int percentComplete = (int) (((double) (x + 1) / BEDFiles.size()) * 100);
9899
setProgress(percentComplete);
99100
}

0 commit comments

Comments
 (0)