{"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":"markdown","source":"# Setting up an RNA Science Environment","metadata":{}},{"cell_type":"markdown","source":"The computational biology field has a lot of helpful software packages for interacting with RNA sequences and experimental data. First, let's install `arnie`, a helpful utility library that simplifies interacting with various secondary structure prediction packages.","metadata":{}},{"cell_type":"code","source":"!pip install arnie","metadata":{"execution":{"iopub.status.busy":"2023-09-18T04:38:52.965845Z","iopub.execute_input":"2023-09-18T04:38:52.966392Z","iopub.status.idle":"2023-09-18T04:39:06.534997Z","shell.execute_reply.started":"2023-09-18T04:38:52.966363Z","shell.execute_reply":"2023-09-18T04:39:06.534078Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Arnie needs at least one secondary structure predictor, so let's install `EternaFold`. [Eternafold](https://www.nature.com/articles/s41592-022-01605-0) is a leading prediction package that was trained using sequences collected via the citizen science game [Eterna](http://eternagame.org). In fact, Eterna players provided many of the sequences in the data for this competition. ","metadata":{}},{"cell_type":"code","source":"# Install Eternafold\n!conda config --set auto_update_conda false\n!conda install -c bioconda eternafold --yes","metadata":{"execution":{"iopub.status.busy":"2023-09-18T04:24:47.841930Z","iopub.execute_input":"2023-09-18T04:24:47.842354Z","iopub.status.idle":"2023-09-18T04:27:13.368227Z","shell.execute_reply.started":"2023-09-18T04:24:47.842322Z","shell.execute_reply":"2023-09-18T04:27:13.367124Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Ordinarily, the `EternaFold` conda package will automatically set necessary environment variables, but Kaggle's conda install works a little differently. Let's set them manually here using `%env`.","metadata":{}},{"cell_type":"code","source":"%env ETERNAFOLD_PATH=/opt/conda/bin/eternafold-bin\n%env ETERNAFOLD_PARAMETERS=/opt/conda/lib/eternafold-lib/parameters/EternaFoldParams.v1","metadata":{"execution":{"iopub.status.busy":"2023-09-18T04:38:51.271082Z","iopub.execute_input":"2023-09-18T04:38:51.271443Z","iopub.status.idle":"2023-09-18T04:38:51.278745Z","shell.execute_reply.started":"2023-09-18T04:38:51.271415Z","shell.execute_reply":"2023-09-18T04:38:51.278036Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Now that we have a predictor, we can make structure predictions about a given sequence. For example, let's look at an example Hammerhead ribozyme sequence. We can use arnie's `mfe`, or Minimum Free Energy, function to predict a secondary structure for this RNA sequence. The structure will be represented in \"dot-bracket\" notation, where `.` is an unpaired base and `()` represent two paired bases.","metadata":{}},{"cell_type":"code","source":"from arnie.mfe import mfe\nsequence = \"CGCUGUCUGUACUUGUAUCAGUACACUGACGAGUCCCUAAAGGACGAAACAGCG\"\nstructure = mfe(sequence,package=\"eternafold\")\nprint(structure)","metadata":{"execution":{"iopub.status.busy":"2023-09-18T04:39:13.678580Z","iopub.execute_input":"2023-09-18T04:39:13.678921Z","iopub.status.idle":"2023-09-18T04:39:13.702699Z","shell.execute_reply.started":"2023-09-18T04:39:13.678894Z","shell.execute_reply":"2023-09-18T04:39:13.701740Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Dot bracket notation can be a little hard to read if you're new to RNA structures. Let's visualize the structure in another way. We're going to install `draw_rna`, a Das Lab tool that let's us plot RNA structures in 2D. `draw_rna` provides a `draw_struct` function that ","metadata":{}},{"cell_type":"code","source":"!pip install draw_rna\n\nfrom draw_rna.ipynb_draw import draw_struct\ndraw_struct(sequence, structure)","metadata":{"execution":{"iopub.status.busy":"2023-09-18T04:39:17.318444Z","iopub.execute_input":"2023-09-18T04:39:17.318798Z","iopub.status.idle":"2023-09-18T04:39:31.794777Z","shell.execute_reply.started":"2023-09-18T04:39:17.318771Z","shell.execute_reply":"2023-09-18T04:39:31.793365Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Arnie provides other functions for structure prediction. We can generate a 'Base Pair Probablility' matrix that predicts the probability of every possible base pairing (e.g, how likely is base 1 to pair with base 2, base 3, base 4...). ","metadata":{}},{"cell_type":"code","source":"from arnie.bpps import bpps\nbpps(sequence,package=\"eternafold\")","metadata":{"execution":{"iopub.status.busy":"2023-09-18T04:39:31.796934Z","iopub.execute_input":"2023-09-18T04:39:31.797292Z","iopub.status.idle":"2023-09-18T04:39:31.827933Z","shell.execute_reply.started":"2023-09-18T04:39:31.797262Z","shell.execute_reply":"2023-09-18T04:39:31.827034Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}