Skip to content

Commit 6df782c

Browse files
committed
separate chart generation from script TagPileup
Only the GUI version of TagPileup generates the composite chart so the classes for this tool arre restuctured in this commit so that the chart is generated by the window_interface/TagPileupOutput class. This results in one less argument input to the script so the CLI class was also minorly affected by this commit.
1 parent 792c67f commit 6df782c

3 files changed

Lines changed: 17 additions & 23 deletions

File tree

src/cli/Read_Analysis/TagPileupCLI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public Integer call() throws Exception {
139139
System.exit(1);
140140
}
141141

142-
TagPileup script_obj = new TagPileup(bedFile, bamFile, p, null, outputOptions.outputMatrix.get(0), false);
142+
TagPileup script_obj = new TagPileup(bedFile, bamFile, p, null, outputOptions.outputMatrix.get(0));
143143
script_obj.run();
144144

145145
System.err.println( "Calculations complete" );

src/scripts/Read_Analysis/TagPileup.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.concurrent.Executors;
2020
import java.util.zip.GZIPOutputStream;
2121

22-
import charts.CompositePlot;
2322
import htsjdk.samtools.AbstractBAMFileIndex;
2423
import htsjdk.samtools.SamReader;
2524
import htsjdk.samtools.SamReaderFactory;
@@ -34,6 +33,9 @@ public class TagPileup {
3433
File BAM = null;
3534

3635
PileupParameters PARAM = null;
36+
public double[] DOMAIN = null;
37+
public double[] AVG_S1 = null;
38+
public double[] AVG_S2 = null;
3739

3840
PrintStream COMPOSITE = null;
3941
// Generic print stream to accept PrintStream of GZIPOutputStream
@@ -46,16 +48,12 @@ public class TagPileup {
4648

4749
String outMatrixBasename;
4850

49-
boolean GUI = false;
50-
51-
public TagPileup(File be, File ba, PileupParameters param, PrintStream outputwindow_ps, String outMat,
52-
boolean guiStatus) {
51+
public TagPileup(File be, File ba, PileupParameters param, PrintStream outputwindow_ps, String outMat) {
5352
BED = be;
5453
BAM = ba;
5554
PARAM = param;
5655
PS = outputwindow_ps;
5756
outMatrixBasename = outMat;
58-
GUI = guiStatus;
5957
}
6058

6159
public void run() throws IOException {
@@ -133,11 +131,11 @@ public void run() throws IOException {
133131
while (!parseMaster.isTerminated()) {
134132
}
135133

136-
double[] AVG_S1 = new double[getMaxBEDSize(INPUT)];
137-
double[] AVG_S2 = null;
134+
DOMAIN = new double[getMaxBEDSize(INPUT)];
135+
AVG_S1 = new double[DOMAIN.length];
136+
AVG_S2 = null;
138137
if (STRAND == 0)
139-
AVG_S2 = new double[AVG_S1.length];
140-
double[] DOMAIN = new double[AVG_S1.length];
138+
AVG_S2 = new double[DOMAIN.length];
141139

142140
// Account for the shifted oversized window produced by binning and smoothing
143141
int OUTSTART = 0;
@@ -278,16 +276,6 @@ public void run() throws IOException {
278276
}
279277
}
280278

281-
// Make composite plots
282-
if (GUI) {
283-
if (STRAND == 0) {
284-
compositePlot = CompositePlot.createCompositePlot(DOMAIN, AVG_S1, AVG_S2, BED.getName(),
285-
PARAM.getColors());
286-
} else {
287-
compositePlot = CompositePlot.createCompositePlot(DOMAIN, AVG_S1, BED.getName(), PARAM.getColors());
288-
}
289-
}
290-
291279
// Output JTV files
292280
if (OUT_S1 != null) {
293281
if (PARAM.getOutputJTV() && PARAM.getOutputType() == 2) {

src/window_interface/Read_Analysis/TagPileupOutput.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import javax.swing.JTabbedPane;
1616
import javax.swing.SpringLayout;
1717

18+
import charts.CompositePlot;
1819
import objects.PileupParameters;
1920
import objects.CustomOutputStream;
2021
import scripts.Read_Analysis.TagPileup;
@@ -104,10 +105,15 @@ public void run() throws IOException {
104105
STATS.setEditable(false); // Make it un-editable
105106
PrintStream ps = new PrintStream(new CustomOutputStream(STATS));
106107

107-
TagPileup script_obj = new TagPileup(BEDFiles.get(BED_Index), BAM, PARAM, ps, null, true);
108+
TagPileup script_obj = new TagPileup(BEDFiles.get(BED_Index), BAM, PARAM, ps, null);
108109
script_obj.run();
109110

110-
tabbedPane_Scatterplot.add(BAM.getName(), script_obj.getCompositePlot());
111+
// Make composite plots
112+
if (PARAM.getStrand() == 0) {
113+
tabbedPane_Scatterplot.add(BAM.getName(), CompositePlot.createCompositePlot(script_obj.DOMAIN, script_obj.AVG_S1, script_obj.AVG_S2, BEDFiles.get(BED_Index).getName(), PARAM.getColors()));
114+
} else {
115+
tabbedPane_Scatterplot.add(BAM.getName(), CompositePlot.createCompositePlot(script_obj.DOMAIN, script_obj.AVG_S1, BEDFiles.get(BED_Index).getName(), PARAM.getColors()));
116+
}
111117

112118
STATS.setCaretPosition(0);
113119
JScrollPane newpane = new JScrollPane(STATS, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,

0 commit comments

Comments
 (0)