{"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":"!pip install arnie\n!pip install draw_rna\n!conda config --set auto_update_conda false\n!conda install -c bioconda eternafold --yes\n%env ETERNAFOLD_PATH=/opt/conda/bin/eternafold-bin\n%env ETERNAFOLD_PARAMETERS=/opt/conda/lib/eternafold-lib/parameters/EternaFoldParams.v1","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-23T05:10:15.201075Z","iopub.execute_input":"2023-10-23T05:10:15.201911Z","iopub.status.idle":"2023-10-23T05:13:24.040925Z","shell.execute_reply.started":"2023-10-23T05:10:15.201874Z","shell.execute_reply":"2023-10-23T05:13:24.039739Z"},"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nfrom arnie.mfe import mfe\nfrom arnie.bpps import bpps\nfrom draw_rna.ipynb_draw import draw_struct\n\ndef plot_struct(sequence):\n    structure = mfe(sequence,package=\"eternafold\")\n\n    bp_matrix = bpps(sequence,package=\"eternafold\")\n    p_unp_vec = 1 - np.sum(bp_matrix, axis=0)\n\n    draw_struct(sequence, structure, c = p_unp_vec, cmap = 'viridis')","metadata":{"execution":{"iopub.status.busy":"2023-10-23T05:13:24.043170Z","iopub.execute_input":"2023-10-23T05:13:24.043472Z","iopub.status.idle":"2023-10-23T05:13:24.066780Z","shell.execute_reply.started":"2023-10-23T05:13:24.043443Z","shell.execute_reply":"2023-10-23T05:13:24.065836Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\n\ndf = pd.read_csv('/kaggle/input/stanford-ribonanza-rna-folding/train_data.csv')\nprint(df.shape)\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-23T05:13:24.068036Z","iopub.execute_input":"2023-10-23T05:13:24.068315Z","iopub.status.idle":"2023-10-23T05:15:13.188275Z","shell.execute_reply.started":"2023-10-23T05:13:24.068290Z","shell.execute_reply":"2023-10-23T05:15:13.187187Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sequences = df['sequence'].sample(n = 30, replace = False).tolist()\n\nfor sequence in sequences:\n    plot_struct(sequence)","metadata":{"execution":{"iopub.status.busy":"2023-10-23T05:19:46.387996Z","iopub.execute_input":"2023-10-23T05:19:46.389025Z","iopub.status.idle":"2023-10-23T05:21:19.265507Z","shell.execute_reply.started":"2023-10-23T05:19:46.388955Z","shell.execute_reply":"2023-10-23T05:21:19.264553Z"},"trusted":true},"execution_count":null,"outputs":[]}]}