geney 1.2.46__py2.py3-none-any.whl → 1.2.48__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='CV', target_label='Epistasis', feature='group', plot=False, time_cap=False):
|
|
67
|
+
def kaplan_meier_analysis(self, df, control_label='CV', target_label='Epistasis', feature='group', plot=False, time_cap=False, ax=None, savepath=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,7 +88,7 @@ class SurvivalAnalysis:
|
|
|
88
88
|
auc_vals.append(auc)
|
|
89
89
|
if plot:
|
|
90
90
|
if count == 0:
|
|
91
|
-
|
|
91
|
+
kmf.plot_survival_function(ax=ax, ci_show=True, color="#2430e0", lw=2)
|
|
92
92
|
else:
|
|
93
93
|
kmf.plot_survival_function(ax=ax, ci_show=True, color="#e60215", lw=2)
|
|
94
94
|
count += 1
|
|
@@ -96,21 +96,24 @@ class SurvivalAnalysis:
|
|
|
96
96
|
p_value = self.log_rank(df[df[feature] == 1], df[df[feature] == 0])
|
|
97
97
|
|
|
98
98
|
if plot:
|
|
99
|
-
ax.text(0.
|
|
99
|
+
ax.text(0.75, 0.6, rf'Survival $p{{v}}$: {p_value:.3e}', transform=ax.transAxes, fontsize=10,
|
|
100
100
|
horizontalalignment='center')
|
|
101
101
|
# Grid and spines
|
|
102
102
|
ax.grid(True, which="major", linestyle="--", linewidth=0.5, color="grey", alpha=0.7)
|
|
103
103
|
ax.spines['top'].set_visible(False)
|
|
104
104
|
ax.spines['right'].set_visible(False)
|
|
105
|
-
ax.tick_params(axis="both", which="major", labelsize=
|
|
106
|
-
ax.legend(fontsize=
|
|
105
|
+
ax.tick_params(axis="both", which="major", labelsize=10)
|
|
106
|
+
legend = ax.legend(fontsize=9, loc='upper right', frameon=True)
|
|
107
|
+
legend.get_frame().set_facecolor('white') # Set the background color to white
|
|
108
|
+
legend.get_frame().set_edgecolor('black') # Set the edge color to black
|
|
107
109
|
plt.xlabel('Time (years)')
|
|
108
110
|
plt.ylabel('Survival Probability')
|
|
109
111
|
if time_cap:
|
|
110
112
|
plt.xlim([0, cap_time])
|
|
111
113
|
plt.tight_layout()
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
if savepath is not None:
|
|
115
|
+
plt.savefig(savepath, bbox_inches='tight', dpi=300)
|
|
116
|
+
plt.show()
|
|
114
117
|
|
|
115
118
|
results['p_value'] = p_value
|
|
116
119
|
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=50i5oAZ_-jK9RLC3Bv2Q5IIODAilwpeBkw1fkHpj1bo,6508
|
|
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.48.dist-info/METADATA,sha256=SKD2Rs1epKVxxTHIvT9sMHD-F0MpBznFCKwSSrfiG2Y,948
|
|
24
|
+
geney-1.2.48.dist-info/WHEEL,sha256=fS9sRbCBHs7VFcwJLnLXN1MZRR0_TVTxvXKzOnaSFs8,110
|
|
25
|
+
geney-1.2.48.dist-info/top_level.txt,sha256=O-FuNUMb5fn9dhZ-dYCgF0aZtfi1EslMstnzhc5IIVo,6
|
|
26
|
+
geney-1.2.48.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|