Add checks for weird situations

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2115 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-11-23 02:14:25 +00:00
parent 04d6ac940c
commit 753cb100a3
2 changed files with 8 additions and 0 deletions

View File

@ -93,6 +93,10 @@ public class AlleleBalance implements VariantAnnotation {
int refCount = counts[BaseUtils.simpleBaseToBaseIndex(ref)];
int altCount = counts[BaseUtils.simpleBaseToBaseIndex(altBase)];
// sanity check
if ( refCount + altCount == 0 )
continue;
double[] posteriors = ((PosteriorsBacked)g).getPosteriors();
posteriors = MathUtils.normalizeFromLog10(posteriors);
weights.add(posteriors[bestGenotype.ordinal()]);

View File

@ -97,6 +97,10 @@ public class OnOffGenotype implements VariantAnnotation {
for (int i = 0; i < counts.length; i++)
totalCount += counts[i];
// sanity check
if ( totalCount == 0 )
continue;
double[] posteriors = ((PosteriorsBacked)g).getPosteriors();
posteriors = MathUtils.normalizeFromLog10(posteriors);
weights.add(posteriors[bestGenotype.ordinal()]);