Skip to content

Commit d2c0657

Browse files
committed
Bugfixes to merge lofreq
1 parent 0355642 commit d2c0657

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
224224
continue;
225225
}
226226

227+
if (vc.isFiltered())
228+
{
229+
continue;
230+
}
231+
227232
//Also perform santity check of VCF early
228233
if (vc.getAttribute("GATK_DP") == null)
229234
{
@@ -439,7 +444,7 @@ else if ("I".equals(line[0]))
439444
while (it.hasNext())
440445
{
441446
VariantContext vc = it.next();
442-
if (vc.isIndel())
447+
if (vc.isIndel() || vc.isFiltered())
443448
{
444449
continue;
445450
}
@@ -499,7 +504,7 @@ else if ("I".equals(line[0]))
499504
alleleToAf.put(a, val);
500505

501506
int val1 = alleleToDp.getOrDefault(a, 0);
502-
if (val1 == NO_DATA_VAL)
507+
if (val1 == (int)NO_DATA_VAL)
503508
{
504509
val1 = 0;
505510
}
@@ -509,6 +514,14 @@ else if ("I".equals(line[0]))
509514
}
510515
}
511516

517+
if (gatkDepth == null)
518+
{
519+
//No variant was called, so this is either considered all WT, or no-call
520+
gatkDepth = getReadDepth(so.getFile(), contigToOffset, site.getLeft(), site.getRight(), ctx);
521+
lofreqDepth = (int)NO_DATA_VAL;
522+
523+
}
524+
512525
List<String> toWrite = new ArrayList<>(line);
513526
toWrite.add(String.valueOf(gatkDepth));
514527
toWrite.add(String.valueOf(lofreqDepth));
@@ -523,6 +536,7 @@ else if ("I".equals(line[0]))
523536
if (dp == (int)NO_DATA_VAL)
524537
{
525538
af = 0.0;
539+
dp = 0;
526540
}
527541

528542
totalAltDepth += dp;

0 commit comments

Comments
 (0)