Spaces:
Runtime error
Runtime error
Upload 10 files
Browse files- Absorption_Lipophilicity_Prediction.py +72 -0
- data/train.csv +0 -0
- data/train_descriptor.csv +0 -0
- model/Absorption_Lipophilicity_Prediction_etr_model.joblib.gz +3 -0
- model/Absorption_Lipophilicity_Prediction_etr_model_optimised.joblib.gz +3 -0
- model/Absorption_Lipophilicity_Prediction_lgbm_model.joblib.gz +3 -0
- model/Absorption_Lipophilicity_Prediction_lgbm_model_optimised.joblib.gz +3 -0
- model/Absorption_Lipophilicity_Prediction_rf_model.joblib.gz +3 -0
- model/Absorption_Lipophilicity_Prediction_rf_model_optimised.joblib.gz +3 -0
- requirements.txt +5 -0
Absorption_Lipophilicity_Prediction.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import joblib
|
3 |
+
from sklearn.ensemble import RandomForestRegressor
|
4 |
+
import gzip
|
5 |
+
from rdkit.Chem import MolFromSmiles, rdMolDescriptors
|
6 |
+
from rdkit.Chem.Descriptors import CalcMolDescriptors
|
7 |
+
import lightgbm as lgb
|
8 |
+
from sklearn.ensemble import ExtraTreesRegressor
|
9 |
+
import streamlit as st
|
10 |
+
|
11 |
+
class Molecule:
|
12 |
+
def __init__(self, smiles: str):
|
13 |
+
if not smiles :
|
14 |
+
print("Empty smiles are given")
|
15 |
+
sys.exit()
|
16 |
+
self.smiles = smiles
|
17 |
+
self.mol = MolFromSmiles(smiles)
|
18 |
+
def descriptor_generator(self):
|
19 |
+
return CalcMolDescriptors(self.mol)
|
20 |
+
|
21 |
+
SMI = st.text_input('Input SMILE', 'O=Cc1ccc(Cl)cc1')
|
22 |
+
st.write('The input SMILE is', str(SMI))
|
23 |
+
mol = MolFromSmiles(SMI)
|
24 |
+
|
25 |
+
formula = rdMolDescriptors.CalcMolFormula(MolFromSmiles(SMI))
|
26 |
+
descriptors = CalcMolDescriptors(mol)
|
27 |
+
descriptors_dataframe = pd.DataFrame([list(descriptors.values())], columns= list(descriptors.keys()))
|
28 |
+
st.markdown(''':rainbow[ABSORPTION]''')
|
29 |
+
|
30 |
+
st.markdown(''':rainbow[Lipophilicity]''')
|
31 |
+
|
32 |
+
st.markdown(''':orange[LGBMRegressor]''')
|
33 |
+
|
34 |
+
|
35 |
+
with gzip.GzipFile('model/Absorption_Lipophilicity_Prediction_lgbm_model.joblib.gz', 'rb') as fa:
|
36 |
+
Absorption_Lipophilicity_Prediction_lgbm_model = joblib.load(fa)
|
37 |
+
|
38 |
+
st.write("Absorption Lipophilicity Result for LGBM Regressor : ", round(Absorption_Lipophilicity_Prediction_lgbm_model.predict(descriptors_dataframe)[0],4))
|
39 |
+
|
40 |
+
|
41 |
+
with gzip.GzipFile('model/Absorption_Lipophilicity_Prediction_etr_model.joblib.gz', 'rb') as fe:
|
42 |
+
Absorption_Lipophilicity_Prediction_etr_model = joblib.load(fe)
|
43 |
+
|
44 |
+
st.markdown(''':orange[ExtraTreesRegressor]''')
|
45 |
+
st.write("Absorption_Lipophilicity Result for ExtraTreesRegressor : ", round(Absorption_Lipophilicity_Prediction_etr_model.predict(descriptors_dataframe)[0],4))
|
46 |
+
|
47 |
+
|
48 |
+
with gzip.GzipFile('model/Absorption_Lipophilicity_Prediction_rf_model.joblib.gz', 'rb') as fi:
|
49 |
+
Absorption_Lipophilicity_Prediction_rf_model = joblib.load(fi)
|
50 |
+
|
51 |
+
|
52 |
+
st.markdown(''':orange[RandomForestRegressor]''')
|
53 |
+
st.write("Absorption_Lipophilicity Result for RandomForestRegressor : ", round(Absorption_Lipophilicity_Prediction_rf_model.predict(descriptors_dataframe)[0],4))
|
54 |
+
|
55 |
+
|
56 |
+
with gzip.GzipFile('model/Absorption_Lipophilicity_Prediction_rf_model_optimised.joblib.gz', 'rb') as fo:
|
57 |
+
Absorption_Lipophilicity_Prediction_rf_model_optimised = joblib.load(fo)
|
58 |
+
|
59 |
+
st.markdown(''':orange[RandomForestRegressor Optimised]''')
|
60 |
+
st.write("Absorption_Lipophilicity Result for Optimised RandomForestRegressor : ", round(Absorption_Lipophilicity_Prediction_rf_model_optimised.predict(descriptors_dataframe)[0],4))
|
61 |
+
|
62 |
+
with gzip.GzipFile('model/Absorption_Lipophilicity_Prediction_etr_model_optimised.joblib.gz', 'rb') as fu:
|
63 |
+
Absorption_Lipophilicity_Prediction_etr_model_optimised = joblib.load(fu)
|
64 |
+
|
65 |
+
st.markdown(''':orange[ExtraTreesRegressor Optimised]''')
|
66 |
+
st.write("Absorption_Lipophilicity Result for Optimised ExtraTreesRegressor : ", round(Absorption_Lipophilicity_Prediction_etr_model_optimised.predict(descriptors_dataframe)[0],4))
|
67 |
+
|
68 |
+
st.markdown(''':orange[LGBMRegressor Optimised]''')
|
69 |
+
with gzip.GzipFile('model/Absorption_Lipophilicity_Prediction_lgbm_model_optimised.joblib.gz', 'rb') as fb:
|
70 |
+
Absorption_Lipophilicity_Prediction_lgbm_model_optimised = joblib.load(fb)
|
71 |
+
|
72 |
+
st.write("Absorption Lipophilicity Result for Optimised LGBM Regressor : ", round(Absorption_Lipophilicity_Prediction_lgbm_model_optimised.predict(descriptors_dataframe)[0],4))
|
data/train.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/train_descriptor.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model/Absorption_Lipophilicity_Prediction_etr_model.joblib.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e46e7216358b1531b5ce56545b47aecf738a9b5133963ca23ef5901e4f81538e
|
3 |
+
size 10857676
|
model/Absorption_Lipophilicity_Prediction_etr_model_optimised.joblib.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:655e711a901c8d25e37df51818d22bf74eebaa59d5aa239f5306888954b30472
|
3 |
+
size 34618685
|
model/Absorption_Lipophilicity_Prediction_lgbm_model.joblib.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d728002c1d117333e1c672a344cd4ddcc3caabbda3420dc429ef3071b53abe6
|
3 |
+
size 28075
|
model/Absorption_Lipophilicity_Prediction_lgbm_model_optimised.joblib.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a3a22ac6be3ed559dc65a91f708931f3180316df575f0ec445ddc6587230dcf
|
3 |
+
size 1099506
|
model/Absorption_Lipophilicity_Prediction_rf_model.joblib.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0592604359e67a70ca440c353485ae95c076cb6812ab8650ed18c8d2c0337024
|
3 |
+
size 64781706
|
model/Absorption_Lipophilicity_Prediction_rf_model_optimised.joblib.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b87ebdbb33aef4e85c069ae7790bc5d11d51a68887369f444f01976e24f7ff3
|
3 |
+
size 5888795
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
scikit-learn==1.3.0
|
2 |
+
joblib
|
3 |
+
rdkit==2023.9.5
|
4 |
+
lightgbm
|
5 |
+
streamlit
|