Bug fix: final map call wasn't being triggered (because we returned when ref==null before applying update0)
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3168 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
b930dc52a5
commit
f1189bac5a
|
|
@ -9,8 +9,6 @@ import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
@Analysis(name = "Count Variants", description = "Counts different classes of variants in the sample")
|
@Analysis(name = "Count Variants", description = "Counts different classes of variants in the sample")
|
||||||
public class CountVariants extends VariantEvaluator {
|
public class CountVariants extends VariantEvaluator {
|
||||||
|
|
@ -91,7 +89,7 @@ public class CountVariants extends VariantEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update0(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
public void update0(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
nProcessedLoci += context.getSkippedBases() + 1;
|
nProcessedLoci += context.getSkippedBases() + (ref == null ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String update1(VariantContext vc1, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
public String update1(VariantContext vc1, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
|
|
|
||||||
|
|
@ -405,9 +405,6 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
//System.out.printf("map at %s with %d skipped%n", context.getLocation(), context.getSkippedBases());
|
//System.out.printf("map at %s with %d skipped%n", context.getLocation(), context.getSkippedBases());
|
||||||
|
|
||||||
if ( ref == null )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
Map<String, VariantContext> vcs = getVariantContexts(tracker, context);
|
Map<String, VariantContext> vcs = getVariantContexts(tracker, context);
|
||||||
//Collection<VariantContext> comps = getCompVariantContexts(tracker, context);
|
//Collection<VariantContext> comps = getCompVariantContexts(tracker, context);
|
||||||
|
|
||||||
|
|
@ -425,6 +422,10 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
// we always call update0 in case the evaluation tracks things like number of bases covered
|
// we always call update0 in case the evaluation tracks things like number of bases covered
|
||||||
evaluation.update0(tracker, ref, context);
|
evaluation.update0(tracker, ref, context);
|
||||||
|
|
||||||
|
// the other updateN methods don't see a null context
|
||||||
|
if ( tracker == null )
|
||||||
|
continue;
|
||||||
|
|
||||||
// now call the single or paired update function
|
// now call the single or paired update function
|
||||||
switch ( evaluation.getComparisonOrder() ) {
|
switch ( evaluation.getComparisonOrder() ) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -444,7 +445,7 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( group.enableInterestingSiteCaptures && captureInterestingSitesOfEvalSet(group) )
|
if ( tracker != null && group.enableInterestingSiteCaptures && captureInterestingSitesOfEvalSet(group) )
|
||||||
writeInterestingSite(interestingReasons, vc, ref.getBase());
|
writeInterestingSite(interestingReasons, vc, ref.getBase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -536,8 +537,10 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
// todo -- we need to deal with dbSNP where there can be multiple records at the same start site. A potential solution is to
|
// todo -- we need to deal with dbSNP where there can be multiple records at the same start site. A potential solution is to
|
||||||
// todo -- allow the variant evaluation to specify the type of variants it wants to see and only take the first such record at a site
|
// todo -- allow the variant evaluation to specify the type of variants it wants to see and only take the first such record at a site
|
||||||
Map<String, VariantContext> bindings = new HashMap<String, VariantContext>();
|
Map<String, VariantContext> bindings = new HashMap<String, VariantContext>();
|
||||||
bindVariantContexts(bindings, evalNames, tracker, context, false);
|
if ( tracker != null ) {
|
||||||
bindVariantContexts(bindings, compNames, tracker, context, true);
|
bindVariantContexts(bindings, evalNames, tracker, context, false);
|
||||||
|
bindVariantContexts(bindings, compNames, tracker, context, true);
|
||||||
|
}
|
||||||
return bindings;
|
return bindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue