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:
parent
c1061e994c
commit
dd974040af
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.annotator;
|
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.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
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 CODON_NUM_KEY = "CODON_NUM";
|
||||||
public static final String CDS_SIZE_KEY = "CDS_SIZE";
|
public static final String CDS_SIZE_KEY = "CDS_SIZE";
|
||||||
|
|
||||||
private static final String RMD_TRACK_NAME = "SnpEff";
|
public static final String RMD_TRACK_NAME = "SnpEff";
|
||||||
private static final Logger logger = Logger.getLogger(SnpEff.class);
|
|
||||||
|
|
||||||
public Map<String, Object> annotate ( RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc ) {
|
public Map<String, Object> annotate ( RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc ) {
|
||||||
List<Object> snpEffFeatures = tracker.getReferenceMetaData(RMD_TRACK_NAME);
|
List<Object> snpEffFeatures = tracker.getReferenceMetaData(RMD_TRACK_NAME);
|
||||||
|
|
||||||
sanityCheckSnpEffFeatures(snpEffFeatures);
|
|
||||||
|
|
||||||
SnpEffFeature mostSignificantEffect = getMostSignificantEffect(snpEffFeatures);
|
SnpEffFeature mostSignificantEffect = getMostSignificantEffect(snpEffFeatures);
|
||||||
return generateAnnotations(mostSignificantEffect);
|
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 ) {
|
private SnpEffFeature getMostSignificantEffect ( List<Object> snpEffFeatures ) {
|
||||||
SnpEffFeature mostSignificantEffect = null;
|
SnpEffFeature mostSignificantEffect = null;
|
||||||
|
|
||||||
|
|
@ -92,7 +71,7 @@ public class SnpEff extends InfoFieldAnnotation implements StandardAnnotation {
|
||||||
SnpEffFeature snpEffFeature = (SnpEffFeature)feature;
|
SnpEffFeature snpEffFeature = (SnpEffFeature)feature;
|
||||||
|
|
||||||
if ( mostSignificantEffect == null ||
|
if ( mostSignificantEffect == null ||
|
||||||
snpEffFeature.getEffectImpact().isHigherImpactThan(mostSignificantEffect.getEffectImpact()) ) {
|
snpEffFeature.isHigherImpactThan(mostSignificantEffect) ) {
|
||||||
|
|
||||||
mostSignificantEffect = snpEffFeature;
|
mostSignificantEffect = snpEffFeature;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,17 @@ public class SnpEffFeature implements Feature {
|
||||||
this.customIntervalID = customIntervalID;
|
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() {
|
public String getChr() {
|
||||||
return contig;
|
return contig;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue