Exemple #1
0
def install_protvis(env):
    """ Installs Andrew Brock's proteomics visualize tool.
    https://bitbucket.org/Andrew_Brock/proteomics-visualise/
    """
    _setup_protvis_env(env)
    protvis_home = env["protvis_home"]
    env.safe_sudo(
        "sudo apt-get -y --force-yes install libxml2-dev libxslt-dev")

    run("rm -rf protvis")
    run("git clone -b lorikeet https://github.com/jmchilton/protvis.git")
    with cd("protvis"):
        run("git submodule init")
        run("git submodule update")
        env.safe_sudo("rsync -avur --delete-after . %s" % (protvis_home))
        _chown_galaxy(env, protvis_home)
        with cd(protvis_home):
            env.safe_sudo("./setup.sh", user=env.get("galaxy_user", "galaxy"))

    #default_revision = "8cc6af1c492c"
    #
    #revision = env.get("protvis_revision", default_revision)
    #url = _get_bitbucket_download_url(revision, "https://bitbucket.org/Andrew_Brock/proteomics-visualise")
    #def _make(env):
    #_get_install(url, env, _make)

    galaxy_data_dir = env.get('galaxy_data_dir', "/mnt/galaxyData/")
    protvis_converted_files_dir = env.get('protvis_converted_files_dir')
    _write_to_file(
        '''GALAXY_ROOT = "%s"
PATH_WHITELIST = ["%s/files/", "%s"]
CONVERTED_FILES = "%s"
''' % (env.galaxy_home, galaxy_data_dir, protvis_converted_files_dir,
       protvis_converted_files_dir), "%s/conf.py" % protvis_home, "0755")
    _setup_protvis_service(env)
Exemple #2
0
def install_protvis(env):
    """ Installs Andrew Brock's proteomics visualize tool.
    https://bitbucket.org/Andrew_Brock/proteomics-visualise/
    """
    _setup_protvis_env(env)
    default_revision = "8cc6af1c492c"
    protvis_home = env["protvis_home"]
    revision = env.get("protvis_revision", default_revision)
    url = _get_bitbucket_download_url(revision, "https://bitbucket.org/Andrew_Brock/proteomics-visualise")
    galaxy_data_dir = env.get('galaxy_data_dir', "/mnt/galaxyData/")
    protvis_converted_files_dir = env.get('protvis_converted_files_dir')

    env.safe_sudo("sudo apt-get -y --force-yes install libxml2-dev libxslt-dev")

    def _make(env):
        env.safe_sudo("rsync -avur --delete-after . %s" % (protvis_home))
        _chown_galaxy(env, protvis_home)
        with cd(protvis_home):
            env.safe_sudo("./setup.sh", user=env.get("galaxy_user", "galaxy"))
    _get_install(url, env, _make)
    _write_to_file('''GALAXY_ROOT = "%s"
PATH_WHITELIST = ["%s/files/", "%s"]
CONVERTED_FILES = "%s"
''' % (env.galaxy_home, galaxy_data_dir, protvis_converted_files_dir, protvis_converted_files_dir), "%s/conf.py" % protvis_home, 0755)
    _setup_protvis_service(env)
