@@ -340,23 +340,27 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
340340 continue ;
341341 }
342342
343- int length = Integer .parseInt (line [3 ]) - Integer .parseInt (line [2 ]) - 1 ; //NOTE: pindel reports one base upstream+downstream as part of the indel
344- writer .writeNext (new String []{ctx .getSequenceSupport ().getCachedReadset (so .getReadset ()).getName (), String .valueOf (so .getRowid ()), String .valueOf (so .getReadset ()), "Pindel" , line [1 ], line [2 ], line [3 ], String .valueOf (length ), "" , line [0 ], line [4 ], "" , line [5 ], line [6 ]});
345-
343+ int end1 = Integer .parseInt (line [3 ]) - 1 ; //pindel reports the end as one bp downstream of the event, so drop 1 bp even though we're keeping 1-based
344+ int length = end1 - Integer .parseInt (line [2 ]); //NOTE: pindel reports one base upstream+downstream as part of the indel
346345 if ("D" .equalsIgnoreCase (line [0 ]))
347346 {
348- ReferenceSequence rs = getReferenceSequence (ctx , genomeIds .iterator ().next (), line [1 ]);
349- int start0 = Integer .parseInt (line [2 ]) - 1 ;
350- char alt = (char )rs .getBases ()[start0 ];
347+ ReferenceSequence rs = getReferenceSequence (ctx , genomeIds .iterator ().next (), line [1 ]);
348+ int start0 = Integer .parseInt (line [2 ]) - 1 ; //for consistency with VCFs, retain the first REF base, as pindel reports
349+ char alt = (char )rs .getBases ()[start0 ];
351350
352- int end1 = Integer .parseInt (line [3 ]) - 1 ; //pindel reports the end as one bp downstream of the event, so drop 1 bp even though we're keeping 1-based
353- String ref = new String (Arrays .copyOfRange (rs .getBases (), start0 , end1 ), StringUtilsLabKey .DEFAULT_CHARSET );
354- if (ref .length () != length + 1 )
355- {
356- throw new PipelineJobException ("Improper pindel parsing: " + so .getRowid () + "/" + line [2 ] + "/" + line [3 ] + "/" + ref + "/" + alt );
357- }
351+ String ref = new String (Arrays .copyOfRange (rs .getBases (), start0 , end1 ), StringUtilsLabKey .DEFAULT_CHARSET );
352+ if (ref .length () != length + 1 )
353+ {
354+ throw new PipelineJobException ("Improper pindel parsing: " + so .getRowid () + "/" + line [2 ] + "/" + line [3 ] + "/" + ref + "/" + alt );
355+ }
358356
359- uniqueIndels .add (line [1 ] + "<>" + line [2 ] + "<>" + ref + "<>" + alt );
357+ uniqueIndels .add (line [1 ] + "<>" + line [2 ] + "<>" + ref + "<>" + alt );
358+
359+ writer .writeNext (new String []{ctx .getSequenceSupport ().getCachedReadset (so .getReadset ()).getName (), String .valueOf (so .getRowid ()), String .valueOf (so .getReadset ()), "Pindel" , line [1 ], line [2 ], String .valueOf (end1 ), String .valueOf (length ), ref , String .valueOf (alt ), line [4 ], "" , line [5 ], line [6 ]});
360+ }
361+ else
362+ {
363+ writer .writeNext (new String []{ctx .getSequenceSupport ().getCachedReadset (so .getReadset ()).getName (), String .valueOf (so .getRowid ()), String .valueOf (so .getReadset ()), "Pindel" , line [1 ], line [2 ], String .valueOf (end1 ), String .valueOf (length ), "" , line [0 ], line [4 ], "" , line [5 ], line [6 ]});
360364 }
361365 }
362366 }
0 commit comments