From c8a3f1a8aeeef0085f1dffd95e8746c265a1ec0e Mon Sep 17 00:00:00 2001 From: George Young Date: Mon, 18 Sep 2023 16:36:44 +0100 Subject: chexmix: new package (#38441) Co-authored-by: LMS Bioinformatics --- .../repos/builtin/packages/chexmix/chexmix.sh | 3 ++ .../repos/builtin/packages/chexmix/package.py | 49 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 var/spack/repos/builtin/packages/chexmix/chexmix.sh create mode 100644 var/spack/repos/builtin/packages/chexmix/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/chexmix/chexmix.sh b/var/spack/repos/builtin/packages/chexmix/chexmix.sh new file mode 100644 index 0000000000..b83bce6e58 --- /dev/null +++ b/var/spack/repos/builtin/packages/chexmix/chexmix.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# convenience wrapper for the chexmix jar file +java -jar chexmix.jar "$@" diff --git a/var/spack/repos/builtin/packages/chexmix/package.py b/var/spack/repos/builtin/packages/chexmix/package.py new file mode 100644 index 0000000000..6654102f4f --- /dev/null +++ b/var/spack/repos/builtin/packages/chexmix/package.py @@ -0,0 +1,49 @@ +# Copyright 2013-2023 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 os + +from spack.package import * + + +class Chexmix(Package): + """ChExMix: the ChIP-exo mixture model. ChExMix aims to characterize protein-DNA binding + subtypes in ChIP-exo experiments.""" + + homepage = "http://mahonylab.org/software/chexmix" + url = "https://github.com/seqcode/chexmix/releases/download/v0.51/chexmix.v0.51.jar" + + # The naming of the .jar files is inconsistent on GitHub. Until this is resolved, downloads + # that don't match the above url spec will need to be renamed - see rename_versions(). + version( + "0.52", + url="https://github.com/seqcode/chexmix/releases/download/v0.52/chexmix.v0.52.public.jar", + sha256="7f856921b6071092cfcf226e4f99d9ab80587cf05502b41d00b8e5e16ccbfcdd", + expand=False, + ) + + depends_on("java@8:", type="run") + depends_on("meme", type="run") + + @run_before("install") + def rename_versions(self): + if self.version == Version("0.52"): + os.rename("chexmix.v0.52.public.jar", "chexmix.v0.52.jar") + + def install(self, spec, prefix): + # install .jar file + mkdirp(prefix.bin) + jar_file = "chexmix.v{0}.jar".format(self.version) + install(jar_file, prefix.bin) + # create a helper script to launch the .jar + script_sh = join_path(os.path.dirname(__file__), "chexmix.sh") + script = prefix.bin.chexmix + install(script_sh, script) + set_executable(script) + # set the helper script to explicitly point to java and the .jar file + java = self.spec["java"].prefix.bin.java + kwargs = {"ignore_absent": False, "backup": False, "string": False} + filter_file("^java", java, script, **kwargs) + filter_file("chexmix.jar", join_path(prefix.bin, jar_file), script, **kwargs) -- cgit v1.2.3-60-g2f50