Exemple #3
0
def install_protkgem(env):
    """This method installs Ira Cooke's ProtK framework for the galaxy user.

    By default this will install ProtK from rubygems server, but if
    env.protk_version is set to <version>@<url> (e.g.
    1.1.5@https://bitbucket.org/iracooke/protk-working) the
    gem will be cloned with hg and installed from source.
    """
    _prep_galaxy(env)
    default_version = "1.2.0"
    version_and_revision = env.get("protk_version", default_version)
    install_from_source = version_and_revision.find("@") > 0
    # e.g. protk_version = 1.1.5@https://bitbucket.org/iracooke/protk-working
    if install_from_source:
        (version, revision) = version_and_revision.split("@")
        url = _get_bitbucket_download_url(revision, "https://bitbucket.org/iracooke/protk")
    else:
        version = version_and_revision

    ruby_version = "1.9.3"
    force_rvm_install = False
    with prefix("HOME=~%s" % env.galaxy_user):
        def rvm_exec(env, cmd="", rvm_cmd="use"):
            prefix = ". $HOME/.rvm/scripts/rvm; rvm %s %s; " % (rvm_cmd, ruby_version)
            env.safe_sudo("%s %s" % (prefix, cmd), user=env.galaxy_user)
        if not exists("$HOME/.rvm") or force_rvm_install:
            env.safe_sudo("curl -L get.rvm.io | bash -s stable; source ~%s/.rvm/scripts/rvm" % (env.galaxy_user), user=env.galaxy_user)
            rvm_exec(env, rvm_cmd="install")
        if not install_from_source:
            # Typical rubygem install
            rvm_exec(env, "gem install  --no-ri --no-rdoc protk -v %s" % version)
        else:
            with cd("~%s" % env.galaxy_user):
                env.safe_sudo("rm -rf protk_source; hg clone '%s' protk_source" % url, user=env.galaxy_user)
                rvm_exec(env, "cd protk_source; gem build protk.gemspec; gem install protk")

        protk_properties = {}
        ## ProtK can set these up itself, should make that an option.
        protk_properties["tpp_root"] = os.path.join(env.galaxy_tools_dir, "transproteomic_pipeline", "default")
        protk_properties['openms_root'] = "/usr"  # os.path.join(env.galaxy_tools_dir, "openms", "default", "bin")
        ### Assumes omssa, blast, and transproteomic_pipeline CBL galaxy installs.
        protk_properties['omssa_root'] = os.path.join(env.galaxy_tools_dir, "omssa", "default", "bin")
        protk_properties['blast_root'] = os.path.join(env.galaxy_tools_dir, "blast+", "default")
        protk_properties['pwiz_root'] = os.path.join(env.galaxy_tools_dir, "transproteomic_pipeline", "default", "bin")
        # Other properties: log_file, blast_root
        env.safe_sudo("mkdir -p \"$HOME/.protk\"", user=env.galaxy_user)
        env.safe_sudo("mkdir -p \"$HOME/.protk/Databases\"", user=env.galaxy_user)

        _write_to_file(yaml.dump(protk_properties), "/home/%s/.protk/config.yml" % env.galaxy_user, 0755)

        rvm_exec(env, "protk_setup.rb galaxyenv")

        install_dir = os.path.join(env.galaxy_tools_dir, "protkgem", version)
        env.safe_sudo("mkdir -p '%s'" % install_dir)
        _chown_galaxy(env, install_dir)
        env.safe_sudo('ln -s -f "$HOME/.protk/galaxy/env.sh" "%s/env.sh"' % install_dir, user=env.galaxy_user)
        with cd(install_dir):
            with cd(".."):
                env.safe_sudo("ln -s -f '%s' default" % version)
def setup_wine_wrapper(env, to):
    basename = os.path.basename(to)
    contents = """#!/bin/bash
setup_proteomics_wine_env.sh
export WINEPREFIX=$HOME/.wine-proteomics
wine %s "$@"
""" % to
    bin_dir = _get_bin_dir(env)
    dest = "%s/%s" % (bin_dir, basename)
    _write_to_file(contents, dest, '0755')
Exemple #5
0
def setup_wine_wrapper(env, to):
    basename = os.path.basename(to)
    contents = """#!/bin/bash
setup_proteomics_wine_env.sh
export WINEPREFIX=$HOME/.wine-proteomics
wine %s "$@"
""" % to
    bin_dir = _get_bin_dir(env)
    dest = "%s/%s" % (bin_dir, basename)
    _write_to_file(contents, dest, '0755')
Exemple #6
0
def install_protk(env):
    """Installs Ira Cooke's ProtK framework for the
    galaxy user"""
    _prep_galaxy(env)
    default_version = "0.95@e81050c1c658"
    version_and_revision = env.get("protk_version", default_version)
    (version, revision) = version_and_revision.split("@")
    url = _get_bitbucket_download_url(revision, "https://bitbucket.org/iracooke/protk")
    with prefix("HOME=~%s" % env.galaxy_user):
        if not exists("$HOME/.rvm"):
            env.safe_sudo("curl -L get.rvm.io | bash -s stable; source ~%s/.rvm/scripts/rvm" % (env.galaxy_user), user=env.galaxy_user)
            env.safe_sudo(". $HOME/.rvm/scripts/rvm; rvm install 1.8.7 | cat", user=env.galaxy_user)
            env.safe_sudo(". $HOME/.rvm/scripts/rvm; rvm 1.8.7 do gem install rake --no-rdoc --no-ri", user=env.galaxy_user)

    install_dir = os.path.join(env.galaxy_tools_dir, "protk", version)

    def _make(env):
        env.safe_sudo("PROTK_DIR=%s; rm -rf $PROTK_DIR; mkdir -p $PROTK_DIR; mv * $PROTK_DIR" % (install_dir))

    _get_install(url, env, _make)
    _chown_galaxy(env, install_dir)
    with prefix("HOME=~%s" % env.galaxy_user):
        import StringIO
        output = StringIO.StringIO()
        get("%s/config.yml.sample" % install_dir, output)
        sample_config = yaml.load(output.getvalue())
        sample_config['test']['tpp_bin'] = os.path.join(env.galaxy_tools_dir, "transproteomic_pipeline", "default", "bin")
        sample_config['test']['omssa_bin'] = os.path.join(env.galaxy_tools_dir, "omssa", "default", "bin")
        sample_config['test']['ncbi_tools_bin'] = os.path.join(env.galaxy_tools_dir, "blast", "default", "bin")
        sample_config['test']['openms_bin'] = os.path.join(env.galaxy_tools_dir, "openms", "default", "bin")
        #sample_config['test']['galaxy_root']=env.galaxy_home
        _write_to_file(yaml.dump(sample_config), "%s/config.yml" % install_dir, 0755)
        with cd(install_dir):
            #env.safe_sudo("mv /tmp/config.yaml .")
            env.safe_sudo(". $HOME/.rvm/scripts/rvm; echo No | ./setup.sh", user=env.galaxy_user)
            env.safe_sudo("gcc -o make_random make_random.c -lm; ln -s ../make_random bin", user=env.galaxy_user)
    with cd("%s/.." % install_dir):
        env.safe_sudo("ln -s -f %s default" % version)
