File: spades_init.py

package info (click to toggle)
spades 3.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,080 kB
  • ctags: 26,239
  • sloc: cpp: 117,391; ansic: 28,438; python: 5,716; perl: 3,139; pascal: 348; makefile: 270; xml: 167; java: 158; sh: 67
file content (52 lines) | stat: -rwxr-xr-x 1,875 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python

############################################################################
# Copyright (c) 2015 Saint Petersburg State University
# Copyright (c) 2011-2014 Saint Petersburg Academic University
# All Rights Reserved
# See file LICENSE for details.
############################################################################

import os
import sys
from os.path import abspath, dirname, realpath, join, isfile

source_dirs = ["", "truspades", "common"]

# developers configuration
spades_home = abspath(dirname(realpath(__file__)))
bin_home = join(spades_home, 'bin')
python_modules_home = join(spades_home, 'src')
ext_python_modules_home = join(spades_home, 'ext', 'src', 'python_libs')
spades_version = ''


def init():
    global spades_home
    global bin_home
    global python_modules_home
    global spades_version
    global ext_python_modules_home

    # users configuration (spades_init.py and spades binary are in the same directory)
    if os.path.isfile('/usr/lib/spades/bin/spades'):
        bin_home = '/usr/lib/spades/bin/'
        spades_home = '/usr/share/spades'
        python_modules_home = spades_home
        ext_python_modules_home = spades_home
    elif os.path.isfile(os.path.join(spades_home, 'spades')):
        install_prefix = dirname(spades_home)
        bin_home = join(install_prefix, 'bin')
        spades_home = join(install_prefix, 'share', 'spades')
        python_modules_home = spades_home
        ext_python_modules_home = spades_home

    for dir in source_dirs:
        sys.path.append(join(python_modules_home, 'spades_pipeline', dir))

    spades_version = open(join(spades_home, 'VERSION'), 'r').readline().strip()


if __name__ == '__main__':
    spades_py_path = join(dirname(realpath(__file__)), 'spades.py')
    sys.stderr.write('Please use ' + spades_py_path + ' for running SPAdes genome assembler\n')