Ejemplo n.º 1
0
def install_biobambam(env):
    version = "0.0.93"
    revision = "20131002162026"
    libmaus_version = "0.0.74"
    libmaus_revision = "20131002161300"
    url = "https://github.com/gt1/biobambam/archive/%s-release-%s.tar.gz" \
          % (version, revision)
    libmaus_url = "https://github.com/gt1/libmaus/archive/%s-release-%s.tar.gz" \
                  % (libmaus_version, libmaus_revision)
    if not versioncheck.up_to_date(env, "bamtofastq --version", version, stdout_flag="This is biobambam version"):
        if not versioncheck.up_to_date(env, "pkg-config --modversion libmaus", libmaus_version):
            _get_install(libmaus_url, env, shared._configure_make)
        _get_install(url, env, shared._configure_make)
Ejemplo n.º 2
0
def install_samtools(env):
    """SAM Tools provide various utilities for manipulating alignments in the SAM format.
    http://samtools.sourceforge.net/
    """
    default_version = "0.1.19"
    version = env.get("tool_version", default_version)
    if versioncheck.up_to_date(env, "samtools", version, stdout_flag="Version:"):
        env.logger.info("samtools version {0} is up to date; not installing"
            .format(version))
        return
    url = "http://downloads.sourceforge.net/project/samtools/samtools/" \
          "%s/samtools-%s.tar.bz2" % (version, version)
    def _safe_ncurses_make(env):
        """Combine samtools, removing ncurses refs if not present on system.
        """
        with settings(warn_only=True):
            result = env.safe_run("make")
        # no ncurses, fix Makefile and rebuild
        if result.failed:
            env.safe_sed("Makefile", "-D_CURSES_LIB=1", "-D_CURSES_LIB=0")
            env.safe_sed("Makefile", "-lcurses", "# -lcurses")
            env.safe_run("make clean")
            env.safe_run("make")
        install_dir = shared._get_bin_dir(env)
        for fname in env.safe_run_output("ls -1 samtools bcftools/bcftools bcftools/vcfutils.pl misc/wgsim").split("\n"):
            env.safe_sudo("cp -f %s %s" % (fname.rstrip("\r"), install_dir))
    _get_install(url, env, _safe_ncurses_make)
Ejemplo n.º 3
0
def install_gemini(env):
    """A lightweight db framework for disease and population genetics.
    https://github.com/arq5x/gemini
    """
    version = "0.6.4"
    if versioncheck.up_to_date(env, "gemini -v", version,
                               stdout_flag="gemini"):
        return
    elif not shared._executable_not_on_path("gemini -v"):
        env.safe_run("gemini update")
    else:
        iurl = "https://raw.github.com/arq5x/gemini/master/gemini/scripts/gemini_install.py"
        data_dir = os.path.join(
            env.system_install,
            "local" if env.system_install.find("/local") == -1 else "",
            "share", "gemini")
        with _make_tmp_dir(ext="-gemini") as work_dir:
            with cd(work_dir):
                if env.safe_exists(os.path.basename(iurl)):
                    env.safe_run("rm -f %s" % os.path.basename(iurl))
                installer = shared._remote_fetch(env, iurl)
                env.safe_run("%s %s %s %s %s" %
                             (_python_cmd(env), installer, "" if env.use_sudo
                              else "--nosudo", env.system_install, data_dir))
                env.safe_run("rm -f gemini_install.py")
Ejemplo n.º 4
0
def install_samtools(env):
    """SAM Tools provide various utilities for manipulating alignments in the SAM format.
    http://samtools.sourceforge.net/
    """
    default_version = "0.1.19"
    version = env.get("tool_version", default_version)
    if versioncheck.up_to_date(env,
                               "samtools",
                               version,
                               stdout_flag="Version:"):
        env.logger.info(
            "samtools version {0} is up to date; not installing".format(
                version))
        return
    url = "http://downloads.sourceforge.net/project/samtools/samtools/" \
          "%s/samtools-%s.tar.bz2" % (version, version)

    def _safe_ncurses_make(env):
        """Combine samtools, removing ncurses refs if not present on system.
        """
        with settings(warn_only=True):
            result = env.safe_run("make")
        # no ncurses, fix Makefile and rebuild
        if result.failed:
            env.safe_sed("Makefile", "-D_CURSES_LIB=1", "-D_CURSES_LIB=0")
            env.safe_sed("Makefile", "-lcurses", "# -lcurses")
            env.safe_run("make clean")
            env.safe_run("make")
        install_dir = shared._get_bin_dir(env)
        for fname in env.safe_run_output(
                "ls -1 samtools bcftools/bcftools bcftools/vcfutils.pl misc/wgsim"
        ).split("\n"):
            env.safe_sudo("cp -f %s %s" % (fname.rstrip("\r"), install_dir))

    _get_install(url, env, _safe_ncurses_make)