Exemple #7
0
def install_galaxy_protk(env):
    """This method installs Ira Cooke's ProtK framework. Very galaxy specific,
    can only be installed in context of custom Galaxy tool.


    By default this will install ProtK from rubygems server, but if
    env.protk_version is set to <version>@<url> (e.g.
    1.1.5@https://bitbucket.org/iracooke/protk-working) the
    gem will be cloned with hg and installed from source.
    """
    if not env.get('galaxy_tool_install', False):
        from cloudbio.custom.galaxy import _prep_galaxy
        _prep_galaxy(env)
    default_version = "1.2.2"
    version = env.get("tool_version", default_version)
    version_and_revision = version
    install_from_source = version_and_revision.find("@") > 0
    # e.g. protk_version = 1.1.5@https://bitbucket.org/iracooke/protk-working
    if install_from_source:
        (version, revision) = version_and_revision.split("@")
        url = _get_bitbucket_download_url(
            revision, "https://bitbucket.org/iracooke/protk")
    else:
        version = version_and_revision

    ruby_version = "1.9.3"
    force_rvm_install = False
    with prefix("HOME=~%s" % env.galaxy_user):

        def rvm_exec(env, cmd="", rvm_cmd="use", with_gemset=False):
            target = ruby_version if not with_gemset else "%s@%s" % (
                ruby_version, "protk-%s" % version)
            prefix = ". $HOME/.rvm/scripts/rvm; rvm %s %s; " % (rvm_cmd,
                                                                target)
            env.safe_sudo("%s %s" % (prefix, cmd), user=env.galaxy_user)

        if not env.safe_exists("$HOME/.rvm") or force_rvm_install:
            env.safe_sudo(
                "curl -L get.rvm.io | bash -s stable; source ~%s/.rvm/scripts/rvm"
                % (env.galaxy_user),
                user=env.galaxy_user)
            rvm_exec(env, rvm_cmd="install")
            rvm_exec(env, cmd="rvm gemset create protk-%s" % version)
        if not install_from_source:
            # Typical rubygem install
            rvm_exec(env,
                     "gem install  --no-ri --no-rdoc protk -v %s" % version,
                     with_gemset=True)
        else:
            with cd("~%s" % env.galaxy_user):
                env.safe_sudo(
                    "rm -rf protk_source; hg clone '%s' protk_source" % url,
                    user=env.galaxy_user)
                rvm_exec(
                    env,
                    "cd protk_source; gem build protk.gemspec; gem install protk",
                    with_gemset=True)

        protk_properties = {}
        ## ProtK can set these up itself, should make that an option.
        protk_properties["tpp_root"] = os.path.join(env.galaxy_tools_dir,
                                                    "transproteomic_pipeline",
                                                    "default")
        protk_properties[
            'openms_root'] = "/usr"  # os.path.join(env.galaxy_tools_dir, "openms", "default", "bin")
        ### Assumes omssa, blast, and transproteomic_pipeline CBL galaxy installs.
        protk_properties['omssa_root'] = os.path.join(env.galaxy_tools_dir,
                                                      "omssa", "default",
                                                      "bin")
        protk_properties['blast_root'] = os.path.join(env.galaxy_tools_dir,
                                                      "blast+", "default")
        protk_properties['pwiz_root'] = os.path.join(
            env.galaxy_tools_dir, "transproteomic_pipeline", "default", "bin")
        # Other properties: log_file, blast_root
        env.safe_sudo("mkdir -p \"$HOME/.protk\"", user=env.galaxy_user)
        env.safe_sudo("mkdir -p \"$HOME/.protk/Databases\"",
                      user=env.galaxy_user)
        import yaml
        _write_to_file(yaml.dump(protk_properties),
                       "/home/%s/.protk/config.yml" % env.galaxy_user, "0755")

        rvm_exec(env, "protk_setup.rb galaxyenv", with_gemset=True)

        install_dir = os.path.join(env.galaxy_tools_dir, "galaxy_protk",
                                   version)
        env.safe_sudo("mkdir -p '%s'" % install_dir)
        _chown_galaxy(env, install_dir)
        env.safe_sudo('ln -s -f "$HOME/.protk/galaxy/env.sh" "%s/env.sh"' %
                      install_dir,
                      user=env.galaxy_user)
        with cd(install_dir):
            with cd(".."):
                env.safe_sudo("ln -s -f '%s' default" % version)