Skip to content

Commit a03dd58

Browse files
committed
Attempt to recover associated NT for frameshift variants
1 parent ec16872 commit a03dd58

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/NextCladeHandler.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import java.sql.SQLException;
4747
import java.util.ArrayList;
4848
import java.util.Arrays;
49-
import java.util.Collection;
5049
import java.util.Collections;
5150
import java.util.Date;
5251
import 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

Comments
 (0)