Example #1
0
def update_file(finfo, sample_info, config):
    """Update file in Galaxy data libraries.
    """
    if GalaxyInstance is None:
        raise ImportError("Could not import bioblend.galaxy")
    if "dir" not in config:
        raise ValueError("Galaxy upload requires `dir` parameter in config specifying the "
                         "shared filesystem path to move files to.")
    folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    if finfo.get("type") == "directory":
        storage_file = None
        if finfo.get("ext") == "qc":
            pdf_file = qcsummary.prep_pdf(finfo["path"], config)
            if pdf_file:
                finfo["path"] = pdf_file
                finfo["type"] = "pdf"
                storage_file = filesystem.copy_finfo(finfo, storage_dir, pass_uptodate=True)
    else:
        storage_file = filesystem.copy_finfo(finfo, storage_dir, pass_uptodate=True)
    if "galaxy_url" in config and "galaxy_api_key" in config:
        galaxy_url = config["galaxy_url"]
        if not galaxy_url.endswith("/"):
            galaxy_url += "/"
        gi = GalaxyInstance(galaxy_url, config["galaxy_api_key"])
    else:
        raise ValueError("Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config")
    if storage_file and sample_info and not finfo.get("index", False):
        _to_datalibrary(storage_file, gi, folder_name, sample_info, config)
Example #2
0
def _galaxy_library_upload(finfo, sample_info, config):
    """Upload results to galaxy library.
    """
    folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    if finfo.get("type") == "directory":
        storage_file = None
        if finfo.get("ext") == "qc":
            pdf_file = qcsummary.prep_pdf(finfo["path"], config)
            if pdf_file:
                finfo["path"] = pdf_file
                finfo["type"] = "pdf"
                storage_file = filesystem.copy_finfo(finfo,
                                                     storage_dir,
                                                     pass_uptodate=True)
    else:
        storage_file = filesystem.copy_finfo(finfo,
                                             storage_dir,
                                             pass_uptodate=True)
    if "galaxy_url" in config and "galaxy_api_key" in config:
        galaxy_url = config["galaxy_url"]
        if not galaxy_url.endswith("/"):
            galaxy_url += "/"
        gi = GalaxyInstance(galaxy_url, config["galaxy_api_key"])
    else:
        raise ValueError(
            "Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config"
        )
    if storage_file and sample_info and not finfo.get(
            "index", False) and not finfo.get("plus", False):
        _to_datalibrary_safe(storage_file, gi, folder_name, sample_info,
                             config)
Example #3
0
def update_file(finfo, sample_info, config):
    """Update file in Galaxy data libraries.
    """
    if GalaxyInstance is None:
        raise ImportError("Could not import bioblend.galaxy")
    if "dir" not in config:
        raise ValueError("Galaxy upload requires `dir` parameter in config specifying the "
                         "shared filesystem path to move files to.")
    folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    if finfo.get("type") == "directory":
        storage_file = None
        if finfo.get("ext") == "qc":
            pdf_file = qcsummary.prep_pdf(finfo["path"], config)
            if pdf_file:
                finfo["path"] = pdf_file
                finfo["type"] = "pdf"
                storage_file = filesystem.copy_finfo(finfo, storage_dir, pass_uptodate=True)
    else:
        storage_file = filesystem.copy_finfo(finfo, storage_dir, pass_uptodate=True)
    if "galaxy_url" in config and "galaxy_api_key" in config:
        galaxy_url = config["galaxy_url"]
        if not galaxy_url.endswith("/"):
            galaxy_url += "/"
        gi = GalaxyInstance(galaxy_url, config["galaxy_api_key"])
    else:
        raise ValueError("Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config")
    if storage_file and sample_info and not finfo.get("index", False):
        _to_datalibrary_safe(storage_file, gi, folder_name, sample_info, config)
