Skip to content

Commit

Permalink
adding fix to deTiN related to very few cites again causing underflow…
Browse files Browse the repository at this point in the history
…s in the zero TiN likelihood model
  • Loading branch information
[email protected] committed Jan 30, 2019
1 parent bd0e6e7 commit 0e0c99d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion deTiN/deTiN.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 0e0c99d

Please sign in to comment.