Eliminated the redundant StratifiedAlignmentContext, which previously just held a ReadBackedPileup, and made all of the class methods here just static functions. Far more logical organization, and avoided O(N) endless copying of data for the COMPLETE context. Many tools have been trivially reorganized to take an alignment context now. Everything passes integration tests.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5562 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2011-04-03 14:20:43 +00:00
parent 40a25af58e
commit 5cca100aea
43 changed files with 219 additions and 305 deletions

View File

@ -25,9 +25,7 @@
package org.broadinstitute.sting.gatk.contexts; package org.broadinstitute.sting.gatk.contexts;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.datasources.sample.Sample; import org.broadinstitute.sting.gatk.datasources.sample.Sample;
import org.broadinstitute.sting.utils.HasGenomeLocation;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.exceptions.UserException;
@ -36,11 +34,10 @@ import org.broadinstitute.sting.utils.pileup.*;
import java.util.*; import java.util.*;
/** /**
* Useful class for storing different AlignmentContexts * Useful utilities for storing different AlignmentContexts
* User: ebanks * User: ebanks
* Modified: chartl (split by read group)
*/ */
public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> implements HasGenomeLocation { public class StratifiedAlignmentContext {
// Definitions: // Definitions:
// COMPLETE = full alignment context // COMPLETE = full alignment context
@ -49,144 +46,86 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> implements
// //
public enum StratifiedContextType { COMPLETE, FORWARD, REVERSE } public enum StratifiedContextType { COMPLETE, FORWARD, REVERSE }
private GenomeLoc loc; private StratifiedAlignmentContext() {
private RBP basePileup = null; // cannot be instantiated
//
// accessors
//
public GenomeLoc getLocation() { return loc; }
public StratifiedAlignmentContext(GenomeLoc loc) {
this(loc,null);
} }
public StratifiedAlignmentContext(GenomeLoc loc, RBP pileup) { /**
this.loc = loc; * Returns a potentially derived subcontext containing only forward, reverse, or in fact all reads
this.basePileup = pileup; * in alignment context context.
} *
* @param context
public AlignmentContext getContext(StratifiedContextType type) { * @param type
* @return
*/
public static AlignmentContext stratify(AlignmentContext context, StratifiedContextType type) {
switch(type) { switch(type) {
case COMPLETE: case COMPLETE:
return new AlignmentContext(loc,basePileup); return context;
case FORWARD: case FORWARD:
return new AlignmentContext(loc,basePileup.getPositiveStrandPileup()); return new AlignmentContext(context.getLocation(),context.getPileup().getPositiveStrandPileup());
case REVERSE: case REVERSE:
return new AlignmentContext(loc,basePileup.getNegativeStrandPileup()); return new AlignmentContext(context.getLocation(),context.getPileup().getNegativeStrandPileup());
default: default:
throw new ReviewedStingException("Unable to get alignment context for type = " + type); throw new ReviewedStingException("Unable to get alignment context for type = " + type);
} }
} }
/** public static Map<String, AlignmentContext> splitContextBySampleName(AlignmentContext context) {
* Splits the given AlignmentContext into a StratifiedAlignmentContext per sample. return splitContextBySampleName(context, null);
*
* @param pileup the original pileup
*
* @return a Map of sample name to StratifiedAlignmentContext
*
**/
public static <RBP extends ReadBackedPileup,PE extends PileupElement> Map<Sample, StratifiedAlignmentContext> splitContextBySample(RBP pileup) {
return splitContextBySample(pileup, null);
} }
/** public static Map<Sample, AlignmentContext> splitContextBySample(AlignmentContext context) {
* Splits the given AlignmentContext into a StratifiedAlignmentContext per sample. Map<Sample, AlignmentContext> m = new HashMap<Sample, AlignmentContext>();
* for ( Map.Entry<String, AlignmentContext> entry : splitContextBySampleName(context, null).entrySet() ) {
* @param pileup the original pileup m.put(new Sample(entry.getKey()), entry.getValue());
* @param assumedSingleSample if not null, any read without a readgroup will be given this sample name
*
* @return a Map of sample name to StratifiedAlignmentContext
*
**/
public static <RBP extends ReadBackedPileup> Map<Sample, StratifiedAlignmentContext> splitContextBySample(RBP pileup, Sample assumedSingleSample) {
GenomeLoc loc = pileup.getLocation();
HashMap<Sample, StratifiedAlignmentContext> contexts = new HashMap<Sample, StratifiedAlignmentContext>();
for(Sample sample: pileup.getSamples()) {
RBP pileupBySample = (RBP)pileup.getPileupForSample(sample);
// Don't add empty pileups to the split context.
if(pileupBySample.size() == 0)
continue;
if(sample != null)
contexts.put(sample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample));
else {
if(assumedSingleSample == null) {
throw new UserException.ReadMissingReadGroup(pileupBySample.iterator().next().getRead());
} }
contexts.put(assumedSingleSample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample)); return m;
}
}
return contexts;
}
public static <RBP extends ReadBackedPileup,PE extends PileupElement> Map<String, StratifiedAlignmentContext> splitContextBySampleName(RBP pileup) {
return splitContextBySampleName(pileup, null);
} }
/** /**
* Splits the given AlignmentContext into a StratifiedAlignmentContext per sample, but referencd by sample name instead * Splits the given AlignmentContext into a StratifiedAlignmentContext per sample, but referencd by sample name instead
* of sample object. * of sample object.
* *
* @param pileup the original pileup * @param context the original pileup
* *
* @return a Map of sample name to StratifiedAlignmentContext * @return a Map of sample name to StratifiedAlignmentContext
* *
**/ **/
public static <RBP extends ReadBackedPileup> Map<String, StratifiedAlignmentContext> splitContextBySampleName(RBP pileup, String assumedSingleSample) { public static Map<String, AlignmentContext> splitContextBySampleName(AlignmentContext context, String assumedSingleSample) {
GenomeLoc loc = context.getLocation();
HashMap<String, AlignmentContext> contexts = new HashMap<String, AlignmentContext>();
GenomeLoc loc = pileup.getLocation(); for(String sample: context.getPileup().getSampleNames()) {
HashMap<String, StratifiedAlignmentContext> contexts = new HashMap<String, StratifiedAlignmentContext>(); ReadBackedPileup pileupBySample = context.getPileup().getPileupForSampleName(sample);
for(String sample: pileup.getSampleNames()) {
RBP pileupBySample = (RBP)pileup.getPileupForSampleName(sample);
// Don't add empty pileups to the split context. // Don't add empty pileups to the split context.
if(pileupBySample.size() == 0) if(pileupBySample.size() == 0)
continue; continue;
if(sample != null) if(sample != null)
contexts.put(sample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample)); contexts.put(sample, new AlignmentContext(loc, pileupBySample));
else { else {
if(assumedSingleSample == null) { if(assumedSingleSample == null) {
throw new UserException.ReadMissingReadGroup(pileupBySample.iterator().next().getRead()); throw new UserException.ReadMissingReadGroup(pileupBySample.iterator().next().getRead());
} }
contexts.put(assumedSingleSample,new StratifiedAlignmentContext<RBP>(loc,pileupBySample)); contexts.put(assumedSingleSample,new AlignmentContext(loc, pileupBySample));
} }
} }
return contexts; return contexts;
} }
public static Map<String, AlignmentContext> splitContextBySampleName(ReadBackedPileup pileup, String assumedSingleSample) {
/** return splitContextBySampleName(new AlignmentContext(pileup.getLocation(), pileup));
* Splits the given AlignmentContext into a StratifiedAlignmentContext per read group.
*
* @param pileup the original pileup
* @return a Map of sample name to StratifiedAlignmentContext
* TODO - support for collapsing or assuming read groups if they are missing
*
**/
public static <RBP extends ReadBackedPileup> Map<String,StratifiedAlignmentContext<RBP>> splitContextByReadGroup(RBP pileup) {
HashMap<String,StratifiedAlignmentContext<RBP>> contexts = new HashMap<String,StratifiedAlignmentContext<RBP>>();
for(String readGroupId: pileup.getReadGroups())
contexts.put(readGroupId,new StratifiedAlignmentContext<RBP>(pileup.getLocation(),(RBP)pileup.getPileupForReadGroup(readGroupId)));
return contexts;
} }
public static AlignmentContext joinContexts(Collection<StratifiedAlignmentContext> contexts) {
public static AlignmentContext joinContexts(Collection<AlignmentContext> contexts) {
// validation // validation
GenomeLoc loc = contexts.iterator().next().getLocation(); GenomeLoc loc = contexts.iterator().next().getLocation();
boolean isExtended = contexts.iterator().next().basePileup instanceof ReadBackedExtendedEventPileup; boolean isExtended = contexts.iterator().next().basePileup instanceof ReadBackedExtendedEventPileup;
for(StratifiedAlignmentContext context: contexts) { for(AlignmentContext context: contexts) {
if(!loc.equals(context.getLocation())) if(!loc.equals(context.getLocation()))
throw new ReviewedStingException("Illegal attempt to join contexts from different genomic locations"); throw new ReviewedStingException("Illegal attempt to join contexts from different genomic locations");
if(isExtended != (context.basePileup instanceof ReadBackedExtendedEventPileup)) if(isExtended != (context.basePileup instanceof ReadBackedExtendedEventPileup))
@ -196,7 +135,7 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> implements
AlignmentContext jointContext; AlignmentContext jointContext;
if(isExtended) { if(isExtended) {
List<ExtendedEventPileupElement> pe = new ArrayList<ExtendedEventPileupElement>(); List<ExtendedEventPileupElement> pe = new ArrayList<ExtendedEventPileupElement>();
for(StratifiedAlignmentContext context: contexts) { for(AlignmentContext context: contexts) {
for(PileupElement pileupElement: context.basePileup) for(PileupElement pileupElement: context.basePileup)
pe.add((ExtendedEventPileupElement)pileupElement); pe.add((ExtendedEventPileupElement)pileupElement);
} }
@ -204,7 +143,7 @@ public class StratifiedAlignmentContext<RBP extends ReadBackedPileup> implements
} }
else { else {
List<PileupElement> pe = new ArrayList<PileupElement>(); List<PileupElement> pe = new ArrayList<PileupElement>();
for(StratifiedAlignmentContext context: contexts) { for(AlignmentContext context: contexts) {
for(PileupElement pileupElement: context.basePileup) for(PileupElement pileupElement: context.basePileup)
pe.add(pileupElement); pe.add(pileupElement);
} }

View File

@ -29,8 +29,8 @@ import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
import org.broadinstitute.sting.utils.*; import org.broadinstitute.sting.utils.*;
@ -44,7 +44,7 @@ import java.util.Arrays;
public class AlleleBalance implements InfoFieldAnnotation { public class AlleleBalance implements InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
@ -61,12 +61,12 @@ public class AlleleBalance implements InfoFieldAnnotation {
if ( !genotype.getValue().isHet() ) if ( !genotype.getValue().isHet() )
continue; continue;
StratifiedAlignmentContext context = stratifiedContexts.get(genotype.getKey()); AlignmentContext context = stratifiedContexts.get(genotype.getKey());
if ( context == null ) if ( context == null )
continue; continue;
if ( vc.isSNP() ) { if ( vc.isSNP() ) {
final String bases = new String(context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup().getBases()); final String bases = new String(context.getBasePileup().getBases());
if ( bases.length() == 0 ) if ( bases.length() == 0 )
return null; return null;
char refChr = vc.getReference().toString().charAt(0); char refChr = vc.getReference().toString().charAt(0);
@ -83,7 +83,7 @@ public class AlleleBalance implements InfoFieldAnnotation {
ratio += genotype.getValue().getNegLog10PError() * ((double)refCount / (double)(refCount + altCount)); ratio += genotype.getValue().getNegLog10PError() * ((double)refCount / (double)(refCount + altCount));
totalWeights += genotype.getValue().getNegLog10PError(); totalWeights += genotype.getValue().getNegLog10PError();
} else if ( vc.isIndel() ) { } else if ( vc.isIndel() ) {
final ReadBackedExtendedEventPileup indelPileup = context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getExtendedEventPileup(); final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
if ( indelPileup == null ) { if ( indelPileup == null ) {
continue; continue;
} }

View File

@ -14,7 +14,7 @@ import java.util.*;
public class AlleleBalanceBySample implements GenotypeAnnotation, ExperimentalAnnotation { public class AlleleBalanceBySample implements GenotypeAnnotation, ExperimentalAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
Double ratio = annotateSNP(stratifiedContext, vc, g); Double ratio = annotateSNP(stratifiedContext, vc, g);
if (ratio == null) if (ratio == null)
return null; return null;
@ -25,8 +25,7 @@ public class AlleleBalanceBySample implements GenotypeAnnotation, ExperimentalAn
} }
private Double annotateSNP(StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) { private Double annotateSNP(AlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
double ratio = -1; double ratio = -1;
if ( !vc.isSNP() ) if ( !vc.isSNP() )
@ -45,7 +44,7 @@ public class AlleleBalanceBySample implements GenotypeAnnotation, ExperimentalAn
if ( altAlleles.size() == 0 ) if ( altAlleles.size() == 0 )
return null; return null;
final String bases = new String(stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup().getBases()); final String bases = new String(stratifiedContext.getBasePileup().getBases());
if ( bases.length() == 0 ) if ( bases.length() == 0 )
return null; return null;
char refChr = vc.getReference().toString().charAt(0); char refChr = vc.getReference().toString().charAt(0);

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.annotator; package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.variantcontext.Genotype; import org.broad.tribble.util.variantcontext.Genotype;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import java.util.Map; import java.util.Map;
@ -10,7 +10,7 @@ import java.util.Map;
public abstract class AnnotationByDepth implements InfoFieldAnnotation { public abstract class AnnotationByDepth implements InfoFieldAnnotation {
protected int annotationByVariantDepth(final Map<String, Genotype> genotypes, Map<String, StratifiedAlignmentContext> stratifiedContexts) { protected int annotationByVariantDepth(final Map<String, Genotype> genotypes, Map<String, AlignmentContext> stratifiedContexts) {
int depth = 0; int depth = 0;
for ( Map.Entry<String, Genotype> genotype : genotypes.entrySet() ) { for ( Map.Entry<String, Genotype> genotype : genotypes.entrySet() ) {
@ -18,9 +18,9 @@ public abstract class AnnotationByDepth implements InfoFieldAnnotation {
if ( genotype.getValue().isHomRef() ) if ( genotype.getValue().isHomRef() )
continue; continue;
StratifiedAlignmentContext context = stratifiedContexts.get(genotype.getKey()); AlignmentContext context = stratifiedContexts.get(genotype.getKey());
if ( context != null ) if ( context != null )
depth += context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).size(); depth += context.size();
} }
return depth; return depth;

View File

@ -34,8 +34,8 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.BaseUtils;
@ -48,14 +48,14 @@ import java.util.Arrays;
public class BaseCounts implements InfoFieldAnnotation { public class BaseCounts implements InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
int[] counts = new int[4]; int[] counts = new int[4];
for ( Map.Entry<String, StratifiedAlignmentContext> sample : stratifiedContexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() ) {
for (byte base : sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup().getBases() ) { for (byte base : sample.getValue().getBasePileup().getBases() ) {
int index = BaseUtils.simpleBaseToBaseIndex(base); int index = BaseUtils.simpleBaseToBaseIndex(base);
if ( index != -1 ) if ( index != -1 )
counts[index]++; counts[index]++;

View File

@ -29,8 +29,8 @@ import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
import org.broad.tribble.vcf.VCFConstants; import org.broad.tribble.vcf.VCFConstants;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils; import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
@ -45,7 +45,7 @@ public class ChromosomeCounts implements InfoFieldAnnotation, StandardAnnotation
new VCFInfoHeaderLine(VCFConstants.ALLELE_COUNT_KEY, -1, VCFHeaderLineType.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed"), new VCFInfoHeaderLine(VCFConstants.ALLELE_COUNT_KEY, -1, VCFHeaderLineType.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed"),
new VCFInfoHeaderLine(VCFConstants.ALLELE_NUMBER_KEY, 1, VCFHeaderLineType.Integer, "Total number of alleles in called genotypes") }; new VCFInfoHeaderLine(VCFConstants.ALLELE_NUMBER_KEY, 1, VCFHeaderLineType.Integer, "Total number of alleles in called genotypes") };
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( ! vc.hasGenotypes() ) if ( ! vc.hasGenotypes() )
return null; return null;

View File

@ -4,8 +4,8 @@ import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
import org.broad.tribble.vcf.VCFConstants; import org.broad.tribble.vcf.VCFConstants;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
@ -17,13 +17,13 @@ import java.util.Arrays;
public class DepthOfCoverage implements InfoFieldAnnotation, StandardAnnotation { public class DepthOfCoverage implements InfoFieldAnnotation, StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
int depth = 0; int depth = 0;
for ( Map.Entry<String, StratifiedAlignmentContext> sample : stratifiedContexts.entrySet() ) for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() )
depth += sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).size(); depth += sample.getValue().size();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(getKeyNames().get(0), String.format("%d", depth)); map.put(getKeyNames().get(0), String.format("%d", depth));
return map; return map;

View File

@ -6,8 +6,8 @@ import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFCompoundHeaderLine; import org.broad.tribble.vcf.VCFCompoundHeaderLine;
import org.broad.tribble.vcf.VCFFormatHeaderLine; import org.broad.tribble.vcf.VCFFormatHeaderLine;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
@ -28,7 +28,7 @@ public class DepthPerAlleleBySample implements GenotypeAnnotation, StandardAnnot
private static String DEL = "DEL"; // constant, for speed: no need to create a key string for deletion allele every time private static String DEL = "DEL"; // constant, for speed: no need to create a key string for deletion allele every time
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
if ( g == null || !g.isCalled() ) if ( g == null || !g.isCalled() )
return null; return null;
@ -40,15 +40,15 @@ public class DepthPerAlleleBySample implements GenotypeAnnotation, StandardAnnot
return null; return null;
} }
private Map<String,Object> annotateSNP(StratifiedAlignmentContext stratifiedContext, VariantContext vc) { private Map<String,Object> annotateSNP(AlignmentContext stratifiedContext, VariantContext vc) {
if ( ! stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).hasBasePileup() ) return null; if ( ! stratifiedContext.hasBasePileup() ) return null;
HashMap<Byte, Integer> alleleCounts = new HashMap<Byte, Integer>(); HashMap<Byte, Integer> alleleCounts = new HashMap<Byte, Integer>();
for ( Allele allele : vc.getAlleles() ) for ( Allele allele : vc.getAlleles() )
alleleCounts.put(allele.getBases()[0], 0); alleleCounts.put(allele.getBases()[0], 0);
ReadBackedPileup pileup = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = stratifiedContext.getBasePileup();
for ( PileupElement p : pileup ) { for ( PileupElement p : pileup ) {
if ( alleleCounts.containsKey(p.getBase()) ) if ( alleleCounts.containsKey(p.getBase()) )
alleleCounts.put(p.getBase(), alleleCounts.get(p.getBase())+1); alleleCounts.put(p.getBase(), alleleCounts.get(p.getBase())+1);
@ -65,14 +65,13 @@ public class DepthPerAlleleBySample implements GenotypeAnnotation, StandardAnnot
return map; return map;
} }
private Map<String,Object> annotateIndel(StratifiedAlignmentContext stratifiedContext, VariantContext vc) { private Map<String,Object> annotateIndel(AlignmentContext stratifiedContext, VariantContext vc) {
if ( ! stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).hasExtendedEventPileup() ) { if ( ! stratifiedContext.hasExtendedEventPileup() ) {
return null; return null;
} }
ReadBackedExtendedEventPileup pileup = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getExtendedEventPileup(); ReadBackedExtendedEventPileup pileup = stratifiedContext.getExtendedEventPileup();
//ReadBackedPileup pileup = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup();
if ( pileup == null ) if ( pileup == null )
return null; return null;

View File

@ -24,8 +24,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator; package org.broadinstitute.sting.gatk.walkers.annotator;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.WorkInProgressAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.WorkInProgressAnnotation;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@ -50,7 +50,7 @@ public class FisherStrand implements InfoFieldAnnotation, WorkInProgressAnnotati
private static final String ALTREV = "ALTREV"; private static final String ALTREV = "ALTREV";
private static final String FS = "FS"; private static final String FS = "FS";
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( ! vc.isVariant() || vc.isFiltered() || ! vc.isBiallelic() || ! vc.isSNP() ) if ( ! vc.isVariant() || vc.isFiltered() || ! vc.isBiallelic() || ! vc.isSNP() )
return null; return null;
@ -200,11 +200,11 @@ public class FisherStrand implements InfoFieldAnnotation, WorkInProgressAnnotati
* allele2 # # * allele2 # #
* @return a 2x2 contingency table * @return a 2x2 contingency table
*/ */
private static int[][] getContingencyTable(Map<String, StratifiedAlignmentContext> stratifiedContexts, Allele ref, Allele alt) { private static int[][] getContingencyTable(Map<String, AlignmentContext> stratifiedContexts, Allele ref, Allele alt) {
int[][] table = new int[2][2]; int[][] table = new int[2][2];
for ( Map.Entry<String, StratifiedAlignmentContext> sample : stratifiedContexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() ) {
for (PileupElement p : sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup()) { for (PileupElement p : sample.getValue().getBasePileup()) {
if ( p.isDeletion() ) // ignore deletions if ( p.isDeletion() ) // ignore deletions
continue; continue;

View File

@ -3,8 +3,8 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.BaseUtils;
@ -17,7 +17,7 @@ import java.util.Arrays;
public class GCContent implements InfoFieldAnnotation, ExperimentalAnnotation { public class GCContent implements InfoFieldAnnotation, ExperimentalAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
double content = computeGCContent(ref); double content = computeGCContent(ref);
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(getKeyNames().get(0), String.format("%.2f", content)); map.put(getKeyNames().get(0), String.format("%.2f", content));

View File

@ -56,7 +56,7 @@ public class HaplotypeScore implements InfoFieldAnnotation, StandardAnnotation {
return p.getOffset() == -1 || ((GATKSAMRecord)p.getRead()).isGoodBase(p.getOffset()); // Use all reads from the filtered context return p.getOffset() == -1 || ((GATKSAMRecord)p.getRead()).isGoodBase(p.getOffset()); // Use all reads from the filtered context
} }
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( !vc.isBiallelic() || stratifiedContexts.size() == 0 ) // size 0 means that call was made by someone else and we have no data here if ( !vc.isBiallelic() || stratifiedContexts.size() == 0 ) // size 0 means that call was made by someone else and we have no data here
return null; return null;
@ -83,9 +83,9 @@ public class HaplotypeScore implements InfoFieldAnnotation, StandardAnnotation {
if (haplotypes != null) { if (haplotypes != null) {
final Set<Map.Entry<String, Genotype>> genotypes = vc.getGenotypes().entrySet(); final Set<Map.Entry<String, Genotype>> genotypes = vc.getGenotypes().entrySet();
for ( final Map.Entry<String, Genotype> genotype : genotypes ) { for ( final Map.Entry<String, Genotype> genotype : genotypes ) {
final StratifiedAlignmentContext thisContext = stratifiedContexts.get(genotype.getKey()); final AlignmentContext thisContext = stratifiedContexts.get(genotype.getKey());
if ( thisContext != null ) { if ( thisContext != null ) {
final AlignmentContext aContext = thisContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE); final AlignmentContext aContext = thisContext;
final ReadBackedPileup thisPileup; final ReadBackedPileup thisPileup;
if (aContext.hasExtendedEventPileup()) if (aContext.hasExtendedEventPileup())
thisPileup = aContext.getExtendedEventPileup(); thisPileup = aContext.getExtendedEventPileup();

View File

@ -5,8 +5,8 @@ import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
import org.broadinstitute.sting.utils.QualityUtils; import org.broadinstitute.sting.utils.QualityUtils;
@ -23,7 +23,7 @@ public class HardyWeinberg implements InfoFieldAnnotation, WorkInProgressAnnotat
private static final int MIN_GENOTYPE_QUALITY = 10; private static final int MIN_GENOTYPE_QUALITY = 10;
private static final int MIN_NEG_LOG10_PERROR = MIN_GENOTYPE_QUALITY / 10; private static final int MIN_NEG_LOG10_PERROR = MIN_GENOTYPE_QUALITY / 10;
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
final Map<String, Genotype> genotypes = vc.getGenotypes(); final Map<String, Genotype> genotypes = vc.getGenotypes();
if ( genotypes == null || genotypes.size() < MIN_SAMPLES ) if ( genotypes == null || genotypes.size() < MIN_SAMPLES )

View File

@ -3,8 +3,8 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
@ -20,7 +20,7 @@ public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation {
private boolean ANNOTATE_INDELS = true; private boolean ANNOTATE_INDELS = true;
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( !vc.isBiallelic() ) if ( !vc.isBiallelic() )
return null; return null;

View File

@ -3,12 +3,11 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.ExperimentalAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.ExperimentalAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.IndelUtils; import org.broadinstitute.sting.utils.IndelUtils;
import java.util.*; import java.util.*;
@ -22,7 +21,7 @@ import java.util.*;
*/ */
public class IndelType implements InfoFieldAnnotation, ExperimentalAnnotation { public class IndelType implements InfoFieldAnnotation, ExperimentalAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
int run; int run;
if ( vc.isIndel() && vc.isBiallelic() ) { if ( vc.isIndel() && vc.isBiallelic() ) {

View File

@ -3,8 +3,8 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
@ -18,16 +18,16 @@ import java.util.Arrays;
public class LowMQ implements InfoFieldAnnotation { public class LowMQ implements InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
double mq0 = 0; double mq0 = 0;
double mq10 = 0; double mq10 = 0;
double total = 0; double total = 0;
for ( Map.Entry<String, StratifiedAlignmentContext> sample : stratifiedContexts.entrySet() ) for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() )
{ {
ReadBackedPileup pileup = sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = sample.getValue().getBasePileup();
for (PileupElement p : pileup ) for (PileupElement p : pileup )
{ {
if ( p.getMappingQual() == 0 ) { mq0 += 1; } if ( p.getMappingQual() == 0 ) { mq0 += 1; }

View File

@ -6,7 +6,6 @@ import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
@ -21,13 +20,13 @@ import java.util.Map;
public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotation { public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
int mq0 = 0; int mq0 = 0;
for ( Map.Entry<String, StratifiedAlignmentContext> sample : stratifiedContexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() ) {
AlignmentContext context = sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE); AlignmentContext context = sample.getValue();
ReadBackedPileup pileup = null; ReadBackedPileup pileup = null;
if (context.hasExtendedEventPileup()) if (context.hasExtendedEventPileup())
pileup = context.getExtendedEventPileup(); pileup = context.getExtendedEventPileup();

View File

@ -28,7 +28,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.PileupElement;
@ -52,12 +51,11 @@ import java.util.Arrays;
*/ */
public class MappingQualityZeroBySample implements GenotypeAnnotation { public class MappingQualityZeroBySample implements GenotypeAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref,
StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) { AlignmentContext context, VariantContext vc, Genotype g) {
if ( g == null || !g.isCalled() ) if ( g == null || !g.isCalled() )
return null; return null;
int mq0 = 0; int mq0 = 0;
AlignmentContext context = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE);
ReadBackedPileup pileup = null; ReadBackedPileup pileup = null;
if (vc.isIndel() && context.hasExtendedEventPileup()) if (vc.isIndel() && context.hasExtendedEventPileup())
pileup = context.getExtendedEventPileup(); pileup = context.getExtendedEventPileup();

View File

@ -5,8 +5,8 @@ import org.broad.tribble.util.variantcontext.GenotypeLikelihoods;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
@ -20,7 +20,7 @@ import java.util.Arrays;
public class QualByDepth extends AnnotationByDepth implements InfoFieldAnnotation, StandardAnnotation { public class QualByDepth extends AnnotationByDepth implements InfoFieldAnnotation, StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
@ -37,11 +37,11 @@ public class QualByDepth extends AnnotationByDepth implements InfoFieldAnnotatio
if ( genotype.getValue().isHomRef() ) if ( genotype.getValue().isHomRef() )
continue; continue;
StratifiedAlignmentContext context = stratifiedContexts.get(genotype.getKey()); AlignmentContext context = stratifiedContexts.get(genotype.getKey());
if ( context == null ) if ( context == null )
continue; continue;
depth += context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).size(); depth += context.size();
if ( genotype.getValue().hasLikelihoods() ) { if ( genotype.getValue().hasLikelihoods() ) {
GenotypeLikelihoods GLs = genotype.getValue().getLikelihoods(); GenotypeLikelihoods GLs = genotype.getValue().getLikelihoods();

View File

@ -6,7 +6,6 @@ import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
@ -19,19 +18,19 @@ import java.util.*;
public class RMSMappingQuality implements InfoFieldAnnotation, StandardAnnotation { public class RMSMappingQuality implements InfoFieldAnnotation, StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
int totalSize = 0; int totalSize = 0;
for ( StratifiedAlignmentContext context : stratifiedContexts.values() ) for ( AlignmentContext context : stratifiedContexts.values() )
totalSize += context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).size(); totalSize += context.size();
int[] qualities = new int[totalSize]; int[] qualities = new int[totalSize];
int index = 0; int index = 0;
for ( Map.Entry<String, StratifiedAlignmentContext> sample : stratifiedContexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() ) {
AlignmentContext context = sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE); AlignmentContext context = sample.getValue();
ReadBackedPileup pileup = null; ReadBackedPileup pileup = null;
if (context.hasExtendedEventPileup()) if (context.hasExtendedEventPileup())
pileup = context.getExtendedEventPileup(); pileup = context.getExtendedEventPileup();

View File

@ -2,8 +2,8 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.variantcontext.Genotype; import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
import org.broadinstitute.sting.utils.*; import org.broadinstitute.sting.utils.*;
@ -20,7 +20,7 @@ import java.util.HashMap;
public abstract class RankSumTest implements InfoFieldAnnotation, ExperimentalAnnotation { public abstract class RankSumTest implements InfoFieldAnnotation, ExperimentalAnnotation {
private static final double minPValue = 1e-20; private static final double minPValue = 1e-20;
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
@ -35,11 +35,11 @@ public abstract class RankSumTest implements InfoFieldAnnotation, ExperimentalAn
final ArrayList<Integer> altQuals = new ArrayList<Integer>(); final ArrayList<Integer> altQuals = new ArrayList<Integer>();
for ( final Map.Entry<String, Genotype> genotype : genotypes.entrySet() ) { for ( final Map.Entry<String, Genotype> genotype : genotypes.entrySet() ) {
final StratifiedAlignmentContext context = stratifiedContexts.get(genotype.getKey()); final AlignmentContext context = stratifiedContexts.get(genotype.getKey());
if ( context == null ) { if ( context == null ) {
continue; continue;
} }
fillQualsFromPileup(ref.getBase(), vc.getAlternateAllele(0).getBases()[0], context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(), refQuals, altQuals); fillQualsFromPileup(ref.getBase(), vc.getAlternateAllele(0).getBases()[0], context.getBasePileup(), refQuals, altQuals);
} }
final MannWhitneyU mannWhitneyU = new MannWhitneyU(); final MannWhitneyU mannWhitneyU = new MannWhitneyU();

View File

@ -25,11 +25,11 @@
package org.broadinstitute.sting.gatk.walkers.annotator; package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
@ -60,7 +60,7 @@ public class ReadDepthAndAllelicFractionBySample implements GenotypeAnnotation {
private static String DEL = "DEL"; // constant, for speed: no need to create a key string for deletion allele every time private static String DEL = "DEL"; // constant, for speed: no need to create a key string for deletion allele every time
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref,
StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) { AlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
if ( g == null || !g.isCalled() ) if ( g == null || !g.isCalled() )
return null; return null;
@ -72,15 +72,15 @@ public class ReadDepthAndAllelicFractionBySample implements GenotypeAnnotation {
return null; return null;
} }
private Map<String,Object> annotateSNP(StratifiedAlignmentContext stratifiedContext, VariantContext vc) { private Map<String,Object> annotateSNP(AlignmentContext stratifiedContext, VariantContext vc) {
if ( ! stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).hasBasePileup() ) return null; if ( ! stratifiedContext.hasBasePileup() ) return null;
HashMap<Byte, Integer> alleleCounts = new HashMap<Byte, Integer>(); HashMap<Byte, Integer> alleleCounts = new HashMap<Byte, Integer>();
for ( Allele allele : vc.getAlternateAlleles() ) for ( Allele allele : vc.getAlternateAlleles() )
alleleCounts.put(allele.getBases()[0], 0); alleleCounts.put(allele.getBases()[0], 0);
ReadBackedPileup pileup = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = stratifiedContext.getBasePileup();
int totalDepth = pileup.size(); int totalDepth = pileup.size();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@ -110,16 +110,15 @@ public class ReadDepthAndAllelicFractionBySample implements GenotypeAnnotation {
return map; return map;
} }
private Map<String,Object> annotateIndel(StratifiedAlignmentContext private Map<String,Object> annotateIndel(AlignmentContext
stratifiedContext, VariantContext stratifiedContext, VariantContext
vc) { vc) {
if ( ! stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).hasExtendedEventPileup() ) { if ( ! stratifiedContext.hasExtendedEventPileup() ) {
return null; return null;
} }
ReadBackedExtendedEventPileup pileup = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getExtendedEventPileup(); ReadBackedExtendedEventPileup pileup = stratifiedContext.getExtendedEventPileup();
//ReadBackedPileup pileup = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup();
if ( pileup == null ) if ( pileup == null )
return null; return null;
int totalDepth = pileup.size(); int totalDepth = pileup.size();

View File

@ -5,8 +5,8 @@ import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFConstants; import org.broad.tribble.vcf.VCFConstants;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import java.util.Arrays; import java.util.Arrays;
@ -18,7 +18,7 @@ import java.util.Map;
public class SBByDepth extends AnnotationByDepth { public class SBByDepth extends AnnotationByDepth {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;

View File

@ -5,7 +5,6 @@ import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
@ -19,14 +18,14 @@ import java.util.Map;
public class SpanningDeletions implements InfoFieldAnnotation, StandardAnnotation { public class SpanningDeletions implements InfoFieldAnnotation, StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;
int deletions = 0; int deletions = 0;
int depth = 0; int depth = 0;
for ( Map.Entry<String, StratifiedAlignmentContext> sample : stratifiedContexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : stratifiedContexts.entrySet() ) {
AlignmentContext context = sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE); AlignmentContext context = sample.getValue();
ReadBackedPileup pileup = null; ReadBackedPileup pileup = null;
if (context.hasExtendedEventPileup()) if (context.hasExtendedEventPileup())
pileup = context.getExtendedEventPileup(); pileup = context.getExtendedEventPileup();

View File

@ -209,7 +209,7 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> {
Collection<VariantContext> annotatedVCs = VCs; Collection<VariantContext> annotatedVCs = VCs;
// if the reference base is not ambiguous, we can annotate // if the reference base is not ambiguous, we can annotate
Map<String, StratifiedAlignmentContext> stratifiedContexts; Map<String, AlignmentContext> stratifiedContexts;
if ( BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 ) { if ( BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 ) {
if ( ! context.hasExtendedEventPileup() ) { if ( ! context.hasExtendedEventPileup() ) {
stratifiedContexts = StratifiedAlignmentContext.splitContextBySampleName(context.getBasePileup(), ASSUME_SINGLE_SAMPLE); stratifiedContexts = StratifiedAlignmentContext.splitContextBySampleName(context.getBasePileup(), ASSUME_SINGLE_SAMPLE);

View File

@ -41,8 +41,8 @@ import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.*; import org.broad.tribble.vcf.*;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource; import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper; import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
@ -147,20 +147,7 @@ public class VariantAnnotatorEngine {
return descriptions; return descriptions;
} }
// A slightly simplified interface for when you don't have any reads, so the stratifiedContexts aren't necessary, and public Collection<VariantContext> annotateContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
// you only permit a single return value
public VariantContext annotateContext(RefMetaDataTracker tracker, ReferenceContext ref, VariantContext vc) {
Collection<VariantContext> results = this.annotateContext(tracker, ref, EMPTY_STRATIFIED_ALIGNMENT_CONTEXT, vc);
if ( results.size() != 1 )
throw new ReviewedStingException("BUG: annotateContext call requires 1 resulting annotated VC, but got " + results);
return results.iterator().next();
}
private static final Map<String, StratifiedAlignmentContext> EMPTY_STRATIFIED_ALIGNMENT_CONTEXT = (Map<String, StratifiedAlignmentContext>)Collections.EMPTY_MAP;
public Collection<VariantContext> annotateContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
Map<String, Object> infoAnnotations = new LinkedHashMap<String, Object>(vc.getAttributes()); Map<String, Object> infoAnnotations = new LinkedHashMap<String, Object>(vc.getAttributes());
@ -246,14 +233,14 @@ public class VariantAnnotatorEngine {
} }
} }
private Map<String, Genotype> annotateGenotypes(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { private Map<String, Genotype> annotateGenotypes(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( requestedGenotypeAnnotations.size() == 0 ) if ( requestedGenotypeAnnotations.size() == 0 )
return vc.getGenotypes(); return vc.getGenotypes();
Map<String, Genotype> genotypes = new HashMap<String, Genotype>(vc.getNSamples()); Map<String, Genotype> genotypes = new HashMap<String, Genotype>(vc.getNSamples());
for ( Map.Entry<String, Genotype> g : vc.getGenotypes().entrySet() ) { for ( Map.Entry<String, Genotype> g : vc.getGenotypes().entrySet() ) {
Genotype genotype = g.getValue(); Genotype genotype = g.getValue();
StratifiedAlignmentContext context = stratifiedContexts.get(g.getKey()); AlignmentContext context = stratifiedContexts.get(g.getKey());
if ( context == null ) { if ( context == null ) {
genotypes.put(g.getKey(), genotype); genotypes.put(g.getKey(), genotype);
continue; continue;

View File

@ -32,8 +32,8 @@ import org.broad.tribble.util.variantcontext.Allele;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.features.annotator.AnnotatorInputTableFeature; import org.broadinstitute.sting.gatk.refdata.features.annotator.AnnotatorInputTableFeature;
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature; import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
@ -140,7 +140,7 @@ public class GenomicAnnotation implements InfoFieldAnnotation {
*/ */
public Map<String, Object> annotate(final RefMetaDataTracker tracker, public Map<String, Object> annotate(final RefMetaDataTracker tracker,
final ReferenceContext ref, final ReferenceContext ref,
final Map<String, StratifiedAlignmentContext> stratifiedContexts, final Map<String, AlignmentContext> stratifiedContexts,
final VariantContext vc) { final VariantContext vc) {
//iterate over each record that overlaps the current locus, and, if it passes certain filters, //iterate over each record that overlaps the current locus, and, if it passes certain filters,

View File

@ -249,7 +249,7 @@ public class GenomicAnnotator extends RodWalker<Integer, Integer> implements Tre
(vc.isVariant() && !vc.isBiallelic()) ) { (vc.isVariant() && !vc.isBiallelic()) ) {
results.add(vc); results.add(vc);
} else { } else {
Map<String, StratifiedAlignmentContext> stratifiedContexts = StratifiedAlignmentContext.splitContextBySampleName(context.getBasePileup()); Map<String, AlignmentContext> stratifiedContexts = StratifiedAlignmentContext.splitContextBySampleName(context);
if ( stratifiedContexts != null ) if ( stratifiedContexts != null )
results.addAll(engine.annotateContext(tracker, ref, stratifiedContexts, vc)); results.addAll(engine.annotateContext(tracker, ref, stratifiedContexts, vc));
else else

View File

@ -3,9 +3,9 @@ package org.broadinstitute.sting.gatk.walkers.annotator.interfaces;
import org.broad.tribble.util.variantcontext.Genotype; import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFFormatHeaderLine; import org.broad.tribble.vcf.VCFFormatHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@ -13,7 +13,7 @@ import java.util.List;
public interface GenotypeAnnotation { public interface GenotypeAnnotation {
// return annotations for the given contexts/genotype split by sample // return annotations for the given contexts/genotype split by sample
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g); public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext stratifiedContext, VariantContext vc, Genotype g);
// return the FORMAT keys // return the FORMAT keys
public List<String> getKeyNames(); public List<String> getKeyNames();

View File

@ -2,9 +2,9 @@ package org.broadinstitute.sting.gatk.walkers.annotator.interfaces;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@ -12,7 +12,7 @@ import java.util.List;
public interface InfoFieldAnnotation { public interface InfoFieldAnnotation {
// return annotations for the given contexts split by sample // return annotations for the given contexts split by sample
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc); public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc);
// return the INFO keys // return the INFO keys
public List<String> getKeyNames(); public List<String> getKeyNames();

View File

@ -85,7 +85,7 @@ public class DindelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoo
private ArrayList<Allele> computeConsensusAlleles(ReferenceContext ref, private ArrayList<Allele> computeConsensusAlleles(ReferenceContext ref,
Map<String, StratifiedAlignmentContext> contexts, Map<String, AlignmentContext> contexts,
StratifiedAlignmentContext.StratifiedContextType contextType) { StratifiedAlignmentContext.StratifiedContextType contextType) {
Allele refAllele=null, altAllele=null; Allele refAllele=null, altAllele=null;
GenomeLoc loc = ref.getLocus(); GenomeLoc loc = ref.getLocus();
@ -99,8 +99,8 @@ public class DindelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoo
int insCount = 0, delCount = 0; int insCount = 0, delCount = 0;
// quick check of total number of indels in pileup // quick check of total number of indels in pileup
for ( Map.Entry<String, StratifiedAlignmentContext> sample : contexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : contexts.entrySet() ) {
AlignmentContext context = sample.getValue().getContext(contextType); AlignmentContext context = StratifiedAlignmentContext.stratify(sample.getValue(), contextType);
final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup(); final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
insCount += indelPileup.getNumberOfInsertions(); insCount += indelPileup.getNumberOfInsertions();
@ -110,8 +110,9 @@ public class DindelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoo
if (insCount < minIndelCountForGenotyping && delCount < minIndelCountForGenotyping) if (insCount < minIndelCountForGenotyping && delCount < minIndelCountForGenotyping)
return aList; return aList;
for ( Map.Entry<String, StratifiedAlignmentContext> sample : contexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : contexts.entrySet() ) {
AlignmentContext context = sample.getValue().getContext(contextType); // todo -- warning, can be duplicating expensive partition here
AlignmentContext context = StratifiedAlignmentContext.stratify(sample.getValue(), contextType);
final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup(); final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
@ -266,7 +267,7 @@ public class DindelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoo
} }
public Allele getLikelihoods(RefMetaDataTracker tracker, public Allele getLikelihoods(RefMetaDataTracker tracker,
ReferenceContext ref, ReferenceContext ref,
Map<String, StratifiedAlignmentContext> contexts, Map<String, AlignmentContext> contexts,
StratifiedAlignmentContext.StratifiedContextType contextType, StratifiedAlignmentContext.StratifiedContextType contextType,
GenotypePriors priors, GenotypePriors priors,
Map<String, BiallelicGenotypeLikelihoods> GLs, Map<String, BiallelicGenotypeLikelihoods> GLs,
@ -353,8 +354,8 @@ public class DindelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoo
double[][] haplotypeLikehoodMatrix; double[][] haplotypeLikehoodMatrix;
for ( Map.Entry<String, StratifiedAlignmentContext> sample : contexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : contexts.entrySet() ) {
AlignmentContext context = sample.getValue().getContext(contextType); AlignmentContext context = StratifiedAlignmentContext.stratify(sample.getValue(), contextType);
ReadBackedPileup pileup = null; ReadBackedPileup pileup = null;
if (context.hasExtendedEventPileup()) if (context.hasExtendedEventPileup())

View File

@ -26,6 +26,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper; package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
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;
@ -78,7 +79,7 @@ public abstract class GenotypeLikelihoodsCalculationModel implements Cloneable {
*/ */
public abstract Allele getLikelihoods(RefMetaDataTracker tracker, public abstract Allele getLikelihoods(RefMetaDataTracker tracker,
ReferenceContext ref, ReferenceContext ref,
Map<String, StratifiedAlignmentContext> contexts, Map<String, AlignmentContext> contexts,
StratifiedAlignmentContext.StratifiedContextType contextType, StratifiedAlignmentContext.StratifiedContextType contextType,
GenotypePriors priors, GenotypePriors priors,
Map<String, BiallelicGenotypeLikelihoods> GLs, Map<String, BiallelicGenotypeLikelihoods> GLs,

View File

@ -26,6 +26,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper; package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.*; import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.exceptions.StingException; import org.broadinstitute.sting.utils.exceptions.StingException;
import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.genotype.DiploidGenotype;
@ -54,7 +55,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
public Allele getLikelihoods(RefMetaDataTracker tracker, public Allele getLikelihoods(RefMetaDataTracker tracker,
ReferenceContext ref, ReferenceContext ref,
Map<String, StratifiedAlignmentContext> contexts, Map<String, AlignmentContext> contexts,
StratifiedAlignmentContext.StratifiedContextType contextType, StratifiedAlignmentContext.StratifiedContextType contextType,
GenotypePriors priors, GenotypePriors priors,
Map<String, BiallelicGenotypeLikelihoods> GLs, Map<String, BiallelicGenotypeLikelihoods> GLs,
@ -98,8 +99,8 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
Allele altAllele = Allele.create(bestAlternateAllele, false); Allele altAllele = Allele.create(bestAlternateAllele, false);
for ( Map.Entry<String, StratifiedAlignmentContext> sample : contexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : contexts.entrySet() ) {
ReadBackedPileup pileup = sample.getValue().getContext(contextType).getBasePileup(); ReadBackedPileup pileup = StratifiedAlignmentContext.stratify(sample.getValue(), contextType).getBasePileup();
// create the GenotypeLikelihoods object // create the GenotypeLikelihoods object
DiploidSNPGenotypeLikelihoods GL = new DiploidSNPGenotypeLikelihoods((DiploidSNPGenotypePriors)priors, UAC.PCR_error); DiploidSNPGenotypeLikelihoods GL = new DiploidSNPGenotypeLikelihoods((DiploidSNPGenotypePriors)priors, UAC.PCR_error);
@ -124,12 +125,12 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
return refAllele; return refAllele;
} }
protected void initializeBestAlternateAllele(byte ref, Map<String, StratifiedAlignmentContext> contexts) { protected void initializeBestAlternateAllele(byte ref, Map<String, AlignmentContext> contexts) {
int[] qualCounts = new int[4]; int[] qualCounts = new int[4];
for ( Map.Entry<String, StratifiedAlignmentContext> sample : contexts.entrySet() ) { for ( Map.Entry<String, AlignmentContext> sample : contexts.entrySet() ) {
// calculate the sum of quality scores for each base // calculate the sum of quality scores for each base
ReadBackedPileup pileup = sample.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = sample.getValue().getBasePileup();
for ( PileupElement p : pileup ) { for ( PileupElement p : pileup ) {
// ignore deletions and filtered bases // ignore deletions and filtered bases
if ( p.isDeletion() || if ( p.isDeletion() ||

View File

@ -166,7 +166,7 @@ public class UnifiedGenotyperEngine {
&& UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES) && UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES)
return null; return null;
*/ */
Map<String, StratifiedAlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext); Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext);
if ( stratifiedContexts == null ) if ( stratifiedContexts == null )
return (UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ? null : new VariantCallContext(generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext), refContext.getBase(), false)); return (UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ? null : new VariantCallContext(generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext), refContext.getBase(), false));
@ -187,13 +187,13 @@ public class UnifiedGenotyperEngine {
* @return the VariantContext object * @return the VariantContext object
*/ */
public VariantContext calculateLikelihoods(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext, Allele alternateAlleleToUse) { public VariantContext calculateLikelihoods(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext, Allele alternateAlleleToUse) {
Map<String, StratifiedAlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext); Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext);
if ( stratifiedContexts == null ) if ( stratifiedContexts == null )
return null; return null;
return calculateLikelihoods(tracker, refContext, stratifiedContexts, StratifiedAlignmentContext.StratifiedContextType.COMPLETE, alternateAlleleToUse); return calculateLikelihoods(tracker, refContext, stratifiedContexts, StratifiedAlignmentContext.StratifiedContextType.COMPLETE, alternateAlleleToUse);
} }
private VariantContext calculateLikelihoods(RefMetaDataTracker tracker, ReferenceContext refContext, Map<String, StratifiedAlignmentContext> stratifiedContexts, StratifiedAlignmentContext.StratifiedContextType type, Allele alternateAlleleToUse) { private VariantContext calculateLikelihoods(RefMetaDataTracker tracker, ReferenceContext refContext, Map<String, AlignmentContext> stratifiedContexts, StratifiedAlignmentContext.StratifiedContextType type, Allele alternateAlleleToUse) {
// initialize the data for this thread if that hasn't been done yet // initialize the data for this thread if that hasn't been done yet
if ( glcm.get() == null ) { if ( glcm.get() == null ) {
@ -210,7 +210,7 @@ public class UnifiedGenotyperEngine {
return null; return null;
} }
private VariantContext generateEmptyContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, AlignmentContext rawContext) { private VariantContext generateEmptyContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, AlignmentContext rawContext) {
VariantContext vc; VariantContext vc;
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) { if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
final VariantContext vcInput = tracker.getVariantContext(ref, "alleles", null, ref.getLocus(), true); final VariantContext vcInput = tracker.getVariantContext(ref, "alleles", null, ref.getLocus(), true);
@ -288,11 +288,11 @@ public class UnifiedGenotyperEngine {
* @return the VariantCallContext object * @return the VariantCallContext object
*/ */
public VariantCallContext calculateGenotypes(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext, VariantContext vc) { public VariantCallContext calculateGenotypes(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext, VariantContext vc) {
Map<String, StratifiedAlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext); Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext);
return calculateGenotypes(tracker, refContext, rawContext, stratifiedContexts, vc); return calculateGenotypes(tracker, refContext, rawContext, stratifiedContexts, vc);
} }
private VariantCallContext calculateGenotypes(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { private VariantCallContext calculateGenotypes(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
// initialize the data for this thread if that hasn't been done yet // initialize the data for this thread if that hasn't been done yet
if ( afcm.get() == null ) { if ( afcm.get() == null ) {
@ -452,10 +452,10 @@ public class UnifiedGenotyperEngine {
return ( d >= 0.0 && d <= 1.0 ); return ( d >= 0.0 && d <= 1.0 );
} }
private Map<String, StratifiedAlignmentContext> getFilteredAndStratifiedContexts(UnifiedArgumentCollection UAC, ReferenceContext refContext, AlignmentContext rawContext) { private Map<String, AlignmentContext> getFilteredAndStratifiedContexts(UnifiedArgumentCollection UAC, ReferenceContext refContext, AlignmentContext rawContext) {
BadBaseFilter badReadPileupFilter = new BadBaseFilter(refContext, UAC); BadBaseFilter badReadPileupFilter = new BadBaseFilter(refContext, UAC);
Map<String, StratifiedAlignmentContext> stratifiedContexts = null; Map<String, AlignmentContext> stratifiedContexts = null;
if ( UAC.GLmodel == GenotypeLikelihoodsCalculationModel.Model.DINDEL && rawContext.hasExtendedEventPileup() ) { if ( UAC.GLmodel == GenotypeLikelihoodsCalculationModel.Model.DINDEL && rawContext.hasExtendedEventPileup() ) {
@ -493,7 +493,7 @@ public class UnifiedGenotyperEngine {
AFs[i] = AlleleFrequencyCalculationModel.VALUE_NOT_CALCULATED; AFs[i] = AlleleFrequencyCalculationModel.VALUE_NOT_CALCULATED;
} }
private VariantCallContext estimateReferenceConfidence(VariantContext vc, Map<String, StratifiedAlignmentContext> contexts, double theta, boolean ignoreCoveredSamples, double initialPofRef) { private VariantCallContext estimateReferenceConfidence(VariantContext vc, Map<String, AlignmentContext> contexts, double theta, boolean ignoreCoveredSamples, double initialPofRef) {
if ( contexts == null ) if ( contexts == null )
return null; return null;
@ -509,7 +509,7 @@ public class UnifiedGenotyperEngine {
int depth = 0; int depth = 0;
if (isCovered) { if (isCovered) {
AlignmentContext context = contexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE); AlignmentContext context = contexts.get(sample);
if (context.hasBasePileup()) if (context.hasBasePileup())
depth = context.getBasePileup().size(); depth = context.getBasePileup().size();
@ -559,11 +559,11 @@ public class UnifiedGenotyperEngine {
verboseWriter.println(); verboseWriter.println();
} }
private boolean filterPileup(Map<String, StratifiedAlignmentContext> stratifiedContexts, BadBaseFilter badBaseFilter) { private boolean filterPileup(Map<String, AlignmentContext> stratifiedContexts, BadBaseFilter badBaseFilter) {
int numDeletions = 0, pileupSize = 0; int numDeletions = 0, pileupSize = 0;
for ( StratifiedAlignmentContext context : stratifiedContexts.values() ) { for ( AlignmentContext context : stratifiedContexts.values() ) {
ReadBackedPileup pileup = context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = context.getBasePileup();
for ( PileupElement p : pileup ) { for ( PileupElement p : pileup ) {
final SAMRecord read = p.getRead(); final SAMRecord read = p.getRead();

View File

@ -70,7 +70,7 @@ public class AlleleBalanceHistogramWalker extends LocusWalker<Map<String,Double>
} }
private HashMap<String,Double> getAlleleBalanceBySample(VariantContext vc, ReferenceContext ref, AlignmentContext context) { private HashMap<String,Double> getAlleleBalanceBySample(VariantContext vc, ReferenceContext ref, AlignmentContext context) {
Map<String, StratifiedAlignmentContext> sampleContext = StratifiedAlignmentContext.splitContextBySampleName(context.getBasePileup(),null); Map<String, AlignmentContext> sampleContext = StratifiedAlignmentContext.splitContextBySampleName(context);
HashMap<String,Double> balances = new HashMap<String,Double>(); HashMap<String,Double> balances = new HashMap<String,Double>();
System.out.println("----- "+ref.getLocus()+" -----"); System.out.println("----- "+ref.getLocus()+" -----");
int returnedBalances = 0; int returnedBalances = 0;
@ -86,24 +86,18 @@ public class AlleleBalanceHistogramWalker extends LocusWalker<Map<String,Double>
return balances; return balances;
} }
private long getCoverage(StratifiedAlignmentContext context) { private long getCoverage(AlignmentContext context) {
return context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).size(); return context.size();
} }
private Double getAlleleBalance(ReferenceContext ref, StratifiedAlignmentContext context, char snpBase) { private Double getAlleleBalance(ReferenceContext ref, AlignmentContext alicon, char snpBase) {
if ( context == null ) { if ( alicon == null ) {
//System.out.println("Stratified context was null"); //System.out.println("Stratified context was null");
return null; return null;
} }
int refBases = 0; int refBases = 0;
int altBases = 0; int altBases = 0;
AlignmentContext alicon = context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE);
if ( alicon == null ) {
System.out.println("Alignment context from stratified was null");
return null;
}
for ( PileupElement e : alicon.getBasePileup() ) { for ( PileupElement e : alicon.getBasePileup() ) {
if ( BaseUtils.basesAreEqual( e.getBase(), ref.getBase() ) ) { if ( BaseUtils.basesAreEqual( e.getBase(), ref.getBase() ) ) {

View File

@ -468,8 +468,8 @@ public class MendelianViolationClassifier extends LocusWalker<MendelianViolation
throw new ReviewedStingException("Parental bases have length zero at "+trio.toString()); throw new ReviewedStingException("Parental bases have length zero at "+trio.toString());
} }
Map<String,StratifiedAlignmentContext> splitContext = StratifiedAlignmentContext.splitContextBySampleName(context.getBasePileup()); Map<String,AlignmentContext> splitContext = StratifiedAlignmentContext.splitContextBySampleName(context);
Double proportion = getAlleleProportion(parental,splitContext.get(trioStructure.child)); Double proportion = getAlleleProportion(parental, splitContext.get(trioStructure.child));
if ( proportion != null ) { if ( proportion != null ) {
violation.addAttribute(MendelianInfoKey.ProportionOfParentAllele.getKey(), proportion); violation.addAttribute(MendelianInfoKey.ProportionOfParentAllele.getKey(), proportion);
if ( ! deNovoRange.contains(proportion) ) { if ( ! deNovoRange.contains(proportion) ) {
@ -502,7 +502,7 @@ public class MendelianViolationClassifier extends LocusWalker<MendelianViolation
// look for tri-allelic sites mis-called as hom -- as a speedup we do this only at non-filtered, non genotype error sites // look for tri-allelic sites mis-called as hom -- as a speedup we do this only at non-filtered, non genotype error sites
if ( ! trio.isFiltered() ) { if ( ! trio.isFiltered() ) {
Map<String,StratifiedAlignmentContext> splitCon = StratifiedAlignmentContext.splitContextBySampleName(context.getBasePileup()); Map<String,AlignmentContext> splitCon = StratifiedAlignmentContext.splitContextBySampleName(context);
Pair<Allele,Integer> triAl = getTriAllelicQuality(tracker, ref, trio, splitCon); Pair<Allele,Integer> triAl = getTriAllelicQuality(tracker, ref, trio, splitCon);
if ( triAl != null ) { if ( triAl != null ) {
violation.addAttribute(MendelianInfoKey.TriAllelicBase.getKey(),triAl.first.toString()); violation.addAttribute(MendelianInfoKey.TriAllelicBase.getKey(),triAl.first.toString());
@ -536,11 +536,11 @@ public class MendelianViolationClassifier extends LocusWalker<MendelianViolation
return violation; return violation;
} }
private Double getAlleleProportion(Allele a, StratifiedAlignmentContext context) { private Double getAlleleProportion(Allele a, AlignmentContext context) {
int numParental = 0; int numParental = 0;
int total = 0; int total = 0;
if ( context != null ) { if ( context != null ) {
for ( PileupElement e : context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup()) { for ( PileupElement e : context.getBasePileup()) {
if ( e.getQual() >= 10 && e.getMappingQual() >= 10 ) { if ( e.getQual() >= 10 && e.getMappingQual() >= 10 ) {
total++; total++;
if ( e.getBase() == a.getBases()[0]) { if ( e.getBase() == a.getBases()[0]) {
@ -556,11 +556,11 @@ public class MendelianViolationClassifier extends LocusWalker<MendelianViolation
} }
private Pair<Allele,Integer> getTriAllelicQuality(RefMetaDataTracker tracker, ReferenceContext ref, VariantContext var, Map<String,StratifiedAlignmentContext> strat) { private Pair<Allele,Integer> getTriAllelicQuality(RefMetaDataTracker tracker, ReferenceContext ref, VariantContext var, Map<String,AlignmentContext> strat) {
int conf = 0; int conf = 0;
Allele alt = null; Allele alt = null;
for ( Map.Entry<String,StratifiedAlignmentContext> sEntry : strat.entrySet() ) { for ( Map.Entry<String,AlignmentContext> sEntry : strat.entrySet() ) {
VariantCallContext call = engine.calculateLikelihoodsAndGenotypes(tracker, ref, sEntry.getValue().getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE)); VariantCallContext call = engine.calculateLikelihoodsAndGenotypes(tracker, ref, sEntry.getValue());
if ( call != null && call.confidentlyCalled ) { if ( call != null && call.confidentlyCalled ) {
if ( call.isSNP() ) { if ( call.isSNP() ) {
if ( ! call.getAlternateAllele(0).basesMatch(var.getAlternateAllele(0))) { if ( ! call.getAlternateAllele(0).basesMatch(var.getAlternateAllele(0))) {

View File

@ -4,8 +4,8 @@ import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.ExperimentalAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.ExperimentalAnnotation;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
@ -21,7 +21,7 @@ import java.util.*;
*/ */
public class HammingDistance implements ExperimentalAnnotation, InfoFieldAnnotation { public class HammingDistance implements ExperimentalAnnotation, InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( tracker == null ) { if ( tracker == null ) {
return null; return null;
} }

View File

@ -2,8 +2,8 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.PileupElement;
@ -25,10 +25,10 @@ public class InsertSizeDistribution implements InfoFieldAnnotation {
public List<String> getKeyNames() { return Arrays.asList("INSIZE"); } public List<String> getKeyNames() { return Arrays.asList("INSIZE"); }
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0),1, VCFHeaderLineType.Integer,"Do not use this if your name is not Chris")); } public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0),1, VCFHeaderLineType.Integer,"Do not use this if your name is not Chris")); }
public Map<String,Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext variant) { public Map<String,Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> context, VariantContext variant) {
int weirdInsertSizeReads = 0; int weirdInsertSizeReads = 0;
for ( String sample : context.keySet() ) { for ( String sample : context.keySet() ) {
ReadBackedPileup pileup = context.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = context.get(sample).getBasePileup();
for (PileupElement e : pileup ) { for (PileupElement e : pileup ) {
if ( Math.abs(e.getRead().getInferredInsertSize()) > INSERT_SIZE_LOWER_BOUND ) { if ( Math.abs(e.getRead().getInferredInsertSize()) > INSERT_SIZE_LOWER_BOUND ) {
weirdInsertSizeReads++; weirdInsertSizeReads++;

View File

@ -28,13 +28,13 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.utils.collections.Pair; import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
@ -57,13 +57,13 @@ public class ProportionOfNonrefBasesSupportingSNP implements InfoFieldAnnotation
return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME,1, VCFHeaderLineType.Float,"Simple proportion of non-reference bases that are the SNP base")); return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME,1, VCFHeaderLineType.Float,"Simple proportion of non-reference bases that are the SNP base"));
} }
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> context, VariantContext vc) {
if ( ! vc.isSNP() || ! vc.isBiallelic() ) if ( ! vc.isSNP() || ! vc.isBiallelic() )
return null; return null;
Pair<Integer,Integer> totalNonref_totalSNP = new Pair<Integer,Integer>(0,0); Pair<Integer,Integer> totalNonref_totalSNP = new Pair<Integer,Integer>(0,0);
for ( String sample : context.keySet() ) { for ( String sample : context.keySet() ) {
ReadBackedPileup pileup = context.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = context.get(sample).getBasePileup();
totalNonref_totalSNP = getNonrefAndSNP(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalNonref_totalSNP); totalNonref_totalSNP = getNonrefAndSNP(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalNonref_totalSNP);
} }

View File

@ -28,6 +28,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.BaseUtils;
@ -35,7 +36,6 @@ import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
@ -55,13 +55,13 @@ public class ProportionOfRefSecondBasesSupportingSNP implements InfoFieldAnnotat
public List<String> getKeyNames() { return Arrays.asList(KEY_NAME); } public List<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> context, VariantContext vc) {
if ( ! vc.isSNP() || ! vc.isBiallelic() ) if ( ! vc.isSNP() || ! vc.isBiallelic() )
return null; return null;
Pair<Integer,Integer> totalAndSNPSupporting = new Pair<Integer,Integer>(0,0); Pair<Integer,Integer> totalAndSNPSupporting = new Pair<Integer,Integer>(0,0);
for ( String sample : context.keySet() ) { for ( String sample : context.keySet() ) {
ReadBackedPileup pileup = context.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = context.get(sample).getBasePileup();
totalAndSNPSupporting = getTotalRefAndSNPSupportCounts(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting); totalAndSNPSupporting = getTotalRefAndSNPSupportCounts(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting);
} }

View File

@ -28,8 +28,8 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.utils.collections.Pair; import org.broadinstitute.sting.utils.collections.Pair;
@ -58,13 +58,13 @@ public class ProportionOfSNPSecondBasesSupportingRef implements InfoFieldAnnotat
public boolean useZeroQualityReads() { return USE_MAPQ0_READS; } public boolean useZeroQualityReads() { return USE_MAPQ0_READS; }
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> context, VariantContext vc) {
if ( ! vc.isSNP() || ! vc.isBiallelic() ) if ( ! vc.isSNP() || ! vc.isBiallelic() )
return null; return null;
Pair<Integer,Integer> totalAndSNPSupporting = new Pair<Integer,Integer>(0,0); Pair<Integer,Integer> totalAndSNPSupporting = new Pair<Integer,Integer>(0,0);
for ( String sample : context.keySet() ) { for ( String sample : context.keySet() ) {
ReadBackedPileup pileup = context.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(); ReadBackedPileup pileup = context.get(sample).getBasePileup();
totalAndSNPSupporting = getTotalSNPandRefSupporting(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting); totalAndSNPSupporting = getTotalSNPandRefSupporting(pileup, ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), totalAndSNPSupporting);
} }

View File

@ -4,8 +4,8 @@ import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFHeaderLineType;
import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFInfoHeaderLine;
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.contexts.StratifiedAlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.AnnotationByDepth; import org.broadinstitute.sting.gatk.walkers.annotator.AnnotationByDepth;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.ExperimentalAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.ExperimentalAnnotation;
@ -21,7 +21,7 @@ import java.util.Map;
* This does not necessarily work well in the case of non-confident genotypes (could over or under penalize) * This does not necessarily work well in the case of non-confident genotypes (could over or under penalize)
*/ */
public class QualByDepthV2 extends AnnotationByDepth implements ExperimentalAnnotation { public class QualByDepthV2 extends AnnotationByDepth implements ExperimentalAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )
return null; return null;

View File

@ -38,8 +38,8 @@ public class MapExtender {
readFilteredPileup = new HashMap<Sample,ReadBackedPileup>(); readFilteredPileup = new HashMap<Sample,ReadBackedPileup>();
if ( current != null ) { if ( current != null ) {
for ( Map.Entry<Sample,StratifiedAlignmentContext> sac : current.getContext().entrySet() ) { for ( Map.Entry<Sample,AlignmentContext> sac : current.getContext().entrySet() ) {
AlignmentContext context = sac.getValue().getContext(TYPE); AlignmentContext context = StratifiedAlignmentContext.stratify(sac.getValue(), TYPE);
if ( context.hasBasePileup() ) { if ( context.hasBasePileup() ) {
fullPileup.put(sac.getKey(),context.getBasePileup()); fullPileup.put(sac.getKey(),context.getBasePileup());
} else if ( context.hasExtendedEventPileup() ) { } else if ( context.hasExtendedEventPileup() ) {
@ -66,7 +66,7 @@ public class MapExtender {
public Map<Sample,ReadBackedPileup> getFullPileup() { return fullPileup; } public Map<Sample,ReadBackedPileup> getFullPileup() { return fullPileup; }
public Map<Sample,ReadBackedPileup> getReadFilteredPileup(){ return readFilteredPileup; } public Map<Sample,ReadBackedPileup> getReadFilteredPileup(){ return readFilteredPileup; }
public Map<Sample,StratifiedAlignmentContext> getPreviousContext() { public Map<Sample,AlignmentContext> getPreviousContext() {
return previous != null ? previous.getContext() : null; return previous != null ? previous.getContext() : null;
} }
@ -78,7 +78,7 @@ public class MapExtender {
return previous != null ? previous.getTracker() : null; return previous != null ? previous.getTracker() : null;
} }
public Map<Sample,StratifiedAlignmentContext> getContext() { public Map<Sample,AlignmentContext> getContext() {
return current != null ? current.getContext() : null; return current != null ? current.getContext() : null;
} }

View File

@ -11,15 +11,15 @@ import java.util.Map;
public class MapHolder { public class MapHolder {
private RefMetaDataTracker tracker; private RefMetaDataTracker tracker;
private ReferenceContext ref; private ReferenceContext ref;
private Map<Sample, StratifiedAlignmentContext> alignments; private Map<Sample, AlignmentContext> alignments;
public MapHolder(RefMetaDataTracker t, ReferenceContext r, AlignmentContext a) { public MapHolder(RefMetaDataTracker t, ReferenceContext r, AlignmentContext a) {
tracker = t; tracker = t;
ref = r; ref = r;
alignments = StratifiedAlignmentContext.splitContextBySample(a.getBasePileup()); alignments = StratifiedAlignmentContext.splitContextBySample(a);
} }
public Map<Sample, StratifiedAlignmentContext> getContext() { public Map<Sample, AlignmentContext> getContext() {
return alignments; return alignments;
} }