From 0e0c99dc6c10c8b5178d728e0ace5afb04dfc254 Mon Sep 17 00:00:00 2001 From: "amaro@broadinstitute.org" Date: Wed, 30 Jan 2019 11:50:15 -0500 Subject: [PATCH] adding fix to deTiN related to very few cites again causing underflows in the zero TiN likelihood model --- deTiN/deTiN.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deTiN/deTiN.py b/deTiN/deTiN.py index 49d6107..566b549 100644 --- a/deTiN/deTiN.py +++ b/deTiN/deTiN.py @@ -8,7 +8,7 @@ import deTiN_utilities as du import deTiN_SSNV_based_estimate as dssnv import deTiN_aSCNA_based_estimate as dascna - +import numpy.ma as ma class input: """class which holds the required detin somatic data prior to model""" @@ -333,7 +333,13 @@ def calculate_joint_estimate(self): self.TiN = 0 self.p_null = 1 pH1 = self.joint_posterior[self.TiN_int] + #print(self.joint_posterior) + #print(self.p_null) + # code to deal with underflows + if ma.is_masked(self.p_null): + self.p_null = 0 pH0 = self.p_null + p_model = np.true_divide(self.input.TiN_prior * pH1, (self.input.TiN_prior * pH1) + ((1 - self.input.TiN_prior) * pH0)) if p_model < 0.5 or ~np.isfinite(p_model):