summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/homer/package.py
blob: 21401cc206434c7a2a294280e647b878b258ff4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# 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)

from os import symlink

from spack.package import *


class Homer(Package):
    """Software for motif discovery and next generation sequencing analysis"""

    homepage = "http://homer.ucsd.edu/homer"
    url = "http://homer.ucsd.edu/homer/data/software/homer.v4.9.1.zip"

    license("GPL-3.0-only")

    version("4.11.1", sha256="80d1cd00616729894017b24a36a2ef81f9cde8bd364e875aead1e0cfb500c82b")
    version("4.9.1", sha256="ad1303b0b0400dc8a88dbeae1ee03a94631977b751a3d335326c4febf0eec3a9")

    depends_on("perl", type=("build", "run"))
    depends_on("r-biocgenerics", type="run")
    depends_on("r-biocparallel", type="run")
    depends_on("r-edger", type="run")
    depends_on("r-deseq2", type="run")

    variant("data", default=False, description="Download genome data packages")

    def install(self, spec, prefix):
        # initialize homer directories
        basedir = join_path(prefix.lib, "homer")
        mkdirp(basedir)

        install_tree(".", basedir)

        # symlink bin so it is included in the PATH
        symlink(join_path(basedir, "bin"), prefix.bin)

        # override homer base directory in configure script
        filter_file(
            "my $homeDir = $1;",
            'my $homeDir = "{0}";'.format(basedir),
            "configureHomer.pl",
            string=True,
        )

        # compile/prepare binaries and perl scripts with the correct paths
        perl = which("perl")
        perl("configureHomer.pl", "-local")

        # download extra data if requested
        if "+data" in spec:
            perl("configureHomer.pl", "-install", "-all")