Unverified Commit 1f9270cb authored by Gustaf Ahdritz's avatar Gustaf Ahdritz Committed by GitHub
Browse files

Merge pull request #308 from vaclavhanzl/colab-add-dep-fix-python-version

Fix Colab again after ModelCIF merge and python version change in Colab
parents cc1f8baa 35b1c4e1
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
"#@markdown **Note**: This installs the software on the Colab \n", "#@markdown **Note**: This installs the software on the Colab \n",
"#@markdown notebook in the cloud and not on your computer.\n", "#@markdown notebook in the cloud and not on your computer.\n",
"\n", "\n",
"import sys\n",
"from IPython.utils import io\n", "from IPython.utils import io\n",
"import os\n", "import os\n",
"import subprocess\n", "import subprocess\n",
...@@ -104,6 +105,8 @@ ...@@ -104,6 +105,8 @@
"\n", "\n",
"TQDM_BAR_FORMAT = '{l_bar}{bar}| {n_fmt}/{total_fmt} [elapsed: {elapsed} remaining: {remaining}]'\n", "TQDM_BAR_FORMAT = '{l_bar}{bar}| {n_fmt}/{total_fmt} [elapsed: {elapsed} remaining: {remaining}]'\n",
"\n", "\n",
"python_version = '.'.join(sys.version.split('.')[:2]) #get string like \"3.9\"\n",
"\n",
"try:\n", "try:\n",
" with io.capture_output() as captured:\n", " with io.capture_output() as captured:\n",
" %shell sudo apt install --quiet --yes hmmer\n", " %shell sudo apt install --quiet --yes hmmer\n",
...@@ -125,12 +128,13 @@ ...@@ -125,12 +128,13 @@
" %shell conda install -y -q -c conda-forge -c bioconda \\\n", " %shell conda install -y -q -c conda-forge -c bioconda \\\n",
" kalign2=2.04 \\\n", " kalign2=2.04 \\\n",
" hhsuite=3.3.0 \\\n", " hhsuite=3.3.0 \\\n",
" python=3.8 \\\n", " python={python_version} \\\n",
" 2>&1 1>/dev/null\n", " 2>&1 1>/dev/null\n",
" %shell pip install -q \\\n", " %shell pip install -q \\\n",
" ml-collections==0.1.0 \\\n", " ml-collections==0.1.0 \\\n",
" PyYAML==5.4.1 \\\n", " PyYAML==5.4.1 \\\n",
" biopython==1.79\n", " biopython==1.79 \\\n",
" modelcif==0.7\n",
"\n", "\n",
" # Create a ramdisk to store a database chunk to make Jackhmmer run fast.\n", " # Create a ramdisk to store a database chunk to make Jackhmmer run fast.\n",
" %shell sudo mkdir -m 777 --parents /tmp/ramdisk\n", " %shell sudo mkdir -m 777 --parents /tmp/ramdisk\n",
...@@ -181,12 +185,8 @@ ...@@ -181,12 +185,8 @@
" %shell cp -f /content/stereo_chemical_props.txt /content/openfold/openfold/resources\n", " %shell cp -f /content/stereo_chemical_props.txt /content/openfold/openfold/resources\n",
" %shell /usr/bin/python3 -m pip install -q ./openfold\n", " %shell /usr/bin/python3 -m pip install -q ./openfold\n",
"\n", "\n",
" %shell conda install -y -q -c conda-forge openmm=7.5.1\n", " %shell conda install -y -q -c conda-forge openmm=7.7.0\n",
" # Apply OpenMM patch.\n", " %shell conda install -y -q -c conda-forge pdbfixer\n",
" %shell pushd /opt/conda/lib/python3.8/site-packages/ && \\\n",
" patch -p0 < /content/openfold/lib/openmm.patch && \\\n",
" popd\n",
" %shell conda install -y -q -c conda-forge pdbfixer=1.7\n",
"\n", "\n",
" if(weight_set == 'AlphaFold'):\n", " if(weight_set == 'AlphaFold'):\n",
" %shell mkdir --parents \"{ALPHAFOLD_PARAMS_DIR}\"\n", " %shell mkdir --parents \"{ALPHAFOLD_PARAMS_DIR}\"\n",
...@@ -220,8 +220,8 @@ ...@@ -220,8 +220,8 @@
"import unittest.mock\n", "import unittest.mock\n",
"import sys\n", "import sys\n",
"\n", "\n",
"sys.path.insert(0, '/usr/local/lib/python3.8/site-packages/')\n", "sys.path.insert(0, f'/usr/local/lib/python{python_version}/site-packages/')\n",
"sys.path.append('/opt/conda/lib/python3.8/site-packages')\n", "sys.path.append(f'/opt/conda/lib/python{python_version}/site-packages')\n",
"\n", "\n",
"# Allows us to skip installing these packages\n", "# Allows us to skip installing these packages\n",
"unnecessary_modules = [\n", "unnecessary_modules = [\n",
......
...@@ -57,7 +57,7 @@ class AmberRelaxation(object): ...@@ -57,7 +57,7 @@ class AmberRelaxation(object):
self._use_gpu = use_gpu self._use_gpu = use_gpu
def process( def process(
self, *, prot: protein.Protein, cif_output: bool self, *, prot: protein.Protein, cif_output: bool = False
) -> Tuple[str, Dict[str, Any], np.ndarray]: ) -> Tuple[str, Dict[str, Any], np.ndarray]:
"""Runs Amber relax on a prediction, adds hydrogens, returns PDB string.""" """Runs Amber relax on a prediction, adds hydrogens, returns PDB string."""
out = amber_minimize.run_pipeline( out = amber_minimize.run_pipeline(
......
...@@ -228,7 +228,7 @@ def prep_output(out, batch, feature_dict, feature_processor, config_preset, mult ...@@ -228,7 +228,7 @@ def prep_output(out, batch, feature_dict, feature_processor, config_preset, mult
return unrelaxed_protein return unrelaxed_protein
def relax_protein(config, model_device, unrelaxed_protein, output_directory, output_name, cif_output): def relax_protein(config, model_device, unrelaxed_protein, output_directory, output_name, cif_output=False):
amber_relaxer = relax.AmberRelaxation( amber_relaxer = relax.AmberRelaxation(
use_gpu=(model_device != "cpu"), use_gpu=(model_device != "cpu"),
**config.relax, **config.relax,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment