Fixing behavior of the --regenotype argument in SelectVariants to properly run in GenotypeGivenAlleles mode. Added integration tests to cover recent SV changes.
This commit is contained in:
parent
34b62fa092
commit
8e3774fb0e
|
|
@ -646,15 +646,17 @@ public class UnifiedGenotyperEngine {
|
||||||
|
|
||||||
// if we're genotyping given alleles and we have a requested SNP at this position, do SNP
|
// if we're genotyping given alleles and we have a requested SNP at this position, do SNP
|
||||||
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
|
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
|
||||||
final VariantContext vcInput = UnifiedGenotyperEngine.getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
|
final VariantContext vcInput = getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
|
||||||
if ( vcInput == null )
|
if ( vcInput == null ) {
|
||||||
|
models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
|
||||||
return models;
|
return models;
|
||||||
|
}
|
||||||
|
|
||||||
if ( vcInput.isSNP() ) {
|
if ( vcInput.isSNP() ) {
|
||||||
// ignore SNPs if the user chose INDEL mode only
|
// ignore SNPs if the user chose INDEL mode only
|
||||||
if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") || UAC.GLmodel.name().toUpperCase().contains("SNP") )
|
if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") || UAC.GLmodel.name().toUpperCase().contains("SNP") )
|
||||||
models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
|
models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
|
||||||
}
|
}
|
||||||
else if ( vcInput.isIndel() || vcInput.isMixed() ) {
|
else if ( vcInput.isIndel() || vcInput.isMixed() ) {
|
||||||
// ignore INDELs if the user chose SNP mode only
|
// ignore INDELs if the user chose SNP mode only
|
||||||
if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") || UAC.GLmodel.name().toUpperCase().contains("INDEL") )
|
if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") || UAC.GLmodel.name().toUpperCase().contains("INDEL") )
|
||||||
|
|
@ -759,7 +761,7 @@ public class UnifiedGenotyperEngine {
|
||||||
|
|
||||||
public static VariantContext getVCFromAllelesRod(RefMetaDataTracker tracker, ReferenceContext ref, GenomeLoc loc, boolean requireSNP, Logger logger, final RodBinding<VariantContext> allelesBinding) {
|
public static VariantContext getVCFromAllelesRod(RefMetaDataTracker tracker, ReferenceContext ref, GenomeLoc loc, boolean requireSNP, Logger logger, final RodBinding<VariantContext> allelesBinding) {
|
||||||
if ( tracker == null || ref == null || logger == null )
|
if ( tracker == null || ref == null || logger == null )
|
||||||
throw new ReviewedStingException("Bad arguments: tracker=" + tracker + " ref=" + ref + " logger=" + logger);
|
return null;
|
||||||
VariantContext vc = null;
|
VariantContext vc = null;
|
||||||
|
|
||||||
// search for usable record
|
// search for usable record
|
||||||
|
|
|
||||||
|
|
@ -470,6 +470,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
|
||||||
final UnifiedArgumentCollection UAC = new UnifiedArgumentCollection();
|
final UnifiedArgumentCollection UAC = new UnifiedArgumentCollection();
|
||||||
UAC.GLmodel = GenotypeLikelihoodsCalculationModel.Model.BOTH;
|
UAC.GLmodel = GenotypeLikelihoodsCalculationModel.Model.BOTH;
|
||||||
UAC.OutputMode = UnifiedGenotyperEngine.OUTPUT_MODE.EMIT_ALL_SITES;
|
UAC.OutputMode = UnifiedGenotyperEngine.OUTPUT_MODE.EMIT_ALL_SITES;
|
||||||
|
UAC.GenotypingMode = GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES;
|
||||||
UAC.NO_SLOD = true;
|
UAC.NO_SLOD = true;
|
||||||
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, null, null, samples, VariantContextUtils.DEFAULT_PLOIDY);
|
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, null, null, samples, VariantContextUtils.DEFAULT_PLOIDY);
|
||||||
headerLines.addAll(UnifiedGenotyper.getHeaderInfo(UAC, null, null));
|
headerLines.addAll(UnifiedGenotyper.getHeaderInfo(UAC, null, null));
|
||||||
|
|
@ -567,7 +568,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
|
||||||
VariantContext sub = subsetRecord(vc, EXCLUDE_NON_VARIANTS);
|
VariantContext sub = subsetRecord(vc, EXCLUDE_NON_VARIANTS);
|
||||||
|
|
||||||
if ( REGENOTYPE && sub.isPolymorphicInSamples() && hasPLs(sub) ) {
|
if ( REGENOTYPE && sub.isPolymorphicInSamples() && hasPLs(sub) ) {
|
||||||
final VariantContextBuilder builder = new VariantContextBuilder(UG_engine.calculateGenotypes(tracker, ref, context, sub)).filters(sub.getFiltersMaybeNull());
|
final VariantContextBuilder builder = new VariantContextBuilder(UG_engine.calculateGenotypes(null, ref, context, sub)).filters(sub.getFiltersMaybeNull());
|
||||||
addAnnotations(builder, sub);
|
addAnnotations(builder, sub);
|
||||||
sub = builder.make();
|
sub = builder.make();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
baseTestString(" -sn A -sn B -sn C --variant " + testfile),
|
baseTestString(" -sn A -sn B -sn C --variant " + testfile),
|
||||||
1,
|
1,
|
||||||
Arrays.asList("3d98a024bf3aecbd282843e0af89d0e6")
|
Arrays.asList("125d1c9fa111cd38dfa2ff3900f16b57")
|
||||||
);
|
);
|
||||||
|
|
||||||
executeTest("testRepeatedLineSelection--" + testfile, spec);
|
executeTest("testRepeatedLineSelection--" + testfile, spec);
|
||||||
|
|
@ -49,7 +49,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
||||||
+ b37hapmapGenotypes + " -disc " + testFile
|
+ b37hapmapGenotypes + " -disc " + testFile
|
||||||
+ " -o %s --no_cmdline_in_header -U LENIENT_VCF_PROCESSING",
|
+ " -o %s --no_cmdline_in_header -U LENIENT_VCF_PROCESSING",
|
||||||
1,
|
1,
|
||||||
Arrays.asList("54289033d35d32b8ebbb38c51fbb614c")
|
Arrays.asList("c0b937edb6a8b6392d477511d4f1ebcf")
|
||||||
);
|
);
|
||||||
spec.disableShadowBCF();
|
spec.disableShadowBCF();
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
"-T SelectVariants -R " + b36KGReference + " -sn NA12892 --variant:dbsnp " + testFile + " -o %s --no_cmdline_in_header",
|
"-T SelectVariants -R " + b36KGReference + " -sn NA12892 --variant:dbsnp " + testFile + " -o %s --no_cmdline_in_header",
|
||||||
1,
|
1,
|
||||||
Arrays.asList("d12ae1617deb38f5ed712dc326935b9a")
|
Arrays.asList("a554459c9ccafb9812ff6d8c06c11726")
|
||||||
);
|
);
|
||||||
|
|
||||||
executeTest("testUsingDbsnpName--" + testFile, spec);
|
executeTest("testUsingDbsnpName--" + testFile, spec);
|
||||||
|
|
@ -148,7 +148,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
"-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
"-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
||||||
1,
|
1,
|
||||||
Arrays.asList("c22ad8864d9951403672a24c20d6c3c2")
|
Arrays.asList("52cb2f150559ca1457e9df7ec153dbb452cb2f150559ca1457e9df7ec153dbb4")
|
||||||
);
|
);
|
||||||
|
|
||||||
executeTest("testRegenotype--" + testFile, spec);
|
executeTest("testRegenotype--" + testFile, spec);
|
||||||
|
|
@ -161,10 +161,10 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
"-T SelectVariants -R " + b36KGReference + " -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
"-T SelectVariants -R " + b36KGReference + " -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
||||||
1,
|
1,
|
||||||
Arrays.asList("")
|
Arrays.asList("a554459c9ccafb9812ff6d8c06c11726")
|
||||||
);
|
);
|
||||||
|
|
||||||
executeTest("testRegenotype--" + testFile, spec);
|
executeTest("testRemoveMLE--" + testFile, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -174,10 +174,10 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
"-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
"-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
||||||
1,
|
1,
|
||||||
Arrays.asList("")
|
Arrays.asList("52cb2f150559ca1457e9df7ec153dbb4")
|
||||||
);
|
);
|
||||||
|
|
||||||
executeTest("testRegenotype--" + testFile, spec);
|
executeTest("testRemoveMLEAndRegenotype--" + testFile, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue