Update app.py
Browse files
app.py
CHANGED
|
@@ -18,12 +18,14 @@ feature_columns = model_package['feature_columns']
|
|
| 18 |
aa_list = model_package['aa_list']
|
| 19 |
dipeptides = model_package['dipeptides']
|
| 20 |
hydrophobicity_scale = model_package['hydrophobicity_scale']
|
|
|
|
| 21 |
aa_mass = model_package['aa_mass']
|
| 22 |
aa_charge = model_package['aa_charge']
|
| 23 |
aa_boman = model_package['aa_boman']
|
| 24 |
aa_flexibility = model_package['aa_flexibility']
|
| 25 |
aa_polarizability = model_package['aa_polarizability']
|
| 26 |
aa_aliphatic = model_package['aa_aliphatic']
|
|
|
|
| 27 |
|
| 28 |
# --- Target cells ---
|
| 29 |
TARGET_CELLS = ["Gram+", "Fungus", "Mammalian Cell", "Cancer", "Gram-"]
|
|
@@ -44,7 +46,7 @@ def extract_features_app(seq: str) -> pd.DataFrame:
|
|
| 44 |
dipeptides_seq = [seq[i:i+2] for i in range(len(seq)-1)]
|
| 45 |
|
| 46 |
if len(seq) < 2:
|
| 47 |
-
physchem_features = [0]*
|
| 48 |
else:
|
| 49 |
mw = np.mean([h(dp, aa_mass) for dp in dipeptides_seq])
|
| 50 |
charge = np.mean([h(dp, aa_charge) for dp in dipeptides_seq])
|
|
@@ -52,14 +54,15 @@ def extract_features_app(seq: str) -> pd.DataFrame:
|
|
| 52 |
aromatic = np.mean([(dp[0] in 'FWY') + (dp[1] in 'FWY') for dp in dipeptides_seq]) / 2.0
|
| 53 |
pI = np.mean([h(dp, {aa: 7 + (int(aa in 'KRH') - int(aa in 'DE')) for aa in aa_list}) for dp in dipeptides_seq])
|
| 54 |
instability = np.mean([((dp[0] in 'DEKR') + (dp[1] in 'DEKR')) / 2.0 for dp in dipeptides_seq])
|
| 55 |
-
hydro_moment = np.sqrt(np.mean([(h(dp,
|
| 56 |
aliphatic = np.mean([h(dp, aa_aliphatic) for dp in dipeptides_seq])
|
| 57 |
boman = np.mean([h(dp, aa_boman) for dp in dipeptides_seq])
|
| 58 |
flexibility = np.mean([h(dp, aa_flexibility) for dp in dipeptides_seq])
|
| 59 |
polarizability = np.mean([h(dp, aa_polarizability) for dp in dipeptides_seq])
|
|
|
|
| 60 |
|
| 61 |
physchem_features = [mw, charge, hydro, aromatic, pI, instability,
|
| 62 |
-
hydro_moment, aliphatic, boman, flexibility, polarizability]
|
| 63 |
|
| 64 |
features = dipep_features + physchem_features
|
| 65 |
|
|
|
|
| 18 |
aa_list = model_package['aa_list']
|
| 19 |
dipeptides = model_package['dipeptides']
|
| 20 |
hydrophobicity_scale = model_package['hydrophobicity_scale']
|
| 21 |
+
eisenberg_scale = model_package['eisenberg_scale']
|
| 22 |
aa_mass = model_package['aa_mass']
|
| 23 |
aa_charge = model_package['aa_charge']
|
| 24 |
aa_boman = model_package['aa_boman']
|
| 25 |
aa_flexibility = model_package['aa_flexibility']
|
| 26 |
aa_polarizability = model_package['aa_polarizability']
|
| 27 |
aa_aliphatic = model_package['aa_aliphatic']
|
| 28 |
+
aa_deltaG = model_package['aa_deltaG']
|
| 29 |
|
| 30 |
# --- Target cells ---
|
| 31 |
TARGET_CELLS = ["Gram+", "Fungus", "Mammalian Cell", "Cancer", "Gram-"]
|
|
|
|
| 46 |
dipeptides_seq = [seq[i:i+2] for i in range(len(seq)-1)]
|
| 47 |
|
| 48 |
if len(seq) < 2:
|
| 49 |
+
physchem_features = [0]*12
|
| 50 |
else:
|
| 51 |
mw = np.mean([h(dp, aa_mass) for dp in dipeptides_seq])
|
| 52 |
charge = np.mean([h(dp, aa_charge) for dp in dipeptides_seq])
|
|
|
|
| 54 |
aromatic = np.mean([(dp[0] in 'FWY') + (dp[1] in 'FWY') for dp in dipeptides_seq]) / 2.0
|
| 55 |
pI = np.mean([h(dp, {aa: 7 + (int(aa in 'KRH') - int(aa in 'DE')) for aa in aa_list}) for dp in dipeptides_seq])
|
| 56 |
instability = np.mean([((dp[0] in 'DEKR') + (dp[1] in 'DEKR')) / 2.0 for dp in dipeptides_seq])
|
| 57 |
+
hydro_moment = np.sqrt(np.mean([(h(dp, eisenberg_scale))**2 for dp in dipeptides_seq]))
|
| 58 |
aliphatic = np.mean([h(dp, aa_aliphatic) for dp in dipeptides_seq])
|
| 59 |
boman = np.mean([h(dp, aa_boman) for dp in dipeptides_seq])
|
| 60 |
flexibility = np.mean([h(dp, aa_flexibility) for dp in dipeptides_seq])
|
| 61 |
polarizability = np.mean([h(dp, aa_polarizability) for dp in dipeptides_seq])
|
| 62 |
+
deltag = np.mean([h(dp, aa_deltaG) for dp in dipeptides_seq])
|
| 63 |
|
| 64 |
physchem_features = [mw, charge, hydro, aromatic, pI, instability,
|
| 65 |
+
hydro_moment, aliphatic, boman, flexibility, polarizability, deltag]
|
| 66 |
|
| 67 |
features = dipep_features + physchem_features
|
| 68 |
|