diff --git a/README.md b/README.md index f8687290..7864bd8c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # AlphaPulldown -[![Downloads](https://static.pepy.tech/badge/alphapulldown)](https://pepy.tech/project/alphapulldown) [![python3.10](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-3100/) ![GPL3 license](https://img.shields.io/badge/license-GPLv3-green) +[![Downloads](https://static.pepy.tech/badge/alphapulldown)](https://pepy.tech/project/alphapulldown) [![python3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/) ![GPL3 license](https://img.shields.io/badge/license-GPLv3-green) *This is a development version of AlphaPulldown! The stable version is available at [0.30.7 branch](https://github.com/KosinskiLab/AlphaPulldown/tree/temp_main). @@ -49,14 +49,14 @@ Check if you have downloaded necessary parameters and databases (e.g. BFD, MGnif **Firstly**, install [Anaconda](https://www.anaconda.com/) and create AlphaPulldown environment, gathering necessary dependencies ```bash -conda create -n AlphaPulldown -c omnia -c bioconda -c conda-forge python==3.10 openmm==8.0 pdbfixer==1.9 kalign2 cctbx-base +conda create -n AlphaPulldown -c omnia -c bioconda -c conda-forge python==3.10 openmm==8.0 pdbfixer==1.9 kalign2 cctbx-base pytest ``` **Secondly**, activate the AlphaPulldown environment and install AlphaPulldown ```bash source activate AlphaPulldown -python3 -m pip install alphapulldown==0.30.8 -pip install jax==0.3.25 jaxlib==0.3.25+cuda11.cudnn805 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html +python3 -m pip install alphapulldown==1.00.0 +pip install jax==0.4.19 jaxlib==0.4.19+cuda11.cudnn86 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html ``` **Optionally**, if you do not have these software yet on your system, install [HMMER](http://hmmer.org/documentation.html), [HH-suite](https://github.com/soedinglab/hh-suite) from Anaconda diff --git a/alphapulldown/__init__.py b/alphapulldown/__init__.py index aa1beff6..e61c914c 100644 --- a/alphapulldown/__init__.py +++ b/alphapulldown/__init__.py @@ -1 +1 @@ -__version__ = "0.30.8" +__version__ = "1.00.0" diff --git a/alphapulldown/create_individual_features.py b/alphapulldown/create_individual_features.py index fadf7119..5865121b 100755 --- a/alphapulldown/create_individual_features.py +++ b/alphapulldown/create_individual_features.py @@ -4,28 +4,20 @@ # This script is just to create msa and structural features for each sequences and store them in pickle # # -import os -import pickle -import sys +from alphafold import run_alphafold as run_af from alphapulldown.objects import MonomericObject -import importlib -from absl import app -from absl import flags -from absl import logging - from alphafold.data.pipeline import DataPipeline from alphafold.data.tools import hmmsearch from alphafold.data import templates -import numpy as np -import os from absl import logging, app -import numpy as np -from alphapulldown.utils import * +from alphapulldown.utils import save_meta_data, create_uniprot_runner, parse_fasta import contextlib from datetime import datetime -import alphafold from pathlib import Path from colabfold.utils import DEFAULT_API_SERVER +import os +import sys +import pickle @contextlib.contextmanager def output_meta_file(file_path): @@ -33,29 +25,6 @@ def output_meta_file(file_path): with open(file_path, "w") as outfile: yield outfile.name - -def load_module(file_name, module_name): - spec = importlib.util.spec_from_file_location(module_name, file_name) - module = importlib.util.module_from_spec(spec) - sys.modules[module_name] = module - spec.loader.exec_module(module) - return module - - -PATH_TO_RUN_ALPHAFOLD = os.path.join( - os.path.dirname(alphafold.__file__), "run_alphafold.py" -) - -try: - run_af = load_module(PATH_TO_RUN_ALPHAFOLD, "run_alphafold") -except FileNotFoundError: - PATH_TO_RUN_ALPHAFOLD = os.path.join( - os.path.dirname(os.path.dirname(alphafold.__file__)), "run_alphafold.py" - ) - - run_af = load_module(PATH_TO_RUN_ALPHAFOLD, "run_alphafold") - - flags = run_af.flags flags.DEFINE_bool("save_msa_files", False, "save msa output or not") flags.DEFINE_bool( diff --git a/alphapulldown/create_individual_features_with_templates.py b/alphapulldown/create_individual_features_with_templates.py index 7e9959f4..c30327b5 100755 --- a/alphapulldown/create_individual_features_with_templates.py +++ b/alphapulldown/create_individual_features_with_templates.py @@ -3,10 +3,10 @@ # create_individual_features using custom multimeric templates # +from alphafold import run_alphafold as run_af from alphapulldown.objects import MonomericObject -from alphapulldown.utils import parse_fasta, save_meta_data, create_uniprot_runner +from alphapulldown.utils import create_uniprot_runner from alphapulldown.create_custom_template_db import create_db -import alphafold from alphafold.data.pipeline import DataPipeline from alphafold.data.tools import hmmsearch from alphafold.data import templates @@ -16,16 +16,7 @@ from pathlib import Path import tempfile import csv -from create_individual_features import load_module, create_and_save_monomer_objects, iter_seqs - - -PATH_TO_RUN_ALPHAFOLD = os.path.join(os.path.dirname(alphafold.__file__), "run_alphafold.py") - -try: - run_af = load_module(PATH_TO_RUN_ALPHAFOLD, "run_alphafold") -except FileNotFoundError: - PATH_TO_RUN_ALPHAFOLD = os.path.join(os.path.dirname(os.path.dirname(alphafold.__file__)), "run_alphafold.py") - run_af = load_module(PATH_TO_RUN_ALPHAFOLD, "run_alphafold") +from create_individual_features import create_and_save_monomer_objects, iter_seqs flags = run_af.flags diff --git a/alphapulldown/objects.py b/alphapulldown/objects.py index d8080529..db7c4607 100644 --- a/alphapulldown/objects.py +++ b/alphapulldown/objects.py @@ -6,7 +6,6 @@ import tempfile import os import contextlib -from tracemalloc import start import numpy as np from alphafold.data import parsers from alphafold.data import pipeline_multimer @@ -16,8 +15,7 @@ from alphafold.data import templates from pathlib import Path as plPath from alphafold.data.tools import hhsearch -from colabfold.batch import get_queries, unserialize_msa, get_msa_and_templates, msa_to_str, build_monomer_feature, \ - parse_fasta +from colabfold.batch import unserialize_msa, get_msa_and_templates, msa_to_str, build_monomer_feature @contextlib.contextmanager diff --git a/alphapulldown/plot_pae.py b/alphapulldown/plot_pae.py index bf12f885..c003dfc2 100644 --- a/alphapulldown/plot_pae.py +++ b/alphapulldown/plot_pae.py @@ -7,7 +7,6 @@ matplotlib.use("agg") import matplotlib.pyplot as plt import pickle as pkl -import numpy as np def plot_pae(seqs: list, order, feature_dir, job_name): diff --git a/alphapulldown/predict_structure.py b/alphapulldown/predict_structure.py index 7d64c24d..7735036a 100644 --- a/alphapulldown/predict_structure.py +++ b/alphapulldown/predict_structure.py @@ -12,9 +12,7 @@ from alphafold.common import residue_constants from alphafold.relax import relax import numpy as np -from alphapulldown.utils import get_run_alphafold - -run_af = get_run_alphafold() +from alphafold import run_alphafold as run_af RELAX_MAX_ITERATIONS = run_af.RELAX_MAX_ITERATIONS RELAX_ENERGY_TOLERANCE = run_af.RELAX_ENERGY_TOLERANCE diff --git a/alphapulldown/rename_colab_search_a3m.py b/alphapulldown/rename_colab_search_a3m.py index 2d9a9b15..bbffae3f 100755 --- a/alphapulldown/rename_colab_search_a3m.py +++ b/alphapulldown/rename_colab_search_a3m.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 -import sys import glob, os from itertools import groupby -import re """ Rename all .a3m files in the current directory diff --git a/alphapulldown/run_multimer_jobs.py b/alphapulldown/run_multimer_jobs.py index 738773da..bf1dce14 100755 --- a/alphapulldown/run_multimer_jobs.py +++ b/alphapulldown/run_multimer_jobs.py @@ -1,23 +1,22 @@ #!/usr/bin/env python3 - # Author: Dingquan Yu # A script to create region information for create_multimer_features.py # # - import itertools -from absl import app, flags, logging -from alphapulldown.utils import * +from absl import app, logging +from alphapulldown.utils import (create_interactors, read_all_proteins, read_custom, make_dir_monomer_dictionary, + load_monomer_objects, check_output_dir, create_model_runners_and_random_seed, + create_and_save_pae_plots) from itertools import combinations from alphapulldown.objects import MultimericObject import os from pathlib import Path from alphapulldown.predict_structure import predict, ModelsToRelax +from alphafold import run_alphafold as run_af - -run_af = get_run_alphafold() flags = run_af.flags flags.DEFINE_enum( diff --git a/alphapulldown/utils.py b/alphapulldown/utils.py index e15b79b0..233e7b89 100644 --- a/alphapulldown/utils.py +++ b/alphapulldown/utils.py @@ -21,8 +21,6 @@ from alphafold.data import parsers from pathlib import Path import numpy as np -import importlib -import alphafold import sys import datetime import re @@ -518,29 +516,4 @@ def parse_fasta(fasta_string: str): continue # Skip blank lines. sequences[index] += line - return sequences, descriptions - - -def load_module(file_name, module_name): - spec = importlib.util.spec_from_file_location(module_name, file_name) - module = importlib.util.module_from_spec(spec) - sys.modules[module_name] = module - spec.loader.exec_module(module) - return module - - -def get_run_alphafold(): - PATH_TO_RUN_ALPHAFOLD = os.path.join( - os.path.dirname(alphafold.__file__), "run_alphafold.py" - ) - - try: - run_af = load_module(PATH_TO_RUN_ALPHAFOLD, "run_alphafold") - except FileNotFoundError: - PATH_TO_RUN_ALPHAFOLD = os.path.join( - os.path.dirname(os.path.dirname(alphafold.__file__)), "run_alphafold.py" - ) - - run_af = load_module(PATH_TO_RUN_ALPHAFOLD, "run_alphafold") - - return run_af + return sequences, descriptions \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 234da461..ea55d68c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,11 @@ [metadata] -name = alphapulldown -version = 1.00.0 +name = alphapulldown author = Dingquan Yu author_email = dingquan.yu@embl-hamburg.de description = Pipeline allows massive screening using alphafold url = https://github.com/KosinskiLab/AlphaPulldown - +long_description = file: README.md +long_description_content_type = text/markdown classifiers = Programming Language :: Python :: 3 License :: OSI Approved :: MIT License @@ -18,39 +18,42 @@ packages= colabfold analysis_pipeline af2plots -package_dir = +package_dir = alphapulldown = ./alphapulldown alphafold = ./alphafold/alphafold colabfold = ./alphapulldown/ColabFold/colabfold analysis_pipeline = ./alphapulldown/analysis_pipeline af2plots = ./alphapulldown/analysis_pipeline/af2plots/af2plots - include_package_data = True - python_requires = ==3.10.* -install_requires = - absl-py >= 0.13.0 - dm-haiku - dm-tree>=0.1.6 - h5py>=3.1.0 - matplotlib>=3.3.3 - ml-collections>=0.1.0 +install_requires = + alphafold @ git+https://github.com/KosinskiLab/alphafold.git@main + colabfold @ git+https://github.com/sokrypton/ColabFold.git@main + af2plots @ git+https://gitlab.com/gchojnowski/af2plots.git@main + absl-py==1.4.0 + dm-haiku==0.0.9 + dm-tree==0.1.8 + h5py==3.10.0 + matplotlib + ml-collections==0.1.1 numpy - pandas>=1.3.4 - tensorflow - importlib-resources==5.8.0 + pandas==1.5.3 + tensorflow==2.14.0 + importlib-resources==6.1.0 biopython>=1.78 - nbformat==5.4.0 - py3Dmol==2.0.1 - ipython - tqdm - appdirs + nbformat==5.9.2 + py3Dmol==2.0.4 + ipython==8.16.1 + tqdm==4.66.1 + appdirs==1.4.4 jupyterlab ipywidgets -scripts = ./alphapulldown/create_individual_features.py, ./alphapulldown/create_individual_features_with_templates.py, ./alphapulldown/run_multimer_jobs.py, ./alphapulldown/analysis_pipeline/create_notebook.py, ./alphapulldown/rename_colab_search_a3m.py, ./alphapulldown/prepare_seq_names.py +scripts = ./alphafold/run_alphafold.py, ./alphapulldown/create_individual_features.py, ./alphapulldown/create_individual_features_with_templates.py, ./alphapulldown/run_multimer_jobs.py, ./alphapulldown/analysis_pipeline/create_notebook.py, ./alphapulldown/rename_colab_search_a3m.py, ./alphapulldown/prepare_seq_names.py + [options.packages.find] where = ./ exclude = test* [options.data_files] -lib/python3.8/site-packages/alphafold/common/ = stereo_chemical_props.txt +lib/python3.10/site-packages/alphafold/common/ = stereo_chemical_props.txt +lib/python3.10/site-packages/alphafold/ = ./alphafold/run_alphafold.py diff --git a/setup.py b/setup.py index 0f05f820..93c59c0e 100755 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ from setuptools import setup +from alphapulldown import __version__ if __name__ == '__main__': - setup() \ No newline at end of file + setup(version=__version__) \ No newline at end of file