{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport plotly.express as px\nimport plotly.graph_objects as go","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-09-13T08:50:15.981884Z","iopub.execute_input":"2023-09-13T08:50:15.982341Z","iopub.status.idle":"2023-09-13T08:50:15.988624Z","shell.execute_reply.started":"2023-09-13T08:50:15.982307Z","shell.execute_reply":"2023-09-13T08:50:15.987456Z"},"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')\nid_map = pd.read_csv('/kaggle/input/open-problems-single-cell-perturbations/id_map.csv')\nmultiome_obs = pd.read_csv('/kaggle/input/open-problems-single-cell-perturbations/multiome_obs_meta.csv')\nmultiome_var = pd.read_csv('/kaggle/input/open-problems-single-cell-perturbations/multiome_var_meta.csv')","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:16.439668Z","iopub.execute_input":"2023-09-13T08:50:16.440083Z","iopub.status.idle":"2023-09-13T08:50:17.750733Z","shell.execute_reply.started":"2023-09-13T08:50:16.440042Z","shell.execute_reply":"2023-09-13T08:50:17.749533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"adata_obs","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:17.752954Z","iopub.execute_input":"2023-09-13T08:50:17.753756Z","iopub.status.idle":"2023-09-13T08:50:17.784755Z","shell.execute_reply.started":"2023-09-13T08:50:17.753709Z","shell.execute_reply":"2023-09-13T08:50:17.783578Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"adata_obs.info()","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:17.786493Z","iopub.execute_input":"2023-09-13T08:50:17.786973Z","iopub.status.idle":"2023-09-13T08:50:17.920776Z","shell.execute_reply.started":"2023-09-13T08:50:17.786931Z","shell.execute_reply":"2023-09-13T08:50:17.919602Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Convert data types to strings\ndata_types_counts = adata_obs.dtypes.astype(str).value_counts()\nfig = go.Figure(data=[go.Pie(labels=data_types_counts.index, values=data_types_counts.values)])\nfig.update_layout(title_text=\"Data Types Distribution\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:18.940978Z","iopub.execute_input":"2023-09-13T08:50:18.941614Z","iopub.status.idle":"2023-09-13T08:50:19.214652Z","shell.execute_reply.started":"2023-09-13T08:50:18.941563Z","shell.execute_reply":"2023-09-13T08:50:19.213386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ax = px.histogram(adata_obs,x=\"control\",marginal=\"box\",title=\"Control\")\nax.update_layout(bargap=0.2)","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:19.217872Z","iopub.execute_input":"2023-09-13T08:50:19.218437Z","iopub.status.idle":"2023-09-13T08:50:20.496778Z","shell.execute_reply.started":"2023-09-13T08:50:19.218403Z","shell.execute_reply":"2023-09-13T08:50:20.495846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('************************************************\\n',adata_obs['sm_name'].value_counts(), '\\n************************************************')\nplt.figure(figsize=(8, 28))\nax = sns.countplot(data=adata_obs, y=\"sm_name\", order=adata_obs['sm_name'].value_counts().index[0:])\nax.bar_label(ax.containers[0])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:20.498089Z","iopub.execute_input":"2023-09-13T08:50:20.498403Z","iopub.status.idle":"2023-09-13T08:50:22.743957Z","shell.execute_reply.started":"2023-09-13T08:50:20.498378Z","shell.execute_reply":"2023-09-13T08:50:22.742873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('************************************************\\n',adata_obs['cell_type'].value_counts(), '\\n************************************************')\nplt.figure(figsize=(9, 5))\nax = sns.countplot(data=adata_obs, y=\"cell_type\", order=adata_obs['cell_type'].value_counts().index[0:])\nax.bar_label(ax.containers[0])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:22.745491Z","iopub.execute_input":"2023-09-13T08:50:22.745868Z","iopub.status.idle":"2023-09-13T08:50:23.269016Z","shell.execute_reply.started":"2023-09-13T08:50:22.745838Z","shell.execute_reply":"2023-09-13T08:50:23.267878Z"},"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'][7]","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:23.272108Z","iopub.execute_input":"2023-09-13T08:50:23.272900Z","iopub.status.idle":"2023-09-13T08:50:23.280258Z","shell.execute_reply.started":"2023-09-13T08:50:23.272854Z","shell.execute_reply":"2023-09-13T08:50:23.278947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pip install rdkit","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:23.281912Z","iopub.execute_input":"2023-09-13T08:50:23.282937Z","iopub.status.idle":"2023-09-13T08:50:35.224937Z","shell.execute_reply.started":"2023-09-13T08:50:23.282899Z","shell.execute_reply":"2023-09-13T08:50:35.223930Z"},"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-09-13T08:50:35.226362Z","iopub.execute_input":"2023-09-13T08:50:35.227297Z","iopub.status.idle":"2023-09-13T08:50:35.233112Z","shell.execute_reply.started":"2023-09-13T08:50:35.227257Z","shell.execute_reply":"2023-09-13T08:50:35.231789Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# pip install eog  # For Ubuntu/Debian","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:35.234640Z","iopub.execute_input":"2023-09-13T08:50:35.235025Z","iopub.status.idle":"2023-09-13T08:50:35.250014Z","shell.execute_reply.started":"2023-09-13T08:50:35.234996Z","shell.execute_reply":"2023-09-13T08:50:35.248658Z"},"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-09-13T08:50:35.251732Z","iopub.execute_input":"2023-09-13T08:50:35.252220Z","iopub.status.idle":"2023-09-13T08:50:35.285003Z","shell.execute_reply.started":"2023-09-13T08:50:35.252177Z","shell.execute_reply":"2023-09-13T08:50:35.283717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:35.286548Z","iopub.execute_input":"2023-09-13T08:50:35.287142Z","iopub.status.idle":"2023-09-13T08:50:35.302130Z","shell.execute_reply.started":"2023-09-13T08:50:35.287109Z","shell.execute_reply":"2023-09-13T08:50:35.300834Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n# 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-09-13T08:50:35.305777Z","iopub.execute_input":"2023-09-13T08:50:35.306171Z","iopub.status.idle":"2023-09-13T08:50:35.329138Z","shell.execute_reply.started":"2023-09-13T08:50:35.306138Z","shell.execute_reply":"2023-09-13T08:50:35.328240Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_1","metadata":{"execution":{"iopub.status.busy":"2023-09-13T08:50:35.330682Z","iopub.execute_input":"2023-09-13T08:50:35.331481Z","iopub.status.idle":"2023-09-13T08:50:35.344653Z","shell.execute_reply.started":"2023-09-13T08:50:35.331439Z","shell.execute_reply":"2023-09-13T08:50:35.343439Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Kernel is Continue...","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"}}