summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/braker/package.py
blob: 879ab34eba89aa307478651bebc952e923336744 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 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 glob

from spack.package import *


class Braker(Package):
    """BRAKER is a pipeline for unsupervised RNA-Seq-based genome annotation
    that combines the advantages of GeneMark-ET and AUGUSTUS"""

    homepage = "http://exon.gatech.edu/braker1.html"
    url = "https://github.com/Gaius-Augustus/BRAKER/archive/v2.1.4.tar.gz"
    list_url = "http://bioinf.uni-greifswald.de/augustus/binaries/old"

    license("Artistic-1.0")

    version("2.1.6", sha256="eef3c4037364472988a010322cbd79b5171158f9c016f4383809adade4866c06")
    version("2.1.4", sha256="d48af5649cc879343046f9ddf180fe2c709b5810e0b78cf314bf298514d31d52")
    version(
        "1.11",
        sha256="cb2d9abe1720ed58753d362eee4af3791007efc617754804882d31f9fe2eab00",
        url="https://bioinf.uni-greifswald.de/augustus/binaries/old/BRAKER1_v1.11.tar.gz",
    )

    depends_on("perl", type=("build", "run"))
    depends_on("perl-scalar-util-numeric", type=("build", "run"))
    depends_on("perl-parallel-forkmanager", type=("build", "run"))
    depends_on("perl-file-which", type=("build", "run"))
    depends_on("perl-yaml", type=("build", "run"))
    depends_on("perl-hash-merge", type=("build", "run"))
    depends_on("perl-logger-simple", type=("build", "run"))
    depends_on("perl-file-homedir", when="@2.1.4:", type=("build", "run"))
    depends_on("perl-list-moreutils", when="@2.1.6:", type=("build", "run"))
    depends_on("augustus")
    depends_on("augustus@3.2.3", when="@:2.1.0")
    depends_on("genemark-et")
    depends_on("bamtools")
    depends_on("samtools")
    depends_on("diamond")

    def install(self, spec, prefix):
        mkdirp(prefix.bin)
        mkdirp(prefix.lib)
        if self.version < Version("2.1.2"):
            install("braker.pl", prefix.bin)
            install("filterGenemark.pl", prefix.bin)
            install("filterIntronsFindStrand.pl", prefix.bin)
            install("helpMod.pm", prefix.lib)
        else:
            install_tree("docs", prefix.docs)
            install_tree("example", prefix.example)
            with working_dir("scripts"):
                install("helpMod.pm", prefix.lib)
                install("*.pl", prefix.bin)

    @run_after("install")
    def filter_sbang(self):
        with working_dir(self.prefix.bin):
            pattern = "^#!.*/usr/bin/env perl"
            repl = "#!{0}".format(self.spec["perl"].command.path)
            files = glob.iglob("*.pl")
            for file in files:
                filter_file(pattern, repl, *files, backup=False)

    def setup_run_environment(self, env):
        env.prepend_path("PERL5LIB", self.prefix.lib)