Multiple eval tracks should be bound with different names, rather than just 'eval'. Added tests to cover usage with multiple tracks.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5177 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
kiran 2011-02-02 22:33:50 +00:00
parent cf15819db5
commit cb6454bf98
13 changed files with 60 additions and 23 deletions

View File

@ -83,6 +83,9 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
protected Boolean NO_STANDARD_MODULES = false; protected Boolean NO_STANDARD_MODULES = false;
// Other arguments // Other arguments
@Argument(fullName="numSamples", shortName="ns", doc="Number of samples (used if no samples are available in the VCF file", required=false)
protected Integer NUM_SAMPLES = 0;
@Argument(fullName="minPhaseQuality", shortName="mpq", doc="Minimum phasing quality", required=false) @Argument(fullName="minPhaseQuality", shortName="mpq", doc="Minimum phasing quality", required=false)
protected double MIN_PHASE_QUALITY = 10.0; protected double MIN_PHASE_QUALITY = 10.0;
@ -376,7 +379,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
// Load the sample list // Load the sample list
sampleNamesForEvaluation.addAll(SampleUtils.getSamplesFromCommandLineInput(vcfSamples, SAMPLE_EXPRESSIONS)); sampleNamesForEvaluation.addAll(SampleUtils.getSamplesFromCommandLineInput(vcfSamples, SAMPLE_EXPRESSIONS));
numSamples = sampleNamesForEvaluation.size(); numSamples = NUM_SAMPLES > 0 ? NUM_SAMPLES : sampleNamesForEvaluation.size();
if (Arrays.asList(STRATIFICATIONS_TO_USE).contains("Sample")) { if (Arrays.asList(STRATIFICATIONS_TO_USE).contains("Sample")) {
sampleNamesForStratification.addAll(sampleNamesForEvaluation); sampleNamesForStratification.addAll(sampleNamesForEvaluation);
@ -507,7 +510,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
if ( vc != null ) { if ( vc != null ) {
VariantContext vcsub = vc; VariantContext vcsub = vc;
if (vc.hasGenotypes(sampleNamesForEvaluation)) { if (vc.hasGenotypes() && vc.hasGenotypes(sampleNamesForEvaluation)) {
vcsub = getSubsetOfVariantContext(vc, sampleNamesForEvaluation); vcsub = getSubsetOfVariantContext(vc, sampleNamesForEvaluation);
} }
@ -516,7 +519,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
} }
// Now, if stratifying, split the subsetted vc per sample and add each as a new context // Now, if stratifying, split the subsetted vc per sample and add each as a new context
if ( trackPerSample ) { if ( vc.hasGenotypes() && trackPerSample ) {
for ( String sampleName : sampleNamesForEvaluation ) { for ( String sampleName : sampleNamesForEvaluation ) {
VariantContext samplevc = getSubsetOfVariantContext(vc, sampleName); VariantContext samplevc = getSubsetOfVariantContext(vc, sampleName);
@ -669,7 +672,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
HashMap<VariantStratifier, ArrayList<String>> stateMap = new HashMap<VariantStratifier, ArrayList<String>>(); HashMap<VariantStratifier, ArrayList<String>> stateMap = new HashMap<VariantStratifier, ArrayList<String>>();
for ( VariantStratifier vs : stratificationObjects ) { for ( VariantStratifier vs : stratificationObjects ) {
ArrayList<String> states = vs.getRelevantStates(ref, comp, compName, eval, sampleName); ArrayList<String> states = vs.getRelevantStates(ref, comp, compName, eval, evalName, sampleName);
stateMap.put(vs, states); stateMap.put(vs, states);
} }

View File

@ -123,8 +123,9 @@ public class SimpleMetricsByAC extends VariantEvaluator implements StandardEval
ac = Integer.valueOf(eval.getAttributeAsString("AC")); ac = Integer.valueOf(eval.getAttributeAsString("AC"));
} }
if ( ac != -1 ) if ( ac != -1 ) {
metrics.get(ac).update(eval); metrics.get(ac).update(eval);
}
} }
} }
@ -150,19 +151,22 @@ public class SimpleMetricsByAC extends VariantEvaluator implements StandardEval
} }
public String update1(VariantContext eval, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) { public String update1(VariantContext eval, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
if (numSamples == 0) {
return null;
}
final String interesting = null; final String interesting = null;
if (eval != null ) { if (eval != null) {
if ( metrics == null ) { if ( metrics == null ) {
int nSamples = numSamples; int nSamples = numSamples;
if ( nSamples != -1 ) if ( nSamples != -1 ) {
metrics = new MetricsByAc(2 * nSamples); metrics = new MetricsByAc(2 * nSamples);
}
} }
if ( eval.isSNP() && if ( eval.isSNP() && eval.isBiallelic() && metrics != null ) {
eval.isBiallelic() &&
metrics != null ) {
metrics.incrValue(eval); metrics.incrValue(eval);
} }
} }

View File

@ -24,7 +24,7 @@ public class CompRod extends VariantStratifier implements RequiredStratification
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add(compName); relevantStates.add(compName);

View File

@ -22,7 +22,7 @@ public class CpG extends VariantStratifier implements StandardStratification {
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
boolean isCpG = false; boolean isCpG = false;
if (ref != null && ref.getBases() != null) { if (ref != null && ref.getBases() != null) {
String fwRefBases = new String(ref.getBases()); String fwRefBases = new String(ref.getBases());

View File

@ -52,7 +52,7 @@ public class Degeneracy extends VariantStratifier {
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add("all"); relevantStates.add("all");

View File

@ -17,17 +17,17 @@ public class EvalRod extends VariantStratifier implements RequiredStratification
this.evalNames = evalNames; this.evalNames = evalNames;
states = new ArrayList<String>(); states = new ArrayList<String>();
states.add("eval"); states.addAll(evalNames);
} }
public ArrayList<String> getAllStates() { public ArrayList<String> getAllStates() {
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add("eval"); relevantStates.add(evalName);
return relevantStates; return relevantStates;
} }

View File

@ -23,7 +23,7 @@ public class Filter extends VariantStratifier {
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add("raw"); relevantStates.add("raw");

View File

@ -24,7 +24,7 @@ public class FunctionalClass extends VariantStratifier {
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add("all"); relevantStates.add("all");

View File

@ -27,7 +27,7 @@ public class JexlExpression extends VariantStratifier implements StandardStratif
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add("none"); relevantStates.add("none");

View File

@ -26,7 +26,7 @@ public class Novelty extends VariantStratifier implements StandardStratification
return states; return states;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add("all"); relevantStates.add("all");

View File

@ -22,7 +22,7 @@ public class Sample extends VariantStratifier {
return samples; return samples;
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
ArrayList<String> relevantStates = new ArrayList<String>(); ArrayList<String> relevantStates = new ArrayList<String>();
relevantStates.add(sampleName); relevantStates.add(sampleName);

View File

@ -15,7 +15,7 @@ public abstract class VariantStratifier implements Comparable {
return new ArrayList<String>(); return new ArrayList<String>();
} }
public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String sampleName) { public ArrayList<String> getRelevantStates(ReferenceContext ref, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName) {
return null; return null;
} }

View File

@ -133,7 +133,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
@Test @Test
public void testCompVsEvalAC() { public void testCompVsEvalAC() {
String extraArgs = "-T VariantEval -R "+b36KGReference+" -o %s -EV GenotypeConcordance -B:evalYRI,VCF /humgen/gsa-hpprojects/GATK/data/Validation_Data/yri.trio.gatk.ug.very.few.lines.vcf -B:compYRI,VCF /humgen/gsa-hpprojects/GATK/data/Validation_Data/yri.trio.gatk.fake.genotypes.ac.test.vcf"; String extraArgs = "-T VariantEval -R "+b36KGReference+" -o %s -EV GenotypeConcordance -B:evalYRI,VCF /humgen/gsa-hpprojects/GATK/data/Validation_Data/yri.trio.gatk.ug.very.few.lines.vcf -B:compYRI,VCF /humgen/gsa-hpprojects/GATK/data/Validation_Data/yri.trio.gatk.fake.genotypes.ac.test.vcf";
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("113228ffa35e0f67b8e067860c04171f")); WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("d8d59ec86ec9e00abad4ec44741de22f"));
executeTestParallel("testCompVsEvalAC",spec); executeTestParallel("testCompVsEvalAC",spec);
//executeTest("testCompVsEvalAC",spec); //executeTest("testCompVsEvalAC",spec);
} }
@ -158,6 +158,36 @@ public class VariantEvalIntegrationTest extends WalkerTest {
//executeTest("testCompOverlap",spec); //executeTest("testCompOverlap",spec);
} }
@Test
public void testEvalTrackWithoutGenotypes() {
String dbsnp = GATKDataLocation + "dbsnp_129_b37.rod";
String extraArgs = "-T VariantEval -R " +
b37KGReference +
" -L 20" +
" -D " + dbsnp +
" -B:evalBI,VCF " + validationDataLocation + "VariantEval/ALL.20100201.chr20.bi.sites.vcf" +
" -noST -ST Novelty -o %s";
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("2e2c24b49f699506b967befbde5a6fa8"));
executeTestParallel("testEvalTrackWithoutGenotypes",spec);
}
@Test
public void testMultipleEvalTracksWithoutGenotypes() {
String dbsnp = GATKDataLocation + "dbsnp_129_b37.rod";
String extraArgs = "-T VariantEval -R " +
b37KGReference +
" -L 20" +
" -D " + dbsnp +
" -B:evalBI,VCF " + validationDataLocation + "VariantEval/ALL.20100201.chr20.bi.sites.vcf" +
" -B:evalBC,VCF " + validationDataLocation + "VariantEval/ALL.20100201.chr20.bc.sites.vcf" +
" -noST -ST Novelty -o %s";
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("144053b8bef5a79b23d0abd17b561294"));
executeTestParallel("testMultipleEvalTracksWithoutGenotypes",spec);
}
// @Test // @Test
// public void testVEValidatePass() { // public void testVEValidatePass() {
// String extraArgs = "-L 1:1-10,000,000"; // String extraArgs = "-L 1:1-10,000,000";