Check for division by 0 in annotations

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2539 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-01-07 19:27:15 +00:00
parent 9a658e6b18
commit c7a8dffa89
4 changed files with 8 additions and 5 deletions

View File

@ -24,8 +24,11 @@ public class QualByDepth extends StandardVariantAnnotation {
return null;
//double QbyD = genotypeQualByDepth(ref.getBase(), genotypes, stratifiedContexts);
double QbyD = 10.0 * variation.getNegLog10PError() / (double)variationQualByDepth(ref.getBase(), genotypes, stratifiedContexts);
int qDepth = variationQualByDepth(ref.getBase(), genotypes, stratifiedContexts);
if ( qDepth == 0 )
return null;
double QbyD = 10.0 * variation.getNegLog10PError() / (double)qDepth;
return String.format("%.2f", QbyD);
}

View File

@ -20,7 +20,7 @@ public class SpanningDeletions extends StandardVariantAnnotation {
deletions += pileup.getNumberOfDeletions();
depth += pileup.size();
}
return String.format("%.2f", (double)deletions/(double)depth);
return String.format("%.2f", depth == 0 ? 0.0 : (double)deletions/(double)depth);
}
public String getKeyName() { return "Dels"; }

View File

@ -46,7 +46,7 @@ public class CallsetConcordanceIntegrationTest extends WalkerTest {
public void testComplex() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString() + " -B set1,VCF," + validationDataLocation + "complexExample.vcf -B set2,VCF," + validationDataLocation + "complexExample.vcf -CT NWayVenn", 1,
Arrays.asList("8b72e557c0dd111738eaa69e9003fb3f"));
Arrays.asList("7bc72ec5f8b0fda5d59ebd2526b53e48"));
executeTest("testComplex", spec);
}
}

View File

@ -98,8 +98,8 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
@Test
public void testParameter() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( "-genotype", "2a8b8d4da5ceed494e2210b15c2c3eb0" );
e.put( "-all_bases", "69b20ce7fc18f78011ee02b48a8d69aa" );
e.put( "-genotype", "b3161d019d467d5f9045d2f5d7203006" );
e.put( "-all_bases", "655c7b8ce2f794a055fa49962b5a6a79" );
e.put( "--min_base_quality_score 26", "67175e0262e626d46aaf3bc8680cf888" );
e.put( "--min_mapping_quality_score 26", "8edb24206529a7a344008280ab69cbb2" );
e.put( "--max_mismatches_in_40bp_window 5", "870812ed23b2c656439dc1c8e6376f89" );