Configure ImmuneBuilder pipeline for WES execution
CodeQL / Analyze (python) (push) Has been cancelled

- Update container image to harbor.cluster.omic.ai/omic/immunebuilder:latest
- Update input/output paths to S3 (s3://omic/eureka/immunebuilder/)
- Remove local mount containerOptions (not needed in k8s)
- Update homepage to Gitea repo URL
- Clean history to remove large model weight blobs
This commit is contained in:
olamideomicmd.com committed 2026-03-16 15:31:53 +01:00
commit 8887cbe592
49 files changed
+8741

No files matched your search

+384
View File
@@ -0,0 +1,384 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "G4yBrceuFbf3"
},
"source": [
"\n",
"---\n",
"\n",
"<div align=\"center\"> \n",
" \n",
"# ImmuneBuilder: Deep-Learning models fo predicting the structures of immune proteins \n",
"\n",
"</div>\n",
"\n",
"---\n",
"\n",
"Immune receptor proteins play a key role in the immune system and have shown great promise as biotherapeutics. The structure of these proteins is critical for understanding their antigen binding properties. Here, we present ImmuneBuilder, a set of deep learning models trained to accurately predict the structure of antibodies (ABodyBuilder2), nanobodies (NanoBodyBuilder2) and T-Cell receptors (TCRBuilder2). We show that ImmuneBuilder generates structures with state of the art accuracy while being far faster than AlphaFold2. For example, on a benchmark of 34 recently solved antibodies, ABodyBuilder2 predicts CDR-H3 loops with an RMSD of 2.81Å, a 0.09Å improvement over AlphaFold-Multimer, while being over a hundred times faster. Similar results are also achieved for nanobodies, (NanoBodyBuilder2 predicts CDR-H3 loops with an average RMSD of 2.89Å, a 0.55Å improvement over AlphaFold2) and TCRs. By predicting an ensemble of structures, ImmuneBuilder also gives an error estimate for every residue in its final prediction.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"cellView": "form",
"id": "kOblAo-xetgx"
},
"outputs": [],
"source": [
"#@title Input chain sequence(s), then hit `Runtime` -> `Run all`\n",
"import sys\n",
"python_version = f\"{sys.version_info.major}.{sys.version_info.minor}\"\n",
"\n",
"#@markdown Select what type of immune protein you are modelling\n",
"\n",
"protein_type = \"Antibody\" #@param [\"Antibody\", \"Nanobody\",\"TCR\"]\n",
"\n",
"#@markdown Insert the sequence for the variable domain. If modelling a Nanobody, only use one of the fields\n",
"\n",
"sequence_1 = 'VKLLEQSGAEVKKPGASVKVSCKASGYSFTSYGLHWVRQAPGQRLEWMGWISAGTGNTKYSQKFRGRVTFTRDTSATTAYMGLSSLRPEDTAVYYCARDQAGYTGGKSEFDYWGQGTLVTVSS' #@param {type:\"string\"}\n",
"sequence_2 = 'ELVMTQSPSSLSASVGDRVNIACRASQGISSALAWYQQKPGKAPRLLIYDASNLESGVPSRFSGSGSGTDFTLTISSLQPEDFAIYYCQQFNSYPLTFGGGTKVEIKRTV' #@param {type:\"string\"}\n",
"\n",
"# remove whitespaces\n",
"sequence_1 = \"\".join(sequence_1.split())\n",
"sequence_2 = \"\".join(sequence_2.split())\n",
"\n",
"#@markdown Insert the output file name\n",
"\n",
"filename = 'ImmuneBuilder_model.pdb' #@param {type:\"string\"}\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"cellView": "form",
"id": "iccGdbe_Pmt9",
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"#@title Install dependencies\n",
"%%capture\n",
"%%bash -s $python_version\n",
"\n",
"#@markdown This script will download and install the ImmuneBuilder code, ANARCI and OpenMM\n",
"\n",
"PYTHON_VERSION=$1\n",
"set -e\n",
"\n",
"if [ ! -f CODE_READY ]; then\n",
" # install dependencies\n",
" pip install ImmuneBuilder 2>&1 1>/dev/null\n",
" pip install py3Dmol 2>&1 1>/dev/null\n",
" touch CODE_READY\n",
"fi\n",
"\n",
"# setup conda\n",
"if [ ! -f CONDA_READY ]; then\n",
" wget -qnc https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh\n",
" bash Miniconda3-latest-Linux-x86_64.sh -bfp /usr/local 2>&1 1>/dev/null\n",
" rm Miniconda3-latest-Linux-x86_64.sh\n",
" touch CONDA_READY\n",
"fi\n",
"\n",
"# setup openmm for amber refinement\n",
"if [ ! -f AMBER_READY ]; then\n",
" conda install -y -q -c conda-forge openmm=7.7.0 python=\"${PYTHON_VERSION}\" pdbfixer 2>&1 1>/dev/null\n",
" touch AMBER_READY\n",
"fi\n",
"\n",
"# setup anarci\n",
"if [ ! -f ANARCI_READY ]; then\n",
" conda install -y -q anarci hmmer biopython -c bioconda --no-deps --solver=classic 2>&1 1>/dev/null\n",
" touch ANARCI_READY\n",
"fi"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"cellView": "form",
"id": "LZM_0K0amcrP"
},
"outputs": [],
"source": [
"#@title Download the model weights\n",
"%%capture\n",
"\n",
"#@markdown This will take a few seconds the first time\n",
"\n",
"if f\"/usr/local/lib/python{python_version}/site-packages/\" not in sys.path:\n",
" sys.path.insert(0, f\"/usr/local/lib/python{python_version}/site-packages/\")\n",
"\n",
"from ImmuneBuilder import ABodyBuilder2, NanoBodyBuilder2, TCRBuilder2\n",
"\n",
"if protein_type == \"Antibody\":\n",
" predictor = ABodyBuilder2()\n",
"elif protein_type == \"Nanobody\":\n",
" predictor = NanoBodyBuilder2()\n",
"elif protein_type == \"TCR\":\n",
" predictor = TCRBuilder2()\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"cellView": "form",
"id": "EbRzRvQkVKJs"
},
"outputs": [],
"source": [
"#@title Predict the structure\n",
"\n",
"from anarci import number\n",
"\n",
"# Find which input sequence is which\n",
"_, chain1 = number(sequence_1)\n",
"_, chain2 = number(sequence_2)\n",
"\n",
"input = dict()\n",
"if chain1:\n",
" input[chain1] = sequence_1\n",
"if chain2:\n",
" input[chain2] = sequence_2\n",
"\n",
"try:\n",
" predictor.predict(input).save(filename)\n",
"except KeyError as e:\n",
" print(f\"ERROR: Missing sequence for chain {str(e)}\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 514
},
"id": "uJg31EJjIz7L",
"outputId": "1a176433-4d4e-46ab-a574-35cbf5b8bbd5"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The error is calulated by comparing how much different models agree or disagree on the placement of each residue\n"
]
},
{
"data": {
"application/3dmoljs_load.v0": "<div id=\"3dmolviewer_16674978917758489\" style=\"position: relative; width: 640px; height: 480px\">\n <p id=\"3dmolwarning_16674978917758489\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension: <br>\n <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n </div>\n<script>\n\nvar loadScriptAsync = function(uri){\n return new Promise((resolve, reject) => {\n var tag = document.createElement('script');\n tag.src = uri;\n tag.async = true;\n tag.onload = () => {\n resolve();\n };\n var firstScriptTag = document.getElementsByTagName('script')[0];\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n});\n};\n\nif(typeof $3Dmolpromise === 'undefined') {\n$3Dmolpromise = null;\n $3Dmolpromise = loadScriptAsync('https://cdn.jsdelivr.net/npm/3dmol@latest/build/3Dmol-min.min.js');\n}\n\nvar viewer_16674978917758489 = null;\nvar warn = document.getElementById(\"3dmolwarning_16674978917758489\");\nif(warn) {\n warn.parentNode.removeChild(warn);\n}\n$3Dmolpromise.then(function() {\nviewer_16674978917758489 = $3Dmol.createViewer($(\"#3dmolviewer_16674978917758489\"),{backgroundColor:\"white\"});\nviewer_16674978917758489.zoomTo();\n\tviewer_16674978917758489.addModel(\"REMARK ANTIBODY STRUCTURE MODELLED USING ABODYBUILDER2 \\nREMARK STRUCTURE REFINED USING OPENMM 7.7, 2022-11-03 \\nATOM 1 N VAL H 1 -17.334 1.744 -10.578 1.00 0.44 N \\nATOM 2 H VAL H 1 -18.100 1.110 -10.759 1.00 0.44 H \\nATOM 3 H2 VAL H 1 -17.015 2.150 -11.451 1.00 0.44 H \\nATOM 4 H3 VAL H 1 -17.646 2.503 -9.985 1.00 0.44 H \\nATOM 5 CA VAL H 1 -16.191 1.038 -9.949 1.00 0.44 C \\nATOM 6 HA VAL H 1 -16.494 0.675 -8.967 1.00 0.44 H \\nATOM 7 C VAL H 1 -15.070 2.037 -9.747 1.00 0.44 C \\nATOM 8 CB VAL H 1 -15.743 -0.183 -10.778 1.00 0.44 C \\nATOM 9 HB VAL H 1 -16.601 -0.853 -10.844 1.00 0.44 H \\nATOM 10 O VAL H 1 -14.887 2.864 -10.628 1.00 0.44 O \\nATOM 11 CG1 VAL H 1 -15.307 0.147 -12.211 1.00 0.44 C \\nATOM 12 HG11 VAL H 1 -14.425 0.789 -12.212 1.00 0.44 H \\nATOM 13 HG12 VAL H 1 -15.049 -0.777 -12.733 1.00 0.44 H \\nATOM 14 HG13 VAL H 1 -16.108 0.632 -12.768 1.00 0.44 H \\nATOM 15 CG2 VAL H 1 -14.618 -0.951 -10.079 1.00 0.44 C \\nATOM 16 HG21 VAL H 1 -14.432 -1.888 -10.608 1.00 0.44 H \\nATOM 17 HG22 VAL H 1 -14.896 -1.193 -9.052 1.00 0.44 H \\nATOM 18 HG23 VAL H 1 -13.691 -0.376 -10.079 1.00 0.44 H \\nATOM 19 N LYS H 2 -14.387 2.017 -8.599 1.00 0.32 N \\nATOM 20 H LYS H 2 -14.516 1.249 -7.957 1.00 0.32 H \\nATOM 21 CA LYS H 2 -13.269 2.929 -8.318 1.00 0.32 C \\nATOM 22 HA LYS H 2 -13.548 3.946 -8.602 1.00 0.32 H \\nATOM 23 C LYS H 2 -12.076 2.499 -9.180 1.00 0.32 C \\nATOM 24 CB LYS H 2 -12.906 2.900 -6.813 1.00 0.32 C \\nATOM 25 HB2 LYS H 2 -12.404 1.959 -6.605 1.00 0.32 H \\nATOM 26 HB3 LYS H 2 -12.199 3.705 -6.606 1.00 0.32 H \\nATOM 27 O LYS H 2 -11.785 1.308 -9.230 1.00 0.32 O \\nATOM 28 CG LYS H 2 -14.097 3.008 -5.834 1.00 0.32 C \\nATOM 29 HG2 LYS H 2 -14.782 2.180 -6.024 1.00 0.32 H \\nATOM 30 HG3 LYS H 2 -14.630 3.942 -6.011 1.00 0.32 H \\nATOM 31 CD LYS H 2 -13.672 2.935 -4.352 1.00 0.32 C \\nATOM 32 HD2 LYS H 2 -12.970 2.112 -4.219 1.00 0.32 H \\nATOM 33 HD3 LYS H 2 -13.176 3.865 -4.069 1.00 0.32 H \\nATOM 34 CE LYS H 2 -14.896 2.688 -3.449 1.00 0.32 C \\nATOM 35 HE2 LYS H 2 -15.396 1.781 -3.798 1.00 0.32 H \\nATOM 36 HE3 LYS H 2 -15.592 3.524 -3.556 1.00 0.32 H \\nATOM 37 NZ LYS H 2 -14.531 2.514 -2.020 1.00 0.32 N \\nATOM 38 HZ1 LYS H 2 -14.105 3.342 -1.620 1.00 0.32 H \\nATOM 39 HZ2 LYS H 2 -15.309 2.243 -1.435 1.00 0.32 H \\nATOM 40 HZ3 LYS H 2 -13.804 1.801 -1.889 1.00 0.32 H \\nATOM 41 N LEU H 3 -11.405 3.427 -9.850 1.00 0.35 N \\nATOM 42 H Line truncated
"text/html": [
"<div id=\"3dmolviewer_16674978917758489\" style=\"position: relative; width: 640px; height: 480px\">\n",
" <p id=\"3dmolwarning_16674978917758489\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension: <br>\n",
" <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n",
" </div>\n",
"<script>\n",
"\n",
"var loadScriptAsync = function(uri){\n",
" return new Promise((resolve, reject) => {\n",
" var tag = document.createElement('script');\n",
" tag.src = uri;\n",
" tag.async = true;\n",
" tag.onload = () => {\n",
" resolve();\n",
" };\n",
" var firstScriptTag = document.getElementsByTagName('script')[0];\n",
" firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n",
"});\n",
"};\n",
"\n",
"if(typeof $3Dmolpromise === 'undefined') {\n",
"$3Dmolpromise = null;\n",
" $3Dmolpromise = loadScriptAsync('https://cdn.jsdelivr.net/npm/3dmol@latest/build/3Dmol-min.min.js');\n",
"}\n",
"\n",
"var viewer_16674978917758489 = null;\n",
"var warn = document.getElementById(\"3dmolwarning_16674978917758489\");\n",
"if(warn) {\n",
" warn.parentNode.removeChild(warn);\n",
"}\n",
"$3Dmolpromise.then(function() {\n",
"viewer_16674978917758489 = $3Dmol.createViewer($(\"#3dmolviewer_16674978917758489\"),{backgroundColor:\"white\"});\n",
"viewer_16674978917758489.zoomTo();\n",
"\tviewer_16674978917758489.addModel(\"REMARK ANTIBODY STRUCTURE MODELLED USING ABODYBUILDER2 \\nREMARK STRUCTURE REFINED USING OPENMM 7.7, 2022-11-03 \\nATOM 1 N VAL H 1 -17.334 1.744 -10.578 1.00 0.44 N \\nATOM 2 H VAL H 1 -18.100 1.110 -10.759 1.00 0.44 H \\nATOM 3 H2 VAL H 1 -17.015 2.150 -11.451 1.00 0.44 H \\nATOM 4 H3 VAL H 1 -17.646 2.503 -9.985 1.00 0.44 H \\nATOM 5 CA VAL H 1 -16.191 1.038 -9.949 1.00 0.44 C \\nATOM 6 HA VAL H 1 -16.494 0.675 -8.967 1.00 0.44 H \\nATOM 7 C VAL H 1 -15.070 2.037 -9.747 1.00 0.44 C \\nATOM 8 CB VAL H 1 -15.743 -0.183 -10.778 1.00 0.44 C \\nATOM 9 HB VAL H 1 -16.601 -0.853 -10.844 1.00 0.44 H \\nATOM 10 O VAL H 1 -14.887 2.864 -10.628 1.00 0.44 O \\nATOM 11 CG1 VAL H 1 -15.307 0.147 -12.211 1.00 0.44 C \\nATOM 12 HG11 VAL H 1 -14.425 0.789 -12.212 1.00 0.44 H \\nATOM 13 HG12 VAL H 1 -15.049 -0.777 -12.733 1.00 0.44 H \\nATOM 14 HG13 VAL H 1 -16.108 0.632 -12.768 1.00 0.44 H \\nATOM 15 CG2 VAL H 1 -14.618 -0.951 -10.079 1.00 0.44 C \\nATOM 16 HG21 VAL H 1 -14.432 -1.888 -10.608 1.00 0.44 H \\nATOM 17 HG22 VAL H 1 -14.896 -1.193 -9.052 1.00 0.44 H \\nATOM 18 HG23 VAL H 1 -13.691 -0.376 -10.079 1.00 0.44 H \\nATOM 19 N LYS H 2 -14.387 2.017 -8.599 1.00 0.32 N \\nATOM 20 H LYS H 2 -14.516 1.249 -7.957 1.00 0.32 H \\nATOM 21 CA LYS H 2 -13.269 2.929 -8.318 1.00 0.32 C \\nATOM 22 HA LYS H 2 -13.548 3.946 -8.602 1.00 0.32 H \\nATOM 23 C LYS H 2 -12.076 2.499 -9.180 1.00 0.32 C \\nATOM 24 CB LYS H 2 -12.906 2.900 -6.813 1.00 0.32 C \\nATOM 25 HB2 LYS H 2 -12.404 1.959 -6.605 1.00 0.32 H \\nATOM 26 HB3 LYS H 2 -12.199 3.705 -6.606 1.00 0.32 H \\nATOM 27 O LYS H 2 -11.785 1.308 -9.230 1.00 0.32 O \\nATOM 28 CG LYS H 2 -14.097 3.008 -5.834 1.00 0.32 C \\nATOM 29 HG2 LYS H 2 -14.782 2.180 -6.024 1.00 0.32 H \\nATOM 30 HG3 LYS H 2 -14.630 3.942 -6.011 1.00 0.32 H \\nATOM 31 CD LYS H 2 -13.672 2.935 -4.352 1.00 0.32 C \\nATOM 32 HD2 LYS H 2 -12.970 2.112 -4.219 1.00 0.32 H \\nATOM 33 HD3 LYS H 2 -13.176 3.865 -4.069 1.00 0.32 H \\nATOM 34 CE LYS H 2 -14.896 2.688 -3.449 1.00 0.32 C \\nATOM 35 HE2 LYS H 2 -15.396 1.781 -3.798 1.00 0.32 H \\nATOM 36 HE3 LYS H 2 -15.592 3.524 -3.556 1.00 0.32 H \\nATOM 37 NZ LYS H 2 -14.531 2.514 -2.020 1.00 0.32 N \\nATOM 38 HZ1 LYS H 2 -14.105 3.342 -1.620 1.00 0.32 H \\nATOM 39 HZ2 LYS H 2 -15.309 2.243 -1.435 1.00 0.32 H \\nATOM 40 HZ3 LYS H 2 -13.804 1.801 -1.889 1.00 0.32 H \\nATOM 41 N LEU H 3 -11.405 3.427 -9.850 1.00 0.35 N \\nATOM 42 H LEU H 3 -11.740 4.384 -9.830 1.00 0.35 H \\nATOM 43 CA LEU H 3 -10.186 3.150 -10.617 1.00 0.35 C \\nATOM 44 HA LEU H 3 -9.732 2.226 -10.256 1.00 0.35 H \\nATOM 45 C LEU H 3 -9.172 4.268 -10.394 1.00 0.35 C \\nATOM 46 CB LEU H 3 -10.495 2.989 -12.120 1.00 0.35 C \\nATOM 47 HB2 LEU H 3 -10.984 3.901 -12.453 1.00 0.35 H \\nATOM 48 HB3 LEU H 3 -9.554 2.904 -12.667 1.00 0.35 H \\nATOM 49 O LEU H 3 -9.552 5.432 -10.252 1.00 0.35 O \\nATOM 50 CG LEU H 3 -11.389 1.794 -12.501 1.00 0.35 C \\nATOM 51 HG LEU H 3 -12.297 1.807 -11.901 1.00 0.35 H \\nATOM 52 CD1 LEU H 3 -11.797 1.904 -13.970 1.00 0.35 C \\nATOM 53 HD11 LEU H 3 -12.444 1.070 -14.239 1.00 0.35 H \\nATOM 54 HD12 LEU H 3 -12.340 2.836 -14.130 1.00 0.35 H \\nATOM 55 HD13 LEU H 3 -10.913 1.894 -14.607 1.00 0.35 H \\nATOM 56 CD2 LEU H 3 -10.676 0.454 -12.308 1.00 0.35 C \\nATOM 57 HD21 LEU H 3 -9.764 0.423 -12.905 1.00 0.35 H \\nATOM 58 HD22 LEU H 3 -11.333 -0.359 -1Line truncated
"\tviewer_16674978917758489.zoomTo();\n",
"\tviewer_16674978917758489.setBackgroundColor(\"white\");\n",
"\tviewer_16674978917758489.setStyle({\"cartoon\": {\"colorscheme\": {\"prop\": \"b\", \"gradient\": \"roygb\", \"min\": 5, \"max\": 0}}});\n",
"\tviewer_16674978917758489.addStyle({\"and\": [{\"resn\": [\"GLY\", \"PRO\"], \"invert\": true}, {\"atom\": [\"C\", \"O\", \"N\"], \"invert\": true}]},{\"stick\": {\"colorscheme\": \"WhiteCarbon\", \"radius\": 0.3}});\n",
"\tviewer_16674978917758489.addStyle({\"and\": [{\"resn\": \"GLY\"}, {\"atom\": \"CA\"}]},{\"sphere\": {\"colorscheme\": \"WhiteCarbon\", \"radius\": 0.3}});\n",
"\tviewer_16674978917758489.addStyle({\"and\": [{\"resn\": \"PRO\"}, {\"atom\": [\"C\", \"O\"], \"invert\": true}]},{\"stick\": {\"colorscheme\": \"WhiteCarbon\", \"radius\": 0.3}});\n",
"\tviewer_16674978917758489.zoomTo();\n",
"viewer_16674978917758489.render();\n",
"});\n",
"</script>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#@title Visualise the prediction\n",
"\n",
"import py3Dmol\n",
"\n",
"#@markdown Choose visualization settings (rerun this cell to update):\n",
"\n",
"colour_by = \"predicted_error\" #@param [\"predicted_error\", \"chain\", \"rainbow\"]\n",
"\n",
"show_sidechains = True #@param {type:\"boolean\"}\n",
"show_mainchains = False #@param {type:\"boolean\"}\n",
"\n",
"\n",
"#First we assign the py3Dmol.view as view\n",
"view=py3Dmol.view()\n",
"#The following lines are used to add the addModel class\n",
"#to read the PDB files of chain B and C\n",
"view.addModel(open(filename, 'r').read(),'pdb')\n",
"#Zooming into all visualized structures \n",
"view.zoomTo()\n",
"#Here we set the background color as white\n",
"view.setBackgroundColor('white')\n",
"\n",
"\n",
"if colour_by == \"chain\":\n",
" #Here we set the visualization style for chain B and C\n",
" view.setStyle({'chain':'H'},{'cartoon': {'color':'purple'}})\n",
" view.setStyle({'chain':'L'},{'cartoon': {'color':'green'}})\n",
"elif colour_by == \"rainbow\":\n",
" view.setStyle({'cartoon': {'color':'spectrum'}})\n",
"elif colour_by == \"predicted_error\":\n",
" # Here we set visualization by b factor\n",
" print(\"The error is calulated by comparing how much different models agree or disagree on the placement of each residue\")\n",
" view.setStyle({'cartoon': {'colorscheme': {'prop':'b','gradient': 'roygb','min':5,'max':0}}})\n",
"\n",
"if show_sidechains:\n",
" BB = ['C','O','N']\n",
" view.addStyle({'and':[{'resn':[\"GLY\",\"PRO\"],'invert':True},{'atom':BB,'invert':True}]},\n",
" {'stick':{'colorscheme':f\"WhiteCarbon\",'radius':0.3}})\n",
" view.addStyle({'and':[{'resn':\"GLY\"},{'atom':'CA'}]},\n",
" {'sphere':{'colorscheme':f\"WhiteCarbon\",'radius':0.3}})\n",
" view.addStyle({'and':[{'resn':\"PRO\"},{'atom':['C','O'],'invert':True}]},\n",
" {'stick':{'colorscheme':f\"WhiteCarbon\",'radius':0.3}}) \n",
"if show_mainchains:\n",
" BB = ['C','O','N','CA']\n",
" view.addStyle({'atom':BB},{'stick':{'colorscheme':f\"WhiteCarbon\",'radius':0.3}})\n",
"\n",
"\n",
"\n",
"#And we finally visualize the structures using the command below\n",
"view.zoomTo()\n",
"view.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 17
},
"id": "33g5IIegij5R",
"outputId": "3fe3d5f4-f743-4bd7-950e-ddbf91e25fec"
},
"outputs": [
{
"data": {
"application/javascript": "\n async function download(id, filename, size) {\n if (!google.colab.kernel.accessAllowed) {\n return;\n }\n const div = document.createElement('div');\n const label = document.createElement('label');\n label.textContent = `Downloading \"${filename}\": `;\n div.appendChild(label);\n const progress = document.createElement('progress');\n progress.max = size;\n div.appendChild(progress);\n document.body.appendChild(div);\n\n const buffers = [];\n let downloaded = 0;\n\n const channel = await google.colab.kernel.comms.open(id);\n // Send a message to notify the kernel that we're ready.\n channel.send({})\n\n for await (const message of channel.messages) {\n // Send a message to notify the kernel that we're ready.\n channel.send({})\n if (message.buffers) {\n for (const buffer of message.buffers) {\n buffers.push(buffer);\n downloaded += buffer.byteLength;\n progress.value = downloaded;\n }\n }\n }\n const blob = new Blob(buffers, {type: 'application/binary'});\n const a = document.createElement('a');\n a.href = window.URL.createObjectURL(blob);\n a.download = filename;\n div.appendChild(a);\n a.click();\n div.remove();\n }\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": "download(\"download_87fea1f8-22e6-467f-b3c0-fed8746d67c5\", \"ImmuneBuilder_model.pdb\", 280386)",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#@title Download predicted structure\n",
"#@markdown If you are having issues downloading the result archive, try disabling your adblocker and run this cell again. If that fails click on the little folder icon to the left, navigate to the file, right-click and select \\\"Download\\\".\n",
"\n",
"from google.colab import files\n",
"\n",
"files.download(filename)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UGUBLzB3C6WN",
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"# Instructions <a name=\"Instructions\"></a>\n",
"**Quick start**\n",
"1. Paste the sequence(s) of your antibody, nanobody or TCR in the input field.\n",
"2. Select what type of protein it is.\n",
"3. Press \"Runtime\" -> \"Run all\".\n",
"4. The pipeline consists of 5 steps. The currently running step is indicated by a circle with a stop sign next to it.\n",
"\n",
"**Troubleshooting**\n",
"* Check your input sequences. They should be antibody, nanobody or TCRs sequences. ImmuneBuilder is not capable of predicting the structure of general proteins.\n",
"* Check that the runtime type is set to GPU at \"Runtime\" -> \"Change runtime type\".\n",
"* Try to restart the session \"Runtime\" -> \"Factory reset runtime\".\n",
"\n",
"**Aknowledgements**\n",
"* This colab notebook was heavily inspired by [ColabFold](https://github.com/sokrypton/ColabFold)."
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"provenance": []
},
"gpuClass": "standard",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}