summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/snpeff/package.py
blob: 7544d504b90af9f189c77edda31e0cdd5ed8cb18 (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
# 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 import *
import os.path


class Snpeff(Package, SourceforgePackage):
    """SnpEff is a variant annotation and effect prediction tool. It
    annotates and predicts the effects of genetic variants (such as
    amino acid changes)."""

    homepage = "http://snpeff.sourceforge.net/"
    sourceforge_mirror_path = "snpeff/snpEff_latest_core.zip"

    version('2017-11-24', sha256='d55a7389a78312947c1e7dadf5e6897b42d3c6e942e7c1b8ec68bb35d2ae2244')

    depends_on('jdk', type=('build', 'run'))

    def install(self, spec, prefix):
        install_tree('snpEff', prefix.bin)

        # Set up a helper script to call java on the jar files,
        # explicitly codes the path for java and the jar files.
        scripts = ['snpEff', 'SnpSift']

        for script in scripts:
            script_sh = join_path(os.path.dirname(__file__), script + ".sh")
            script_path = join_path(prefix.bin, script)
            install(script_sh, script_path)
            set_executable(script_path)

            # Munge the helper script to explicitly point to java and the
            # jar file.
            java = self.spec['java'].prefix.bin.java
            kwargs = {'backup': False}
            filter_file('^java', java, script_path, **kwargs)
            filter_file(script + '.jar',
                        join_path(prefix.bin, script + '.jar'),
                        script_path, **kwargs)