VariantEval now includes -keepAC0 argument to include sites with alt alleles but AC 0 in analyses
-- Updated EvalModules to work with new paramter -- adding test file for keepAC0 to public/testdata and integration tests
This commit is contained in:
parent
15e26fec04
commit
1ccea866d8
|
|
@ -165,6 +165,9 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
@Argument(fullName="requireStrictAlleleMatch", shortName="strict", doc="If provided only comp and eval tracks with exactly matching reference and alternate alleles will be counted as overlapping", required=false)
|
||||
private boolean requireStrictAlleleMatch = false;
|
||||
|
||||
@Argument(fullName="keepAC0", shortName="keepAC0", doc="If provided, modules that track polymorphic sites will not require that a site have AC > 0 when the input eval has genotypes", required=false)
|
||||
private boolean keepSitesWithAC0 = false;
|
||||
|
||||
/**
|
||||
* If true, VariantEval will treat -eval 1 -eval 2 as separate tracks from the same underlying
|
||||
* variant set, and evaluate the union of the results. Useful when you want to do -eval chr1.vcf -eval chr2.vcf etc.
|
||||
|
|
@ -580,4 +583,8 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
public GenomeAnalysisEngine getToolkit() {
|
||||
return super.getToolkit();
|
||||
}
|
||||
|
||||
public boolean ignoreAC0Sites() {
|
||||
return ! keepSitesWithAC0;
|
||||
}
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ public class CountVariants extends VariantEvaluator implements StandardEval {
|
|||
// So in order to maintain consistency with the previous implementation (and the intention of the original author), I've
|
||||
// added in a proxy check for monomorphic status here.
|
||||
// Protect against case when vc only as no-calls too - can happen if we strafity by sample and sample as a single no-call.
|
||||
if ( vc1.isMonomorphicInSamples() ) {
|
||||
if ( getWalker().ignoreAC0Sites() && vc1.isMonomorphicInSamples() ) {
|
||||
nRefLoci++;
|
||||
} else {
|
||||
switch (vc1.getType()) {
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class IndelSummary extends VariantEvaluator implements StandardEval {
|
|||
@Override public int getComparisonOrder() { return 2; }
|
||||
|
||||
public void update2(VariantContext eval, VariantContext comp, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
if ( eval == null || eval.isMonomorphicInSamples() )
|
||||
if ( eval == null || (getWalker().ignoreAC0Sites() && eval.isMonomorphicInSamples()) )
|
||||
return;
|
||||
|
||||
// update counts
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class MultiallelicSummary extends VariantEvaluator implements StandardEva
|
|||
@Override public int getComparisonOrder() { return 2; }
|
||||
|
||||
public void update2(VariantContext eval, VariantContext comp, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
if ( eval == null || eval.isMonomorphicInSamples() )
|
||||
if ( eval == null || (getWalker().ignoreAC0Sites() && eval.isMonomorphicInSamples()) )
|
||||
return;
|
||||
|
||||
// update counts
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ThetaVariantEvaluator extends VariantEvaluator {
|
|||
}
|
||||
|
||||
public void update1(VariantContext vc, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
if (vc == null || !vc.isSNP() || !vc.hasGenotypes() || vc.isMonomorphicInSamples()) {
|
||||
if (vc == null || !vc.isSNP() || (getWalker().ignoreAC0Sites() && vc.isMonomorphicInSamples())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,8 @@ public class VariantSummary extends VariantEvaluator implements StandardEval {
|
|||
}
|
||||
|
||||
public void update2(VariantContext eval, VariantContext comp, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
if ( eval == null || eval.isMonomorphicInSamples() ) return;
|
||||
if ( eval == null || (getWalker().ignoreAC0Sites() && eval.isMonomorphicInSamples()) )
|
||||
return;
|
||||
|
||||
final Type type = getType(eval);
|
||||
|
||||
|
|
|
|||
|
|
@ -506,4 +506,21 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
UserException.class);
|
||||
executeTest("testIncompatibleEvalAndStrat", spec);
|
||||
}
|
||||
|
||||
public void testIncludingAC0(boolean includeAC0, final String md5) {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
buildCommandLine(
|
||||
"-T VariantEval",
|
||||
"-R " + b37KGReference,
|
||||
"-eval " + testDir + "/ac0.vcf",
|
||||
"-L 20:81006 -noST -noEV -EV VariantSummary -o %s" + (includeAC0 ? " -keepAC0" : "")
|
||||
),
|
||||
1,
|
||||
Arrays.asList(md5));
|
||||
executeTest("testIncludingAC0 keep ac 0 = " + includeAC0, spec);
|
||||
}
|
||||
|
||||
@Test public void testWithAC0() { testIncludingAC0(true, "0ed2c8e4b4e06973a06838bc930a132d"); }
|
||||
@Test public void testWithoutAC0() { testIncludingAC0(false, "79d28ddd0ab9584776b6cbefe48331df"); }
|
||||
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue