File size: 1,741 Bytes
7970890 c358248 6c84dbd c358248 6c84dbd c358248 6c84dbd c358248 6c84dbd c358248 6c84dbd c358248 eb2d4ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
## Script to sanitize and split Boldini2024 dataset
#1. Import modules
pip install rdkit
pip install molvs
import pandas as pd
import numpy as np
import urllib.request
import tqdm
import rdkit
from rdkit import Chem
import molvs
standardizer = molvs.Standardizer()
fragment_remover = molvs.fragment.FragmentRemover()
#2. Download the original datasets
# Download the original datasets from the paper
#. Machine Learning Assisted Hit Prioritization for High Throughput Screening in Drug Discovery
#. Davide Boldini, Lukas Friedrich, Daniel Kuhn, and Stephan A. Sieber*
#. https://github.com/dahvida/AIC_Finder/tree/main/Datasets
#3. Import one of the 17 datasets
#. Here we chose GPCR.csv for example
df = pd.read_csv("GPCR.csv")
#4. Sanitize with MolVS and print problems
df['X'] = [ \
rdkit.Chem.MolToSmiles(
fragment_remover.remove(
standardizer.standardize(
rdkit.Chem.MolFromSmiles(
smiles))))
for smiles in df['smiles']]
problems = []
for index, row in tqdm.tqdm(df.iterrows()):
result = molvs.validate_smiles(row['X'])
if len(result) == 0:
continue
problems.append( (row['ID'], result) )
# Most are because it includes the salt form and/or it is not neutralized
for id, alert in problems:
print(f"ID: {id}, problem: {alert[0]}")
# Result interpretation
# - Can't kekulize mol: The error message means that kekulization would break the molecules down, so it couldn't proceed
# It doesn't mean that the molecules are bad, it just means that normalization failed
#5. Select columns and rename the dataset
df.rename(columns={'X': 'SMILES'}, inplace=True)
df[['SMILES', 'Primary', 'Score', 'Confirmatory']].to_csv('GPCR_sanitized.csv', index=False)
|