Merge branch 'master' of ssh://gsa4.broadinstitute.org/humgen/gsa-scr1/gsa-engineering/git/unstable
This commit is contained in:
commit
db92671b7f
|
|
@ -57,8 +57,6 @@ public class GATKArgumentCollection {
|
|||
public GATKArgumentCollection() {
|
||||
}
|
||||
|
||||
public Map<String, String> walkerArgs = new HashMap<String, String>();
|
||||
|
||||
// parameters and their defaults
|
||||
@Input(fullName = "input_file", shortName = "I", doc = "SAM or BAM file(s)", required = false)
|
||||
public List<String> samFiles = new ArrayList<String>();
|
||||
|
|
|
|||
|
|
@ -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 ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
|
||||
final VariantContext vcInput = UnifiedGenotyperEngine.getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
|
||||
if ( vcInput == null )
|
||||
final VariantContext vcInput = getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
|
||||
if ( vcInput == null ) {
|
||||
models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
|
||||
return models;
|
||||
}
|
||||
|
||||
if ( vcInput.isSNP() ) {
|
||||
// ignore SNPs if the user chose INDEL mode only
|
||||
if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") || UAC.GLmodel.name().toUpperCase().contains("SNP") )
|
||||
models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
|
||||
}
|
||||
}
|
||||
else if ( vcInput.isIndel() || vcInput.isMixed() ) {
|
||||
// ignore INDELs if the user chose SNP mode only
|
||||
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) {
|
||||
if ( tracker == null || ref == null || logger == null )
|
||||
throw new ReviewedStingException("Bad arguments: tracker=" + tracker + " ref=" + ref + " logger=" + logger);
|
||||
return null;
|
||||
VariantContext vc = null;
|
||||
|
||||
// search for usable record
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ public class AlleleCount extends VariantStratifier {
|
|||
AC = Math.max(AC, eval.getCalledChrCount(allele));
|
||||
}
|
||||
|
||||
// make sure that the AC isn't invalid
|
||||
if ( AC > eval.getCalledChrCount() )
|
||||
throw new UserException.MalformedVCF(String.format("The AC or MLEAC value (%d) at position %s:%d is larger than the possible called chromosome count (%d)", AC, eval.getChr(), eval.getStart(), eval.getCalledChrCount()));
|
||||
|
||||
return Collections.singletonList((Object) AC);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
|
|
|
|||
|
|
@ -470,6 +470,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
|
|||
final UnifiedArgumentCollection UAC = new UnifiedArgumentCollection();
|
||||
UAC.GLmodel = GenotypeLikelihoodsCalculationModel.Model.BOTH;
|
||||
UAC.OutputMode = UnifiedGenotyperEngine.OUTPUT_MODE.EMIT_ALL_SITES;
|
||||
UAC.GenotypingMode = GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES;
|
||||
UAC.NO_SLOD = true;
|
||||
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, null, null, samples, VariantContextUtils.DEFAULT_PLOIDY);
|
||||
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);
|
||||
|
||||
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);
|
||||
sub = builder.make();
|
||||
}
|
||||
|
|
@ -730,7 +731,13 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
|
|||
if ( vc.getAlleles().size() != sub.getAlleles().size() )
|
||||
newGC = VariantContextUtils.stripPLs(sub.getGenotypes());
|
||||
|
||||
//Remove a fraction of the genotypes if needed
|
||||
// if we have fewer samples in the selected VC than in the original VC, we need to strip out the MLE tags
|
||||
if ( vc.getNSamples() != sub.getNSamples() ) {
|
||||
builder.rmAttribute(VCFConstants.MLE_ALLELE_COUNT_KEY);
|
||||
builder.rmAttribute(VCFConstants.MLE_ALLELE_FREQUENCY_KEY);
|
||||
}
|
||||
|
||||
// Remove a fraction of the genotypes if needed
|
||||
if ( fractionGenotypes > 0 ){
|
||||
ArrayList<Genotype> genotypes = new ArrayList<Genotype>();
|
||||
for ( Genotype genotype : newGC ) {
|
||||
|
|
@ -767,17 +774,21 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
|
|||
|
||||
VariantContextUtils.calculateChromosomeCounts(builder, false);
|
||||
|
||||
boolean sawDP = false;
|
||||
int depth = 0;
|
||||
for (String sample : originalVC.getSampleNames()) {
|
||||
Genotype g = originalVC.getGenotype(sample);
|
||||
|
||||
if ( ! g.isFiltered() ) {
|
||||
if ( g.hasDP() )
|
||||
if ( g.hasDP() ) {
|
||||
depth += g.getDP();
|
||||
sawDP = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
builder.attribute("DP", depth);
|
||||
if ( sawDP )
|
||||
builder.attribute("DP", depth);
|
||||
}
|
||||
|
||||
private void randomlyAddVariant(int rank, VariantContext vc) {
|
||||
|
|
|
|||
|
|
@ -585,6 +585,21 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
executeTest("testStandardIndelEval", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadACValue() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
buildCommandLine(
|
||||
"-T VariantEval",
|
||||
"-R " + b37KGReference,
|
||||
"-eval " + privateTestDir + "vcfexample.withBadAC.vcf",
|
||||
"-noST -ST AlleleCount",
|
||||
"-noEV -EV VariantSummary"
|
||||
),
|
||||
0,
|
||||
UserException.class);
|
||||
executeTest("testBadACValue", spec);
|
||||
}
|
||||
|
||||
|
||||
@Test()
|
||||
public void testIncompatibleEvalAndStrat() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
|||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString(" -sn A -sn B -sn C --variant " + testfile),
|
||||
1,
|
||||
Arrays.asList("3d98a024bf3aecbd282843e0af89d0e6")
|
||||
Arrays.asList("125d1c9fa111cd38dfa2ff3900f16b57")
|
||||
);
|
||||
|
||||
executeTest("testRepeatedLineSelection--" + testfile, spec);
|
||||
|
|
@ -49,7 +49,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
|||
+ b37hapmapGenotypes + " -disc " + testFile
|
||||
+ " -o %s --no_cmdline_in_header -U LENIENT_VCF_PROCESSING",
|
||||
1,
|
||||
Arrays.asList("54289033d35d32b8ebbb38c51fbb614c")
|
||||
Arrays.asList("c0b937edb6a8b6392d477511d4f1ebcf")
|
||||
);
|
||||
spec.disableShadowBCF();
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
|||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T SelectVariants -R " + b36KGReference + " -sn NA12892 --variant:dbsnp " + testFile + " -o %s --no_cmdline_in_header",
|
||||
1,
|
||||
Arrays.asList("d12ae1617deb38f5ed712dc326935b9a")
|
||||
Arrays.asList("a554459c9ccafb9812ff6d8c06c11726")
|
||||
);
|
||||
|
||||
executeTest("testUsingDbsnpName--" + testFile, spec);
|
||||
|
|
@ -148,12 +148,38 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
|
|||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
||||
1,
|
||||
Arrays.asList("c22ad8864d9951403672a24c20d6c3c2")
|
||||
Arrays.asList("52cb2f150559ca1457e9df7ec153dbb452cb2f150559ca1457e9df7ec153dbb4")
|
||||
);
|
||||
|
||||
executeTest("testRegenotype--" + testFile, spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMLE() {
|
||||
String testFile = privateTestDir + "vcfexample.withMLE.vcf";
|
||||
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T SelectVariants -R " + b36KGReference + " -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
||||
1,
|
||||
Arrays.asList("a554459c9ccafb9812ff6d8c06c11726")
|
||||
);
|
||||
|
||||
executeTest("testRemoveMLE--" + testFile, spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMLEAndRegenotype() {
|
||||
String testFile = privateTestDir + "vcfexample.withMLE.vcf";
|
||||
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
|
||||
1,
|
||||
Arrays.asList("52cb2f150559ca1457e9df7ec153dbb4")
|
||||
);
|
||||
|
||||
executeTest("testRemoveMLEAndRegenotype--" + testFile, spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleRecordsAtOnePosition() {
|
||||
String testFile = privateTestDir + "selectVariants.onePosition.vcf";
|
||||
|
|
|
|||
Loading…
Reference in New Issue