2727public class PEStats {
2828
2929 public static Vector <ChartPanel > getPEStats ( File out_basename , File bamFile , boolean DUP_STATUS , int MIN_INSERT , int MAX_INSERT , PrintStream PS_INSERT , PrintStream PS_DUP , boolean SUM_STATUS ){
30- System .out .println ("getPEStats called" );
3130 final SamReaderFactory factory = SamReaderFactory .makeDefault ().enable (SamReaderFactory .Option .INCLUDE_SOURCE_IN_RECORDS , SamReaderFactory .Option .VALIDATE_CRC_CHECKSUMS ).validationStringency (ValidationStringency .SILENT );
3231
3332 // Output Vecotr of Charts to be returned
@@ -40,6 +39,7 @@ public static Vector<ChartPanel> getPEStats( File out_basename, File bamFile, bo
4039 PrintStream OUT_DUP = null ;
4140 File OUT_DUPPNG = null ;
4241
42+ // Set output PrintStreams and PNG file objects
4343 if ( out_basename !=null ) {
4444 try {
4545 OUT_INSERT = new PrintStream (new File ( out_basename .getCanonicalPath () + "_InsertHistogram.out" ));
@@ -60,9 +60,7 @@ public static Vector<ChartPanel> getPEStats( File out_basename, File bamFile, bo
6060 printBoth ( null , OUT_INSERT_SUM , time );
6161 printBoth ( PS_INSERT , OUT_INSERT , time );
6262 printBoth ( PS_DUP , OUT_DUP , time );
63-
64- if (PS_DUP !=null ){ PS_DUP .println ("YO!" ); }
65-
63+
6664 //Check if BAI index file exists
6765 File f = new File (bamFile + ".bai" );
6866 if (f .exists () && !f .isDirectory ()) {
@@ -77,6 +75,7 @@ public static Vector<ChartPanel> getPEStats( File out_basename, File bamFile, bo
7775 //Code to get individual chromosome stats
7876 SamReader reader = factory .open (bamFile );
7977 AbstractBAMFileIndex bai = (AbstractBAMFileIndex ) reader .indexing ().getIndex ();
78+ System .out .println (bamFile );
8079
8180 //Variables to keep track of insert size histogram
8281 double InsertAverage = 0 ;
@@ -197,13 +196,13 @@ public static Vector<ChartPanel> getPEStats( File out_basename, File bamFile, bo
197196 try {
198197 charts .add ( 0 , Histogram .createBarChart (HIST , DOMAIN , OUT_INSPNG ) );
199198 }catch ( IOException e ){ e .printStackTrace (); }
200-
199+
200+ //Duplication statistics
201201 if (DUP_STATUS ) {
202- //Duplication statistics
203202 double UNIQUE_MOLECULES = 0 ;
204203 String [] BIN_NAME = initializeBIN_Names ();
205204 ArrayList <Double > BIN = new ArrayList <Double >();
206- initializeBINS (BIN );
205+ initializeBINS (BIN );
207206
208207 Iterator <Integer > keys = ALL_COMPLEXITY .keySet ().iterator ();
209208 while (keys .hasNext ()) {
@@ -223,14 +222,13 @@ public static Vector<ChartPanel> getPEStats( File out_basename, File bamFile, bo
223222 charts .add ( 1 , LineChart .createLineChart (BIN , BIN_NAME , OUT_DUPPNG ) );
224223 }catch ( IOException e ){ e .printStackTrace (); }
225224 }
226-
227225 } else {
226+ charts .add (0 , new ChartPanel (null ));
227+ charts .add (1 , new ChartPanel (null ));
228228 printBoth ( PS_INSERT , OUT_INSERT , "BAI Index File does not exist for: " + bamFile .getName () );
229229 printBoth ( System .err , OUT_INSERT_SUM , "BAI Index File does not exist for: " + bamFile .getName () );
230230 printBoth ( PS_DUP , OUT_DUP , "BAI Index File does not exist for: " + bamFile .getName () );
231231 }
232- if (PS_INSERT != null ){ PS_INSERT .close (); }
233- if (PS_DUP !=null ){ PS_DUP .close (); }
234232
235233 if (OUT_INSERT != null ){ OUT_INSERT .close (); }
236234 if (OUT_INSERT_SUM !=null ){ OUT_INSERT_SUM .close (); }
0 commit comments