geney 1.2.47__py2.py3-none-any.whl → 1.2.49__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
geney/survival_utils.py
CHANGED
|
@@ -64,7 +64,7 @@ class SurvivalAnalysis:
|
|
|
64
64
|
df[col].nunique() > 1]] # and df[col].value_counts(normalize=True).min() >= 0.01]]
|
|
65
65
|
return df
|
|
66
66
|
|
|
67
|
-
def kaplan_meier_analysis(self, df, control_label='
|
|
67
|
+
def kaplan_meier_analysis(self, df, control_label='Unaffected Patients', target_label='Affected Patients', feature='group', plot=False, title=None, time_cap=False, savepath=None, figsize=(7, 3), tmb_p_value=None):
|
|
68
68
|
# Can only be performed on features with two unique values
|
|
69
69
|
cap_time = df.groupby(feature).duration.max().min()
|
|
70
70
|
# df['duration'] = df['duration'].clip(upper=cap_time)
|
|
@@ -88,6 +88,7 @@ class SurvivalAnalysis:
|
|
|
88
88
|
auc_vals.append(auc)
|
|
89
89
|
if plot:
|
|
90
90
|
if count == 0:
|
|
91
|
+
fig, ax = plt.subplots(figsize=figsize)
|
|
91
92
|
kmf.plot_survival_function(ax=ax, ci_show=True, color="#2430e0", lw=2)
|
|
92
93
|
else:
|
|
93
94
|
kmf.plot_survival_function(ax=ax, ci_show=True, color="#e60215", lw=2)
|
|
@@ -96,14 +97,19 @@ class SurvivalAnalysis:
|
|
|
96
97
|
p_value = self.log_rank(df[df[feature] == 1], df[df[feature] == 0])
|
|
97
98
|
|
|
98
99
|
if plot:
|
|
99
|
-
ax.text(0.
|
|
100
|
+
ax.text(0.82, 0.6, rf'Survival $p{{v}}$: {p_value:.3e}', transform=ax.transAxes, fontsize=10,
|
|
100
101
|
horizontalalignment='center')
|
|
102
|
+
if tmb_p_value:
|
|
103
|
+
ax.text(0.82, 0.53, rf'TMB $p{{v}}$: {tmb_p_value:.3e}', transform=ax.transAxes, fontsize=10,
|
|
104
|
+
horizontalalignment='center')
|
|
101
105
|
# Grid and spines
|
|
102
106
|
ax.grid(True, which="major", linestyle="--", linewidth=0.5, color="grey", alpha=0.7)
|
|
103
107
|
ax.spines['top'].set_visible(False)
|
|
104
108
|
ax.spines['right'].set_visible(False)
|
|
105
109
|
ax.tick_params(axis="both", which="major", labelsize=10)
|
|
106
|
-
|
|
110
|
+
if title:
|
|
111
|
+
ax.set_title(title, fontsize=12)
|
|
112
|
+
legend = ax.legend(fontsize=9, loc='upper right', frameon=True)
|
|
107
113
|
legend.get_frame().set_facecolor('white') # Set the background color to white
|
|
108
114
|
legend.get_frame().set_edgecolor('black') # Set the edge color to black
|
|
109
115
|
plt.xlabel('Time (years)')
|
|
@@ -111,8 +117,9 @@ class SurvivalAnalysis:
|
|
|
111
117
|
if time_cap:
|
|
112
118
|
plt.xlim([0, cap_time])
|
|
113
119
|
plt.tight_layout()
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
if savepath is not None:
|
|
121
|
+
plt.savefig(savepath, bbox_inches='tight', dpi=300)
|
|
122
|
+
plt.show()
|
|
116
123
|
|
|
117
124
|
results['p_value'] = p_value
|
|
118
125
|
results['auc_target'] = auc_vals[-1]
|
|
@@ -12,7 +12,7 @@ geney/power_utils.py,sha256=MehZFUdkJ2EFUot709yPEDxSkXmH5XevMebX2HD768A,7330
|
|
|
12
12
|
geney/seqmat_utils.py,sha256=YV5DFLbfjXLIswPGvqK1-eEfwn9TUby0b2kewdGAKws,18372
|
|
13
13
|
geney/spliceai_utils.py,sha256=gIGPC8u3J15A7EQrk2Elho5PbF9MmUUNopGGH-eEV8s,1873
|
|
14
14
|
geney/splicing_utils.py,sha256=lGBNknnAdKhcJ3MqPQ5c9oz_NKcL2lcFAr78StjKa6o,16151
|
|
15
|
-
geney/survival_utils.py,sha256=
|
|
15
|
+
geney/survival_utils.py,sha256=5DkV4HuXdFIfbVshRhdCFa59QD6DWAwLjjt98oBfGZ8,6893
|
|
16
16
|
geney/tcga_utils.py,sha256=D_BNHm-D_K408dlcJm3hzH2c6QNFjQsKvUcOPiQRk7g,17612
|
|
17
17
|
geney/tis_utils.py,sha256=vA2ci4gNfwwQZlCjPpO5ehvL2NRVeM7lHI_VyfT-_10,8049
|
|
18
18
|
geney/utils.py,sha256=EsKvBM-Nz2a3_4ZAhF4Dxd4PwT7_6YYKpxEN4LLgg10,2174
|
|
@@ -20,7 +20,7 @@ geney/translation_initiation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
|
20
20
|
geney/translation_initiation/tis_utils.py,sha256=AF3siFjuQH-Rs44EV-80zHdbxRMvN4woLFSHroWIETc,4448
|
|
21
21
|
geney/translation_initiation/resources/kozak_pssm.json,sha256=pcd0Olziutq-6H3mFWDCD9cujQ_AlZO-iiOvBl82hqE,1165
|
|
22
22
|
geney/translation_initiation/resources/tis_regressor_model.joblib,sha256=IXb4DUDhJ5rBDKcqMk9zE3ECTZZcdj7Jixz3KpoZ7OA,2592025
|
|
23
|
-
geney-1.2.
|
|
24
|
-
geney-1.2.
|
|
25
|
-
geney-1.2.
|
|
26
|
-
geney-1.2.
|
|
23
|
+
geney-1.2.49.dist-info/METADATA,sha256=lKeYqaJwqQigXx3rmxyumCqWx7Y2j2H7gq5OsCeUFuM,948
|
|
24
|
+
geney-1.2.49.dist-info/WHEEL,sha256=fS9sRbCBHs7VFcwJLnLXN1MZRR0_TVTxvXKzOnaSFs8,110
|
|
25
|
+
geney-1.2.49.dist-info/top_level.txt,sha256=O-FuNUMb5fn9dhZ-dYCgF0aZtfi1EslMstnzhc5IIVo,6
|
|
26
|
+
geney-1.2.49.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|