summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/blast2go/package.py
blob: 3c8605fadfd6cc7bd0f411ddb29236ce45d08939 (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
# 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 archspec

from spack import *


class Blast2go(Package):
    """Blast2GO is a bioinformatics platform for high-quality functional
       annotation and analysis of genomic datasets."""

    homepage = "https://www.blast2go.com/"

    version('5.2.5', sha256='c37aeda25f96ac0553b52da6b5af3167d50671ddbfb3b39bcb11afe5d0643891')

    for t in set([str(x.family) for x in archspec.cpu.TARGETS.values()
                 if str(x.family) != 'x86_64']):
        conflicts('target={0}:'.format(t), msg='blast2go is available x86_64 only')

    depends_on('bash', type='build')
    depends_on('blast-plus', type='run')
    depends_on('java', type='build')

    def url_for_version(self, version):
        fname = 'Blast2GO_unix_{0}.zip'.format(version.underscored)
        return 'http://resources.biobam.com/software/blast2go/nico/%s' % fname

    def install(self, spec, prefix):
        # blast2go install script prompts for the following:
        #
        # continue? [o/c] => o
        # installation prefix => prefix
        # desktop icon [y/n] => n
        # run blast2go? [y/n] => n

        config_input_file = 'spack-config.in'

        config_input_data = [
            'o\n',
            prefix.bin + '\n',
            'n\n',
            'n\n',
        ]

        with open(config_input_file, 'w') as f:
            f.writelines(config_input_data)

        with open(config_input_file, 'r') as f:
            bash = which('bash')
            bash('Blast2GO_unix_%s.sh' % self.version.underscored, input=f)