@@ -27,10 +27,10 @@ public class ReadIndels {
2727 private VcfHeader header ;
2828
2929 private static final int errRecordLimit = 100 ;
30- //counts from each input, {No of new indel, No of overlap indel, No of indels with mult Allel , No of inputs variants, No of input variants with multi Allel }
30+ //counts from each input, {No of new indel, No of overlap indel, No of indels with multi Allele , No of inputs variants, No of input variants with multi Allele }
3131 private final int [] counts = {0 , 0 , 0 , 0 , 0 };
3232
33- //here key will be uniq for indel: chr, start, end, allel
33+ //here key will be uniq for indel: chr, start, end, allele
3434 private final Map <VcfRecord , VcfRecord > positionRecordMap = new ConcurrentHashMap <>();
3535
3636 public ReadIndels ( QLogger logger ) {
@@ -49,7 +49,7 @@ public void appendTestIndels(File f) throws IOException {
4949 List <String > format = vcf .getFormatFields ();
5050 if (format != null ) {
5151 while (format .size () > 2 ) {
52- format .remove ( format . size () - 1 );
52+ format .removeLast ();
5353 }
5454 vcf .setFormatFields (format );
5555 VcfUtils .addMissingDataToFormatFields (vcf , 2 );
@@ -94,12 +94,12 @@ private boolean mergeTestIndel(VcfRecord secVcf) {
9494 //only keep first sample column of second vcf
9595 List <String > secformat = secVcf .getFormatFields ();
9696 while (secformat != null && secformat .size () > 2 ) {
97- secformat .remove ( secformat . size () - 1 );
97+ secformat .removeLast ();
9898 }
9999
100100 //copy secVcf with sample column "FORMAT <missing data> oriSample" only
101101 if (existingvcf == null ) {
102- //the test only indel always set as somatic, even gatkeTest runMode
102+ //the test only indel always set as somatic, even gatk Test runMode
103103 existingvcf = new VcfRecord .Builder (secVcf .getChrPosition (), secVcf .getRef ())
104104 .id (secVcf .getId ()).allele (secVcf .getAlt ()).filter (FILTER_SOMATIC ).build ();
105105
@@ -116,15 +116,15 @@ private boolean mergeTestIndel(VcfRecord secVcf) {
116116 return false ;
117117 } else {
118118 //gatk mode already set filter as "." (germline) ignore pileup, since they are also appear on control vcf
119- //only keep first sample column of exsiting vcf
119+ //only keep first sample column of existing vcf
120120 List <String > format1 = existingvcf .getFormatFields ();
121121
122122 if (format1 != null ) {
123123 while (format1 .size () > 2 ) {
124- format1 .remove ( format1 . size () - 1 );
124+ format1 .removeLast ();
125125 }
126126 existingvcf .setFormatFields (format1 );
127- //merge exiting and second vcf format, the exsitingvcf already inside map
127+ //merge exiting and second vcf format, the existing vcf already inside map
128128 VcfUtils .addAdditionalSampleToFormatField (existingvcf , secformat ) ;
129129 }
130130 return true ;
@@ -178,7 +178,7 @@ public void loadIndels(File f) throws IOException {
178178 vcf1 .setFilter (Constants .MISSING_DATA_STRING );
179179
180180 if (positionRecordMap .containsKey (vcf1 ) && (indelOverlap ++) < errRecordLimit ) {
181- logger .warn ("same variants already exsits , this one will be discard:\n " + positionRecordMap .get (vcf1 ).toString () );
181+ logger .warn ("same variants already exists , this one will be discard:\n " + positionRecordMap .get (vcf1 ).toString () );
182182 continue ; //no overwrite but just warning
183183 }
184184 positionRecordMap .put (vcf1 , vcf1 );
@@ -197,7 +197,7 @@ public void loadIndels(File f) throws IOException {
197197 }
198198
199199 /**
200- * change the input vcf by putting '.' on "GT" field if there are multi Alleles existis ;
200+ * change the input vcf by putting '.' on "GT" field if multi Alleles exists ;
201201 * do nothing if not multi Alleles or not GT field on format column
202202 * @param vcf input vcf record
203203 */
@@ -211,7 +211,7 @@ public void resetGenotype(VcfRecord vcf) {
211211 //add GD to second field
212212 VcfFormatFieldRecord [] frecords = new VcfFormatFieldRecord [format .size () - 1 ];
213213 for (int i = 1 ; i < format .size (); i ++) {
214- VcfFormatFieldRecord re = new VcfFormatFieldRecord (format .get ( 0 ), format .get (i ));
214+ VcfFormatFieldRecord re = new VcfFormatFieldRecord (format .getFirst ( ), format .get (i ));
215215 String gd = IndelUtils .getGenotypeDetails (re , vcf .getRef (), vcf .getAlt () );
216216 re .setField (1 , VcfHeaderUtils .FORMAT_GENOTYPE_DETAILS , gd == null ? Constants .MISSING_DATA_STRING : gd );
217217
@@ -229,7 +229,7 @@ public void resetGenotype(VcfRecord vcf) {
229229 for (int i = 1 ; i < frecords .length ; i ++) {
230230 //the exception shouldn't happen
231231 if ( !frecords [i ].getFormatColumnString ().equals (frecords [0 ].getFormatColumnString ())) {
232- throw new IllegalArgumentException ("both sample column with differnt format column: \n "
232+ throw new IllegalArgumentException ("both sample column with different format column: \n "
233233 + frecords [0 ].getFormatColumnString () + "\n " + frecords [i ].getFormatColumnString ());
234234 }
235235 format .add (frecords [i ].getSampleColumnString ());
@@ -241,7 +241,6 @@ public void resetGenotype(VcfRecord vcf) {
241241 /**
242242 *
243243 * @return a map of, key is the indel position, value is the list a vcf record on that position.
244- * @throws Exception
245244 */
246245 public Map <ChrRangePosition , IndelPosition > getIndelMap () throws Q3IndelException {
247246
0 commit comments