Ejemplo n.º 5
0
def install_freebayes(env):
    """Bayesian haplotype-based polymorphism discovery and genotyping.
    https://github.com/ekg/freebayes
    """
    version = "0.9.9.2-21"
    revision = "4f2fe5eee"
    if versioncheck.up_to_date(env,
                               "freebayes",
                               version,
                               stdout_flag="version:"):
        return
    repository = "git clone --recursive https://github.com/ekg/freebayes.git"

    def _fix_tabixpp_library_order(env):
        env.safe_sed("vcflib/tabixpp/Makefile", "-ltabix", "-ltabix -lz")

    def _fix_autoversion(env):
        env.safe_sed("src/Makefile",
                     "all: autoversion ../bin/freebayes ../bin/bamleftalign",
                     "all: ../bin/freebayes ../bin/bamleftalign")

    def _freebayes_fixes(env):
        _fix_tabixpp_library_order(env)
        _fix_autoversion(env)

    _get_install(repository,
                 env,
                 _make_copy("ls -1 bin/*"),
                 post_unpack_fn=_freebayes_fixes,
                 revision=revision)
Ejemplo n.º 6
0
def install_lumpy(env):
    """a general probabilistic framework for structural variant discovery
    https://github.com/arq5x/lumpy-sv
    """
    version = "0.1.2"
    revision = "a8b9e14cc5"
    if versioncheck.up_to_date(env, "lumpy", version, stdout_flag="Program:"):
        return
    repository = "git clone https://github.com/arq5x/lumpy-sv.git"

    def _add_gsl_includes():
        """Add multi-environment include and library links for finding GNU Scientific Libraries.
        """
        env.safe_sed("defs.local", "^\([^#]\)", "#\1")
        env.safe_append(
            "defs.local",
            ("GSL_INCLUDE=-I/usr/local/include -I/usr/local/include/gsl "
             "-I/usr/include/gsl -I%s/include/gsl" % env.system_install))
        env.safe_append("defs.local",
                        ("GSL_LINK=-L/usr/local/lib -L/usr/lib -L%s/lib" %
                         env.system_install))

    _get_install(repository,
                 env,
                 _make_copy("ls -1 bin/*", _add_gsl_includes),
                 revision=revision)
Ejemplo n.º 7
0
def install_biobambam(env):
    version = "0.0.96"
    revision = "20131022183655"
    libmaus_version = "0.0.77"
    libmaus_revision = "20131022183354"
    url = "https://github.com/gt1/biobambam/archive/%s-release-%s.tar.gz" \
          % (version, revision)
    libmaus_url = "https://github.com/gt1/libmaus/archive/%s-release-%s.tar.gz" \
                  % (libmaus_version, libmaus_revision)
    if not versioncheck.up_to_date(env,
                                   "bamtofastq --version",
                                   version,
                                   stdout_flag="This is biobambam version"):
        if not versioncheck.up_to_date(env, "pkg-config --modversion libmaus",
                                       libmaus_version):
            _get_install(libmaus_url, env, shared._configure_make)
        _get_install(url, env, shared._configure_make)
Ejemplo n.º 8
0
def install_bedtools(env):
    """A flexible suite of utilities for comparing genomic features.
    https://code.google.com/p/bedtools/
    """
    version = "2.17.0"
    if versioncheck.up_to_date(env, "bedtools --version", version, stdout_flag="bedtools"):
        return
    url = "https://bedtools.googlecode.com/files/" \
          "BEDTools.v%s.tar.gz" % version
    _get_install(url, env, _make_copy("ls -1 bin/*"))
