Modified VariantEval FunctionalClass stratification to remove hardcoded GenomicAnnotator keynames
This is a temporary and hopefully short-lived solution. I've modified the FunctionalClass stratification to stratify by effect impact as defined by SnpEff annotations (high, moderate, and low impact) rather than by the silent/missense/nonsense categories. If we want to bring back the silent/missense/nonsense stratification, we should probably take the approach of asking the SnpEff author to add it as a feature to SnpEff rather than coding it ourselves, since the whole point of moving to SnpEff was to outsource genomic annotation.
This commit is contained in:
parent
1213b2f8c6
commit
e0c8c0ddcb
|
|
@ -2,21 +2,29 @@ package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
|
|||
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.annotator.SnpEff;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Stratifies by nonsense, missense, silent, and all annotations in the input ROD, from the INFO field annotation.
|
||||
* Stratifies by low-, moderate-, and high-impact genomic effect using SnpEff annotations produced by VariantAnnotator
|
||||
*/
|
||||
public class FunctionalClass extends VariantStratifier {
|
||||
|
||||
public static final String LOW_IMPACT_STATE_NAME = "low-impact";
|
||||
public static final String MODERATE_IMPACT_STATE_NAME = "moderate-impact";
|
||||
public static final String HIGH_IMPACT_STATE_NAME = "high-impact";
|
||||
|
||||
public static final String EFFECT_IMPACT_ATTRIBUTE_KEY = SnpEff.InfoFieldKey.EFF_IMPACT.toString();
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
states.add("all");
|
||||
states.add("silent");
|
||||
states.add("missense");
|
||||
states.add("nonsense");
|
||||
states.add(LOW_IMPACT_STATE_NAME);
|
||||
states.add(MODERATE_IMPACT_STATE_NAME);
|
||||
states.add(HIGH_IMPACT_STATE_NAME);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -25,36 +33,17 @@ public class FunctionalClass extends VariantStratifier {
|
|||
|
||||
relevantStates.add("all");
|
||||
|
||||
if (eval != null && eval.isVariant()) {
|
||||
String type = null;
|
||||
if ( eval != null && eval.isVariant() && eval.hasAttribute(EFFECT_IMPACT_ATTRIBUTE_KEY) ) {
|
||||
String effectImpact = eval.getAttributeAsString(EFFECT_IMPACT_ATTRIBUTE_KEY);
|
||||
|
||||
if (eval.hasAttribute("refseq.functionalClass")) {
|
||||
type = eval.getAttributeAsString("refseq.functionalClass");
|
||||
} else if (eval.hasAttribute("refseq.functionalClass_1")) {
|
||||
int annotationId = 1;
|
||||
String key;
|
||||
|
||||
do {
|
||||
key = String.format("refseq.functionalClass_%d", annotationId);
|
||||
|
||||
String newtype = eval.getAttributeAsString(key);
|
||||
|
||||
if ( newtype != null && !newtype.equalsIgnoreCase("null") &&
|
||||
( type == null ||
|
||||
( type.equals("silent") && !newtype.equals("silent") ) ||
|
||||
( type.equals("missense") && newtype.equals("nonsense") ) )
|
||||
) {
|
||||
type = newtype;
|
||||
}
|
||||
|
||||
annotationId++;
|
||||
} while (eval.hasAttribute(key));
|
||||
if ( effectImpact.equals(SnpEff.EffectImpact.LOW.toString()) ) {
|
||||
relevantStates.add(LOW_IMPACT_STATE_NAME);
|
||||
}
|
||||
|
||||
if (type != null) {
|
||||
if (type.equals("silent")) { relevantStates.add("silent"); }
|
||||
else if (type.equals("missense")) { relevantStates.add("missense"); }
|
||||
else if (type.equals("nonsense")) { relevantStates.add("nonsense"); }
|
||||
else if ( effectImpact.equals(SnpEff.EffectImpact.MODERATE.toString()) ) {
|
||||
relevantStates.add(MODERATE_IMPACT_STATE_NAME);
|
||||
}
|
||||
else if ( effectImpact.equals(SnpEff.EffectImpact.HIGH.toString()) ) {
|
||||
relevantStates.add(HIGH_IMPACT_STATE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,9 +123,8 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
buildCommandLine(
|
||||
"-T VariantEval",
|
||||
"-R " + b37KGReference,
|
||||
"--dbsnp " + b37dbSNP132,
|
||||
"--eval " + fundamentalTestVCF,
|
||||
"-R " + hg19Reference,
|
||||
"--eval " + validationDataLocation + "snpEff.AFR.unfiltered.VariantAnnotator.output.vcf",
|
||||
"-noEV",
|
||||
"-EV CountVariants",
|
||||
"-noST",
|
||||
|
|
@ -134,7 +133,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
"-o %s"
|
||||
),
|
||||
1,
|
||||
Arrays.asList("e40b77e7ed6581328e373a24b93cd170")
|
||||
Arrays.asList("e93b3d66a5c150cbf1ae4262ec075d2d")
|
||||
);
|
||||
executeTest("testFundamentalsCountVariantsSNPsandIndelsWithFunctionalClass", spec);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue