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:
ebanks 2010-04-14 16:58:55 +00:00
parent b930dc52a5
commit f1189bac5a
2 changed files with 10 additions and 9 deletions

View File

@ -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.utils.StingException;
import java.util.List;
import java.util.Arrays;
@Analysis(name = "Count Variants", description = "Counts different classes of variants in the sample")
public class CountVariants extends VariantEvaluator {
@ -91,7 +89,7 @@ public class CountVariants extends VariantEvaluator {
}
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) {

View File

@ -405,9 +405,6 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
//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);
//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
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
switch ( evaluation.getComparisonOrder() ) {
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());
}
@ -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 -- 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>();
bindVariantContexts(bindings, evalNames, tracker, context, false);
bindVariantContexts(bindings, compNames, tracker, context, true);
if ( tracker != null ) {
bindVariantContexts(bindings, evalNames, tracker, context, false);
bindVariantContexts(bindings, compNames, tracker, context, true);
}
return bindings;
}