Example #4
0
def update_file(finfo, sample_info, config):
    """Update file in Galaxy data libraries.
    """
    folder_name = "%s_%s" % (config["fc_name"], config["fc_date"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    storage_file = filesystem.copy_finfo(finfo, storage_dir)
    if config.has_key("galaxy_url") and config.has_key("galaxy_api_key"):
        gi = GalaxyInstance(config["galaxy_url"], config["galaxy_api_key"])
    else:
        raise ValueError("Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config")
    if storage_file:
        _to_datalibrary(storage_file, gi, folder_name, sample_info, config)
Example #5
0
def _galaxy_library_upload(finfo, sample_info, config):
    """Upload results to galaxy library.
    """
    folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    if finfo.get("type") == "directory":
        storage_file = None
        if finfo.get("ext") == "qc":
            pdf_file = qcsummary.prep_pdf(finfo["path"], config)
            if pdf_file:
                finfo["path"] = pdf_file
                finfo["type"] = "pdf"
                storage_file = filesystem.copy_finfo(finfo, storage_dir, pass_uptodate=True)
    else:
        storage_file = filesystem.copy_finfo(finfo, storage_dir, pass_uptodate=True)
    if "galaxy_url" in config and "galaxy_api_key" in config:
        galaxy_url = config["galaxy_url"]
        if not galaxy_url.endswith("/"):
            galaxy_url += "/"
        gi = GalaxyInstance(galaxy_url, config["galaxy_api_key"])
    else:
        raise ValueError("Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config")
    if storage_file and sample_info and not finfo.get("index", False) and not finfo.get("plus", False):
        _to_datalibrary_safe(storage_file, gi, folder_name, sample_info, config)
Example #6
0
def update_file(finfo, sample_info, config):
    """Update file in Galaxy data libraries.
    """
    if GalaxyInstance is None:
        raise ImportError("Could not import bioblend.galaxy")
    folder_name = "%s_%s" % (config["fc_name"], config["fc_date"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    storage_file = filesystem.copy_finfo(finfo, storage_dir)
    if config.has_key("galaxy_url") and config.has_key("galaxy_api_key"):
        gi = GalaxyInstance(config["galaxy_url"], config["galaxy_api_key"])
    else:
        raise ValueError(
            "Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config"
        )
    if storage_file and sample_info:
        _to_datalibrary(storage_file, gi, folder_name, sample_info, config)
Example #7
0
def update_file(finfo, sample_info, config):
    """Update file in Galaxy data libraries.
    """
    if GalaxyInstance is None:
        raise ImportError("Could not import bioblend.galaxy")
    if "dir" not in config:
        raise ValueError("Galaxy upload requires `dir` parameter in config specifying the "
                         "shared filesystem path to move files to.")
    folder_name = "%s_%s" % (config["fc_name"], config["fc_date"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    storage_file = (filesystem.copy_finfo(finfo, storage_dir)
                    if finfo.get("type") != "directory" else None)
    if "galaxy_url" in config and "galaxy_api_key" in config:
        gi = GalaxyInstance(config["galaxy_url"], config["galaxy_api_key"])
    else:
        raise ValueError("Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config")
    if storage_file and sample_info:
        _to_datalibrary(storage_file, gi, folder_name, sample_info, config)
Example #8
0
def update_file(finfo, sample_info, config):
    """Update file in Galaxy data libraries.
    """
    if GalaxyInstance is None:
        raise ImportError("Could not import bioblend.galaxy")
    if "dir" not in config:
        raise ValueError(
            "Galaxy upload requires `dir` parameter in config specifying the "
            "shared filesystem path to move files to.")
    folder_name = "%s_%s" % (config["fc_name"], config["fc_date"])
    storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
    storage_file = (filesystem.copy_finfo(finfo, storage_dir)
                    if finfo.get("type") != "directory" else None)
    if "galaxy_url" in config and "galaxy_api_key" in config:
        gi = GalaxyInstance(config["galaxy_url"], config["galaxy_api_key"])
    else:
        raise ValueError(
            "Galaxy upload requires `galaxy_url` and `galaxy_api_key` in config"
        )
    if storage_file and sample_info:
        _to_datalibrary(storage_file, gi, folder_name, sample_info, config)