@@ -53,6 +53,7 @@ def get_concordant_cn_states(self):
5353 states_across_samples = {} # hold union of all copy number states in all samples
5454 for sample in self .sample_list :
5555 if region in sample .cn_states :
56+ # Coerce copy number states to integer states
5657 if 0. <= sample .cn_states [region ].cn_a1 < 1. :
5758 cn_a1 = 0.
5859 elif 1. < sample .cn_states [region ].cn_a1 <= 2. :
@@ -182,7 +183,7 @@ def _get_cluster_ccfs(self):
182183 cluster_ccfs .setdefault (c , np .zeros ((n_samples , 101 )))
183184 cluster_ccfs [c ] += np .log (mut .ccf_dist + 1e-10 )
184185 for c in cluster_ccfs :
185- cluster_ccfs [c ] = np .exp (cluster_ccfs [c ] - logsumexp (cluster_ccfs [c ]))
186+ cluster_ccfs [c ] = np .exp (cluster_ccfs [c ] - logsumexp (cluster_ccfs [c ], axis = 1 , keepdims = True ))
186187 return cluster_ccfs
187188
188189 def time_events (self ):
@@ -375,7 +376,7 @@ def call_wgd(self, use_concordant_states=False):
375376 regions_supporting_WGD .append (cn_state )
376377 if cn_state .cn_a1 >= 2 and cn_state .cn_a2 >= 2 :
377378 regions_both_arms_gained .append (cn_state )
378- if len (regions_both_arms_gained ) >= 5 or len (regions_supporting_WGD ) * 2 >= \
379+ if len (regions_both_arms_gained ) >= 5 and len (regions_supporting_WGD ) * 2 >= \
379380 len (self .arm_regions ) - len (self .missing_arms ):
380381 supporting_arm_states = [TimingCNState ([self ], s .chrN , s .arm , (s .cn_a1 , s .cn_a2 ), s .purity , supporting_muts = s .supporting_muts ) for
381382 s in supporting_arm_states ]
0 commit comments