new package: py-alphafold (#27849)

* new package: alphafold

and related dependencies, depends on #27138

* [@spackbot] updating style on behalf of aweits

* fix

Co-authored-by: aweits <aweits@users.noreply.github.com>
This commit is contained in:
Andrew W Elble 2022-08-02 16:01:22 -04:00 committed by GitHub
parent 4e723b634e
commit e11211eec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 380 additions and 2 deletions

View File

@ -0,0 +1,33 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class HhSuite(CMakePackage):
"""HH-suite is a widely used open source software suite for
sensitive sequence similarity searches and protein fold
recognition. It is based on pairwise alignment of profile Hidden
Markov models (HMMs), which represent multiple sequence alignments
of homologous proteins."""
homepage = "https://github.com/soedinglab/hh-suite"
url = "https://github.com/soedinglab/hh-suite/archive/refs/tags/v3.3.0.tar.gz"
version("3.3.0", sha256="dd67f7f3bf601e48c9c0bc4cf1fbe3b946f787a808bde765e9436a48d27b0964")
variant("mpi", default=True, description="Enable MPI support")
depends_on("cmake@2.8.12:", type="build")
depends_on("mpi", when="+mpi")
def build_args(self, spec, prefix):
args = []
if "+mpi" in self.spec:
args.append("-DCHECK_MPI=1")
else:
args.append("-DCHECK_MPI=0")
return args

View File

@ -0,0 +1,20 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Kalign(AutotoolsPackage):
"""A fast multiple sequence alignment program for biological sequences."""
homepage = "https://github.com/TimoLassmann/kalign"
url = "https://github.com/TimoLassmann/kalign/archive/refs/tags/v3.3.1.tar.gz"
version("3.3.1", sha256="7f10acf9a3fa15deabbc0304e7c14efa25cea39108318c9f02b47257de2d7390")
depends_on("autoconf", type="build")
depends_on("automake", type="build")
depends_on("libtool", type="build")

View File

@ -19,6 +19,8 @@ class Openmm(CMakePackage, CudaPackage):
homepage = "https://openmm.org/" homepage = "https://openmm.org/"
url = "https://github.com/openmm/openmm/archive/7.4.1.tar.gz" url = "https://github.com/openmm/openmm/archive/7.4.1.tar.gz"
version("7.6.0", sha256="5a99c491ded9ba83ecc3fb1d8d22fca550f45da92e14f64f25378fda0048a89d")
version("7.5.1", sha256="c88d6946468a2bde2619acb834f57b859b5e114a93093cf562165612e10f4ff7")
version("7.5.0", sha256="516748b4f1ae936c4d70cc6401174fc9384244c65cd3aef27bc2c53eac6d6de5") version("7.5.0", sha256="516748b4f1ae936c4d70cc6401174fc9384244c65cd3aef27bc2c53eac6d6de5")
version("7.4.1", sha256="e8102b68133e6dcf7fcf29bc76a11ea54f30af71d8a7705aec0aee957ebe3a6d") version("7.4.1", sha256="e8102b68133e6dcf7fcf29bc76a11ea54f30af71d8a7705aec0aee957ebe3a6d")

View File

@ -0,0 +1,85 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
from spack.package import *
class PyAlphafold(PythonPackage, CudaPackage):
"""AlphaFold is an AI system developed by DeepMind that predicts a
protein's 3D structure from its amino acid sequence. It regularly
achieves accuracy competitive with experiment."""
homepage = "https://github.com/deepmind/alphafold"
url = "https://github.com/deepmind/alphafold/archive/refs/tags/v2.1.1.tar.gz"
maintainers = ["aweits"]
version("2.1.1", sha256="1adb6e213ba9ac321fc1acb1c563ba9b4fc054c1cebe1191bc0e2aaa671dadf7")
conflicts("platform=darwin", msg="alphafold is only supported on Linux")
depends_on("python@3.7:", type=("build", "run"))
depends_on("py-setuptools", type="build")
depends_on("py-absl-py@0.13.0:", type=("build", "run"))
depends_on("py-biopython@1.79:", type=("build", "run"))
depends_on("py-chex@0.0.7:", type=("build", "run"))
depends_on("py-dm-haiku@0.0.4:", type=("build", "run"))
depends_on("py-dm-tree@0.1.6:", type=("build", "run"))
depends_on("py-immutabledict@2.0.0:", type=("build", "run"))
depends_on("py-jax@0.2.14:", type=("build", "run"))
for arch in CudaPackage.cuda_arch_values:
depends_on(
"py-jax@0.2.14:+cuda cuda_arch={0}".format(arch),
type=("build", "run"),
when="cuda_arch={0}".format(arch),
)
depends_on("py-ml-collections@0.1.0:", type=("build", "run"))
depends_on("py-numpy@1.19.5:", type=("build", "run"))
depends_on("py-pandas@1.3.4:", type=("build", "run"))
depends_on("py-scipy@1.7.0:", type=("build", "run"))
depends_on("py-pdbfixer@1.7", type=("build", "run"))
depends_on("py-tensorflow@2.5:", type=("build", "run"))
depends_on(
"openmm@7.5.1+cuda",
type="run",
patches=[
patch(
"https://raw.githubusercontent.com/deepmind/alphafold/main/docker/openmm.patch",
sha256="a5a0ced820f3ecc56ae634c3111f80614863559b0587954a2658c8d4b2a07ae3",
working_dir="wrappers/python",
level=0,
)
],
)
depends_on("hmmer", type="run")
depends_on("kalign", type="run")
depends_on("hh-suite", type="run")
depends_on("aria2", type="run")
resource(
name="chemprops",
url="https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt",
destination="",
sha256="24510899eeb49167cffedec8fa45363a4d08279c0c637a403b452f7d0ac09451",
expand=False,
placement="chemprops",
)
@run_after("install")
def install_scripts(self):
mkdirp(self.prefix.bin)
shebang = "#!{0}\n".format(self.spec["python"].command)
for fname in glob.glob("run_alphafold*.py"):
destfile = join_path(self.prefix.bin, fname)
with open(fname, "r") as src:
srcdata = src.read()
with open(destfile, "w") as dest:
dest.write(shebang + srcdata)
set_executable(destfile)
python_dir = join_path(self.prefix, python_platlib, "alphafold", "common")
install("chemprops/stereo_chemical_props.txt", python_dir)
install_tree("scripts", self.prefix.scripts)

View File

@ -16,6 +16,7 @@ class PyBiopython(PythonPackage):
homepage = "https://biopython.org/wiki/Main_Page" homepage = "https://biopython.org/wiki/Main_Page"
url = "https://biopython.org/DIST/biopython-1.65.tar.gz" url = "https://biopython.org/DIST/biopython-1.65.tar.gz"
version("1.79", sha256="edb07eac99d3b8abd7ba56ff4bedec9263f76dfc3c3f450e7d2e2bcdecf8559b")
version("1.78", sha256="1ee0a0b6c2376680fea6642d5080baa419fd73df104a62d58a8baf7a8bbe4564") version("1.78", sha256="1ee0a0b6c2376680fea6642d5080baa419fd73df104a62d58a8baf7a8bbe4564")
version("1.73", sha256="70c5cc27dc61c23d18bb33b6d38d70edc4b926033aea3b7434737c731c94a5e0") version("1.73", sha256="70c5cc27dc61c23d18bb33b6d38d70edc4b926033aea3b7434737c731c94a5e0")
version("1.70", sha256="4a7c5298f03d1a45523f32bae1fffcff323ea9dce007fb1241af092f5ab2e45b") version("1.70", sha256="4a7c5298f03d1a45523f32bae1fffcff323ea9dce007fb1241af092f5ab2e45b")

View File

@ -0,0 +1,25 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyChex(PythonPackage):
"""Chex is a library of utilities for helping to write reliable JAX code."""
homepage = "https://github.com/deepmind/chex"
pypi = "chex/chex-0.1.0.tar.gz"
version("0.1.0", sha256="9e032058f5fed2fc1d5e9bf8e12ece5910cf6a478c12d402b6d30984695f2161")
depends_on("python@3.7:", type=("build", "run"))
depends_on("py-setuptools", type="build")
depends_on("py-absl-py@0.9.0:", type=("build", "run"))
depends_on("py-dm-tree@0.1.5:", type=("build", "run"))
depends_on("py-jax@0.1.55:", type=("build", "run"))
depends_on("py-jaxlib@0.1.37:", type=("build", "run"))
depends_on("py-numpy@1.18.0:", type=("build", "run"))
depends_on("py-toolz@0.9.0:", type=("build", "run"))

View File

@ -0,0 +1,24 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyDmHaiku(PythonPackage):
"""JAX-based neural network library"""
homepage = "https://github.com/deepmind/dm-haiku"
pypi = "dm-haiku/dm-haiku-0.0.5.tar.gz"
version("0.0.5", sha256="e986237e1f840aa3bd26217ecad84b611bf1456e2139f0f79ea71f9c6222d231")
depends_on("python@3.7:", type=("build", "run"))
depends_on("py-setuptools", type="build")
depends_on("py-absl-py@0.7.1:", type=("build", "run"))
depends_on("py-jmp@0.0.2:", type=("build", "run"))
depends_on("py-numpy@1.18.0:", type=("build", "run"))
depends_on("py-tabulate@0.8.9:", type=("build", "run"))
depends_on("py-typing-extensions", when="^python@:3.7", type=("build", "run"))
depends_on("py-jax", type=("build", "run"))

View File

@ -19,6 +19,7 @@ class PyDmTree(PythonPackage):
maintainers = ["aweits"] maintainers = ["aweits"]
version("0.1.6", sha256="6776404b23b4522c01012ffb314632aba092c9541577004ab153321e87da439a")
version("0.1.5", sha256="a951d2239111dfcc468071bc8ff792c7b1e3192cab5a3c94d33a8b2bda3127fa") version("0.1.5", sha256="a951d2239111dfcc468071bc8ff792c7b1e3192cab5a3c94d33a8b2bda3127fa")
depends_on("py-setuptools", type="build") depends_on("py-setuptools", type="build")

View File

@ -0,0 +1,28 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyImmutabledict(PythonPackage):
"""A fork of frozendict, an immutable wrapper around
dictionaries. It implements the complete mapping interface and can be used as a
drop-in replacement for dictionaries where immutability is
desired. The immutabledict constructor mimics dict, and all of the
expected interfaces (iter, len, repr, hash, getitem) are
provided. Note that an immutabledict does not guarantee the
immutability of its values, so the utility of hash method is
restricted by usage. The only difference is that the copy() method
of immutable takes variable keyword arguments, which will be
present as key/value pairs in the new, immutable copy."""
homepage = "https://github.com/corenting/immutabledict"
pypi = "immutabledict/immutabledict-2.2.1.tar.gz"
version("2.2.1", sha256="1ddb0edf1bb6c70d0197eb90ce1fe2b2d58502334f5fdfde72d7c633d723ec3a")
depends_on("python@3.6:3", type=("build", "run"))
depends_on("py-poetry-core@1:", type="build")

View File

@ -0,0 +1,42 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyJax(PythonPackage, CudaPackage):
"""JAX is Autograd and XLA, brought together for high-performance
machine learning research. With its updated version of Autograd,
JAX can automatically differentiate native Python and NumPy
functions. It can differentiate through loops, branches,
recursion, and closures, and it can take derivatives of
derivatives of derivatives. It supports reverse-mode
differentiation (a.k.a. backpropagation) via grad as well as
forward-mode differentiation, and the two can be composed
arbitrarily to any order."""
homepage = "https://github.com/google/jax"
pypi = "jax/jax-0.2.25.tar.gz"
version("0.2.25", sha256="822e8d1e06257eaa0fdc4c0a0686c4556e9f33647fa2a766755f984786ae7446")
variant("cuda", default=True, description="CUDA support")
depends_on("python@3.7:", type=("build", "run"))
depends_on("py-setuptools", type="build")
depends_on("py-numpy@1.18:", type=("build", "run"))
depends_on("py-absl-py", type=("build", "run"))
depends_on("py-opt-einsum", type=("build", "run"))
depends_on("py-scipy@1.2.1:", type=("build", "run"))
depends_on("py-typing-extensions", type=("build", "run"))
depends_on("py-jaxlib@0.1.69:", type=("build", "run"), when="~cuda")
depends_on("py-jaxlib@0.1.69:+cuda", type=("build", "run"), when="+cuda")
for arch in CudaPackage.cuda_arch_values:
depends_on(
"py-jaxlib@0.1.69:+cuda cuda_arch={0}".format(arch),
type=("build", "run"),
when="cuda_arch={0}".format(arch),
)

View File

@ -0,0 +1,69 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import tempfile
import llnl.util.tty as tty
from spack.package import *
class PyJaxlib(PythonPackage, CudaPackage):
"""XLA library for Jax"""
homepage = "https://github.com/google/jax"
url = "https://github.com/google/jax/archive/refs/tags/jaxlib-v0.1.74.tar.gz"
tmp_path = ""
version("0.1.74", sha256="bbc78c7a4927012dcb1b7cd135c7521f782d7dad516a2401b56d3190f81afe35")
depends_on("python@3.7:", type=("build", "run"))
depends_on("py-setuptools", type="build")
depends_on("py-numpy@1.18:", type=("build", "run"))
depends_on("py-scipy", type=("build", "run"))
depends_on("py-absl-py", type=("build", "run"))
depends_on("py-flatbuffers@1.12:2", type=("build", "run"))
depends_on("bazel@4.1.0:", type=("build"))
depends_on("cudnn@8.0.5:", when="+cuda")
depends_on("cuda@11.1:", when="+cuda")
def install(self, spec, prefix):
args = []
args.append("build/build.py")
if "+cuda" in spec:
args.append("--enable_cuda")
args.append("--cuda_path={0}".format(self.spec["cuda"].prefix))
args.append("--cudnn_path={0}".format(self.spec["cudnn"].prefix))
capabilities = ",".join(
"{0:.1f}".format(float(i) / 10.0) for i in spec.variants["cuda_arch"].value
)
args.append("--cuda_compute_capabilities={0}".format(capabilities))
args.append("--bazel_startup_options=" "--output_user_root={0}".format(self.buildtmp))
python(*args)
with working_dir(self.tmp_path):
tty.warn("in dir " + self.tmp_path)
args = std_pip_args + ["--prefix=" + self.prefix, "."]
pip(*args)
remove_linked_tree(self.tmp_path)
remove_linked_tree(self.buildtmp)
def patch(self):
self.tmp_path = tempfile.mkdtemp(prefix="spack")
self.buildtmp = tempfile.mkdtemp(prefix="spack")
filter_file(
"""f"--output_path={output_path}",""",
"""f"--output_path={output_path}","""
"""f"--sources_path=%s","""
"""f"--nohome_rc'","""
"""f"--nosystem_rc'",""" % self.tmp_path,
"build/build.py",
)
filter_file(
"args = parser.parse_args()",
"args,junk = parser.parse_known_args()",
"build/build_wheel.py",
string=True,
)

View File

@ -0,0 +1,23 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyJmp(PythonPackage):
"""JMP is a Mixed Precision library for JAX."""
homepage = "https://github.com/deepmind/jmp"
# pypi tarball has requirements.txt missing
url = "https://github.com/deepmind/jmp/archive/refs/tags/v0.0.2.tar.gz"
version("0.0.2", sha256="4d242fb14502b15a7c072e112bdcd7cb5d8b373d9733162eea23e0b9b7dbb6d0")
depends_on("python@3.6:", type=("build", "run"))
depends_on("py-setuptools", type="build")
depends_on("py-numpy@1.19.5:", type=("build", "run"))
depends_on("py-dataclasses@0.7:", type=("build", "run"), when="^python@:3.6")
depends_on("py-jax@0.1.71:", type=("build", "run"))

View File

@ -11,8 +11,10 @@ class PyMlCollections(PythonPackage):
homepage = "https://https://github.com/google/ml_collections" homepage = "https://https://github.com/google/ml_collections"
pypi = "ml_collections/ml_collections-0.1.0.tar.gz" pypi = "ml_collections/ml_collections-0.1.0.tar.gz"
git = "https://github.com/google/ml_collections"
version("0.1.1", sha256="3fefcc72ec433aa1e5d32307a3e474bbb67f405be814ea52a2166bfc9dbe68cc") version("0.1.1", sha256="3fefcc72ec433aa1e5d32307a3e474bbb67f405be814ea52a2166bfc9dbe68cc")
version("0.1.0", commit="63a7c22d1bf3521c3bb3f9da6ebf07972c25fec4")
depends_on("python@2.6:", type=("build", "run")) depends_on("python@2.6:", type=("build", "run"))
depends_on("py-setuptools", type=("build", "run")) depends_on("py-setuptools", type=("build", "run"))
@ -20,5 +22,5 @@ class PyMlCollections(PythonPackage):
depends_on("py-absl-py", type=("build", "run")) depends_on("py-absl-py", type=("build", "run"))
depends_on("py-six", type=("build", "run")) depends_on("py-six", type=("build", "run"))
depends_on("py-contextlib2", type=("build", "run")) depends_on("py-contextlib2", type=("build", "run"))
depends_on("py-dataclasses", type=("build", "run"), when="python@:3.6") depends_on("py-dataclasses", type=("build", "run"), when="^python@:3.6")
depends_on("py-typing", type=("build", "run"), when="python@:3.5") depends_on("py-typing", type=("build", "run"), when="^python@:3.4")

View File

@ -0,0 +1,23 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyPdbfixer(PythonPackage):
"""PDBFixer is an easy to use application for fixing problems in
Protein Data Bank files in preparation for simulating them."""
homepage = "https://github.com/openmm/pdbfixer"
url = "https://github.com/openmm/pdbfixer/archive/refs/tags/v1.8.1.tar.gz"
version("1.8.1", sha256="d50551abfe9dbaefc066f4d9d400cdebe57f1fefd9de9d01e12beb87efd99595")
version("1.7", sha256="a0bef3c52a7bbe69a6aea5333f51f3e7d158339be5829aed19b0344bd66d4eea")
depends_on("py-setuptools", type="build")
depends_on("openmm@7.1:7.5", type=("build", "run"), when="1.7")
depends_on("openmm@7.6:", type=("build", "run"), when="@1.8:")
depends_on("py-numpy", type=("build", "run"))