Update app.py
Browse files
app.py
CHANGED
|
@@ -114,14 +114,29 @@ def extract_features(seq):
|
|
| 114 |
bend = avg_bendability(seq)
|
| 115 |
freq_a,freq_t,freq_g,freq_c = nucleotide_frequencies(seq)
|
| 116 |
pur_pyr = purine_pyrimidine_ratio(seq)
|
| 117 |
-
return [gc,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
# --- Prediction functions ---
|
| 120 |
def predict_terminator(sequence: str) -> tuple[str, float]:
|
| 121 |
clean_seq = "".join(sequence.split()).upper()
|
| 122 |
X_new_df = pd.DataFrame([extract_features(clean_seq)], columns=[
|
| 123 |
-
"gc_content",
|
| 124 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
])
|
| 126 |
y_pred_proba = ensemble.predict_proba(X_new_df)[0]
|
| 127 |
label = "Terminator" if y_pred_proba>=0.5 else "Non-terminator"
|
|
|
|
| 114 |
bend = avg_bendability(seq)
|
| 115 |
freq_a,freq_t,freq_g,freq_c = nucleotide_frequencies(seq)
|
| 116 |
pur_pyr = purine_pyrimidine_ratio(seq)
|
| 117 |
+
return [gc,
|
| 118 |
+
cpg,
|
| 119 |
+
dg,
|
| 120 |
+
bend,
|
| 121 |
+
freq_a,
|
| 122 |
+
freq_t,
|
| 123 |
+
freq_g,
|
| 124 |
+
freq_c,
|
| 125 |
+
pur_pyr]
|
| 126 |
|
| 127 |
# --- Prediction functions ---
|
| 128 |
def predict_terminator(sequence: str) -> tuple[str, float]:
|
| 129 |
clean_seq = "".join(sequence.split()).upper()
|
| 130 |
X_new_df = pd.DataFrame([extract_features(clean_seq)], columns=[
|
| 131 |
+
"gc_content",
|
| 132 |
+
"cpg_ratio",
|
| 133 |
+
"deltaG",
|
| 134 |
+
"bendability",
|
| 135 |
+
"freq_A",
|
| 136 |
+
"freq_T",
|
| 137 |
+
"freq_G",
|
| 138 |
+
"freq_C",
|
| 139 |
+
"purine_pyrimidine_ratio"
|
| 140 |
])
|
| 141 |
y_pred_proba = ensemble.predict_proba(X_new_df)[0]
|
| 142 |
label = "Terminator" if y_pred_proba>=0.5 else "Non-terminator"
|