From 64374fa74bdef487f7fcb444193a1f4a04e54d3e Mon Sep 17 00:00:00 2001 From: Aleksei Artemiev <34196081+aalksii@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:29:35 +0300 Subject: [PATCH 1/2] Fix AF requirements --- rgn2_prediction.ipynb | 125 ++++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 60 deletions(-) diff --git a/rgn2_prediction.ipynb b/rgn2_prediction.ipynb index 286ec13..48ed53d 100644 --- a/rgn2_prediction.ipynb +++ b/rgn2_prediction.ipynb @@ -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", @@ -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", @@ -70,12 +78,16 @@ " %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 \\\n", + " 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 \\ \n", + " 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", @@ -95,17 +107,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", @@ -127,17 +139,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", @@ -171,22 +183,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": [ @@ -227,6 +232,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", @@ -242,17 +254,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", @@ -283,17 +295,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", @@ -310,14 +321,8 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" - }, - "colab": { - "provenance": [], - "collapsed_sections": [] - }, - "accelerator": "GPU", - "gpuClass": "standard" + } }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} From 1ca8f969dae81ceadb7a1b742465afd7e9c1fec5 Mon Sep 17 00:00:00 2001 From: Aleksei Artemiev <34196081+aalksii@users.noreply.github.com> Date: Tue, 28 Nov 2023 19:46:34 +0300 Subject: [PATCH 2/2] Fix indents --- rgn2_prediction.ipynb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rgn2_prediction.ipynb b/rgn2_prediction.ipynb index 48ed53d..ddf5b76 100644 --- a/rgn2_prediction.ipynb +++ b/rgn2_prediction.ipynb @@ -78,14 +78,12 @@ " %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 ml-collections==0.1.0 numpy==1.21.6 pandas==1.3.4 \\\n", - " protobuf==3.20.1 scipy==1.7.0 tensorflow-cpu==2.9.0\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.25 \\\n", " jaxlib==0.3.25+cuda11.cudnn82 \\\n", " -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html\n", - " %shell {AF2_ENV_INIT} && pip install biopython==1.81 chex==0.1.5 dm-haiku==0.0.9 \\ \n", - " dm-tree==0.1.8 docker==6.1.3 immutabledict==2.2.5\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",