Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,7 @@ def display_dti():
|
|
55 |
if smiles:
|
56 |
mol = Chem.MolFromSmiles(smiles)
|
57 |
mol_img = Chem.Draw.MolToImage(mol)
|
58 |
-
st.image(mol_img
|
59 |
|
60 |
selected_encoder = st.selectbox(
|
61 |
'Select encoder for drug compound',('None', 'CDDD', 'MolBERT')
|
@@ -65,7 +65,6 @@ def display_dti():
|
|
65 |
CDDD_MODEL_DIR = 'checkpoints/CDDD/default_model'
|
66 |
cddd_model = InferenceModel(CDDD_MODEL_DIR)
|
67 |
embedding = cddd_model.seq_to_emb([smiles])
|
68 |
-
st.write(f'CDDD embedding: {embedding}')
|
69 |
elif selected_encoder == 'MolBERT':
|
70 |
from molbert.utils.featurizer.molbert_featurizer import MolBertFeaturizer
|
71 |
MOLBERT_MODEL_DIR = 'checkpoints/MolBert/molbert_100epochs/checkpoints/last.ckpt'
|
@@ -73,13 +72,17 @@ def display_dti():
|
|
73 |
embedding = molbert_model.transform([smiles])
|
74 |
else:
|
75 |
st.write('No pre-trained version of HyperPCM is available for the chosen encoder.')
|
|
|
|
|
|
|
|
|
76 |
|
77 |
with col2:
|
78 |
st.markdown('### Target')
|
79 |
sequence = st.text_input('Enter the amino-acid sequence of the query protein target', value='HXHVWPVQDAKARFSEFLDACITEGPQIVSRRGAEEAVLVPIGEWRRLQAAA', placeholder='HXHVWPVQDAKARFSEFLDACITEGPQIVSRRGAEEAVLVPIGEWRRLQAAA')
|
80 |
|
81 |
if sequence:
|
82 |
-
st.
|
83 |
|
84 |
selected_encoder = st.selectbox(
|
85 |
'Select encoder for protein target',('None', 'SeqVec', 'UniRep', 'ESM-1b', 'ProtT5')
|
@@ -107,9 +110,10 @@ def display_dti():
|
|
107 |
embedding = encoder.reduce_per_protein(embedding)
|
108 |
else:
|
109 |
st.write('No pre-trained version of HyperPCM is available for the chosen encoder.')
|
110 |
-
|
111 |
if embedding is not None:
|
112 |
-
st.write(f'{selected_encoder} embedding
|
|
|
113 |
|
114 |
|
115 |
def display_protein():
|
|
|
55 |
if smiles:
|
56 |
mol = Chem.MolFromSmiles(smiles)
|
57 |
mol_img = Chem.Draw.MolToImage(mol)
|
58 |
+
st.image(mol_img) #, width = 140)
|
59 |
|
60 |
selected_encoder = st.selectbox(
|
61 |
'Select encoder for drug compound',('None', 'CDDD', 'MolBERT')
|
|
|
65 |
CDDD_MODEL_DIR = 'checkpoints/CDDD/default_model'
|
66 |
cddd_model = InferenceModel(CDDD_MODEL_DIR)
|
67 |
embedding = cddd_model.seq_to_emb([smiles])
|
|
|
68 |
elif selected_encoder == 'MolBERT':
|
69 |
from molbert.utils.featurizer.molbert_featurizer import MolBertFeaturizer
|
70 |
MOLBERT_MODEL_DIR = 'checkpoints/MolBert/molbert_100epochs/checkpoints/last.ckpt'
|
|
|
72 |
embedding = molbert_model.transform([smiles])
|
73 |
else:
|
74 |
st.write('No pre-trained version of HyperPCM is available for the chosen encoder.')
|
75 |
+
embedding = None
|
76 |
+
if embedding is not None:
|
77 |
+
st.write(f'{selected_encoder} embedding')
|
78 |
+
st.write(embedding)
|
79 |
|
80 |
with col2:
|
81 |
st.markdown('### Target')
|
82 |
sequence = st.text_input('Enter the amino-acid sequence of the query protein target', value='HXHVWPVQDAKARFSEFLDACITEGPQIVSRRGAEEAVLVPIGEWRRLQAAA', placeholder='HXHVWPVQDAKARFSEFLDACITEGPQIVSRRGAEEAVLVPIGEWRRLQAAA')
|
83 |
|
84 |
if sequence:
|
85 |
+
st.markdown('\n\n\n\n Plot of protein to be added soon. \n\n\n\n')
|
86 |
|
87 |
selected_encoder = st.selectbox(
|
88 |
'Select encoder for protein target',('None', 'SeqVec', 'UniRep', 'ESM-1b', 'ProtT5')
|
|
|
110 |
embedding = encoder.reduce_per_protein(embedding)
|
111 |
else:
|
112 |
st.write('No pre-trained version of HyperPCM is available for the chosen encoder.')
|
113 |
+
embedding = None
|
114 |
if embedding is not None:
|
115 |
+
st.write(f'{selected_encoder} embedding')
|
116 |
+
st.write(embedding)
|
117 |
|
118 |
|
119 |
def display_protein():
|