1818
1919public  class  ReadGroupSummary  {
2020
21- 	public  static  final  int  ERR_READ_LIMIT   = 10 ;	
22- 	// xml node name 	 
23- 	public  static  final  String  NODE_READGROUP  = "readGroup" ;		
2421	public  static  final  String  NODE_SOFTCLIP  = "softClippedBases" ;
2522	public  static  final  String  NODE_TRIM  = "trimmedBases" ;	
2623	public  static  final  String  NODE_HARDCLIP  = "hardClippedBases" ;
2724	public  static  final  String  NODE_READ_LENGTH  = "readLength"  ; 
2825	public  static  final  String  NODE_PAIR_TLEN  = "tLen"  ; 	
2926	public  static  final  String  NODE_OVERLAP  = "overlappedBases" ;	
3027	public  static  final  String  NODE_DUPLICATE  = "duplicateReads" ;
31- 	public  static  final  String  NODE_SECONDARY  = "secondary" ;
32- 	public  static  final  String  NODE_SUPPLEMENTARY  = "supplementary" ; 	
3328	public  static  final  String  NODE_UNMAPPED  = "unmappedReads" ;
3429	public  static  final  String  NODE_NOT_PROPER_PAIR  = "notProperPairs" ;
35- 	public  static  final  String  NODE_FAILED_VENDOR_QUALITY  = "failedVendorQuality" ;
36- 		
30+ 
3731	public  static  final  String  MIN  = "min" ;	
3832	public  static  final  String  MAX  = "max" ;
3933	public  static  final  String  MEAN  = "mean" ; 
@@ -54,11 +48,11 @@ public class ReadGroupSummary {
5448	// record read length excluding the discard reads but includes duplicate,unmapped and nonCanonicalReads	 
5549	QCMGAtomicLongArray  readLength  = new  QCMGAtomicLongArray (128 );	
5650	QCMGAtomicLongArray  forTrimLength  = new  QCMGAtomicLongArray (128 );	
57- 	private  final  ConcurrentMap <String , AtomicLong > cigarValuesCount  = new  ConcurrentHashMap <String ,  AtomicLong >();
51+ 	private  final  ConcurrentMap <String , AtomicLong > cigarValuesCount  = new  ConcurrentHashMap <>();
5852	// must be concurrent set for multi threads 
5953	private  final  ConcurrentMap <Integer , PairSummary > pairCategory  = new  ConcurrentHashMap <>();
6054
61- 	// bad reads inforamtion  
55+ 	// bad reads information  
6256	AtomicLong  duplicate  = new  AtomicLong ();
6357	AtomicLong  secondary   = new  AtomicLong ();
6458	AtomicLong  supplementary   = new  AtomicLong ();
@@ -122,7 +116,7 @@ public long getUnmappedBase() {
122116		return  this .unmapped .get () * getMaxReadLength (); 
123117	}	
124118
125- 	public  long  getnotPoperPairedBase () {
119+ 	public  long  getNotProperPairedBase () {
126120		return  notProperPairedReads .get () * getMaxReadLength (); 
127121	}
128122
@@ -149,7 +143,7 @@ public boolean parseRecord( final SAMRecord record ) {
149143			return  false ;
150144		} 		
151145
152- 		// parseing  cigar 
146+ 		// parsing  cigar 
153147		// cigar string from reads including duplicateReads, nonCanonicalPairs and unmappedReads but excluding discardedReads (failed, secondary and supplementary). 
154148		int  lHard  = 0 ;
155149		int  lSoft  = 0 ;
@@ -181,7 +175,7 @@ public boolean parseRecord( final SAMRecord record ) {
181175			return  false ;
182176		} 
183177
184- 		// check pair orientaiton , tLen, mate 
178+ 		// check pair orientation , tLen, mate 
185179		if  (record .getReadPairedFlag ()) {
186180			BwaPair .Pair  pairType  = BwaPair .getPairType (record );
187181			boolean  isProper  = record .getProperPairFlag ();
@@ -204,7 +198,7 @@ public boolean parseRecord( final SAMRecord record ) {
204198			softClip .increment (lSoft );
205199		}
206200		// record read length excluding the discard reads duplicate.get() + unmapped.get() + getnonCanonicalReadsCount();	 
207- 		// due to it for trimmed base caculation  as well 
201+ 		// due to it for trimmed base calculation  as well 
208202		forTrimLength .increment (record .getReadLength () + lHard );	
209203
210204		return  true ;  
@@ -221,8 +215,8 @@ public long getDiscardreads() {
221215
222216
223217	/** 
224- 	 * check all globle  value and assign the sumamry  value 
225- 	 * eg. private long trimedBase  = 0; 	  
218+ 	 * check all global  value and assign the summary  value 
219+ 	 * eg. private long trimmedBase  = 0; 
226220	 */ 
227221	public  void  preSummary () {				
228222		// check overlap and tLen from pairSummary  
@@ -247,19 +241,18 @@ public void preSummary() {
247241		this .hardclipStats  = new  SummaryReportUtils .TallyStats ( hardClip );
248242		this .readlengthStats  = new  SummaryReportUtils .TallyStats ( readLength  );	
249243
250- 		int  maxLenght  = (int )readlengthStats .getMax ();
251- 		QCMGAtomicLongArray  trimedBase  = new  QCMGAtomicLongArray (maxLenght  + 1 );	 
244+ 		int  maxLength  = (int )readlengthStats .getMax ();
245+ 		QCMGAtomicLongArray  trimmedBase  = new  QCMGAtomicLongArray (maxLength  + 1 );
252246		for  (int  i  = 0  ; i  < forTrimLength .length () ; i  ++)	 {			
253- 			if  (forTrimLength .get (i ) == 0  || maxLenght  == i  ) {
247+ 			if  (forTrimLength .get (i ) == 0  || maxLength  == i  ) {
254248				continue ;
255249			}
256- 			trimedBase .increment ( maxLenght  - i , forTrimLength .get (i ));
250+ 			trimmedBase .increment ( maxLength  - i , forTrimLength .get (i ));
257251		}
258- 		this .trimBaseStats  = new  SummaryReportUtils .TallyStats ( trimedBase  );			 
252+ 		this .trimBaseStats  = new  SummaryReportUtils .TallyStats ( trimmedBase  );
259253	}
260254
261- 	@ SuppressWarnings ("unchecked" )
262- 	public  void  readSummary2Xml (Element  parent  ) throws  Exception  {	
255+ 	public  void  readSummary2Xml (Element  parent  ) {
263256
264257		preSummary ();
265258
@@ -275,7 +268,7 @@ public void readSummary2Xml(Element parent ) throws Exception {
275268		lostBaseStats ( rgElement , NODE_OVERLAP , overlapStats  );
276269
277270		// create node for overall	 
278- 		rgElement  = XmlUtils .createMetricsNode (parent ,"reads" , new  Pair <String ,  Number >(READ_COUNT , inputReadCounts .get ()));		 
271+ 		rgElement  = XmlUtils .createMetricsNode (parent ,"reads" , new  Pair <>(READ_COUNT , inputReadCounts .get ()));
279272		Element  ele  = XmlUtils .createGroupNode (rgElement , XmlUtils .DISCARD_READS  );
280273		XmlUtils .outputValueNode (ele , "supplementaryAlignmentCount" , supplementary .get ());
281274		XmlUtils .outputValueNode (ele , "secondaryAlignmentCount" , secondary .get ());
@@ -326,7 +319,7 @@ public void pairSummary2Xml( Element parent ) {
326319					sum  += p .getFirstOfPairCounts ();
327320				}			
328321			}
329- 			// can't really count he  pair number due to RAM limits, just pickup number of firstOfPair 
322+ 			// can't really count the  pair number due to RAM limits, just pickup number of firstOfPair 
330323			ele .setAttribute ( PAIR_COUNT , sum  + "" );  			
331324		}
332325	}
0 commit comments