{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-11-01T10:52:35.651600Z","iopub.execute_input":"2023-11-01T10:52:35.652738Z","iopub.status.idle":"2023-11-01T10:52:35.658813Z","shell.execute_reply.started":"2023-11-01T10:52:35.652695Z","shell.execute_reply":"2023-11-01T10:52:35.657695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pip install rdkit","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:35.661130Z","iopub.execute_input":"2023-11-01T10:52:35.662293Z","iopub.status.idle":"2023-11-01T10:52:49.477740Z","shell.execute_reply.started":"2023-11-01T10:52:35.662252Z","shell.execute_reply":"2023-11-01T10:52:49.475987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from rdkit import Chem\nfrom rdkit.Chem import Draw","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:49.480321Z","iopub.execute_input":"2023-11-01T10:52:49.481308Z","iopub.status.idle":"2023-11-01T10:52:49.487541Z","shell.execute_reply.started":"2023-11-01T10:52:49.481255Z","shell.execute_reply":"2023-11-01T10:52:49.486305Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"adata_obs = pd.read_csv('/kaggle/input/open-problems-single-cell-perturbations/adata_obs_meta.csv')","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:49.489234Z","iopub.execute_input":"2023-11-01T10:52:49.489729Z","iopub.status.idle":"2023-11-01T10:52:50.401928Z","shell.execute_reply.started":"2023-11-01T10:52:49.489687Z","shell.execute_reply":"2023-11-01T10:52:50.400725Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# SMILES (Simplified Molecular Input Line Entry System)","metadata":{}},{"cell_type":"code","source":"adata_obs['SMILES'][1]","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:50.405209Z","iopub.execute_input":"2023-11-01T10:52:50.405594Z","iopub.status.idle":"2023-11-01T10:52:50.414109Z","shell.execute_reply.started":"2023-11-01T10:52:50.405562Z","shell.execute_reply":"2023-11-01T10:52:50.412459Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Your SMILES string\nsmiles = \"CCCCOc1c(C(=O)c2c(F)cc(C)cc2F)cnc2[nH]ncc12\"\n\n# Convert the SMILES string to an RDKit molecule object\nmol = Chem.MolFromSmiles(smiles)\n\n# Check if the conversion was successful\nif mol is not None:\n    # Generate a 2D depiction of the molecule\n    img = Draw.MolToImage(mol)    \n    # Save the image to a file\n#     img.save(\"molecule.png\")\nelse:\n    print(\"Invalid SMILES string\")\n","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:50.416094Z","iopub.execute_input":"2023-11-01T10:52:50.416595Z","iopub.status.idle":"2023-11-01T10:52:50.437078Z","shell.execute_reply.started":"2023-11-01T10:52:50.416551Z","shell.execute_reply":"2023-11-01T10:52:50.435758Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:50.438906Z","iopub.execute_input":"2023-11-01T10:52:50.440608Z","iopub.status.idle":"2023-11-01T10:52:50.461737Z","shell.execute_reply.started":"2023-11-01T10:52:50.440567Z","shell.execute_reply":"2023-11-01T10:52:50.460285Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Your SMILES string\nsmiles = 'O=C(/C=C/c1cccc(S(=O)(=O)Nc2ccccc2)c1)NO'\n\n# Convert the SMILES string to an RDKit molecule object\nmol = Chem.MolFromSmiles(smiles)\n\n# Check if the conversion was successful\nif mol is not None:\n    # Generate a 2D depiction of the molecule\n    img_1 = Draw.MolToImage(mol)    \n    # Save the image to a file\n    img_1.save(\"molecule.png\")\nelse:\n    print(\"Invalid SMILES string\")","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:50.463136Z","iopub.execute_input":"2023-11-01T10:52:50.463449Z","iopub.status.idle":"2023-11-01T10:52:50.486416Z","shell.execute_reply.started":"2023-11-01T10:52:50.463422Z","shell.execute_reply":"2023-11-01T10:52:50.484957Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_1","metadata":{"execution":{"iopub.status.busy":"2023-11-01T10:52:50.488218Z","iopub.execute_input":"2023-11-01T10:52:50.489174Z","iopub.status.idle":"2023-11-01T10:52:50.504991Z","shell.execute_reply.started":"2023-11-01T10:52:50.489128Z","shell.execute_reply":"2023-11-01T10:52:50.503283Z"},"trusted":true},"execution_count":null,"outputs":[]}]}