Example #1
0
def _get_remote_files(config):
    """Retrieve remote file references.
    """
    if "cache" in config:
        return config["cache"]
    out = []
    for f in _config_folders(config):
        out.extend(objectstore.list(f))
    return out
Example #2
0
def _retrieve_remote(fnames):
    """Retrieve remote inputs found in the same bucket as the template or metadata files.
    """
    for fname in fnames:
        if objectstore.is_remote(fname):
            inputs = []
            regions = []
            remote_base = os.path.dirname(fname)
            for rfname in objectstore.list(remote_base):
                if rfname.endswith(tuple(KNOWN_EXTS.keys())):
                    inputs.append(rfname)
                elif rfname.endswith((".bed", ".bed.gz")):
                    regions.append(rfname)
            return {"base": remote_base, "inputs": inputs, "region": regions[0] if len(regions) == 1 else None}
    return {}
Example #3
0
def _add_jar_resources(config, sample_config):
    """Find uploaded jars for GATK and MuTect relative to input file.

    Automatically puts these into the configuration file to make them available
    for downstream processing. Searches for them in the specific project folder
    and also a global jar directory for a bucket.
    """
    base, rest = sample_config.split("//", 1)
    for dirname in [os.path.join("%s//%s" % (base, rest.split("/")[0]), "jars"),
                    os.path.join(os.path.dirname(sample_config), "jars")]:
        for fname in objectstore.list(dirname):
            if fname.lower().find("genomeanalysistk") >= 0:
                prog = "gatk"
            elif fname.lower().find("mutect") >= 0:
                prog = "mutect"
            else:
                prog = None
            if prog:
                if "resources" not in config:
                    config["resources"] = {}
                if prog not in config["resources"]:
                    config["resources"][prog] = {}
                config["resources"][prog]["jar"] = str(fname)
    return config