When finding the highest-impact effect at a locus, all effects that are not within a

non-coding gene are now considered higher impact than all effects that are within a
non-coding gene.
This commit is contained in:
David Roazen 2011-08-08 10:46:18 -04:00
parent c1061e994c
commit dd974040af
2 changed files with 26 additions and 36 deletions

View File

@ -24,7 +24,6 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@ -56,35 +55,15 @@ public class SnpEff extends InfoFieldAnnotation implements StandardAnnotation {
public static final String CODON_NUM_KEY = "CODON_NUM";
public static final String CDS_SIZE_KEY = "CDS_SIZE";
private static final String RMD_TRACK_NAME = "SnpEff";
private static final Logger logger = Logger.getLogger(SnpEff.class);
public static final String RMD_TRACK_NAME = "SnpEff";
public Map<String, Object> annotate ( RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc ) {
List<Object> snpEffFeatures = tracker.getReferenceMetaData(RMD_TRACK_NAME);
sanityCheckSnpEffFeatures(snpEffFeatures);
SnpEffFeature mostSignificantEffect = getMostSignificantEffect(snpEffFeatures);
return generateAnnotations(mostSignificantEffect);
}
private void sanityCheckSnpEffFeatures( List<Object> snpEffFeatures ) {
Boolean locusIsNonCodingGene = null;
for ( Object feature : snpEffFeatures ) {
SnpEffFeature snpEffFeature = (SnpEffFeature)feature;
if ( locusIsNonCodingGene == null ) {
locusIsNonCodingGene = snpEffFeature.isNonCodingGene();
}
else if ( ! locusIsNonCodingGene.equals(snpEffFeature.isNonCodingGene()) ) {
logger.warn(String.format("Locus %s:%d is marked as both within and not within a non-coding gene",
snpEffFeature.getChr(), snpEffFeature.getStart()));
return;
}
}
}
private SnpEffFeature getMostSignificantEffect ( List<Object> snpEffFeatures ) {
SnpEffFeature mostSignificantEffect = null;
@ -92,7 +71,7 @@ public class SnpEff extends InfoFieldAnnotation implements StandardAnnotation {
SnpEffFeature snpEffFeature = (SnpEffFeature)feature;
if ( mostSignificantEffect == null ||
snpEffFeature.getEffectImpact().isHigherImpactThan(mostSignificantEffect.getEffectImpact()) ) {
snpEffFeature.isHigherImpactThan(mostSignificantEffect) ) {
mostSignificantEffect = snpEffFeature;
}
@ -153,19 +132,19 @@ public class SnpEff extends InfoFieldAnnotation implements StandardAnnotation {
public List<VCFInfoHeaderLine> getDescriptions() {
return Arrays.asList(
new VCFInfoHeaderLine(GENE_ID_KEY, 1, VCFHeaderLineType.String, "Gene ID"),
new VCFInfoHeaderLine(GENE_NAME_KEY, 1, VCFHeaderLineType.String, "Gene name"),
new VCFInfoHeaderLine(TRANSCRIPT_ID_KEY, 1, VCFHeaderLineType.String, "Transcript ID"),
new VCFInfoHeaderLine(EXON_ID_KEY, 1, VCFHeaderLineType.String, "Exon ID"),
new VCFInfoHeaderLine(EXON_RANK_KEY, 1, VCFHeaderLineType.Integer, "Exon rank"),
new VCFInfoHeaderLine(WITHIN_NON_CODING_GENE_KEY, 0, VCFHeaderLineType.Flag, "If present, gene is non-coding"),
new VCFInfoHeaderLine(EFFECT_KEY, 1, VCFHeaderLineType.String, "One of the most high-impact effects across all transcripts at this site"),
new VCFInfoHeaderLine(EFFECT_IMPACT_KEY, 1, VCFHeaderLineType.String, "Impact of the effect " + Arrays.toString(SnpEffConstants.EffectImpact.values())),
new VCFInfoHeaderLine(EFFECT_EXTRA_INFORMATION_KEY, 1, VCFHeaderLineType.String, "Additional information about the effect"),
new VCFInfoHeaderLine(OLD_NEW_AA_KEY, 1, VCFHeaderLineType.String, "Old/New amino acid"),
new VCFInfoHeaderLine(OLD_NEW_CODON_KEY, 1, VCFHeaderLineType.String, "Old/New codon"),
new VCFInfoHeaderLine(CODON_NUM_KEY, 1, VCFHeaderLineType.Integer, "Codon number"),
new VCFInfoHeaderLine(CDS_SIZE_KEY, 1, VCFHeaderLineType.Integer, "CDS size")
new VCFInfoHeaderLine(GENE_ID_KEY, 1, VCFHeaderLineType.String, "Gene ID"),
new VCFInfoHeaderLine(GENE_NAME_KEY, 1, VCFHeaderLineType.String, "Gene name"),
new VCFInfoHeaderLine(TRANSCRIPT_ID_KEY, 1, VCFHeaderLineType.String, "Transcript ID"),
new VCFInfoHeaderLine(EXON_ID_KEY, 1, VCFHeaderLineType.String, "Exon ID"),
new VCFInfoHeaderLine(EXON_RANK_KEY, 1, VCFHeaderLineType.Integer, "Exon rank"),
new VCFInfoHeaderLine(WITHIN_NON_CODING_GENE_KEY, 0, VCFHeaderLineType.Flag, "If present, gene is non-coding"),
new VCFInfoHeaderLine(EFFECT_KEY, 1, VCFHeaderLineType.String, "One of the most high-impact effects across all transcripts at this site"),
new VCFInfoHeaderLine(EFFECT_IMPACT_KEY, 1, VCFHeaderLineType.String, "Impact of the effect " + Arrays.toString(SnpEffConstants.EffectImpact.values())),
new VCFInfoHeaderLine(EFFECT_EXTRA_INFORMATION_KEY, 1, VCFHeaderLineType.String, "Additional information about the effect"),
new VCFInfoHeaderLine(OLD_NEW_AA_KEY, 1, VCFHeaderLineType.String, "Old/New amino acid"),
new VCFInfoHeaderLine(OLD_NEW_CODON_KEY, 1, VCFHeaderLineType.String, "Old/New codon"),
new VCFInfoHeaderLine(CODON_NUM_KEY, 1, VCFHeaderLineType.Integer, "Codon number"),
new VCFInfoHeaderLine(CDS_SIZE_KEY, 1, VCFHeaderLineType.Integer, "CDS size")
);
}
}

View File

@ -112,6 +112,17 @@ public class SnpEffFeature implements Feature {
this.customIntervalID = customIntervalID;
}
public boolean isHigherImpactThan ( SnpEffFeature other ) {
if ( ! isNonCodingGene() && other.isNonCodingGene() ) {
return true;
}
else if ( isNonCodingGene() && ! other.isNonCodingGene() ) {
return false;
}
return getEffectImpact().isHigherImpactThan(other.getEffectImpact());
}
public String getChr() {
return contig;
}