Set AD and DP to zero if no read coverage

This commit is contained in:
Ron Levine 2017-01-26 08:42:25 -05:00
parent c0bf07cb78
commit 8316fa92f3
6 changed files with 19 additions and 14 deletions

View File

@ -108,10 +108,13 @@ public class DepthPerAlleleBySample extends GenotypeAnnotation implements Standa
if ( g == null || !g.isCalled() || ( stratifiedContext == null && alleleLikelihoodMap == null) ) if ( g == null || !g.isCalled() || ( stratifiedContext == null && alleleLikelihoodMap == null) )
return; return;
if (alleleLikelihoodMap != null && !alleleLikelihoodMap.isEmpty()) if (alleleLikelihoodMap != null && !alleleLikelihoodMap.isEmpty()) {
annotateWithLikelihoods(alleleLikelihoodMap, vc, gb); annotateWithLikelihoods(alleleLikelihoodMap, vc, gb);
else if ( stratifiedContext != null && (vc.isSNP())) } else if ( stratifiedContext != null && (vc.isSNP())) {
annotateWithPileup(stratifiedContext, vc, gb); annotateWithPileup(stratifiedContext, vc, gb);
} else {
gb.AD(new int[vc.getNAlleles()]);
}
} }
private void annotateWithPileup(final AlignmentContext stratifiedContext, final VariantContext vc, final GenotypeBuilder gb) { private void annotateWithPileup(final AlignmentContext stratifiedContext, final VariantContext vc, final GenotypeBuilder gb) {

View File

@ -137,10 +137,10 @@ public class DepthPerSampleHC extends GenotypeAnnotation implements StandardHCAn
dp++; dp++;
} }
} }
}
gb.DP(dp); gb.DP(dp);
} }
}
@Override @Override
public List<String> getKeyNames() { public List<String> getKeyNames() {

View File

@ -146,11 +146,13 @@ public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotati
if ( genotype.hasAD() ) { if ( genotype.hasAD() ) {
final int[] AD = genotype.getAD(); final int[] AD = genotype.getAD();
final int totalADdepth = (int)MathUtils.sum(AD); final int totalADdepth = (int)MathUtils.sum(AD);
if ( totalADdepth != 0 ) {
if (totalADdepth - AD[0] > 1) if (totalADdepth - AD[0] > 1)
ADrestrictedDepth += totalADdepth; ADrestrictedDepth += totalADdepth;
standardDepth += totalADdepth; standardDepth += totalADdepth;
continue; continue;
} }
}
if (stratifiedContexts!= null && !stratifiedContexts.isEmpty()) { if (stratifiedContexts!= null && !stratifiedContexts.isEmpty()) {
final AlignmentContext context = stratifiedContexts.get(genotype.getSampleName()); final AlignmentContext context = stratifiedContexts.get(genotype.getSampleName());

View File

@ -69,17 +69,17 @@ public class UnifiedGenotyperGeneralPloidySuite1IntegrationTest extends WalkerTe
@Test(enabled = true) @Test(enabled = true)
public void testSNP_ACS_Pools() { public void testSNP_ACS_Pools() {
executor.PC_LSV_Test_short("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 6 -out_mode EMIT_ALL_CONFIDENT_SITES", "LSV_SNP_ACS", "SNP", "90ed6f1c268b9c57ecb52b35a88b9368"); executor.PC_LSV_Test_short("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 6 -out_mode EMIT_ALL_CONFIDENT_SITES", "LSV_SNP_ACS", "SNP", "963e128314aceaab06c240850b836b10");
} }
@Test(enabled = true) @Test(enabled = true)
public void testBOTH_GGA_Pools() { public void testBOTH_GGA_Pools() {
executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_BOTH_GGA", "BOTH", "5ad4dd6b0c3c170ba44fdad6d4fa58cf"); executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_BOTH_GGA", "BOTH", "f3bf8b59a04db9fb52dcdea76664606d");
} }
@Test(enabled = true) @Test(enabled = true)
public void testINDEL_GGA_Pools() { public void testINDEL_GGA_Pools() {
executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_INDEL_GGA", "INDEL", "d26b0ba07e056b73fe4cfe873636d0d6"); executor.PC_LSV_Test(String.format("-A AlleleCountBySample -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s", LSV_ALLELES), "LSV_INDEL_GGA", "INDEL", "f8bae1491695d02ccb929205b4458759");
} }
@Test(enabled = true) @Test(enabled = true)

View File

@ -129,12 +129,12 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
@Test @Test
public void testOutputParameterAllConfident() { public void testOutputParameterAllConfident() {
testOutputParameters("--output_mode EMIT_ALL_CONFIDENT_SITES", "182af9490667cb6ce1415305de4f3fdd"); testOutputParameters("--output_mode EMIT_ALL_CONFIDENT_SITES", "96567418000ec94abee98d70199a700a");
} }
@Test @Test
public void testOutputParameterAllSites() { public void testOutputParameterAllSites() {
testOutputParameters("--output_mode EMIT_ALL_SITES", "524e85c225ce330fd094de93f078fa56"); testOutputParameters("--output_mode EMIT_ALL_SITES", "5ccff12b34ace5e882e465047a286c5a");
} }
private void testOutputParameters(final String args, final String md5) { private void testOutputParameters(final String args, final String md5) {

View File

@ -72,7 +72,7 @@ public class HaplotypeCallerComplexAndSymbolicVariantsIntegrationTest extends Wa
@Test @Test
public void testHaplotypeCallerMultiSampleComplex1() { public void testHaplotypeCallerMultiSampleComplex1() {
HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "4f30d9c9f1eb4529071b7060e497235d"); HCTestComplexVariants(privateTestDir + "AFR.complex.variants.bam", "", "590428bdfe466159cb8e1637aaa4f47c");
} }
private void HCTestSymbolicVariants(String bam, String args, String md5) { private void HCTestSymbolicVariants(String bam, String args, String md5) {