4646import java .sql .SQLException ;
4747import java .util .ArrayList ;
4848import java .util .Arrays ;
49- import java .util .Collection ;
5049import java .util .Collections ;
5150import java .util .Date ;
5251import java .util .List ;
@@ -294,9 +293,9 @@ public static void processAndImportNextCladeAa(PipelineJob job, File jsonFile, i
294293 if (vcList .isEmpty ())
295294 {
296295 //NOTE: if this is an indel, upstream variants could cause this:
296+ job .getLogger ().info ("No identical position match found, inspecting overlapping variants (" + consensusMap .size () + "):" );
297297 for (int ntPos : consensusMap .keySet ())
298298 {
299- job .getLogger ().info ("No identical position match found, inspecting overlapping variants:" );
300299 for (VariantContext vc : consensusMap .get (ntPos ))
301300 {
302301 if (vc .overlaps (new Interval (vc .getContig (), positions .get (0 ), positions .get (positions .size () - 1 ))))
@@ -307,6 +306,32 @@ public static void processAndImportNextCladeAa(PipelineJob job, File jsonFile, i
307306 }
308307 }
309308
309+ // Try to recover frameshifts:
310+ if (vcList .isEmpty ())
311+ {
312+ List <Integer > potentialFs = new ArrayList <>();
313+ potentialFs .addAll (consensusMap .keySet ().stream ().filter (x -> x < positions .get (0 )).collect (Collectors .toList ()));
314+ Collections .sort (potentialFs , Collections .reverseOrder ());
315+ OUTER : for (int ntPos : potentialFs )
316+ {
317+ if (positions .get (0 ) - ntPos > 100 )
318+ {
319+ break ;
320+ }
321+
322+ for (VariantContext vc : consensusMap .get (ntPos ))
323+ {
324+ if (vc .isIndel ())
325+ {
326+ job .getLogger ().info ("Inferred associated NT is: " + vc .getStart ());
327+ job .getLogger ().info ("for pos: " + aa .toString ());
328+ vcList .add (vc );
329+ break OUTER ;
330+ }
331+ }
332+ }
333+ }
334+
310335 if (vcList .isEmpty ())
311336 {
312337 job .getLogger ().error ("Cannot find matching NT SNP: " + aa .toString ());
0 commit comments