Ejemplo n.º 9
0
def install_delly(env):
    """DELLY: Structural variant discovery by integrated paired-end and split-read analysis
    http://www.embl.de/~rausch/delly.html
    """
    version = "0.0.11"
    if versioncheck.up_to_date(env, "delly", version, stdout_flag="Deletion finder"):
        return
    url = "http://www.embl.de/~rausch/delly_v%s.tar.gz" % version
    _get_install(url, env, _make_copy("find -perm -100 -type f",
                                      do_make=False))
Ejemplo n.º 10
0
def install_delly(env):
    """DELLY: Structural variant discovery by integrated paired-end and split-read analysis
    http://www.embl.de/~rausch/delly.html
    """
    version = "0.0.11"
    if versioncheck.up_to_date(env, "delly", version, stdout_flag="Deletion finder"):
        return
    url = "http://www.embl.de/~rausch/delly_v%s.tar.gz" % version
    _get_install(url, env, _make_copy("find -perm -100 -type f",
                                      do_make=False))
Ejemplo n.º 11
0
def install_freec(env):
    """Control-FREEC: a tool for detection of copy number changes and allelic imbalances.
    http://bioinfo-out.curie.fr/projects/freec/
    """
    version = "6.4"
    if env.distribution in ["ubuntu", "debian"]:
        if env.is_64bit:
            url = "http://bioinfo-out.curie.fr/projects/freec/src/FREEC_Linux64.tar.gz"
        else:
            url = "http://bioinfo-out.curie.fr/projects/freec/src/FREEC_LINUX32.tar.gz"

    if not versioncheck.up_to_date(env, "freec", version, stdout_index=1):
        _get_install(url, env, _make_copy("find -name 'freec'"), dir_name=".")
Ejemplo n.º 12
0
def install_freec(env):
    """Control-FREEC: a tool for detection of copy number changes and allelic imbalances.
    http://bioinfo-out.curie.fr/projects/freec/
    """
    version = "6.4"
    if env.distribution in ["ubuntu", "debian"]:
        if env.is_64bit:
            url = "http://bioinfo-out.curie.fr/projects/freec/src/FREEC_Linux64.tar.gz"
        else:
            url = "http://bioinfo-out.curie.fr/projects/freec/src/FREEC_LINUX32.tar.gz"

        if not versioncheck.up_to_date(env, "freec", version, stdout_index=1):
            _get_install(url, env, _make_copy("find -name 'freec'"), dir_name=".")
Ejemplo n.º 13
0
def install_bedtools(env):
    """A flexible suite of utilities for comparing genomic features.
    https://code.google.com/p/bedtools/
    """
    version = "2.17.0"
    if versioncheck.up_to_date(env,
                               "bedtools --version",
                               version,
                               stdout_flag="bedtools"):
        return
    url = "https://bedtools.googlecode.com/files/" \
          "BEDTools.v%s.tar.gz" % version
    _get_install(url, env, _make_copy("ls -1 bin/*"))
Ejemplo n.º 14
0
def install_featurecounts(env):
    """
    featureCounts from the subread package for counting reads mapping to
    genomic features
    """
    default_version = "1.4.4"
    version = env.get("tool_version", default_version)
    if versioncheck.up_to_date(env, "featureCounts", version, stdout_flag="Version"):
        return
    platform = "MacOS" if env.distribution == "macosx" else "Linux"
    url = ("http://downloads.sourceforge.net/project/subread/"
           "subread-%s/subread-%s-%s-x86_64.tar.gz"
           % (version, version, platform))
    _get_install(url, env, _make_copy("find . -type f -perm -100 -name 'featureCounts'",
                                      do_make=False))
Ejemplo n.º 15
0
def install_grabix(env):
    """a wee tool for random access into BGZF files
    https://github.com/arq5x/grabix
    """
    version = "0.1.1"
    try:
        uptodate = versioncheck.up_to_date(env, "grabix", version, stdout_flag="version:")
    # Old versions will not have any version information
    except IOError:
        uptodate = False
    if uptodate:
        return
    revision = "80150d00e5"
    repository = "git clone https://github.com/arq5x/grabix.git"
    _get_install(repository, env, _make_copy("ls -1 grabix"),
                 revision=revision)
