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:
parent
04d6ac940c
commit
753cb100a3
|
|
@ -93,6 +93,10 @@ public class AlleleBalance implements VariantAnnotation {
|
||||||
int refCount = counts[BaseUtils.simpleBaseToBaseIndex(ref)];
|
int refCount = counts[BaseUtils.simpleBaseToBaseIndex(ref)];
|
||||||
int altCount = counts[BaseUtils.simpleBaseToBaseIndex(altBase)];
|
int altCount = counts[BaseUtils.simpleBaseToBaseIndex(altBase)];
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
if ( refCount + altCount == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
double[] posteriors = ((PosteriorsBacked)g).getPosteriors();
|
double[] posteriors = ((PosteriorsBacked)g).getPosteriors();
|
||||||
posteriors = MathUtils.normalizeFromLog10(posteriors);
|
posteriors = MathUtils.normalizeFromLog10(posteriors);
|
||||||
weights.add(posteriors[bestGenotype.ordinal()]);
|
weights.add(posteriors[bestGenotype.ordinal()]);
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,10 @@ public class OnOffGenotype implements VariantAnnotation {
|
||||||
for (int i = 0; i < counts.length; i++)
|
for (int i = 0; i < counts.length; i++)
|
||||||
totalCount += counts[i];
|
totalCount += counts[i];
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
if ( totalCount == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
double[] posteriors = ((PosteriorsBacked)g).getPosteriors();
|
double[] posteriors = ((PosteriorsBacked)g).getPosteriors();
|
||||||
posteriors = MathUtils.normalizeFromLog10(posteriors);
|
posteriors = MathUtils.normalizeFromLog10(posteriors);
|
||||||
weights.add(posteriors[bestGenotype.ordinal()]);
|
weights.add(posteriors[bestGenotype.ordinal()]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue