Download model/include/importtests/af2_importtest.py from OneScience-Group/dl_binder_design: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/OneScience-Group/dl_binder_design/resolve/main/model/include/importtests/af2_importtest.py
- Command line
-
hf download hf://OneScience-Group/dl_binder_design/model/include/importtests/af2_importtest.py
-
curl -L -o af2_importtest.py https://huggingface.co/OneScience-Group/dl_binder_design/resolve/main/model/include/importtests/af2_importtest.py
2.01 kB
| #!/usr/bin/env python | |
| ''' | |
| Test the imports required by the AF2 initial guess scripts | |
| This will also test whether the currently installed version of JAX is able to | |
| run on the GPU. | |
| Run this on a gpu node like this: | |
| python importtest.py | |
| ''' | |
| import os | |
| import mock | |
| import numpy as np | |
| import sys | |
| # Get the path of the script | |
| scriptdir = os.path.dirname(os.path.realpath(__file__)) | |
| sys.path.append(f'{scriptdir}/../../af2_initial_guess') | |
| import datetime | |
| from typing import Any, Mapping, Optional, Sequence, Tuple | |
| import collections | |
| from collections import OrderedDict | |
| from timeit import default_timer as timer | |
| import argparse | |
| import io | |
| from Bio import PDB | |
| from Bio.PDB.Polypeptide import PPBuilder | |
| from Bio.PDB import PDBParser | |
| from Bio.PDB.mmcifio import MMCIFIO | |
| import scipy | |
| import jax | |
| import jax.numpy as jnp | |
| from alphafold.common import residue_constants | |
| from alphafold.common import protein | |
| from alphafold.common import confidence | |
| from alphafold.data import pipeline | |
| from alphafold.data import templates | |
| from alphafold.data import mmcif_parsing | |
| from alphafold.model import data | |
| from alphafold.model import config | |
| from alphafold.model import model | |
| from alphafold.data.tools import hhsearch | |
| sys.path.append(f'{scriptdir}/../..') | |
| from include.silent_tools import silent_tools | |
| # PyRosetta install test | |
| print("/"*200) | |
| print("Testing PyRosetta install. If this script errors before you see a PyRosetta success message then you " + \ | |
| "have an issue with your PyRosetta install") | |
| print("/"*200) | |
| from pyrosetta import * | |
| from rosetta import * | |
| init() | |
| print("/"*70) | |
| print("PyRosetta installation was successful!") | |
| print("/"*70) | |
| print("\n") | |
| from jax.lib import xla_bridge | |
| device = xla_bridge.get_backend().platform | |
| if device == 'gpu': | |
| print('/'*70) | |
| print('Found a GPU! This environment passes all import tests') | |
| print('/'*70) | |
| else: | |
| print('/'*70) | |
| print('No GPU found! This environment passes all import tests, but will not be able to use a GPU!!') | |
| print('/'*70) | |