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:
parent
cf15819db5
commit
cb6454bf98
|
|
@ -83,6 +83,9 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
protected Boolean NO_STANDARD_MODULES = false;
|
||||
|
||||
// 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)
|
||||
protected double MIN_PHASE_QUALITY = 10.0;
|
||||
|
||||
|
|
@ -376,7 +379,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
|
||||
// Load the sample list
|
||||
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")) {
|
||||
sampleNamesForStratification.addAll(sampleNamesForEvaluation);
|
||||
|
|
@ -507,7 +510,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
if ( vc != null ) {
|
||||
VariantContext vcsub = vc;
|
||||
|
||||
if (vc.hasGenotypes(sampleNamesForEvaluation)) {
|
||||
if (vc.hasGenotypes() && vc.hasGenotypes(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
|
||||
if ( trackPerSample ) {
|
||||
if ( vc.hasGenotypes() && trackPerSample ) {
|
||||
for ( String sampleName : sampleNamesForEvaluation ) {
|
||||
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>>();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,8 +123,9 @@ public class SimpleMetricsByAC extends VariantEvaluator implements StandardEval
|
|||
ac = Integer.valueOf(eval.getAttributeAsString("AC"));
|
||||
}
|
||||
|
||||
if ( ac != -1 )
|
||||
if ( ac != -1 ) {
|
||||
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) {
|
||||
if (numSamples == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String interesting = null;
|
||||
|
||||
if (eval != null ) {
|
||||
if (eval != null) {
|
||||
if ( metrics == null ) {
|
||||
int nSamples = numSamples;
|
||||
|
||||
if ( nSamples != -1 )
|
||||
if ( nSamples != -1 ) {
|
||||
metrics = new MetricsByAc(2 * nSamples);
|
||||
}
|
||||
}
|
||||
|
||||
if ( eval.isSNP() &&
|
||||
eval.isBiallelic() &&
|
||||
metrics != null ) {
|
||||
if ( eval.isSNP() && eval.isBiallelic() && metrics != null ) {
|
||||
metrics.incrValue(eval);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class CompRod extends VariantStratifier implements RequiredStratification
|
|||
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>();
|
||||
|
||||
relevantStates.add(compName);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class CpG extends VariantStratifier implements StandardStratification {
|
|||
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;
|
||||
if (ref != null && ref.getBases() != null) {
|
||||
String fwRefBases = new String(ref.getBases());
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class Degeneracy extends VariantStratifier {
|
|||
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>();
|
||||
|
||||
relevantStates.add("all");
|
||||
|
|
|
|||
|
|
@ -17,17 +17,17 @@ public class EvalRod extends VariantStratifier implements RequiredStratification
|
|||
this.evalNames = evalNames;
|
||||
|
||||
states = new ArrayList<String>();
|
||||
states.add("eval");
|
||||
states.addAll(evalNames);
|
||||
}
|
||||
|
||||
public ArrayList<String> getAllStates() {
|
||||
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>();
|
||||
|
||||
relevantStates.add("eval");
|
||||
relevantStates.add(evalName);
|
||||
|
||||
return relevantStates;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class Filter extends VariantStratifier {
|
|||
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>();
|
||||
|
||||
relevantStates.add("raw");
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class FunctionalClass extends VariantStratifier {
|
|||
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>();
|
||||
|
||||
relevantStates.add("all");
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class JexlExpression extends VariantStratifier implements StandardStratif
|
|||
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>();
|
||||
relevantStates.add("none");
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class Novelty extends VariantStratifier implements StandardStratification
|
|||
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>();
|
||||
|
||||
relevantStates.add("all");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class Sample extends VariantStratifier {
|
|||
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>();
|
||||
relevantStates.add(sampleName);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public abstract class VariantStratifier implements Comparable {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
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";
|
||||
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("113228ffa35e0f67b8e067860c04171f"));
|
||||
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("d8d59ec86ec9e00abad4ec44741de22f"));
|
||||
executeTestParallel("testCompVsEvalAC",spec);
|
||||
//executeTest("testCompVsEvalAC",spec);
|
||||
}
|
||||
|
|
@ -158,6 +158,36 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
//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
|
||||
// public void testVEValidatePass() {
|
||||
// String extraArgs = "-L 1:1-10,000,000";
|
||||
|
|
|
|||
Loading…
Reference in New Issue