Require each filter or feature to declare whether or not they want mapping quality zero reads in the alignment context
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1486 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
e70101febc
commit
1a299dd459
|
|
@ -50,7 +50,6 @@ public class VariantContext {
|
|||
public RefMetaDataTracker getTracker() { return tracker; }
|
||||
public ReferenceContext getReferenceContext() { return ref; }
|
||||
public rodVariants getVariant() { return variant; }
|
||||
public AlignmentContext getAlignmentContext() { return getAlignmentContext(false); }
|
||||
public AlignmentContext getAlignmentContext(boolean useMQ0Reads) {
|
||||
return (useMQ0Reads ? context : getQ0freeContext());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ public class IVFBinomialStrand implements IndependentVariantFeature {
|
|||
VariantContext context = contextWindow.getContext();
|
||||
likelihoods = new double[10];
|
||||
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(context.getReferenceContext().getBase(), context.getAlignmentContext());
|
||||
List<SAMRecord> reads = context.getAlignmentContext().getReads();
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(context.getReferenceContext().getBase(), context.getAlignmentContext(useZeroQualityReads()));
|
||||
List<SAMRecord> reads = context.getAlignmentContext(useZeroQualityReads()).getReads();
|
||||
String bases = pileup.getBases();
|
||||
|
||||
for (int genotypeIndex = 0; genotypeIndex < Genotype.values().length; genotypeIndex++) {
|
||||
|
|
@ -59,4 +59,6 @@ public class IVFBinomialStrand implements IndependentVariantFeature {
|
|||
public String getStudyInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class IVFPrimaryBases implements IndependentVariantFeature {
|
|||
VariantContext context = contextWindow.getContext();
|
||||
likelihoods = new double[10];
|
||||
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(context.getReferenceContext().getBase(), context.getAlignmentContext());
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(context.getReferenceContext().getBase(), context.getAlignmentContext(useZeroQualityReads()));
|
||||
String primaryBases = pileup.getBases();
|
||||
|
||||
for (int genotypeIndex = 0; genotypeIndex < Genotype.values().length; genotypeIndex++) {
|
||||
|
|
@ -77,4 +77,6 @@ public class IVFPrimaryBases implements IndependentVariantFeature {
|
|||
public String getStudyInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class IVFSecondaryBases implements IndependentVariantFeature {
|
|||
VariantContext context = contextWindow.getContext();
|
||||
likelihoods = new double[10];
|
||||
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(context.getReferenceContext().getBase(), context.getAlignmentContext());
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(context.getReferenceContext().getBase(), context.getAlignmentContext(useZeroQualityReads()));
|
||||
String primaryBases = pileup.getBases();
|
||||
String secondaryBases = pileup.getSecondaryBasePileup();
|
||||
|
||||
|
|
@ -124,4 +124,6 @@ public class IVFSecondaryBases implements IndependentVariantFeature {
|
|||
public String getStudyInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@ public interface IndependentVariantFeature {
|
|||
public String getStudyHeader();
|
||||
|
||||
public String getStudyInfo();
|
||||
|
||||
public boolean useZeroQualityReads();
|
||||
}
|
||||
|
|
@ -31,8 +31,8 @@ public class VECClusteredSnps implements VariantExclusionCriterion {
|
|||
if ( variants[i] == null || variants[i+snpThreshold-1] == null )
|
||||
continue;
|
||||
|
||||
GenomeLoc left = variants[i].getAlignmentContext().getLocation();
|
||||
GenomeLoc right = variants[i+snpThreshold-1].getAlignmentContext().getLocation();
|
||||
GenomeLoc left = variants[i].getAlignmentContext(useZeroQualityReads()).getLocation();
|
||||
GenomeLoc right = variants[i+snpThreshold-1].getAlignmentContext(useZeroQualityReads()).getLocation();
|
||||
if ( left.getContigIndex() == right.getContigIndex() ) {
|
||||
distance = Math.abs(right.getStart() - left.getStart());
|
||||
if ( distance <= window ) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class VECDepthOfCoverage implements VariantExclusionCriterion {
|
|||
|
||||
public void compute(VariantContextWindow contextWindow) {
|
||||
VariantContext context = contextWindow.getContext();
|
||||
depth = context.getAlignmentContext().getReads().size();
|
||||
depth = context.getAlignmentContext(useZeroQualityReads()).getReads().size();
|
||||
exclude = depth > maximum;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class VECFisherStrand implements VariantExclusionCriterion {
|
|||
int allele2 = BaseUtils.simpleBaseToBaseIndex(variant.getBestGenotype().charAt(1));
|
||||
|
||||
if (allele1 != allele2) {
|
||||
exclude = strandTest(context.getReferenceContext().getBase(), context.getAlignmentContext(), allele1, allele2, pvalueLimit, null);
|
||||
exclude = strandTest(context.getReferenceContext().getBase(), context.getAlignmentContext(useZeroQualityReads()), allele1, allele2, pvalueLimit, null);
|
||||
} else {
|
||||
exclude = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class VECHomopolymer implements VariantExclusionCriterion {
|
|||
|
||||
public void compute(VariantContextWindow contextWindow) {
|
||||
VariantContext context = contextWindow.getContext();
|
||||
AlignmentContext alignmentContext = context.getAlignmentContext();
|
||||
AlignmentContext alignmentContext = context.getAlignmentContext(useZeroQualityReads());
|
||||
char[] geno = context.getVariant().getBestGenotype().toCharArray();
|
||||
int[] genotype = {-1,-1};
|
||||
for (int h = 0; h < 2; h ++) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class VECMappingQuality implements VariantExclusionCriterion {
|
|||
|
||||
public void compute(VariantContextWindow contextWindow) {
|
||||
VariantContext context = contextWindow.getContext();
|
||||
List<SAMRecord> reads = context.getAlignmentContext().getReads();
|
||||
List<SAMRecord> reads = context.getAlignmentContext(useZeroQualityReads()).getReads();
|
||||
int[] qualities = new int[reads.size()];
|
||||
for (int i=0; i < reads.size(); i++)
|
||||
qualities[i] = reads.get(i).getMappingQuality();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class VECOnOffGenotypeRatio implements VariantExclusionCriterion { // ext
|
|||
VariantContext context = contextWindow.getContext();
|
||||
char ref = context.getReferenceContext().getBase();
|
||||
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(ref, context.getAlignmentContext());
|
||||
ReadBackedPileup pileup = new ReadBackedPileup(ref, context.getAlignmentContext(useZeroQualityReads()));
|
||||
Pair<Integer, Integer> counts = scoreVariant(ref, pileup, context.getVariant());
|
||||
int n = counts.first + counts.second;
|
||||
ratio = counts.first.doubleValue() / (double)n;
|
||||
|
|
|
|||
Loading…
Reference in New Issue