Merge pull request #240 from broadinstitute/rp_gga_implies_both_models
Bugfix for GGA mode in UG silently ignoring indels
This commit is contained in:
commit
3516daff52
|
|
@ -83,6 +83,9 @@ public class UnifiedGenotyperEngine {
|
||||||
public static final double HUMAN_SNP_HETEROZYGOSITY = 1e-3;
|
public static final double HUMAN_SNP_HETEROZYGOSITY = 1e-3;
|
||||||
public static final double HUMAN_INDEL_HETEROZYGOSITY = 1e-4;
|
public static final double HUMAN_INDEL_HETEROZYGOSITY = 1e-4;
|
||||||
|
|
||||||
|
private static final int SNP_MODEL = 0;
|
||||||
|
private static final int INDEL_MODEL = 1;
|
||||||
|
|
||||||
public enum OUTPUT_MODE {
|
public enum OUTPUT_MODE {
|
||||||
/** produces calls only at variant sites */
|
/** produces calls only at variant sites */
|
||||||
EMIT_VARIANTS_ONLY,
|
EMIT_VARIANTS_ONLY,
|
||||||
|
|
@ -693,13 +696,13 @@ public class UnifiedGenotyperEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void determineGLModelsToUse() {
|
private void determineGLModelsToUse() {
|
||||||
|
|
||||||
String modelPrefix = "";
|
String modelPrefix = "";
|
||||||
if ( !UAC.GLmodel.name().contains(GPSTRING) && UAC.samplePloidy != GATKVariantContextUtils.DEFAULT_PLOIDY )
|
if ( !UAC.GLmodel.name().contains(GPSTRING) && UAC.samplePloidy != GATKVariantContextUtils.DEFAULT_PLOIDY )
|
||||||
modelPrefix = GPSTRING;
|
modelPrefix = GPSTRING;
|
||||||
|
|
||||||
if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") ) {
|
// GGA mode => must initialize both the SNP and indel models
|
||||||
modelPrefix += UAC.GLmodel.name().toUpperCase().replaceAll("BOTH","");
|
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ||
|
||||||
|
UAC.GLmodel.name().toUpperCase().contains("BOTH") ) {
|
||||||
modelsToUse.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
|
modelsToUse.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
|
||||||
modelsToUse.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"INDEL"));
|
modelsToUse.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"INDEL"));
|
||||||
}
|
}
|
||||||
|
|
@ -712,31 +715,24 @@ public class UnifiedGenotyperEngine {
|
||||||
private List<GenotypeLikelihoodsCalculationModel.Model> getGLModelsToUse(final RefMetaDataTracker tracker,
|
private List<GenotypeLikelihoodsCalculationModel.Model> getGLModelsToUse(final RefMetaDataTracker tracker,
|
||||||
final ReferenceContext refContext,
|
final ReferenceContext refContext,
|
||||||
final AlignmentContext rawContext) {
|
final AlignmentContext rawContext) {
|
||||||
|
|
||||||
if ( UAC.GenotypingMode != GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES )
|
if ( UAC.GenotypingMode != GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES )
|
||||||
return modelsToUse;
|
return modelsToUse;
|
||||||
|
|
||||||
|
if ( modelsToUse.size() != 2 )
|
||||||
|
throw new IllegalStateException("GGA mode assumes that we have initialized both the SNP and indel models but found " + modelsToUse);
|
||||||
|
|
||||||
// if we're genotyping given alleles then we need to choose the model corresponding to the variant type requested
|
// if we're genotyping given alleles then we need to choose the model corresponding to the variant type requested
|
||||||
final List<GenotypeLikelihoodsCalculationModel.Model> GGAmodel = new ArrayList<GenotypeLikelihoodsCalculationModel.Model>(1);
|
|
||||||
final VariantContext vcInput = getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
|
final VariantContext vcInput = getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
|
||||||
if ( vcInput == null )
|
|
||||||
return GGAmodel; // no work to be done
|
|
||||||
|
|
||||||
if ( vcInput.isSNP() ) {
|
if ( vcInput == null ) {
|
||||||
// use the SNP model unless the user chose INDEL mode only
|
return Collections.emptyList(); // no work to be done
|
||||||
if ( modelsToUse.size() == 2 || modelsToUse.get(0).name().endsWith("SNP") )
|
} else if ( vcInput.isSNP() ) {
|
||||||
GGAmodel.add(modelsToUse.get(0));
|
return Collections.singletonList(modelsToUse.get(SNP_MODEL));
|
||||||
|
} else if ( vcInput.isIndel() || vcInput.isMixed() ) {
|
||||||
|
return Collections.singletonList(modelsToUse.get(INDEL_MODEL));
|
||||||
|
} else {
|
||||||
|
return Collections.emptyList(); // No support for other types yet
|
||||||
}
|
}
|
||||||
else if ( vcInput.isIndel() || vcInput.isMixed() ) {
|
|
||||||
// use the INDEL model unless the user chose SNP mode only
|
|
||||||
if ( modelsToUse.size() == 2 )
|
|
||||||
GGAmodel.add(modelsToUse.get(1));
|
|
||||||
else if ( modelsToUse.get(0).name().endsWith("INDEL") )
|
|
||||||
GGAmodel.add(modelsToUse.get(0));
|
|
||||||
}
|
|
||||||
// No support for other types yet
|
|
||||||
|
|
||||||
return GGAmodel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class UnifiedGenotyperGeneralPloidySuite1IntegrationTest extends WalkerTe
|
||||||
|
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
public void testINDEL_GGA_Pools() {
|
public void testINDEL_GGA_Pools() {
|
||||||
executor.PC_LSV_Test(String.format(" -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_INDEL_GGA", "INDEL", "3f7d763c654f1d708323f369ea4a099b");
|
executor.PC_LSV_Test(String.format(" -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_INDEL_GGA", "INDEL", "ceb105e3db0f2b993e3d725b0d60b6a3");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue