Skip to content

Commit

Permalink
Major update of dependencies and structure
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaMolod committed Oct 20, 2023
1 parent 79055cb commit 966633c
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 120 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

<span style="color:red">*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)</span>.

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion alphapulldown/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.30.8"
__version__ = "1.00.0"
41 changes: 5 additions & 36 deletions alphapulldown/create_individual_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,27 @@
# 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):
"""function that create temp file"""
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(
Expand Down
15 changes: 3 additions & 12 deletions alphapulldown/create_individual_features_with_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions alphapulldown/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion alphapulldown/plot_pae.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions alphapulldown/predict_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions alphapulldown/rename_colab_search_a3m.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 5 additions & 6 deletions alphapulldown/run_multimer_jobs.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
29 changes: 1 addition & 28 deletions alphapulldown/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
49 changes: 26 additions & 23 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[metadata]
name = alphapulldown
version = 1.00.0
name = alphapulldown
author = Dingquan Yu
author_email = [email protected]
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
Expand All @@ -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
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from setuptools import setup
from alphapulldown import __version__
if __name__ == '__main__':
setup()
setup(version=__version__)

0 comments on commit 966633c

Please sign in to comment.