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
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Copyright 2024 Divya Karade
|
| 3 |
+
|
| 4 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
you may not use this file except in compliance with the License.
|
| 6 |
+
You may obtain a copy of the License at
|
| 7 |
+
|
| 8 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
|
| 10 |
+
Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
See the License for the specific language governing permissions and
|
| 14 |
+
limitations under the License.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
import matplotlib.pyplot as plt
|
| 18 |
+
import pandas as pd
|
| 19 |
+
import streamlit as st
|
| 20 |
+
from io import BytesIO
|
| 21 |
+
import streamlit.components.v1 as components
|
| 22 |
+
from rdkit import Chem, DataStructs
|
| 23 |
+
from rdkit.Chem import Draw, AllChem, MACCSkeys
|
| 24 |
+
import pubchempy as pcp
|
| 25 |
+
import mols2grid
|
| 26 |
+
import urllib
|
| 27 |
+
|
| 28 |
+
# Page expands to full width
|
| 29 |
+
st.set_page_config(page_title='AIDrugApp', page_icon='🌐', layout="wide")
|
| 30 |
+
|
| 31 |
+
st.title('ChemInsight')
|
| 32 |
+
st.success(
|
| 33 |
+
"ChemInsight is a module of [**AIDrugApp v1.2.6**](https://aidrugapp.streamlit.app/) that facilitates molecule "
|
| 34 |
+
"identification by converting chemical names to SMILES, identifying compound names and their 2D structures from "
|
| 35 |
+
"SMILES strings, and detecting molecular similarities from user data.")
|
| 36 |
+
|
| 37 |
+
expander_bar = st.expander("👉 More information")
|
| 38 |
+
expander_bar.markdown("""
|
| 39 |
+
* **Python libraries:** pubchempy, pandas, rdkit, mols2grid, matplotlib
|
| 40 |
+
* **Publications:** Divya Karade. (2021). Custom ML Module of AIDrugApp for Molecular Identification, Descriptor Calculation, and Building ML/DL QSAR Models. [ChemRxiv Preprint] (https://doi.org/10.33774/chemrxiv-2021-3f1f9).
|
| 41 |
+
""")
|
| 42 |
+
|
| 43 |
+
expander_bar = st.expander("👉 How to use ChemInsight?")
|
| 44 |
+
expander_bar.markdown("""
|
| 45 |
+
**Step 1:** On the "User Input Panel" first select whether you would like to search for a single molecule or upload a batch file for multiple molecules (Example input batch file given)
|
| 46 |
+
""")
|
| 47 |
+
expander_bar.markdown("""
|
| 48 |
+
**Step 2:** Select type of data to identify
|
| 49 |
+
""")
|
| 50 |
+
expander_bar.markdown("""
|
| 51 |
+
**Step 3:** Input molecular names or SMILES as per requirement in single string or batch file
|
| 52 |
+
""")
|
| 53 |
+
expander_bar.markdown("""
|
| 54 |
+
**Step 4:** Click on the "button" and the results will be displayed below to copy or download
|
| 55 |
+
""")
|
| 56 |
+
|
| 57 |
+
# Sidebar
|
| 58 |
+
# Collects user input features into dataframe
|
| 59 |
+
st.sidebar.header('⚙️ USER INPUT PANEL')
|
| 60 |
+
st.sidebar.subheader('1. Type of Input data')
|
| 61 |
+
add_selectbox1 = st.sidebar.radio(
|
| 62 |
+
"How would you like to search?",
|
| 63 |
+
("Single molecule", "Multiple molecules (Batch)"))
|
| 64 |
+
|
| 65 |
+
st.sidebar.subheader('2. Type of retrieving data')
|
| 66 |
+
add_selectbox2 = st.sidebar.radio(
|
| 67 |
+
"What would you like to identify?",
|
| 68 |
+
("Name to SMILE", "SMILE to Compound", "Molecular Similarity", "2-D Structure"))
|
| 69 |
+
|
| 70 |
+
if add_selectbox2 == "Name to SMILE":
|
| 71 |
+
add_selectbox3 = st.sidebar.selectbox("Select type of SMILES to retrieve",
|
| 72 |
+
("Canonical SMILES", "Isomeric SMILES"))
|
| 73 |
+
|
| 74 |
+
if add_selectbox1 == 'Single molecule':
|
| 75 |
+
if add_selectbox2 == "Name to SMILE":
|
| 76 |
+
# Get the feature input from the user
|
| 77 |
+
st.sidebar.subheader('3. Enter compound name')
|
| 78 |
+
# def user_input_features():
|
| 79 |
+
mol_name = st.sidebar.text_input('Enter compound name to retrieve SMILES', 'compound name')
|
| 80 |
+
|
| 81 |
+
# Store a dictionary into a variable
|
| 82 |
+
user_data = {'Name': mol_name}
|
| 83 |
+
|
| 84 |
+
# Transform a data into a dataframe
|
| 85 |
+
user_input = pd.DataFrame(user_data, index=[0])
|
| 86 |
+
df = pd.concat([user_input['Name']], axis=1)
|
| 87 |
+
df.to_csv('molecule.txt', sep='\t', header=False, index=False)
|
| 88 |
+
st.write(df)
|
| 89 |
+
List_of_Chemicals = df['Name'].values
|
| 90 |
+
|
| 91 |
+
if st.sidebar.button("😊 GET SMILES"):
|
| 92 |
+
if add_selectbox3 == "Canonical SMILES":
|
| 93 |
+
# list of chemical names
|
| 94 |
+
for chemical_name in List_of_Chemicals:
|
| 95 |
+
cid = pcp.get_cids(chemical_name)
|
| 96 |
+
prop2 = pcp.get_compounds(chemical_name, 'name')
|
| 97 |
+
for compound in prop2:
|
| 98 |
+
x = compound.canonical_smiles
|
| 99 |
+
x1 = (chemical_name + ' ' + str(x))
|
| 100 |
+
st.subheader('Canonical SMILES')
|
| 101 |
+
st.write(x1)
|
| 102 |
+
|
| 103 |
+
if add_selectbox3 == "Isomeric SMILES":
|
| 104 |
+
# list of chemical names
|
| 105 |
+
for chemical_name in List_of_Chemicals:
|
| 106 |
+
cid = pcp.get_cids(chemical_name)
|
| 107 |
+
prop2 = pcp.get_compounds(chemical_name, 'name')
|
| 108 |
+
for compound in prop2:
|
| 109 |
+
x = compound.isomeric_smiles
|
| 110 |
+
x1 = (chemical_name + ' ' + str(x))
|
| 111 |
+
st.subheader('Isomeric SMILES')
|
| 112 |
+
st.write(x1)
|
| 113 |
+
|
| 114 |
+
if add_selectbox2 == "SMILE to Compound":
|
| 115 |
+
# Get the feature input from the user
|
| 116 |
+
st.sidebar.subheader('3. Enter Canonical SMILES')
|
| 117 |
+
# def user_input_features():
|
| 118 |
+
smiles = st.sidebar.text_input('Enter SMILES to retrieve compound info', 'Canonical SMILES')
|
| 119 |
+
|
| 120 |
+
# Store a dictionary into a variable
|
| 121 |
+
user_data = {'smiles': smiles}
|
| 122 |
+
|
| 123 |
+
# Transform a data into a dataframe
|
| 124 |
+
user_input = pd.DataFrame(user_data, index=[0])
|
| 125 |
+
df = pd.concat([user_input['smiles']], axis=1)
|
| 126 |
+
df.to_csv('molecule.smi', sep='\t', header=False, index=False)
|
| 127 |
+
st.write(df)
|
| 128 |
+
smile = df['smiles'].values
|
| 129 |
+
|
| 130 |
+
if st.sidebar.button("😊 GET COMPOUND"):
|
| 131 |
+
# list of chemical names
|
| 132 |
+
for smiles in smile:
|
| 133 |
+
prop2 = pcp.get_compounds(smiles, 'smiles')
|
| 134 |
+
comp = (smiles + ' ' + str(prop2))
|
| 135 |
+
st.subheader('PubChem Compound ID')
|
| 136 |
+
st.write(comp)
|
| 137 |
+
for compound in prop2:
|
| 138 |
+
df4 = pcp.compounds_to_frame(prop2,
|
| 139 |
+
properties=['synonyms', 'canonical_smiles',
|
| 140 |
+
'molecular_formula',
|
| 141 |
+
'iupac_name', 'inchi', 'inchikey'])
|
| 142 |
+
st.subheader('Compound Info')
|
| 143 |
+
st.write(df4)
|
| 144 |
+
st.download_button('Download CSV', df4.to_csv(), 'Cmpd_info.csv', 'text/csv')
|
| 145 |
+
|
| 146 |
+
if add_selectbox2 == "Molecular Similarity":
|
| 147 |
+
# Get the feature input from the user
|
| 148 |
+
st.sidebar.subheader('3. Enter SMILES to get molecular similarity')
|
| 149 |
+
# def user_input_features():
|
| 150 |
+
smiles1 = st.sidebar.text_input('Enter SMILES1', 'Canonical SMILES1')
|
| 151 |
+
smiles2 = st.sidebar.text_input('Enter SMILES2', 'Canonical SMILES2')
|
| 152 |
+
|
| 153 |
+
# Store a dictionary into a variable
|
| 154 |
+
user_data1 = {'smiles1': smiles1}
|
| 155 |
+
user_data2 = {'smiles2': smiles2}
|
| 156 |
+
|
| 157 |
+
# Transform a data into a dataframe
|
| 158 |
+
user_input1 = pd.DataFrame(user_data1, index=[0])
|
| 159 |
+
user_input2 = pd.DataFrame(user_data2, index=[0])
|
| 160 |
+
df = pd.concat([user_input1['smiles1'], user_input2['smiles2']], axis=1)
|
| 161 |
+
# df2 = pd.concat([df['smiles']], axis=1)
|
| 162 |
+
df.to_csv('molecule.smi', sep='\t', header=False, index=False)
|
| 163 |
+
st.write(df)
|
| 164 |
+
# s1 = df['smiles1'].values
|
| 165 |
+
# s2 = df['smiles2'].values
|
| 166 |
+
|
| 167 |
+
if st.sidebar.button("😊 GET SIMILARITY"):
|
| 168 |
+
# list
|
| 169 |
+
st.subheader('Similarity Scores')
|
| 170 |
+
|
| 171 |
+
mol1 = Chem.MolFromSmiles(smiles1)
|
| 172 |
+
mol2 = Chem.MolFromSmiles(smiles2)
|
| 173 |
+
fp1 = AllChem.GetMorganFingerprintAsBitVect(mol1, 3, nBits=2048)
|
| 174 |
+
fp2 = AllChem.GetMorganFingerprintAsBitVect(mol2, 3, nBits=2048)
|
| 175 |
+
|
| 176 |
+
st.write("Tanimoto :", round(DataStructs.TanimotoSimilarity(fp1, fp2), 4))
|
| 177 |
+
st.write("Dice :", round(DataStructs.DiceSimilarity(fp1, fp2), 4))
|
| 178 |
+
st.write("Cosine :", round(DataStructs.CosineSimilarity(fp1, fp2), 4))
|
| 179 |
+
st.write("Sokal :", round(DataStructs.SokalSimilarity(fp1, fp2), 4))
|
| 180 |
+
st.write("McConnaughey:", round(DataStructs.McConnaugheySimilarity(fp1, fp2), 4))
|
| 181 |
+
|
| 182 |
+
if add_selectbox2 == "2-D Structure":
|
| 183 |
+
# Get the feature input from the user
|
| 184 |
+
st.sidebar.subheader('3. Enter Canonical SMILES')
|
| 185 |
+
# def user_input_features():
|
| 186 |
+
smiles = st.sidebar.text_input('Enter SMILES to get 2-D structure', 'Canonical SMILES')
|
| 187 |
+
|
| 188 |
+
# Store a dictionary into a variable
|
| 189 |
+
user_data = {'smiles': smiles}
|
| 190 |
+
|
| 191 |
+
# Transform a data into a dataframe
|
| 192 |
+
user_input = pd.DataFrame(user_data, index=[0])
|
| 193 |
+
df = pd.concat([user_input['smiles']], axis=1)
|
| 194 |
+
df.to_csv('molecule.smi', sep='\t', header=False, index=False)
|
| 195 |
+
st.write(df)
|
| 196 |
+
smile = df['smiles'].values
|
| 197 |
+
|
| 198 |
+
if st.sidebar.button("😊 GET STRUCTURE"):
|
| 199 |
+
st.subheader('2-D structure')
|
| 200 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 201 |
+
# x = st.image(Draw.MolToImage(mol))
|
| 202 |
+
img = (Draw.MolToImage(mol))
|
| 203 |
+
bio = BytesIO()
|
| 204 |
+
img.save(bio, format='png')
|
| 205 |
+
st.image(img)
|
| 206 |
+
|
| 207 |
+
if add_selectbox1 == 'Multiple molecules (Batch)':
|
| 208 |
+
if add_selectbox2 == "Name to SMILE":
|
| 209 |
+
# Sidebar
|
| 210 |
+
with st.sidebar.subheader('3. Upload your CSV data'):
|
| 211 |
+
uploaded_file = st.sidebar.file_uploader(
|
| 212 |
+
"Upload your input CSV file containing 'Name' as one column of compound names", type=["csv"])
|
| 213 |
+
st.sidebar.markdown("""
|
| 214 |
+
[Example CSV input file](https://github.com/DivyaKarade/Example-.csv-input-files--AIDrugApp-v1.2/blob/main/Mol_identifier.csv)
|
| 215 |
+
""")
|
| 216 |
+
|
| 217 |
+
if uploaded_file is not None:
|
| 218 |
+
# Read CSV data
|
| 219 |
+
@st.cache_data
|
| 220 |
+
def load_csv():
|
| 221 |
+
csv = pd.read_csv(uploaded_file)
|
| 222 |
+
return csv
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
df1 = load_csv()
|
| 226 |
+
df2 = df1.iloc[:, 0:8]
|
| 227 |
+
X = df2
|
| 228 |
+
# Write CSV data
|
| 229 |
+
df2.to_csv('molecule.txt', sep='\t', header=False, index=False)
|
| 230 |
+
st.subheader('Uploaded data')
|
| 231 |
+
st.write(df2)
|
| 232 |
+
List_of_Chemicals = df2['Name'].values
|
| 233 |
+
|
| 234 |
+
if st.sidebar.button("😊 GET SMILES"):
|
| 235 |
+
if add_selectbox3 == "Canonical SMILES":
|
| 236 |
+
st.subheader('Canonical SMILES')
|
| 237 |
+
# list of chemical names
|
| 238 |
+
data = []
|
| 239 |
+
for Name in List_of_Chemicals:
|
| 240 |
+
try:
|
| 241 |
+
df4 = pcp.get_properties(
|
| 242 |
+
['canonical_smiles'], Name, 'name')
|
| 243 |
+
|
| 244 |
+
# st.write(df4)
|
| 245 |
+
data.append(df4)
|
| 246 |
+
except (pcp.BadRequestError, TimeoutError, urllib.error.URLError, ValueError):
|
| 247 |
+
pass
|
| 248 |
+
# st.write(data)
|
| 249 |
+
|
| 250 |
+
rows = []
|
| 251 |
+
columns = data[0][0].keys()
|
| 252 |
+
for i in range(len(data)):
|
| 253 |
+
rows.append(data[i][0].values())
|
| 254 |
+
props_df = pd.DataFrame(data=rows, columns=columns)
|
| 255 |
+
# st.write(props_df)
|
| 256 |
+
props_df.insert(0, 'Name', df2['Name'], True)
|
| 257 |
+
st.write(props_df)
|
| 258 |
+
st.download_button('Download CSV', props_df.to_csv(), 'Can_smile.csv', 'text/csv')
|
| 259 |
+
|
| 260 |
+
if add_selectbox3 == "Isomeric SMILES":
|
| 261 |
+
# list of chemical names
|
| 262 |
+
st.subheader('Isomeric SMILES')
|
| 263 |
+
# list of chemical names
|
| 264 |
+
data = []
|
| 265 |
+
for Name in List_of_Chemicals:
|
| 266 |
+
try:
|
| 267 |
+
df4 = pcp.get_properties(
|
| 268 |
+
['isomeric_smiles'], Name, 'name')
|
| 269 |
+
|
| 270 |
+
# st.write(df4)
|
| 271 |
+
data.append(df4)
|
| 272 |
+
except (pcp.BadRequestError, TimeoutError, urllib.error.URLError, ValueError):
|
| 273 |
+
pass
|
| 274 |
+
# st.write(data)
|
| 275 |
+
|
| 276 |
+
rows = []
|
| 277 |
+
columns = data[0][0].keys()
|
| 278 |
+
for i in range(len(data)):
|
| 279 |
+
rows.append(data[i][0].values())
|
| 280 |
+
props_df = pd.DataFrame(data=rows, columns=columns)
|
| 281 |
+
# st.write(props_df)
|
| 282 |
+
props_df.insert(0, 'Name', df2['Name'], True)
|
| 283 |
+
st.write(props_df)
|
| 284 |
+
st.download_button('Download CSV', props_df.to_csv(), 'isomeric_smile.csv', 'text/csv')
|
| 285 |
+
|
| 286 |
+
if add_selectbox2 == "SMILE to Compound":
|
| 287 |
+
# Sidebar
|
| 288 |
+
with st.sidebar.subheader('3. Upload your CSV data'):
|
| 289 |
+
uploaded_file = st.sidebar.file_uploader(
|
| 290 |
+
"Upload your input CSV file containing 'smile' as one column of molecular SMILES", type=["csv"])
|
| 291 |
+
st.sidebar.markdown("""
|
| 292 |
+
[Example CSV input file](https://github.com/DivyaKarade/Example-.csv-input-files--AIDrugApp-v1.2/blob/main/Mol_identifier.csv)
|
| 293 |
+
""")
|
| 294 |
+
|
| 295 |
+
if uploaded_file is not None:
|
| 296 |
+
# Read CSV data
|
| 297 |
+
@st.cache_data
|
| 298 |
+
def load_csv():
|
| 299 |
+
csv = pd.read_csv(uploaded_file)
|
| 300 |
+
return csv
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
df1 = load_csv()
|
| 304 |
+
df2 = df1.iloc[:, 0:]
|
| 305 |
+
X = df2
|
| 306 |
+
# Write CSV data
|
| 307 |
+
df2.to_csv('molecule.smi', sep='\t', header=False, index=False)
|
| 308 |
+
st.subheader('Uploaded data')
|
| 309 |
+
st.write(df2)
|
| 310 |
+
smile = df2['smiles'].values
|
| 311 |
+
|
| 312 |
+
if st.sidebar.button("😊 GET COMPOUND"):
|
| 313 |
+
|
| 314 |
+
# list of chemical names
|
| 315 |
+
st.subheader('PubChem Compound Information')
|
| 316 |
+
|
| 317 |
+
data = []
|
| 318 |
+
for smiles in smile:
|
| 319 |
+
try:
|
| 320 |
+
df4 = pcp.get_properties(
|
| 321 |
+
['canonical_smiles', 'molecular_formula', 'iupac_name', 'inchi', 'inchikey'],
|
| 322 |
+
smiles,
|
| 323 |
+
'smiles')
|
| 324 |
+
# st.write(df4)
|
| 325 |
+
data.append(df4)
|
| 326 |
+
except (pcp.BadRequestError, TimeoutError, urllib.error.URLError, ValueError):
|
| 327 |
+
pass
|
| 328 |
+
# st.write(data)
|
| 329 |
+
|
| 330 |
+
rows = []
|
| 331 |
+
columns = data[0][0].keys()
|
| 332 |
+
for i in range(len(data)):
|
| 333 |
+
rows.append(data[i][0].values())
|
| 334 |
+
props_df = pd.DataFrame(data=rows, columns=columns)
|
| 335 |
+
# st.write(props_df)
|
| 336 |
+
props_df.insert(0, 'smiles', df2['smiles'], True)
|
| 337 |
+
st.write(props_df)
|
| 338 |
+
st.download_button('Download CSV', props_df.to_csv(), 'Cmpd_info.csv', 'text/csv')
|
| 339 |
+
|
| 340 |
+
if add_selectbox2 == "Molecular Similarity":
|
| 341 |
+
# Sidebar
|
| 342 |
+
with st.sidebar.subheader('3. Upload your CSV data'):
|
| 343 |
+
uploaded_file = st.sidebar.file_uploader(
|
| 344 |
+
"Upload input file containing 'Name' & 'smile' as two columns of compound names and SMILES",
|
| 345 |
+
type=["csv"])
|
| 346 |
+
st.sidebar.markdown("""
|
| 347 |
+
[Example CSV input file](https://github.com/DivyaKarade/Example-.csv-input-files--AIDrugApp-v1.2/blob/main/Mol_identifier.csv)
|
| 348 |
+
""")
|
| 349 |
+
|
| 350 |
+
if uploaded_file is not None:
|
| 351 |
+
# Read CSV data
|
| 352 |
+
@st.cache_data
|
| 353 |
+
def load_csv():
|
| 354 |
+
csv = pd.read_csv(uploaded_file)
|
| 355 |
+
return csv
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
df1 = load_csv()
|
| 359 |
+
df2 = df1.iloc[:, 0:]
|
| 360 |
+
X = df2
|
| 361 |
+
# Write CSV data
|
| 362 |
+
df2.to_csv('molecule.smi', sep='\t', header=False, index=False)
|
| 363 |
+
st.subheader('Uploaded data')
|
| 364 |
+
st.write(df2)
|
| 365 |
+
smile = df2['smiles'].values
|
| 366 |
+
Name = df2['Name'].values
|
| 367 |
+
|
| 368 |
+
if st.sidebar.button("😊 GET SIMILARITY"):
|
| 369 |
+
st.write("****")
|
| 370 |
+
st.subheader('Computation of similarity scores')
|
| 371 |
+
st.info('**Similarity scores between compounds**')
|
| 372 |
+
|
| 373 |
+
mols = [Chem.MolFromSmiles(smiles) for smiles in smile]
|
| 374 |
+
fps = [MACCSkeys.GenMACCSKeys(x) for x in mols]
|
| 375 |
+
st.write("Number of compounds:", len(mols))
|
| 376 |
+
st.write("Number of fingerprints:", len(fps))
|
| 377 |
+
st.write("The number of compound pairs:", (len(fps) * (len(fps) - 1)) / 2)
|
| 378 |
+
|
| 379 |
+
scores = []
|
| 380 |
+
|
| 381 |
+
for i in range(0, len(fps)):
|
| 382 |
+
|
| 383 |
+
if i == 0:
|
| 384 |
+
print("Processing compound ", end='')
|
| 385 |
+
|
| 386 |
+
if i % 100 == 0:
|
| 387 |
+
print(i, end=' ')
|
| 388 |
+
|
| 389 |
+
for j in range(i + 1, len(fps)):
|
| 390 |
+
scores.append(DataStructs.FingerprintSimilarity(fps[i], fps[j]))
|
| 391 |
+
|
| 392 |
+
st.write("Number of scores : ", len(scores))
|
| 393 |
+
st.write("****")
|
| 394 |
+
st.info('**Similarity Scores**')
|
| 395 |
+
st.write("Tanimoto :", round(DataStructs.TanimotoSimilarity(fps[0], fps[1]), 4))
|
| 396 |
+
st.write("Dice :", round(DataStructs.DiceSimilarity(fps[0], fps[1]), 4))
|
| 397 |
+
st.write("Cosine :", round(DataStructs.CosineSimilarity(fps[0], fps[1]), 4))
|
| 398 |
+
st.write("Sokal :", round(DataStructs.SokalSimilarity(fps[0], fps[1]), 4))
|
| 399 |
+
st.write("McConnaughey:", round(DataStructs.McConnaugheySimilarity(fps[0], fps[1]), 4))
|
| 400 |
+
|
| 401 |
+
# Generate a histogram that shows the distribution of the pair-wise scores
|
| 402 |
+
st.write("****")
|
| 403 |
+
st.subheader('Distribution of similarity scores')
|
| 404 |
+
st.info('**Histograms showing the distribution of the pair-wise scores**')
|
| 405 |
+
mybins = [x * 0.01 for x in range(101)]
|
| 406 |
+
|
| 407 |
+
# Create the figure object
|
| 408 |
+
fig = plt.figure(figsize=(8, 4), dpi=300)
|
| 409 |
+
|
| 410 |
+
# First subplot: Distribution
|
| 411 |
+
plt.subplot(1, 2, 1)
|
| 412 |
+
plt.title("Distribution")
|
| 413 |
+
plt.hist(scores, bins=mybins)
|
| 414 |
+
|
| 415 |
+
# Second subplot: Cumulative Distribution
|
| 416 |
+
plt.subplot(1, 2, 2)
|
| 417 |
+
plt.title("Cumulative Distribution")
|
| 418 |
+
plt.hist(scores, bins=mybins, density=True, cumulative=1)
|
| 419 |
+
plt.plot([0, 1], [0.95, 0.95])
|
| 420 |
+
|
| 421 |
+
# Pass the figure to st.pyplot()
|
| 422 |
+
st.pyplot(fig)
|
| 423 |
+
|
| 424 |
+
st.info("**Interpretation of similarity scores**")
|
| 425 |
+
st.write(
|
| 426 |
+
"Average similarity score between two compounds (computed using the Tanimoto equation and MACCS keys) :",
|
| 427 |
+
sum(scores) / len(scores))
|
| 428 |
+
# to find a threshold for top 3% compound pairs (i.e., 97% percentile)
|
| 429 |
+
st.write("Total compound pairs: ", len(scores))
|
| 430 |
+
st.write("95% of compound pairs: ", len(scores) * 0.97)
|
| 431 |
+
st.write("Score at 95% percentile:", scores[round(len(scores) * 0.97)])
|
| 432 |
+
|
| 433 |
+
st.info(
|
| 434 |
+
'**Table showing the % of compound pairs and their similarity scores.** (Table Columns: Similarity score, Number of compound pairs, % of compound pairs)')
|
| 435 |
+
for i in range(21):
|
| 436 |
+
thresh = i / 20
|
| 437 |
+
num_similar_pairs = len([x for x in scores if x >= thresh])
|
| 438 |
+
prob = num_similar_pairs / len(scores) * 100
|
| 439 |
+
st.write("%.3f %8d (%8.4f %%)" % (thresh, num_similar_pairs, round(prob, 4)))
|
| 440 |
+
|
| 441 |
+
st.write("****")
|
| 442 |
+
st.info('**Pair-wise similarity scores among molecules**'
|
| 443 |
+
' (To make higher scores easier to find, they are indicated with the "+" character(s).)')
|
| 444 |
+
for i in range(0, len(fps)):
|
| 445 |
+
for j in range(i + 1, len(fps)):
|
| 446 |
+
|
| 447 |
+
score = DataStructs.FingerprintSimilarity(fps[i], fps[j])
|
| 448 |
+
st.write(Name[i], "vs.", Name[j], ":", round(score, 3), end='')
|
| 449 |
+
|
| 450 |
+
if score >= 0.85:
|
| 451 |
+
st.write(" ++++ ")
|
| 452 |
+
elif score >= 0.75:
|
| 453 |
+
st.write(" +++ ")
|
| 454 |
+
elif score >= 0.65:
|
| 455 |
+
st.write(" ++ ")
|
| 456 |
+
elif score >= 0.55:
|
| 457 |
+
st.write(" + ")
|
| 458 |
+
else:
|
| 459 |
+
st.write(" ")
|
| 460 |
+
|
| 461 |
+
if add_selectbox2 == "2-D Structure":
|
| 462 |
+
# Sidebar
|
| 463 |
+
with st.sidebar.subheader('3. Upload your CSV data'):
|
| 464 |
+
uploaded_file = st.sidebar.file_uploader(
|
| 465 |
+
"Upload your input CSV file containing 'smile' as one column of molecular SMILES", type=["csv"])
|
| 466 |
+
st.sidebar.markdown("""
|
| 467 |
+
[Example CSV input file](https://github.com/DivyaKarade/Example-.csv-input-files--AIDrugApp-v1.2/blob/main/Mol_identifier.csv)
|
| 468 |
+
""")
|
| 469 |
+
|
| 470 |
+
if uploaded_file is not None:
|
| 471 |
+
# Read CSV data
|
| 472 |
+
@st.cache_data
|
| 473 |
+
def load_csv():
|
| 474 |
+
csv = pd.read_csv(uploaded_file)
|
| 475 |
+
return csv
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
df1 = load_csv()
|
| 479 |
+
df2 = df1.iloc[:, 0:]
|
| 480 |
+
X = df2
|
| 481 |
+
# Write CSV data
|
| 482 |
+
df2.to_csv('molecule.smi', sep='\t', header=False, index=False)
|
| 483 |
+
st.subheader('Uploaded data')
|
| 484 |
+
st.write(df2)
|
| 485 |
+
smile = df2['smiles'].values
|
| 486 |
+
|
| 487 |
+
if st.sidebar.button("😊 GET STRUCTURE"):
|
| 488 |
+
st.subheader('2-D structure')
|
| 489 |
+
# raw_html = mols2grid.display(df2, mapping={"smiles": "SMILES"}, subset=["img", "iupac_name"], tooltip=["molecular_formula", "inchikey"])._repr_html_()
|
| 490 |
+
raw_html = mols2grid.display(df2, mapping={"smiles": "SMILES"},
|
| 491 |
+
tooltip=["SMILES"])._repr_html_()
|
| 492 |
+
components.html(raw_html, width=900, height=900, scrolling=True)
|
Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight Python image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
libxrender1 \
|
| 7 |
+
libxext6 \
|
| 8 |
+
libgl1-mesa-glx \
|
| 9 |
+
libglib2.0-0 \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# Set the working directory in the container
|
| 13 |
+
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
# Copy all files from the current directory into the container
|
| 16 |
+
COPY . /app
|
| 17 |
+
|
| 18 |
+
# Install system dependencies from packages.txt
|
| 19 |
+
RUN apt-get update && xargs -a packages.txt apt-get install -y
|
| 20 |
+
|
| 21 |
+
# Install Python dependencies
|
| 22 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
+
|
| 24 |
+
# Expose the port (Streamlit typically uses 8501, but Render will assign a dynamic port)
|
| 25 |
+
EXPOSE 8501
|
| 26 |
+
|
| 27 |
+
# Run the app with Streamlit, using Render's assigned $PORT
|
| 28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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
README.md
CHANGED
|
@@ -1,12 +1 @@
|
|
| 1 |
-
|
| 2 |
-
title: ChemInsight
|
| 3 |
-
emoji: 📊
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: streamlit
|
| 7 |
-
sdk_version: 1.43.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
# ChemInsight
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
libxrender1
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
matplotlib
|
| 2 |
+
pandas
|
| 3 |
+
streamlit
|
| 4 |
+
rdkit
|
| 5 |
+
pubchempy
|
| 6 |
+
mols2grid
|