@@ -340,26 +340,37 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
340340 continue ;
341341 }
342342
343+ int start0 = Integer .parseInt (line [2 ]) - 1 ; //for consistency with VCFs, retain the first REF base, as pindel reports
343344 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
345- if ("D" .equalsIgnoreCase (line [0 ]))
345+ if ("D" .equalsIgnoreCase (line [0 ]) || "I" .equalsIgnoreCase (line [0 ]))
346346 {
347347 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 ];
350-
348+ int refLength = end1 - start0 ;
351349 String ref = new String (Arrays .copyOfRange (rs .getBases (), start0 , end1 ), StringUtilsLabKey .DEFAULT_CHARSET );
352- if (ref .length () != length + 1 )
350+ if (ref .length () != refLength )
353351 {
354- throw new PipelineJobException ("Improper pindel parsing: " + so .getRowid () + "/" + line [2 ] + "/" + line [3 ] + "/" + ref + "/" + alt );
352+ throw new PipelineJobException ("Improper pindel parsing: " + so .getRowid () + "/" + line [2 ] + "/" + line [3 ] + "/" + ref );
355353 }
356354
357- uniqueIndels .add (line [1 ] + "<>" + line [2 ] + "<>" + ref + "<>" + alt );
355+ String alt = "" ;
356+ int length = -1 ;
357+ if ("D" .equals (line [0 ]))
358+ {
359+ length = end1 - Integer .parseInt (line [2 ]); //NOTE: pindel reports one base upstream+downstream as part of the indel
360+ alt = String .valueOf (rs .getBases ()[start0 ]);
361+ }
362+ else if ("I" .equals (line [0 ]))
363+ {
364+ alt = (char )rs .getBases ()[start0 ] + line [7 ];
365+ length = alt .length ();
366+ }
358367
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 ]});
368+ uniqueIndels .add (line [1 ] + "<>" + line [2 ] + "<>" + ref + "<>" + alt );
369+ 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 , alt , line [4 ], "" , line [5 ], line [6 ]});
360370 }
361371 else
362372 {
373+ int length = end1 - start0 ;
363374 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 ]});
364375 }
365376 }
0 commit comments