This script reads a list of SMILES (Simplified Molecular Input Line Entry System) strings from a file, converts them into chemical structures using RDKit, and displays the structures as images directly within a Jupyter notebook. Each structure is labeled with its entry number.
Tutorial:
- Generate a csv file, for example, for a specific protein target, you can download a csv file from Chembl database
![image](https://private-user-images.githubusercontent.com/75652473/345650207-3cf5a98c-b25b-46a1-b4b1-16836ccd92c2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2NzAzOTMsIm5iZiI6MTcyNDY3MDA5MywicGF0aCI6Ii83NTY1MjQ3My8zNDU2NTAyMDctM2NmNWE5OGMtYjI1Yi00NmExLWI0YjEtMTY4MzZjY2Q5MmMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI2VDExMDEzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZlY2Q1MzhiNmFiZWFhZmU0YzUxMGFjYjFjZDkzZjUxN2NlMjNlYTVlMzlhY2JlODVmY2IyN2NjMWU3ZGUzNDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.aEU8PDbSS98qv-OZVL5OIHxmZn9n9P38VnpJ-mUf_1U)
-
Open this csv file with your excel or Mac number software, export it to csv again, since the downloaded csv may have some minor format issue not recognised by this code.
-
Upload this new csv file to the code via the Colab budge link, and it is ready to process through the SMILES inside the csv you provided.
-
read the file by modifying the file name
df = pd.read_csv('11.csv') df
-
Change the column number based on where is your SMILES in the csv file, if they are stored at 9th column, it should be
!awk -F "\"*,\"*" '{print $8}' 11.csv > smile.smi
(6. Delete rows that not a SMILES, and export the new smiles string to a new csv file.)
Display the molecules as images inside Jupyter Notebook
![image](https://private-user-images.githubusercontent.com/75652473/345653923-0418e0f8-2291-429a-ab0b-f97c7f3cc056.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2NzAzOTMsIm5iZiI6MTcyNDY3MDA5MywicGF0aCI6Ii83NTY1MjQ3My8zNDU2NTM5MjMtMDQxOGUwZjgtMjI5MS00MjlhLWFiMGItZjk3YzdmM2NjMDU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI2VDExMDEzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVkODI0ZmM1ODQ5ODViY2Q4MGE2NzJiM2M1YzUxMjdiMDg2NzI0NGU1NGI3ZmFmNTE4NzRiYmY1NGExMGQ0YzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mXQ9TDiyD1Uj3CvrZVi568FMFInZIj8eYTJ89CxzkP8)