Adding option to VariantAnnotator to do strict allele matching when annotating with comp track concordance.
This commit is contained in:
parent
953998dcd0
commit
bc842ab3a5
|
|
@ -170,6 +170,9 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> implements Ann
|
||||||
@Argument(fullName="MendelViolationGenotypeQualityThreshold",shortName="mvq",required=false,doc="The genotype quality treshold in order to annotate mendelian violation ratio")
|
@Argument(fullName="MendelViolationGenotypeQualityThreshold",shortName="mvq",required=false,doc="The genotype quality treshold in order to annotate mendelian violation ratio")
|
||||||
public double minGenotypeQualityP = 0.0;
|
public double minGenotypeQualityP = 0.0;
|
||||||
|
|
||||||
|
@Argument(fullName="requireStrictAlleleMatch", shortName="strict", doc="If provided only comp tracks that exactly match both reference and alternate alleles will be counted as concordant", required=false)
|
||||||
|
private boolean requireStrictAlleleMatch = false;
|
||||||
|
|
||||||
private VariantAnnotatorEngine engine;
|
private VariantAnnotatorEngine engine;
|
||||||
|
|
||||||
private Collection<VariantContext> indelBufferContext;
|
private Collection<VariantContext> indelBufferContext;
|
||||||
|
|
@ -211,6 +214,7 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> implements Ann
|
||||||
else
|
else
|
||||||
engine = new VariantAnnotatorEngine(annotationGroupsToUse, annotationsToUse, annotationsToExclude, this, getToolkit());
|
engine = new VariantAnnotatorEngine(annotationGroupsToUse, annotationsToUse, annotationsToExclude, this, getToolkit());
|
||||||
engine.initializeExpressions(expressionsToUse);
|
engine.initializeExpressions(expressionsToUse);
|
||||||
|
engine.setRequireStrictAlleleMatch(requireStrictAlleleMatch);
|
||||||
|
|
||||||
// setup the header fields
|
// setup the header fields
|
||||||
// note that if any of the definitions conflict with our new ones, then we want to overwrite the old ones
|
// note that if any of the definitions conflict with our new ones, then we want to overwrite the old ones
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,11 @@ public class VariantAnnotatorEngine {
|
||||||
private List<GenotypeAnnotation> requestedGenotypeAnnotations;
|
private List<GenotypeAnnotation> requestedGenotypeAnnotations;
|
||||||
private List<VAExpression> requestedExpressions = new ArrayList<VAExpression>();
|
private List<VAExpression> requestedExpressions = new ArrayList<VAExpression>();
|
||||||
|
|
||||||
private HashMap<RodBinding<VariantContext>, String> dbAnnotations = new HashMap<RodBinding<VariantContext>, String>();
|
private final HashMap<RodBinding<VariantContext>, String> dbAnnotations = new HashMap<RodBinding<VariantContext>, String>();
|
||||||
private AnnotatorCompatibleWalker walker;
|
private final AnnotatorCompatibleWalker walker;
|
||||||
private GenomeAnalysisEngine toolkit;
|
private final GenomeAnalysisEngine toolkit;
|
||||||
|
|
||||||
|
private boolean requireStrictAlleleMatch = false;
|
||||||
|
|
||||||
protected static class VAExpression {
|
protected static class VAExpression {
|
||||||
|
|
||||||
|
|
@ -163,6 +165,10 @@ public class VariantAnnotatorEngine {
|
||||||
return descriptions;
|
return descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRequireStrictAlleleMatch( final boolean requireStrictAlleleMatch ) {
|
||||||
|
this.requireStrictAlleleMatch = requireStrictAlleleMatch;
|
||||||
|
}
|
||||||
|
|
||||||
public VariantContext annotateContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
public VariantContext annotateContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||||
Map<String, Object> infoAnnotations = new LinkedHashMap<String, Object>(vc.getAttributes());
|
Map<String, Object> infoAnnotations = new LinkedHashMap<String, Object>(vc.getAttributes());
|
||||||
|
|
||||||
|
|
@ -197,7 +203,7 @@ public class VariantAnnotatorEngine {
|
||||||
} else {
|
} else {
|
||||||
boolean overlapsComp = false;
|
boolean overlapsComp = false;
|
||||||
for ( VariantContext comp : tracker.getValues(dbSet.getKey(), ref.getLocus()) ) {
|
for ( VariantContext comp : tracker.getValues(dbSet.getKey(), ref.getLocus()) ) {
|
||||||
if ( !comp.isFiltered() ) {
|
if ( !comp.isFiltered() && ( !requireStrictAlleleMatch || comp.getAlleles().equals(vc.getAlleles()) ) ) {
|
||||||
overlapsComp = true;
|
overlapsComp = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue