Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 63 additions & 60 deletions rgn2_prediction.ipynb
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "3SDCdyj7XneF",
"metadata": {
"id": "3SDCdyj7XneF"
},
"source": [
"# RGN2 Colab\n",
"## Instructions\n",
"1. Paste your protein sequence in the input field.\n",
"2. Run the cells in the Colab individually with the play button on the left or via _Runtime_ > _Run all._\n",
"3. The predicted protein structure will be downloaded after the final \"Refinement\" cell is executed."
],
"metadata": {
"id": "3SDCdyj7XneF"
},
"id": "3SDCdyj7XneF"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "_ds-a3EgRUsb",
"metadata": {
"cellView": "form",
"id": "_ds-a3EgRUsb"
},
"outputs": [],
"source": [
"#@title Download RGN2 and Install Dependencies\n",
"\n",
Expand Down Expand Up @@ -52,7 +60,7 @@
" https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \\\n",
" && bash /tmp/Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \\\n",
" && rm /tmp/Miniconda3-latest-Linux-x86_64.sh\n",
" \n",
"\n",
" PATH=%env PATH\n",
" %env PATH=/opt/conda/bin:{PATH}\n",
"\n",
Expand All @@ -70,12 +78,14 @@
" %shell rm -rf alphafold\n",
" %shell git clone --branch v2.2.4 {AF2_GIT_REPO} alphafold\n",
" %shell {CONDA_INIT} && conda create -y -q --name af2 python=3.7\n",
" %shell {AF2_ENV_INIT} && pip install -r ./alphafold/requirements.txt\n",
" %shell {AF2_ENV_INIT} && pip install ml-collections==0.1.0 numpy==1.21.6 pandas==1.3.4 protobuf==3.20.1 scipy==1.7.0 tensorflow-cpu==2.9.0\n",
" %shell {AF2_ENV_INIT} && pip install --no-dependencies ./alphafold\n",
" %shell {AF2_ENV_INIT} && pip install --upgrade jax==0.3.17 \\\n",
" jaxlib==0.3.15+cuda11.cudnn805 \\\n",
" %shell {AF2_ENV_INIT} && pip install --upgrade jax==0.3.25 \\\n",
" jaxlib==0.3.25+cuda11.cudnn82 \\\n",
" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html\n",
" \n",
" %shell {AF2_ENV_INIT} && pip install biopython==1.81 chex==0.1.5 dm-haiku==0.0.9 dm-tree==0.1.8 docker==6.1.3 immutabledict==2.2.5\n",
" %shell {AF2_ENV_INIT} && pip install --upgrade typing_extensions\n",
"\n",
" %shell mkdir --parents \"{AF2_PARAMS_DIR}\"\n",
" %shell wget -O \"{AF2_PARAMS_PATH}\" \"{AF2_SOURCE_URL}\"\n",
" %shell tar --extract --verbose --file=\"{AF2_PARAMS_PATH}\" \\\n",
Expand All @@ -95,17 +105,17 @@
"except subprocess.CalledProcessError:\n",
" print(captured)\n",
" raise"
],
"metadata": {
"id": "_ds-a3EgRUsb",
"cellView": "form"
},
"id": "_ds-a3EgRUsb",
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7GBilHivRmgP",
"metadata": {
"cellView": "form",
"id": "7GBilHivRmgP"
},
"outputs": [],
"source": [
"#@title Import Python Packages\n",
"\n",
Expand All @@ -127,17 +137,17 @@
"\n",
"sys.path.append('/content/alphafold')\n",
"from ter2pdb import ter2pdb"
],
"metadata": {
"id": "7GBilHivRmgP",
"cellView": "form"
},
"id": "7GBilHivRmgP",
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "_5YeBefARz0D",
"metadata": {
"cellView": "form",
"id": "_5YeBefARz0D"
},
"outputs": [],
"source": [
"#@title ### Enter the amino acid sequence to fold ⬇️\n",
"sequence = 'DEEEIQKAIEELLRKGVSEEEAAIIIVQRFNVAVVVVVQDERQGKHISEYIRRYIPEADVILFANLVVIKVETHELSTRVWEAAQKAY' #@param {type:\"string\"}\n",
Expand Down Expand Up @@ -171,22 +181,15 @@
"REFINE_DIR = 'output/refine_model1'\n",
"SEQ_PATH = os.path.join(DATA_DIR, f'{seq_id}.fa')\n",
"TER_PATH = os.path.join(RUN_DIR, '1', 'outputsTesting', f'{seq_id}.tertiary')"
],
"metadata": {
"id": "_5YeBefARz0D",
"cellView": "form"
},
"id": "_5YeBefARz0D",
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d93c3e44",
"metadata": {
"id": "d93c3e44",
"cellView": "form"
"cellView": "form",
"id": "d93c3e44"
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -227,6 +230,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "IJkrRgF3R63Q",
"metadata": {
"cellView": "form",
"id": "IJkrRgF3R63Q"
},
"outputs": [],
"source": [
"#@title Run RGN2\n",
"#@markdown This step generates the raw RGN2-predicted C-alpha trace.\n",
Expand All @@ -242,17 +252,17 @@
" raise\n",
"\n",
"print('Prediction completed!')"
],
"metadata": {
"id": "IJkrRgF3R63Q",
"cellView": "form"
},
"id": "IJkrRgF3R63Q",
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "I0A_TUORSukb",
"metadata": {
"cellView": "form",
"id": "I0A_TUORSukb"
},
"outputs": [],
"source": [
"#@title Refinement and Structure Download\n",
"#@markdown Once this cell has been executed, a PDB file with the refined\n",
Expand Down Expand Up @@ -283,17 +293,16 @@
"print('Refinement completed!')\n",
"\n",
"files.download(os.path.join(REFINE_DIR, f'{seq_id}{out_suffix}.pdb'))"
],
"metadata": {
"id": "I0A_TUORSukb",
"cellView": "form"
},
"id": "I0A_TUORSukb",
"execution_count": null,
"outputs": []
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"provenance": []
},
"gpuClass": "standard",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
Expand All @@ -310,14 +319,8 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
},
"colab": {
"provenance": [],
"collapsed_sections": []
},
"accelerator": "GPU",
"gpuClass": "standard"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
}