Ejemplo n.º 16
0
def install_vcftools(env):
    """Work with VCF files, such as those generated by the 1000 Genomes Project.
    http://vcftools.sourceforge.net/
    """
    version = "0.1.11"
    url = "http://downloads.sourceforge.net/project/vcftools/vcftools_{v}.tar.gz".format(
        v=version)
    if versioncheck.up_to_date(env, "vcftools", version, stdout_flag="VCFtools"):
        return
    def _vcf_make(env):
        env.safe_sudo("make install PREFIX={dir}".format(dir=env.system_install))
        for perl_module in ["FaSlice.pm", "Vcf.pm", "VcfStats.pm"]:
            env.safe_sudo("cp perl/%s %s/lib/perl5" % (perl_module, env.system_install))
        env.safe_sudo("make clean")
    _get_install(url, env, _vcf_make)
    _get_install_local(url, env, _make_copy())
Ejemplo n.º 17
0
def install_vcftools(env):
    """Work with VCF files, such as those generated by the 1000 Genomes Project.
    http://vcftools.sourceforge.net/
    """
    version = "0.1.11"
    url = "http://downloads.sourceforge.net/project/vcftools/vcftools_{v}.tar.gz".format(
        v=version)
    if versioncheck.up_to_date(env, "vcftools", version, stdout_flag="VCFtools"):
        return
    def _vcf_make(env):
        env.safe_sudo("make install PREFIX={dir}".format(dir=env.system_install))
        for perl_module in ["FaSlice.pm", "Vcf.pm", "VcfStats.pm"]:
            env.safe_sudo("cp perl/%s %s/lib/perl5" % (perl_module, env.system_install))
        env.safe_sudo("make clean")
    _get_install(url, env, _vcf_make)
    _get_install_local(url, env, _make_copy())
Ejemplo n.º 18
0
def install_bwa(env):
    """BWA:  aligns short nucleotide sequences against a long reference sequence.
    http://bio-bwa.sourceforge.net/
    """
    default_version = "0.7.5a"
    version = env.get("tool_version", default_version)
    if versioncheck.up_to_date(env, "bwa", version, stdout_flag="Version:"):
        return
    url = "http://downloads.sourceforge.net/project/bio-bwa/bwa-%s.tar.bz2" % (
            version)
    def _fix_makefile():
        arch = env.safe_run_output("uname -m")
        # if not 64bit, remove the appropriate flag
        if arch.find("x86_64") == -1:
            env.safe_run("sed -i.bak -r -e 's/-O2 -m64/-O2/g' Makefile")
    _get_install(url, env, _make_copy("ls -1 bwa qualfa2fq.pl",
                                        _fix_makefile))
Ejemplo n.º 19
0
def install_bwa(env):
    """BWA:  aligns short nucleotide sequences against a long reference sequence.
    http://bio-bwa.sourceforge.net/
    """
    default_version = "0.7.5a"
    version = env.get("tool_version", default_version)
    if versioncheck.up_to_date(env, "bwa", version, stdout_flag="Version:"):
        return
    url = "http://downloads.sourceforge.net/project/bio-bwa/bwa-%s.tar.bz2" % (
            version)
    def _fix_makefile():
        arch = env.safe_run_output("uname -m")
        # if not 64bit, remove the appropriate flag
        if arch.find("x86_64") == -1:
            env.safe_run("sed -i.bak -r -e 's/-O2 -m64/-O2/g' Makefile")
    _get_install(url, env, _make_copy("ls -1 bwa qualfa2fq.pl",
                                        _fix_makefile))
