1. Don't print out values in filter field of the VCF.

2. Fix ratio printouts (for params file)
3. Rename ratio filter's get counts method to avoid confusion; more changes on the way this week.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1616 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-09-14 21:03:39 +00:00
parent 436f543b3b
commit 01e7b39c8d
8 changed files with 16 additions and 16 deletions

View File

@ -37,7 +37,7 @@ public abstract class RatioFilter implements VariantExclusionCriterion {
highThreshold = threshold;
}
protected abstract Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, RodGeliText variant);
protected abstract Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant);
protected abstract boolean excludeHetsOnly();
public boolean useZeroQualityReads() { return false; }
@ -48,7 +48,7 @@ public abstract class RatioFilter implements VariantExclusionCriterion {
char ref = context.getReferenceContext().getBase();
ReadBackedPileup pileup = new ReadBackedPileup(ref, context.getAlignmentContext(useZeroQualityReads()));
Pair<Integer, Integer> counts = scoreVariant(ref, pileup, variant);
Pair<Integer, Integer> counts = getRatioCounts(ref, pileup, variant);
boolean highGenotypeConfidence = variant.getConsensusConfidence() > minGenotypeConfidenceToTest;
boolean excludable = !excludeHetsOnly() || GenotypeUtils.isHet((AllelicVariant)variant);
@ -68,10 +68,10 @@ public abstract class RatioFilter implements VariantExclusionCriterion {
// TODO - this whole calculation needs to be redone correctly
private boolean pointEstimateExclude(Pair<Integer, Integer> counts) {
if ( counts.first + counts.second < minDepthOfCoverage )
int n = counts.first + counts.second;
if ( n < minDepthOfCoverage )
return false;
int n = counts.first + counts.second;
double ratio = counts.first.doubleValue() / (double)n;
return !passesThreshold(ratio);
}

View File

@ -31,7 +31,7 @@ public class VECAlleleBalance extends RatioFilter {
* Return the count of bases matching the major (first) and minor (second) alleles as a pair.
*
*/
protected Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, RodGeliText variant) {
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
final String genotype = variant.getBestGenotype();
final String bases = pileup.getBases();
@ -47,7 +47,7 @@ public class VECAlleleBalance extends RatioFilter {
int refCount = a == ref ? aCount : bCount;
int altCount = a == ref ? bCount : aCount;
ratio = (double)refCount / (double)altCount;
ratio = (double)refCount / (double)(refCount + altCount);
return new Pair<Integer, Integer>(refCount, altCount);
}
@ -69,7 +69,7 @@ public class VECAlleleBalance extends RatioFilter {
}
public String getVCFFilterString() {
return "AlleleBalance" + ratio;
return "AlleleBalance";
}
}

View File

@ -47,7 +47,7 @@ public class VECDepthOfCoverage implements VariantExclusionCriterion {
}
public String getVCFFilterString() {
return "DoC" + depth;
return "DoC";
}
public boolean useZeroQualityReads() { return false; }

View File

@ -48,7 +48,7 @@ public class VECFisherStrand implements VariantExclusionCriterion {
}
public String getVCFFilterString() {
return "strand" + pValue;
return "strand";
}
public boolean useZeroQualityReads() { return false; }

View File

@ -36,6 +36,6 @@ public class VECLodThreshold implements VariantExclusionCriterion {
}
public String getVCFFilterString() {
return "LOD" + lod;
return "LOD";
}
}

View File

@ -42,7 +42,7 @@ public class VECMappingQuality implements VariantExclusionCriterion {
}
public String getVCFFilterString() {
return "MQ" + rms;
return "MQ";
}
public boolean useZeroQualityReads() { return true; }

View File

@ -42,7 +42,7 @@ public class VECMappingQualityZero implements VariantExclusionCriterion {
}
public String getVCFFilterString() {
return "MQzero" + mq0Count;
return "MQzero";
}
public boolean useZeroQualityReads() { return true; }

View File

@ -26,7 +26,7 @@ public class VECOnOffGenotypeRatio extends RatioFilter {
* best genotype). On are in the first field, off in the second.
*
*/
protected Pair<Integer, Integer> scoreVariant(char ref, ReadBackedPileup pileup, RodGeliText variant) {
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
final String genotype = variant.getBestGenotype().toUpperCase();
final String bases = pileup.getBases();
@ -44,7 +44,7 @@ public class VECOnOffGenotypeRatio extends RatioFilter {
//System.out.printf("count = %d, on=%d, off=%d for %c in %s%n", count, on, off, base, genotype);
}
ratio = (double)on / (double)off;
ratio = (double)on / (double)(on + off);
return new Pair<Integer, Integer>(on, off);
}
@ -65,6 +65,6 @@ public class VECOnOffGenotypeRatio extends RatioFilter {
}
public String getVCFFilterString() {
return "onOffGenotype" + ratio;
return "onOffGenotype";
}
}
}