Ejemplo n.º 20
0
def install_lumpy(env):
    """a general probabilistic framework for structural variant discovery
    https://github.com/arq5x/lumpy-sv
    """
    version = "0.1.2"
    revision = "a8b9e14cc5"
    if versioncheck.up_to_date(env, "lumpy", version, stdout_flag="Program:"):
        return
    repository = "git clone https://github.com/arq5x/lumpy-sv.git"
    def _add_gsl_includes():
        """Add multi-environment include and library links for finding GNU Scientific Libraries.
        """
        env.safe_sed("defs.local", "^\([^#]\)", "#\1")
        env.safe_append("defs.local", ("GSL_INCLUDE=-I/usr/local/include -I/usr/local/include/gsl "
                                       "-I/usr/include/gsl -I%s/include/gsl" % env.system_install))
        env.safe_append("defs.local", ("GSL_LINK=-L/usr/local/lib -L/usr/lib -L%s/lib" % env.system_install))
    _get_install(repository, env, _make_copy("ls -1 bin/*", _add_gsl_includes),
                 revision=revision)
Ejemplo n.º 21
0
def install_freebayes(env):
    """Bayesian haplotype-based polymorphism discovery and genotyping.
    https://github.com/ekg/freebayes
    """
    version = "0.9.9.2-14"
    revision = "10ac8d449"
    if versioncheck.up_to_date(env, "freebayes", version, stdout_flag="version:"):
        return
    repository = "git clone --recursive https://github.com/ekg/freebayes.git"
    def _fix_tabixpp_library_order(env):
        env.safe_sed("vcflib/tabixpp/Makefile", "-ltabix", "-ltabix -lz")
    def _fix_autoversion(env):
        env.safe_sed("src/Makefile", "all: autoversion ../bin/freebayes ../bin/bamleftalign",
                     "all: ../bin/freebayes ../bin/bamleftalign")
    def _freebayes_fixes(env):
        _fix_tabixpp_library_order(env)
        _fix_autoversion(env)
    _get_install(repository, env, _make_copy("ls -1 bin/*"),
                 post_unpack_fn=_freebayes_fixes,
                 revision=revision)
Ejemplo n.º 22
0
def install_featurecounts(env):
    """
    featureCounts from the subread package for counting reads mapping to
    genomic features
    """
    default_version = "1.4.4"
    version = env.get("tool_version", default_version)
    if versioncheck.up_to_date(env,
                               "featureCounts",
                               version,
                               stdout_flag="Version"):
        return
    platform = "MacOS" if env.distribution == "macosx" else "Linux"
    url = ("http://downloads.sourceforge.net/project/subread/"
           "subread-%s/subread-%s-%s-x86_64.tar.gz" %
           (version, version, platform))
    _get_install(
        url, env,
        _make_copy("find . -type f -perm -100 -name 'featureCounts'",
                   do_make=False))
Ejemplo n.º 23
0
def install_grabix(env):
    """a wee tool for random access into BGZF files
    https://github.com/arq5x/grabix
    """
    version = "0.1.2"
    revision = "a78cbaf488"
    try:
        uptodate = versioncheck.up_to_date(env,
                                           "grabix",
                                           version,
                                           stdout_flag="version:")
    # Old versions will not have any version information
    except IOError:
        uptodate = False
    if uptodate:
        return
    repository = "git clone https://github.com/arq5x/grabix.git"
    _get_install(repository,
                 env,
                 _make_copy("ls -1 grabix"),
                 revision=revision)
Ejemplo n.º 24
0
def install_gemini(env):
    """A lightweight db framework for disease and population genetics.
    https://github.com/arq5x/gemini
    """
    version = "0.6.1"
    if versioncheck.up_to_date(env, "gemini -v", version, stdout_flag="gemini"):
        return
    elif not shared._executable_not_on_path("gemini -v"):
        env.safe_run("gemini update")
    else:
        iurl = "https://raw.github.com/arq5x/gemini/master/gemini/scripts/gemini_install.py"
        data_dir = os.path.join(env.system_install,
                                "local" if env.system_install.find("/local") == -1 else "",
                                "share", "gemini")
        with _make_tmp_dir(ext="-gemini") as work_dir:
            with cd(work_dir):
                if env.safe_exists(os.path.basename(iurl)):
                    env.safe_run("rm -f %s" % os.path.basename(iurl))
                installer = shared._remote_fetch(env, iurl)
                env.safe_run("%s %s %s %s %s" %
                             (_python_cmd(env), installer, "" if env.use_sudo else "--nosudo",
                              env.system_install, data_dir))
                env.safe_run("rm -f gemini_install.py")