repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
bcbio/bcbio-nextgen | bcbio/workflow/template.py | _add_ped_metadata | def _add_ped_metadata(name, metadata):
"""Add standard PED file attributes into metadata if not present.
http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped
"""
ignore = set(["-9", "undefined", "unknown", "."])
def _ped_mapping(x, valmap):
try:
x = int(x)
except Va... | python | def _add_ped_metadata(name, metadata):
"""Add standard PED file attributes into metadata if not present.
http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped
"""
ignore = set(["-9", "undefined", "unknown", "."])
def _ped_mapping(x, valmap):
try:
x = int(x)
except Va... | [
"def",
"_add_ped_metadata",
"(",
"name",
",",
"metadata",
")",
":",
"ignore",
"=",
"set",
"(",
"[",
"\"-9\"",
",",
"\"undefined\"",
",",
"\"unknown\"",
",",
"\".\"",
"]",
")",
"def",
"_ped_mapping",
"(",
"x",
",",
"valmap",
")",
":",
"try",
":",
"x",
... | Add standard PED file attributes into metadata if not present.
http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped | [
"Add",
"standard",
"PED",
"file",
"attributes",
"into",
"metadata",
"if",
"not",
"present",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L365-L401 | train |
bcbio/bcbio-nextgen | bcbio/workflow/template.py | _add_metadata | def _add_metadata(item, metadata, remotes, only_metadata=False):
"""Add metadata information from CSV file to current item.
Retrieves metadata based on 'description' parsed from input CSV file.
Adds to object and handles special keys:
- `description`: A new description for the item. Used to relabel ite... | python | def _add_metadata(item, metadata, remotes, only_metadata=False):
"""Add metadata information from CSV file to current item.
Retrieves metadata based on 'description' parsed from input CSV file.
Adds to object and handles special keys:
- `description`: A new description for the item. Used to relabel ite... | [
"def",
"_add_metadata",
"(",
"item",
",",
"metadata",
",",
"remotes",
",",
"only_metadata",
"=",
"False",
")",
":",
"for",
"check_key",
"in",
"[",
"item",
"[",
"\"description\"",
"]",
"]",
"+",
"_get_file_keys",
"(",
"item",
")",
"+",
"_get_vrn_keys",
"(",... | Add metadata information from CSV file to current item.
Retrieves metadata based on 'description' parsed from input CSV file.
Adds to object and handles special keys:
- `description`: A new description for the item. Used to relabel items
based on the pre-determined description from fastq name or BAM... | [
"Add",
"metadata",
"information",
"from",
"CSV",
"file",
"to",
"current",
"item",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L421-L461 | train |
bcbio/bcbio-nextgen | bcbio/workflow/template.py | _retrieve_remote | 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 ob... | python | 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 ob... | [
"def",
"_retrieve_remote",
"(",
"fnames",
")",
":",
"for",
"fname",
"in",
"fnames",
":",
"if",
"objectstore",
".",
"is_remote",
"(",
"fname",
")",
":",
"inputs",
"=",
"[",
"]",
"regions",
"=",
"[",
"]",
"remote_base",
"=",
"os",
".",
"path",
".",
"di... | Retrieve remote inputs found in the same bucket as the template or metadata files. | [
"Retrieve",
"remote",
"inputs",
"found",
"in",
"the",
"same",
"bucket",
"as",
"the",
"template",
"or",
"metadata",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L477-L493 | train |
bcbio/bcbio-nextgen | bcbio/workflow/template.py | _convert_to_relpaths | def _convert_to_relpaths(data, work_dir):
"""Convert absolute paths in the input data to relative paths to the work directory.
"""
work_dir = os.path.abspath(work_dir)
data["files"] = [os.path.relpath(f, work_dir) for f in data["files"]]
for topk in ["metadata", "algorithm"]:
for k, v in dat... | python | def _convert_to_relpaths(data, work_dir):
"""Convert absolute paths in the input data to relative paths to the work directory.
"""
work_dir = os.path.abspath(work_dir)
data["files"] = [os.path.relpath(f, work_dir) for f in data["files"]]
for topk in ["metadata", "algorithm"]:
for k, v in dat... | [
"def",
"_convert_to_relpaths",
"(",
"data",
",",
"work_dir",
")",
":",
"work_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"work_dir",
")",
"data",
"[",
"\"files\"",
"]",
"=",
"[",
"os",
".",
"path",
".",
"relpath",
"(",
"f",
",",
"work_dir",
")... | Convert absolute paths in the input data to relative paths to the work directory. | [
"Convert",
"absolute",
"paths",
"in",
"the",
"input",
"data",
"to",
"relative",
"paths",
"to",
"the",
"work",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L495-L504 | train |
bcbio/bcbio-nextgen | bcbio/workflow/template.py | _check_all_metadata_found | def _check_all_metadata_found(metadata, items):
"""Print warning if samples in CSV file are missing in folder"""
for name in metadata:
seen = False
for sample in items:
check_file = sample["files"][0] if sample.get("files") else sample["vrn_file"]
if isinstance(name, (tup... | python | def _check_all_metadata_found(metadata, items):
"""Print warning if samples in CSV file are missing in folder"""
for name in metadata:
seen = False
for sample in items:
check_file = sample["files"][0] if sample.get("files") else sample["vrn_file"]
if isinstance(name, (tup... | [
"def",
"_check_all_metadata_found",
"(",
"metadata",
",",
"items",
")",
":",
"for",
"name",
"in",
"metadata",
":",
"seen",
"=",
"False",
"for",
"sample",
"in",
"items",
":",
"check_file",
"=",
"sample",
"[",
"\"files\"",
"]",
"[",
"0",
"]",
"if",
"sample... | Print warning if samples in CSV file are missing in folder | [
"Print",
"warning",
"if",
"samples",
"in",
"CSV",
"file",
"are",
"missing",
"in",
"folder"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L506-L520 | train |
bcbio/bcbio-nextgen | bcbio/workflow/template.py | _copy_to_configdir | def _copy_to_configdir(items, out_dir, args):
"""Copy configuration files like PED inputs to working config directory.
"""
out = []
for item in items:
ped_file = tz.get_in(["metadata", "ped"], item)
if ped_file and os.path.exists(ped_file):
ped_config_file = os.path.join(out_... | python | def _copy_to_configdir(items, out_dir, args):
"""Copy configuration files like PED inputs to working config directory.
"""
out = []
for item in items:
ped_file = tz.get_in(["metadata", "ped"], item)
if ped_file and os.path.exists(ped_file):
ped_config_file = os.path.join(out_... | [
"def",
"_copy_to_configdir",
"(",
"items",
",",
"out_dir",
",",
"args",
")",
":",
"out",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"ped_file",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"metadata\"",
",",
"\"ped\"",
"]",
",",
"item",
")",
"if",
... | Copy configuration files like PED inputs to working config directory. | [
"Copy",
"configuration",
"files",
"like",
"PED",
"inputs",
"to",
"working",
"config",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L522-L536 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | load_system_config | def load_system_config(config_file=None, work_dir=None, allow_missing=False):
"""Load bcbio_system.yaml configuration file, handling standard defaults.
Looks for configuration file in default location within
final base directory from a standard installation. Handles both standard
installs (galaxy/bcbio... | python | def load_system_config(config_file=None, work_dir=None, allow_missing=False):
"""Load bcbio_system.yaml configuration file, handling standard defaults.
Looks for configuration file in default location within
final base directory from a standard installation. Handles both standard
installs (galaxy/bcbio... | [
"def",
"load_system_config",
"(",
"config_file",
"=",
"None",
",",
"work_dir",
"=",
"None",
",",
"allow_missing",
"=",
"False",
")",
":",
"docker_config",
"=",
"_get_docker_config",
"(",
")",
"if",
"config_file",
"is",
"None",
":",
"config_file",
"=",
"\"bcbio... | Load bcbio_system.yaml configuration file, handling standard defaults.
Looks for configuration file in default location within
final base directory from a standard installation. Handles both standard
installs (galaxy/bcbio_system.yaml) and docker installs (config/bcbio_system.yaml). | [
"Load",
"bcbio_system",
".",
"yaml",
"configuration",
"file",
"handling",
"standard",
"defaults",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L50-L79 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | _merge_system_configs | def _merge_system_configs(host_config, container_config, out_file=None):
"""Create a merged system configuration from external and internal specification.
"""
out = copy.deepcopy(container_config)
for k, v in host_config.items():
if k in set(["galaxy_config"]):
out[k] = v
eli... | python | def _merge_system_configs(host_config, container_config, out_file=None):
"""Create a merged system configuration from external and internal specification.
"""
out = copy.deepcopy(container_config)
for k, v in host_config.items():
if k in set(["galaxy_config"]):
out[k] = v
eli... | [
"def",
"_merge_system_configs",
"(",
"host_config",
",",
"container_config",
",",
"out_file",
"=",
"None",
")",
":",
"out",
"=",
"copy",
".",
"deepcopy",
"(",
"container_config",
")",
"for",
"k",
",",
"v",
"in",
"host_config",
".",
"items",
"(",
")",
":",
... | Create a merged system configuration from external and internal specification. | [
"Create",
"a",
"merged",
"system",
"configuration",
"from",
"external",
"and",
"internal",
"specification",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L84-L110 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | merge_resources | def merge_resources(args):
"""Merge docker local resources and global resource specification in a set of arguments.
Finds the `data` object within passed arguments and updates the resources
from a local docker configuration if present.
"""
docker_config = _get_docker_config()
if not docker_conf... | python | def merge_resources(args):
"""Merge docker local resources and global resource specification in a set of arguments.
Finds the `data` object within passed arguments and updates the resources
from a local docker configuration if present.
"""
docker_config = _get_docker_config()
if not docker_conf... | [
"def",
"merge_resources",
"(",
"args",
")",
":",
"docker_config",
"=",
"_get_docker_config",
"(",
")",
"if",
"not",
"docker_config",
":",
"return",
"args",
"else",
":",
"def",
"_update_resources",
"(",
"config",
")",
":",
"config",
"[",
"\"resources\"",
"]",
... | Merge docker local resources and global resource specification in a set of arguments.
Finds the `data` object within passed arguments and updates the resources
from a local docker configuration if present. | [
"Merge",
"docker",
"local",
"resources",
"and",
"global",
"resource",
"specification",
"in",
"a",
"set",
"of",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L118-L131 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | load_config | def load_config(config_file):
"""Load YAML config file, replacing environmental variables.
"""
with open(config_file) as in_handle:
config = yaml.safe_load(in_handle)
config = _expand_paths(config)
if 'resources' not in config:
config['resources'] = {}
# lowercase resource names,... | python | def load_config(config_file):
"""Load YAML config file, replacing environmental variables.
"""
with open(config_file) as in_handle:
config = yaml.safe_load(in_handle)
config = _expand_paths(config)
if 'resources' not in config:
config['resources'] = {}
# lowercase resource names,... | [
"def",
"load_config",
"(",
"config_file",
")",
":",
"with",
"open",
"(",
"config_file",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_handle",
")",
"config",
"=",
"_expand_paths",
"(",
"config",
")",
"if",
"'resources'",
"n... | Load YAML config file, replacing environmental variables. | [
"Load",
"YAML",
"config",
"file",
"replacing",
"environmental",
"variables",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L133-L147 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_resources | def get_resources(name, config):
"""Retrieve resources for a program, pulling from multiple config sources.
"""
return tz.get_in(["resources", name], config,
tz.get_in(["resources", "default"], config, {})) | python | def get_resources(name, config):
"""Retrieve resources for a program, pulling from multiple config sources.
"""
return tz.get_in(["resources", name], config,
tz.get_in(["resources", "default"], config, {})) | [
"def",
"get_resources",
"(",
"name",
",",
"config",
")",
":",
"return",
"tz",
".",
"get_in",
"(",
"[",
"\"resources\"",
",",
"name",
"]",
",",
"config",
",",
"tz",
".",
"get_in",
"(",
"[",
"\"resources\"",
",",
"\"default\"",
"]",
",",
"config",
",",
... | Retrieve resources for a program, pulling from multiple config sources. | [
"Retrieve",
"resources",
"for",
"a",
"program",
"pulling",
"from",
"multiple",
"config",
"sources",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L165-L169 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_program | def get_program(name, config, ptype="cmd", default=None):
"""Retrieve program information from the configuration.
This handles back compatible location specification in input
YAML. The preferred location for program information is in
`resources` but the older `program` tag is also supported.
"""
... | python | def get_program(name, config, ptype="cmd", default=None):
"""Retrieve program information from the configuration.
This handles back compatible location specification in input
YAML. The preferred location for program information is in
`resources` but the older `program` tag is also supported.
"""
... | [
"def",
"get_program",
"(",
"name",
",",
"config",
",",
"ptype",
"=",
"\"cmd\"",
",",
"default",
"=",
"None",
")",
":",
"# support taking in the data dictionary",
"config",
"=",
"config",
".",
"get",
"(",
"\"config\"",
",",
"config",
")",
"try",
":",
"pconfig... | Retrieve program information from the configuration.
This handles back compatible location specification in input
YAML. The preferred location for program information is in
`resources` but the older `program` tag is also supported. | [
"Retrieve",
"program",
"information",
"from",
"the",
"configuration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L171-L195 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | _get_program_cmd | def _get_program_cmd(name, pconfig, config, default):
"""Retrieve commandline of a program.
"""
if pconfig is None:
return name
elif isinstance(pconfig, six.string_types):
return pconfig
elif "cmd" in pconfig:
return pconfig["cmd"]
elif default is not None:
return... | python | def _get_program_cmd(name, pconfig, config, default):
"""Retrieve commandline of a program.
"""
if pconfig is None:
return name
elif isinstance(pconfig, six.string_types):
return pconfig
elif "cmd" in pconfig:
return pconfig["cmd"]
elif default is not None:
return... | [
"def",
"_get_program_cmd",
"(",
"name",
",",
"pconfig",
",",
"config",
",",
"default",
")",
":",
"if",
"pconfig",
"is",
"None",
":",
"return",
"name",
"elif",
"isinstance",
"(",
"pconfig",
",",
"six",
".",
"string_types",
")",
":",
"return",
"pconfig",
"... | Retrieve commandline of a program. | [
"Retrieve",
"commandline",
"of",
"a",
"program",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L221-L233 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_jar | def get_jar(base_name, dname):
"""Retrieve a jar in the provided directory
"""
jars = glob.glob(os.path.join(expand_path(dname), "%s*.jar" % base_name))
if len(jars) == 1:
return jars[0]
elif len(jars) > 1:
raise ValueError("Found multiple jars for %s in %s. Need single jar: %s" %
... | python | def get_jar(base_name, dname):
"""Retrieve a jar in the provided directory
"""
jars = glob.glob(os.path.join(expand_path(dname), "%s*.jar" % base_name))
if len(jars) == 1:
return jars[0]
elif len(jars) > 1:
raise ValueError("Found multiple jars for %s in %s. Need single jar: %s" %
... | [
"def",
"get_jar",
"(",
"base_name",
",",
"dname",
")",
":",
"jars",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"expand_path",
"(",
"dname",
")",
",",
"\"%s*.jar\"",
"%",
"base_name",
")",
")",
"if",
"len",
"(",
"jars",
")",... | Retrieve a jar in the provided directory | [
"Retrieve",
"a",
"jar",
"in",
"the",
"provided",
"directory"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L247-L259 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_algorithm_config | def get_algorithm_config(xs):
"""Flexibly extract algorithm configuration for a sample from any function arguments.
"""
if isinstance(xs, dict):
xs = [xs]
for x in xs:
if is_std_config_arg(x):
return x["algorithm"]
elif is_nested_config_arg(x):
return x["c... | python | def get_algorithm_config(xs):
"""Flexibly extract algorithm configuration for a sample from any function arguments.
"""
if isinstance(xs, dict):
xs = [xs]
for x in xs:
if is_std_config_arg(x):
return x["algorithm"]
elif is_nested_config_arg(x):
return x["c... | [
"def",
"get_algorithm_config",
"(",
"xs",
")",
":",
"if",
"isinstance",
"(",
"xs",
",",
"dict",
")",
":",
"xs",
"=",
"[",
"xs",
"]",
"for",
"x",
"in",
"xs",
":",
"if",
"is_std_config_arg",
"(",
"x",
")",
":",
"return",
"x",
"[",
"\"algorithm\"",
"]... | Flexibly extract algorithm configuration for a sample from any function arguments. | [
"Flexibly",
"extract",
"algorithm",
"configuration",
"for",
"a",
"sample",
"from",
"any",
"function",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L269-L282 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_dataarg | def get_dataarg(args):
"""Retrieve the world 'data' argument from a set of input parameters.
"""
for i, arg in enumerate(args):
if is_nested_config_arg(arg):
return i, arg
elif is_std_config_arg(arg):
return i, {"config": arg}
elif isinstance(arg, (list, tuple... | python | def get_dataarg(args):
"""Retrieve the world 'data' argument from a set of input parameters.
"""
for i, arg in enumerate(args):
if is_nested_config_arg(arg):
return i, arg
elif is_std_config_arg(arg):
return i, {"config": arg}
elif isinstance(arg, (list, tuple... | [
"def",
"get_dataarg",
"(",
"args",
")",
":",
"for",
"i",
",",
"arg",
"in",
"enumerate",
"(",
"args",
")",
":",
"if",
"is_nested_config_arg",
"(",
"arg",
")",
":",
"return",
"i",
",",
"arg",
"elif",
"is_std_config_arg",
"(",
"arg",
")",
":",
"return",
... | Retrieve the world 'data' argument from a set of input parameters. | [
"Retrieve",
"the",
"world",
"data",
"argument",
"from",
"a",
"set",
"of",
"input",
"parameters",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L284-L294 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | add_cores_to_config | def add_cores_to_config(args, cores_per_job, parallel=None):
"""Add information about available cores for a job to configuration.
Ugly hack to update core information in a configuration dictionary.
"""
def _update_cores(config):
config["algorithm"]["num_cores"] = int(cores_per_job)
if pa... | python | def add_cores_to_config(args, cores_per_job, parallel=None):
"""Add information about available cores for a job to configuration.
Ugly hack to update core information in a configuration dictionary.
"""
def _update_cores(config):
config["algorithm"]["num_cores"] = int(cores_per_job)
if pa... | [
"def",
"add_cores_to_config",
"(",
"args",
",",
"cores_per_job",
",",
"parallel",
"=",
"None",
")",
":",
"def",
"_update_cores",
"(",
"config",
")",
":",
"config",
"[",
"\"algorithm\"",
"]",
"[",
"\"num_cores\"",
"]",
"=",
"int",
"(",
"cores_per_job",
")",
... | Add information about available cores for a job to configuration.
Ugly hack to update core information in a configuration dictionary. | [
"Add",
"information",
"about",
"available",
"cores",
"for",
"a",
"job",
"to",
"configuration",
".",
"Ugly",
"hack",
"to",
"update",
"core",
"information",
"in",
"a",
"configuration",
"dictionary",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L296-L306 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | _update_config | def _update_config(args, update_fn, allow_missing=False):
"""Update configuration, nested in argument list, with the provided update function.
"""
new_i = None
for i, arg in enumerate(args):
if (is_std_config_arg(arg) or is_nested_config_arg(arg) or
(isinstance(arg, (list, tuple)) ... | python | def _update_config(args, update_fn, allow_missing=False):
"""Update configuration, nested in argument list, with the provided update function.
"""
new_i = None
for i, arg in enumerate(args):
if (is_std_config_arg(arg) or is_nested_config_arg(arg) or
(isinstance(arg, (list, tuple)) ... | [
"def",
"_update_config",
"(",
"args",
",",
"update_fn",
",",
"allow_missing",
"=",
"False",
")",
":",
"new_i",
"=",
"None",
"for",
"i",
",",
"arg",
"in",
"enumerate",
"(",
"args",
")",
":",
"if",
"(",
"is_std_config_arg",
"(",
"arg",
")",
"or",
"is_nes... | Update configuration, nested in argument list, with the provided update function. | [
"Update",
"configuration",
"nested",
"in",
"argument",
"list",
"with",
"the",
"provided",
"update",
"function",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L308-L336 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | convert_to_bytes | def convert_to_bytes(mem_str):
"""Convert a memory specification, potentially with M or G, into bytes.
"""
if str(mem_str)[-1].upper().endswith("G"):
return int(round(float(mem_str[:-1]) * 1024 * 1024))
elif str(mem_str)[-1].upper().endswith("M"):
return int(round(float(mem_str[:-1]) * 1... | python | def convert_to_bytes(mem_str):
"""Convert a memory specification, potentially with M or G, into bytes.
"""
if str(mem_str)[-1].upper().endswith("G"):
return int(round(float(mem_str[:-1]) * 1024 * 1024))
elif str(mem_str)[-1].upper().endswith("M"):
return int(round(float(mem_str[:-1]) * 1... | [
"def",
"convert_to_bytes",
"(",
"mem_str",
")",
":",
"if",
"str",
"(",
"mem_str",
")",
"[",
"-",
"1",
"]",
".",
"upper",
"(",
")",
".",
"endswith",
"(",
"\"G\"",
")",
":",
"return",
"int",
"(",
"round",
"(",
"float",
"(",
"mem_str",
"[",
":",
"-"... | Convert a memory specification, potentially with M or G, into bytes. | [
"Convert",
"a",
"memory",
"specification",
"potentially",
"with",
"M",
"or",
"G",
"into",
"bytes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L338-L346 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | adjust_memory | def adjust_memory(val, magnitude, direction="increase", out_modifier="", maximum=None):
"""Adjust memory based on number of cores utilized.
"""
modifier = val[-1:]
amount = float(val[:-1])
if direction == "decrease":
new_amount = amount / float(magnitude)
# dealing with a specifier l... | python | def adjust_memory(val, magnitude, direction="increase", out_modifier="", maximum=None):
"""Adjust memory based on number of cores utilized.
"""
modifier = val[-1:]
amount = float(val[:-1])
if direction == "decrease":
new_amount = amount / float(magnitude)
# dealing with a specifier l... | [
"def",
"adjust_memory",
"(",
"val",
",",
"magnitude",
",",
"direction",
"=",
"\"increase\"",
",",
"out_modifier",
"=",
"\"\"",
",",
"maximum",
"=",
"None",
")",
":",
"modifier",
"=",
"val",
"[",
"-",
"1",
":",
"]",
"amount",
"=",
"float",
"(",
"val",
... | Adjust memory based on number of cores utilized. | [
"Adjust",
"memory",
"based",
"on",
"number",
"of",
"cores",
"utilized",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L361-L396 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | adjust_opts | def adjust_opts(in_opts, config):
"""Establish JVM opts, adjusting memory for the context if needed.
This allows using less or more memory for highly parallel or multicore
supporting processes, respectively.
"""
memory_adjust = config["algorithm"].get("memory_adjust", {})
out_opts = []
for ... | python | def adjust_opts(in_opts, config):
"""Establish JVM opts, adjusting memory for the context if needed.
This allows using less or more memory for highly parallel or multicore
supporting processes, respectively.
"""
memory_adjust = config["algorithm"].get("memory_adjust", {})
out_opts = []
for ... | [
"def",
"adjust_opts",
"(",
"in_opts",
",",
"config",
")",
":",
"memory_adjust",
"=",
"config",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"memory_adjust\"",
",",
"{",
"}",
")",
"out_opts",
"=",
"[",
"]",
"for",
"opt",
"in",
"in_opts",
":",
"if",
"op... | Establish JVM opts, adjusting memory for the context if needed.
This allows using less or more memory for highly parallel or multicore
supporting processes, respectively. | [
"Establish",
"JVM",
"opts",
"adjusting",
"memory",
"for",
"the",
"context",
"if",
"needed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L398-L415 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | use_vqsr | def use_vqsr(algs, call_file=None):
"""Processing uses GATK's Variant Quality Score Recalibration.
"""
from bcbio.variation import vcfutils
vqsr_callers = set(["gatk", "gatk-haplotype"])
vqsr_sample_thresh = 50
vqsr_supported = collections.defaultdict(int)
coverage_intervals = set([])
fo... | python | def use_vqsr(algs, call_file=None):
"""Processing uses GATK's Variant Quality Score Recalibration.
"""
from bcbio.variation import vcfutils
vqsr_callers = set(["gatk", "gatk-haplotype"])
vqsr_sample_thresh = 50
vqsr_supported = collections.defaultdict(int)
coverage_intervals = set([])
fo... | [
"def",
"use_vqsr",
"(",
"algs",
",",
"call_file",
"=",
"None",
")",
":",
"from",
"bcbio",
".",
"variation",
"import",
"vcfutils",
"vqsr_callers",
"=",
"set",
"(",
"[",
"\"gatk\"",
",",
"\"gatk-haplotype\"",
"]",
")",
"vqsr_sample_thresh",
"=",
"50",
"vqsr_su... | Processing uses GATK's Variant Quality Score Recalibration. | [
"Processing",
"uses",
"GATK",
"s",
"Variant",
"Quality",
"Score",
"Recalibration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L419-L450 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | use_bcbio_variation_recall | def use_bcbio_variation_recall(algs):
"""Processing uses bcbio-variation-recall. Avoids core requirement if not used.
"""
for alg in algs:
jointcaller = alg.get("jointcaller", [])
if not isinstance(jointcaller, (tuple, list)):
jointcaller = [jointcaller]
for caller in joi... | python | def use_bcbio_variation_recall(algs):
"""Processing uses bcbio-variation-recall. Avoids core requirement if not used.
"""
for alg in algs:
jointcaller = alg.get("jointcaller", [])
if not isinstance(jointcaller, (tuple, list)):
jointcaller = [jointcaller]
for caller in joi... | [
"def",
"use_bcbio_variation_recall",
"(",
"algs",
")",
":",
"for",
"alg",
"in",
"algs",
":",
"jointcaller",
"=",
"alg",
".",
"get",
"(",
"\"jointcaller\"",
",",
"[",
"]",
")",
"if",
"not",
"isinstance",
"(",
"jointcaller",
",",
"(",
"tuple",
",",
"list",... | Processing uses bcbio-variation-recall. Avoids core requirement if not used. | [
"Processing",
"uses",
"bcbio",
"-",
"variation",
"-",
"recall",
".",
"Avoids",
"core",
"requirement",
"if",
"not",
"used",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L457-L467 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | program_installed | def program_installed(program, data):
"""
returns True if the path to a program can be found
"""
try:
path = get_program(program, data)
except CmdNotFound:
return False
return True | python | def program_installed(program, data):
"""
returns True if the path to a program can be found
"""
try:
path = get_program(program, data)
except CmdNotFound:
return False
return True | [
"def",
"program_installed",
"(",
"program",
",",
"data",
")",
":",
"try",
":",
"path",
"=",
"get_program",
"(",
"program",
",",
"data",
")",
"except",
"CmdNotFound",
":",
"return",
"False",
"return",
"True"
] | returns True if the path to a program can be found | [
"returns",
"True",
"if",
"the",
"path",
"to",
"a",
"program",
"can",
"be",
"found"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L480-L488 | train |
bcbio/bcbio-nextgen | bcbio/provenance/versioncheck.py | samtools | def samtools(items):
"""Ensure samtools has parallel processing required for piped analysis.
"""
samtools = config_utils.get_program("samtools", items[0]["config"])
p = subprocess.Popen([samtools, "sort", "-h"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, stderr ... | python | def samtools(items):
"""Ensure samtools has parallel processing required for piped analysis.
"""
samtools = config_utils.get_program("samtools", items[0]["config"])
p = subprocess.Popen([samtools, "sort", "-h"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, stderr ... | [
"def",
"samtools",
"(",
"items",
")",
":",
"samtools",
"=",
"config_utils",
".",
"get_program",
"(",
"\"samtools\"",
",",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
")",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"samtools",
",",
"\"sort\"",
... | Ensure samtools has parallel processing required for piped analysis. | [
"Ensure",
"samtools",
"has",
"parallel",
"processing",
"required",
"for",
"piped",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/versioncheck.py#L11-L25 | train |
bcbio/bcbio-nextgen | bcbio/provenance/versioncheck.py | _needs_java | def _needs_java(data):
"""Check if a caller needs external java for MuTect.
No longer check for older GATK (<3.6) versions because of time cost; this
won't be relevant to most runs so we skip the sanity check.
"""
vc = dd.get_variantcaller(data)
if isinstance(vc, dict):
out = {}
... | python | def _needs_java(data):
"""Check if a caller needs external java for MuTect.
No longer check for older GATK (<3.6) versions because of time cost; this
won't be relevant to most runs so we skip the sanity check.
"""
vc = dd.get_variantcaller(data)
if isinstance(vc, dict):
out = {}
... | [
"def",
"_needs_java",
"(",
"data",
")",
":",
"vc",
"=",
"dd",
".",
"get_variantcaller",
"(",
"data",
")",
"if",
"isinstance",
"(",
"vc",
",",
"dict",
")",
":",
"out",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"vc",
".",
"items",
"(",
")",
":",... | Check if a caller needs external java for MuTect.
No longer check for older GATK (<3.6) versions because of time cost; this
won't be relevant to most runs so we skip the sanity check. | [
"Check",
"if",
"a",
"caller",
"needs",
"external",
"java",
"for",
"MuTect",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/versioncheck.py#L32-L56 | train |
bcbio/bcbio-nextgen | bcbio/provenance/versioncheck.py | java | def java(items):
"""Check for presence of external Java 1.7 for tools that require it.
"""
if any([_needs_java(d) for d in items]):
min_version = "1.7"
max_version = "1.8"
with setpath.orig_paths():
java = utils.which("java")
if not java:
retur... | python | def java(items):
"""Check for presence of external Java 1.7 for tools that require it.
"""
if any([_needs_java(d) for d in items]):
min_version = "1.7"
max_version = "1.8"
with setpath.orig_paths():
java = utils.which("java")
if not java:
retur... | [
"def",
"java",
"(",
"items",
")",
":",
"if",
"any",
"(",
"[",
"_needs_java",
"(",
"d",
")",
"for",
"d",
"in",
"items",
"]",
")",
":",
"min_version",
"=",
"\"1.7\"",
"max_version",
"=",
"\"1.8\"",
"with",
"setpath",
".",
"orig_paths",
"(",
")",
":",
... | Check for presence of external Java 1.7 for tools that require it. | [
"Check",
"for",
"presence",
"of",
"external",
"Java",
"1",
".",
"7",
"for",
"tools",
"that",
"require",
"it",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/versioncheck.py#L58-L84 | train |
bcbio/bcbio-nextgen | bcbio/install.py | upgrade_bcbio | def upgrade_bcbio(args):
"""Perform upgrade of bcbio to latest release, or from GitHub development version.
Handles bcbio, third party tools and data.
"""
print("Upgrading bcbio")
args = add_install_defaults(args)
if args.upgrade in ["stable", "system", "deps", "development"]:
if args.u... | python | def upgrade_bcbio(args):
"""Perform upgrade of bcbio to latest release, or from GitHub development version.
Handles bcbio, third party tools and data.
"""
print("Upgrading bcbio")
args = add_install_defaults(args)
if args.upgrade in ["stable", "system", "deps", "development"]:
if args.u... | [
"def",
"upgrade_bcbio",
"(",
"args",
")",
":",
"print",
"(",
"\"Upgrading bcbio\"",
")",
"args",
"=",
"add_install_defaults",
"(",
"args",
")",
"if",
"args",
".",
"upgrade",
"in",
"[",
"\"stable\"",
",",
"\"system\"",
",",
"\"deps\"",
",",
"\"development\"",
... | Perform upgrade of bcbio to latest release, or from GitHub development version.
Handles bcbio, third party tools and data. | [
"Perform",
"upgrade",
"of",
"bcbio",
"to",
"latest",
"release",
"or",
"from",
"GitHub",
"development",
"version",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L51-L115 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _pip_safe_ssl | def _pip_safe_ssl(cmds, anaconda_dir):
"""Run pip, retrying with conda SSL certificate if global certificate fails.
"""
try:
for cmd in cmds:
subprocess.check_call(cmd)
except subprocess.CalledProcessError:
_set_pip_ssl(anaconda_dir)
for cmd in cmds:
subpr... | python | def _pip_safe_ssl(cmds, anaconda_dir):
"""Run pip, retrying with conda SSL certificate if global certificate fails.
"""
try:
for cmd in cmds:
subprocess.check_call(cmd)
except subprocess.CalledProcessError:
_set_pip_ssl(anaconda_dir)
for cmd in cmds:
subpr... | [
"def",
"_pip_safe_ssl",
"(",
"cmds",
",",
"anaconda_dir",
")",
":",
"try",
":",
"for",
"cmd",
"in",
"cmds",
":",
"subprocess",
".",
"check_call",
"(",
"cmd",
")",
"except",
"subprocess",
".",
"CalledProcessError",
":",
"_set_pip_ssl",
"(",
"anaconda_dir",
")... | Run pip, retrying with conda SSL certificate if global certificate fails. | [
"Run",
"pip",
"retrying",
"with",
"conda",
"SSL",
"certificate",
"if",
"global",
"certificate",
"fails",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L117-L126 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _set_pip_ssl | def _set_pip_ssl(anaconda_dir):
"""Set PIP SSL certificate to installed conda certificate to avoid SSL errors
"""
if anaconda_dir:
cert_file = os.path.join(anaconda_dir, "ssl", "cert.pem")
if os.path.exists(cert_file):
os.environ["PIP_CERT"] = cert_file | python | def _set_pip_ssl(anaconda_dir):
"""Set PIP SSL certificate to installed conda certificate to avoid SSL errors
"""
if anaconda_dir:
cert_file = os.path.join(anaconda_dir, "ssl", "cert.pem")
if os.path.exists(cert_file):
os.environ["PIP_CERT"] = cert_file | [
"def",
"_set_pip_ssl",
"(",
"anaconda_dir",
")",
":",
"if",
"anaconda_dir",
":",
"cert_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"anaconda_dir",
",",
"\"ssl\"",
",",
"\"cert.pem\"",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"cert_file",
")... | Set PIP SSL certificate to installed conda certificate to avoid SSL errors | [
"Set",
"PIP",
"SSL",
"certificate",
"to",
"installed",
"conda",
"certificate",
"to",
"avoid",
"SSL",
"errors"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L128-L134 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _set_matplotlib_default_backend | def _set_matplotlib_default_backend():
"""
matplotlib will try to print to a display if it is available, but don't want
to run it in interactive mode. we tried setting the backend to 'Agg'' before
importing, but it was still resulting in issues. we replace the existing
backend with 'agg' in the defa... | python | def _set_matplotlib_default_backend():
"""
matplotlib will try to print to a display if it is available, but don't want
to run it in interactive mode. we tried setting the backend to 'Agg'' before
importing, but it was still resulting in issues. we replace the existing
backend with 'agg' in the defa... | [
"def",
"_set_matplotlib_default_backend",
"(",
")",
":",
"if",
"_matplotlib_installed",
"(",
")",
":",
"import",
"matplotlib",
"matplotlib",
".",
"use",
"(",
"'Agg'",
",",
"force",
"=",
"True",
")",
"config",
"=",
"matplotlib",
".",
"matplotlib_fname",
"(",
")... | matplotlib will try to print to a display if it is available, but don't want
to run it in interactive mode. we tried setting the backend to 'Agg'' before
importing, but it was still resulting in issues. we replace the existing
backend with 'agg' in the default matplotlibrc. This is a hack until we can
f... | [
"matplotlib",
"will",
"try",
"to",
"print",
"to",
"a",
"display",
"if",
"it",
"is",
"available",
"but",
"don",
"t",
"want",
"to",
"run",
"it",
"in",
"interactive",
"mode",
".",
"we",
"tried",
"setting",
"the",
"backend",
"to",
"Agg",
"before",
"importing... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L136-L155 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _symlink_bcbio | def _symlink_bcbio(args, script="bcbio_nextgen.py", env_name=None, prefix=None):
"""Ensure a bcbio-nextgen script symlink in final tool directory.
"""
if env_name:
bcbio_anaconda = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(sys.executable))),
... | python | def _symlink_bcbio(args, script="bcbio_nextgen.py", env_name=None, prefix=None):
"""Ensure a bcbio-nextgen script symlink in final tool directory.
"""
if env_name:
bcbio_anaconda = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(sys.executable))),
... | [
"def",
"_symlink_bcbio",
"(",
"args",
",",
"script",
"=",
"\"bcbio_nextgen.py\"",
",",
"env_name",
"=",
"None",
",",
"prefix",
"=",
"None",
")",
":",
"if",
"env_name",
":",
"bcbio_anaconda",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
... | Ensure a bcbio-nextgen script symlink in final tool directory. | [
"Ensure",
"a",
"bcbio",
"-",
"nextgen",
"script",
"symlink",
"in",
"final",
"tool",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L164-L181 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _install_container_bcbio_system | def _install_container_bcbio_system(datadir):
"""Install limited bcbio_system.yaml file for setting core and memory usage.
Adds any non-specific programs to the exposed bcbio_system.yaml file, only
when upgrade happening inside a docker container.
"""
base_file = os.path.join(datadir, "config", "bc... | python | def _install_container_bcbio_system(datadir):
"""Install limited bcbio_system.yaml file for setting core and memory usage.
Adds any non-specific programs to the exposed bcbio_system.yaml file, only
when upgrade happening inside a docker container.
"""
base_file = os.path.join(datadir, "config", "bc... | [
"def",
"_install_container_bcbio_system",
"(",
"datadir",
")",
":",
"base_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"\"config\"",
",",
"\"bcbio_system.yaml\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"base_file",
")",
... | Install limited bcbio_system.yaml file for setting core and memory usage.
Adds any non-specific programs to the exposed bcbio_system.yaml file, only
when upgrade happening inside a docker container. | [
"Install",
"limited",
"bcbio_system",
".",
"yaml",
"file",
"for",
"setting",
"core",
"and",
"memory",
"usage",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L183-L211 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _check_for_conda_problems | def _check_for_conda_problems():
"""Identify post-install conda problems and fix.
- libgcc upgrades can remove libquadmath, which moved to libgcc-ng
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
lib_dir = os.path.join(os.path.dirname(conda_bin), os.pardir, "lib")
... | python | def _check_for_conda_problems():
"""Identify post-install conda problems and fix.
- libgcc upgrades can remove libquadmath, which moved to libgcc-ng
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
lib_dir = os.path.join(os.path.dirname(conda_bin), os.pardir, "lib")
... | [
"def",
"_check_for_conda_problems",
"(",
")",
":",
"conda_bin",
"=",
"_get_conda_bin",
"(",
")",
"channels",
"=",
"_get_conda_channels",
"(",
"conda_bin",
")",
"lib_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"co... | Identify post-install conda problems and fix.
- libgcc upgrades can remove libquadmath, which moved to libgcc-ng | [
"Identify",
"post",
"-",
"install",
"conda",
"problems",
"and",
"fix",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L218-L228 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _update_bcbiovm | def _update_bcbiovm():
"""Update or install a local bcbiovm install with tools and dependencies.
"""
print("## CWL support with bcbio-vm")
python_env = "python=3"
conda_bin, env_name = _add_environment("bcbiovm", python_env)
channels = _get_conda_channels(conda_bin)
base_cmd = [conda_bin, "i... | python | def _update_bcbiovm():
"""Update or install a local bcbiovm install with tools and dependencies.
"""
print("## CWL support with bcbio-vm")
python_env = "python=3"
conda_bin, env_name = _add_environment("bcbiovm", python_env)
channels = _get_conda_channels(conda_bin)
base_cmd = [conda_bin, "i... | [
"def",
"_update_bcbiovm",
"(",
")",
":",
"print",
"(",
"\"## CWL support with bcbio-vm\"",
")",
"python_env",
"=",
"\"python=3\"",
"conda_bin",
",",
"env_name",
"=",
"_add_environment",
"(",
"\"bcbiovm\"",
",",
"python_env",
")",
"channels",
"=",
"_get_conda_channels"... | Update or install a local bcbiovm install with tools and dependencies. | [
"Update",
"or",
"install",
"a",
"local",
"bcbiovm",
"install",
"with",
"tools",
"and",
"dependencies",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L230-L240 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _get_conda_channels | def _get_conda_channels(conda_bin):
"""Retrieve default conda channels, checking if they are pre-specified in config.
This allows users to override defaults with specific mirrors in their .condarc
"""
channels = ["bioconda", "conda-forge"]
out = []
config = yaml.safe_load(subprocess.check_outpu... | python | def _get_conda_channels(conda_bin):
"""Retrieve default conda channels, checking if they are pre-specified in config.
This allows users to override defaults with specific mirrors in their .condarc
"""
channels = ["bioconda", "conda-forge"]
out = []
config = yaml.safe_load(subprocess.check_outpu... | [
"def",
"_get_conda_channels",
"(",
"conda_bin",
")",
":",
"channels",
"=",
"[",
"\"bioconda\"",
",",
"\"conda-forge\"",
"]",
"out",
"=",
"[",
"]",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"subprocess",
".",
"check_output",
"(",
"[",
"conda_bin",
",",
... | Retrieve default conda channels, checking if they are pre-specified in config.
This allows users to override defaults with specific mirrors in their .condarc | [
"Retrieve",
"default",
"conda",
"channels",
"checking",
"if",
"they",
"are",
"pre",
"-",
"specified",
"in",
"config",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L255-L271 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _update_conda_packages | def _update_conda_packages():
"""If installed in an anaconda directory, upgrade conda packages.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, ("Could not find anaconda distribution for upgrading bcbio.\n"
"Using python at %s but c... | python | def _update_conda_packages():
"""If installed in an anaconda directory, upgrade conda packages.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, ("Could not find anaconda distribution for upgrading bcbio.\n"
"Using python at %s but c... | [
"def",
"_update_conda_packages",
"(",
")",
":",
"conda_bin",
"=",
"_get_conda_bin",
"(",
")",
"channels",
"=",
"_get_conda_channels",
"(",
"conda_bin",
")",
"assert",
"conda_bin",
",",
"(",
"\"Could not find anaconda distribution for upgrading bcbio.\\n\"",
"\"Using python ... | If installed in an anaconda directory, upgrade conda packages. | [
"If",
"installed",
"in",
"an",
"anaconda",
"directory",
"upgrade",
"conda",
"packages",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L273-L288 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _update_conda_devel | def _update_conda_devel():
"""Update to the latest development conda package.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, "Could not find anaconda distribution for upgrading bcbio"
subprocess.check_call([conda_bin, "install", "--quiet", "--yes"] +... | python | def _update_conda_devel():
"""Update to the latest development conda package.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, "Could not find anaconda distribution for upgrading bcbio"
subprocess.check_call([conda_bin, "install", "--quiet", "--yes"] +... | [
"def",
"_update_conda_devel",
"(",
")",
":",
"conda_bin",
"=",
"_get_conda_bin",
"(",
")",
"channels",
"=",
"_get_conda_channels",
"(",
"conda_bin",
")",
"assert",
"conda_bin",
",",
"\"Could not find anaconda distribution for upgrading bcbio\"",
"subprocess",
".",
"check_... | Update to the latest development conda package. | [
"Update",
"to",
"the",
"latest",
"development",
"conda",
"package",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L290-L298 | train |
bcbio/bcbio-nextgen | bcbio/install.py | get_genome_dir | def get_genome_dir(gid, galaxy_dir, data):
"""Return standard location of genome directories.
"""
if galaxy_dir:
refs = genome.get_refs(gid, None, galaxy_dir, data)
seq_file = tz.get_in(["fasta", "base"], refs)
if seq_file and os.path.exists(seq_file):
return os.path.dirn... | python | def get_genome_dir(gid, galaxy_dir, data):
"""Return standard location of genome directories.
"""
if galaxy_dir:
refs = genome.get_refs(gid, None, galaxy_dir, data)
seq_file = tz.get_in(["fasta", "base"], refs)
if seq_file and os.path.exists(seq_file):
return os.path.dirn... | [
"def",
"get_genome_dir",
"(",
"gid",
",",
"galaxy_dir",
",",
"data",
")",
":",
"if",
"galaxy_dir",
":",
"refs",
"=",
"genome",
".",
"get_refs",
"(",
"gid",
",",
"None",
",",
"galaxy_dir",
",",
"data",
")",
"seq_file",
"=",
"tz",
".",
"get_in",
"(",
"... | Return standard location of genome directories. | [
"Return",
"standard",
"location",
"of",
"genome",
"directories",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L300-L311 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _prepare_cwl_tarballs | def _prepare_cwl_tarballs(data_dir):
"""Create CWL ready tarballs for complex directories.
Avoids need for CWL runners to pass and serialize complex directories
of files, which is inconsistent between runners.
"""
for dbref_dir in filter(os.path.isdir, glob.glob(os.path.join(data_dir, "genomes", "*... | python | def _prepare_cwl_tarballs(data_dir):
"""Create CWL ready tarballs for complex directories.
Avoids need for CWL runners to pass and serialize complex directories
of files, which is inconsistent between runners.
"""
for dbref_dir in filter(os.path.isdir, glob.glob(os.path.join(data_dir, "genomes", "*... | [
"def",
"_prepare_cwl_tarballs",
"(",
"data_dir",
")",
":",
"for",
"dbref_dir",
"in",
"filter",
"(",
"os",
".",
"path",
".",
"isdir",
",",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"genomes\"",
",",
"\"*\"",
",",
... | Create CWL ready tarballs for complex directories.
Avoids need for CWL runners to pass and serialize complex directories
of files, which is inconsistent between runners. | [
"Create",
"CWL",
"ready",
"tarballs",
"for",
"complex",
"directories",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L358-L373 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _upgrade_genome_resources | def _upgrade_genome_resources(galaxy_dir, base_url):
"""Retrieve latest version of genome resource YAML configuration files.
"""
import requests
for dbkey, ref_file in genome.get_builds(galaxy_dir):
# Check for a remote genome resources file
remote_url = base_url % dbkey
requests... | python | def _upgrade_genome_resources(galaxy_dir, base_url):
"""Retrieve latest version of genome resource YAML configuration files.
"""
import requests
for dbkey, ref_file in genome.get_builds(galaxy_dir):
# Check for a remote genome resources file
remote_url = base_url % dbkey
requests... | [
"def",
"_upgrade_genome_resources",
"(",
"galaxy_dir",
",",
"base_url",
")",
":",
"import",
"requests",
"for",
"dbkey",
",",
"ref_file",
"in",
"genome",
".",
"get_builds",
"(",
"galaxy_dir",
")",
":",
"# Check for a remote genome resources file",
"remote_url",
"=",
... | Retrieve latest version of genome resource YAML configuration files. | [
"Retrieve",
"latest",
"version",
"of",
"genome",
"resource",
"YAML",
"configuration",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L375-L398 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _upgrade_snpeff_data | def _upgrade_snpeff_data(galaxy_dir, args, remotes):
"""Install or upgrade snpEff databases, localized to reference directory.
"""
snpeff_version = effects.snpeff_version(args)
if not snpeff_version:
return
for dbkey, ref_file in genome.get_builds(galaxy_dir):
resource_file = os.path... | python | def _upgrade_snpeff_data(galaxy_dir, args, remotes):
"""Install or upgrade snpEff databases, localized to reference directory.
"""
snpeff_version = effects.snpeff_version(args)
if not snpeff_version:
return
for dbkey, ref_file in genome.get_builds(galaxy_dir):
resource_file = os.path... | [
"def",
"_upgrade_snpeff_data",
"(",
"galaxy_dir",
",",
"args",
",",
"remotes",
")",
":",
"snpeff_version",
"=",
"effects",
".",
"snpeff_version",
"(",
"args",
")",
"if",
"not",
"snpeff_version",
":",
"return",
"for",
"dbkey",
",",
"ref_file",
"in",
"genome",
... | Install or upgrade snpEff databases, localized to reference directory. | [
"Install",
"or",
"upgrade",
"snpEff",
"databases",
"localized",
"to",
"reference",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L404-L435 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _is_old_database | def _is_old_database(db_dir, args):
"""Check for old database versions, supported in snpEff 4.1.
"""
snpeff_version = effects.snpeff_version(args)
if LooseVersion(snpeff_version) >= LooseVersion("4.1"):
pred_file = os.path.join(db_dir, "snpEffectPredictor.bin")
if not utils.file_exists(p... | python | def _is_old_database(db_dir, args):
"""Check for old database versions, supported in snpEff 4.1.
"""
snpeff_version = effects.snpeff_version(args)
if LooseVersion(snpeff_version) >= LooseVersion("4.1"):
pred_file = os.path.join(db_dir, "snpEffectPredictor.bin")
if not utils.file_exists(p... | [
"def",
"_is_old_database",
"(",
"db_dir",
",",
"args",
")",
":",
"snpeff_version",
"=",
"effects",
".",
"snpeff_version",
"(",
"args",
")",
"if",
"LooseVersion",
"(",
"snpeff_version",
")",
">=",
"LooseVersion",
"(",
"\"4.1\"",
")",
":",
"pred_file",
"=",
"o... | Check for old database versions, supported in snpEff 4.1. | [
"Check",
"for",
"old",
"database",
"versions",
"supported",
"in",
"snpEff",
"4",
".",
"1",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L437-L450 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _get_biodata | def _get_biodata(base_file, args):
"""Retrieve biodata genome targets customized by install parameters.
"""
with open(base_file) as in_handle:
config = yaml.safe_load(in_handle)
config["install_liftover"] = False
config["genome_indexes"] = args.aligners
ann_groups = config.pop("annotatio... | python | def _get_biodata(base_file, args):
"""Retrieve biodata genome targets customized by install parameters.
"""
with open(base_file) as in_handle:
config = yaml.safe_load(in_handle)
config["install_liftover"] = False
config["genome_indexes"] = args.aligners
ann_groups = config.pop("annotatio... | [
"def",
"_get_biodata",
"(",
"base_file",
",",
"args",
")",
":",
"with",
"open",
"(",
"base_file",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_handle",
")",
"config",
"[",
"\"install_liftover\"",
"]",
"=",
"False",
"config... | Retrieve biodata genome targets customized by install parameters. | [
"Retrieve",
"biodata",
"genome",
"targets",
"customized",
"by",
"install",
"parameters",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L452-L462 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _setup_genome_annotations | def _setup_genome_annotations(g, args, ann_groups):
"""Configure genome annotations to install based on datatarget.
"""
available_anns = g.get("annotations", []) + g.pop("annotations_available", [])
anns = []
for orig_target in args.datatarget:
if orig_target in ann_groups:
targe... | python | def _setup_genome_annotations(g, args, ann_groups):
"""Configure genome annotations to install based on datatarget.
"""
available_anns = g.get("annotations", []) + g.pop("annotations_available", [])
anns = []
for orig_target in args.datatarget:
if orig_target in ann_groups:
targe... | [
"def",
"_setup_genome_annotations",
"(",
"g",
",",
"args",
",",
"ann_groups",
")",
":",
"available_anns",
"=",
"g",
".",
"get",
"(",
"\"annotations\"",
",",
"[",
"]",
")",
"+",
"g",
".",
"pop",
"(",
"\"annotations_available\"",
",",
"[",
"]",
")",
"anns"... | Configure genome annotations to install based on datatarget. | [
"Configure",
"genome",
"annotations",
"to",
"install",
"based",
"on",
"datatarget",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L464-L480 | train |
bcbio/bcbio-nextgen | bcbio/install.py | upgrade_thirdparty_tools | def upgrade_thirdparty_tools(args, remotes):
"""Install and update third party tools used in the pipeline.
Creates a manifest directory with installed programs on the system.
"""
cbl = get_cloudbiolinux(remotes)
if args.toolconf and os.path.exists(args.toolconf):
package_yaml = args.toolcon... | python | def upgrade_thirdparty_tools(args, remotes):
"""Install and update third party tools used in the pipeline.
Creates a manifest directory with installed programs on the system.
"""
cbl = get_cloudbiolinux(remotes)
if args.toolconf and os.path.exists(args.toolconf):
package_yaml = args.toolcon... | [
"def",
"upgrade_thirdparty_tools",
"(",
"args",
",",
"remotes",
")",
":",
"cbl",
"=",
"get_cloudbiolinux",
"(",
"remotes",
")",
"if",
"args",
".",
"toolconf",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"args",
".",
"toolconf",
")",
":",
"package_yaml",
... | Install and update third party tools used in the pipeline.
Creates a manifest directory with installed programs on the system. | [
"Install",
"and",
"update",
"third",
"party",
"tools",
"used",
"in",
"the",
"pipeline",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L482-L503 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _install_toolplus | def _install_toolplus(args):
"""Install additional tools we cannot distribute, updating local manifest.
"""
manifest_dir = os.path.join(_get_data_dir(), "manifest")
toolplus_manifest = os.path.join(manifest_dir, "toolplus-packages.yaml")
system_config = os.path.join(_get_data_dir(), "galaxy", "bcbio... | python | def _install_toolplus(args):
"""Install additional tools we cannot distribute, updating local manifest.
"""
manifest_dir = os.path.join(_get_data_dir(), "manifest")
toolplus_manifest = os.path.join(manifest_dir, "toolplus-packages.yaml")
system_config = os.path.join(_get_data_dir(), "galaxy", "bcbio... | [
"def",
"_install_toolplus",
"(",
"args",
")",
":",
"manifest_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_get_data_dir",
"(",
")",
",",
"\"manifest\"",
")",
"toolplus_manifest",
"=",
"os",
".",
"path",
".",
"join",
"(",
"manifest_dir",
",",
"\"toolplu... | Install additional tools we cannot distribute, updating local manifest. | [
"Install",
"additional",
"tools",
"we",
"cannot",
"distribute",
"updating",
"local",
"manifest",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L505-L522 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _install_gatk_jar | def _install_gatk_jar(name, fname, manifest, system_config, toolplus_dir):
"""Install a jar for GATK or associated tools like MuTect.
"""
if not fname.endswith(".jar"):
raise ValueError("--toolplus argument for %s expects a jar file: %s" % (name, fname))
version = get_gatk_jar_version(name, fnam... | python | def _install_gatk_jar(name, fname, manifest, system_config, toolplus_dir):
"""Install a jar for GATK or associated tools like MuTect.
"""
if not fname.endswith(".jar"):
raise ValueError("--toolplus argument for %s expects a jar file: %s" % (name, fname))
version = get_gatk_jar_version(name, fnam... | [
"def",
"_install_gatk_jar",
"(",
"name",
",",
"fname",
",",
"manifest",
",",
"system_config",
",",
"toolplus_dir",
")",
":",
"if",
"not",
"fname",
".",
"endswith",
"(",
"\".jar\"",
")",
":",
"raise",
"ValueError",
"(",
"\"--toolplus argument for %s expects a jar f... | Install a jar for GATK or associated tools like MuTect. | [
"Install",
"a",
"jar",
"for",
"GATK",
"or",
"associated",
"tools",
"like",
"MuTect",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L532-L541 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _update_manifest | def _update_manifest(manifest_file, name, version):
"""Update the toolplus manifest file with updated name and version
"""
if os.path.exists(manifest_file):
with open(manifest_file) as in_handle:
manifest = yaml.safe_load(in_handle)
else:
manifest = {}
manifest[name] = {"... | python | def _update_manifest(manifest_file, name, version):
"""Update the toolplus manifest file with updated name and version
"""
if os.path.exists(manifest_file):
with open(manifest_file) as in_handle:
manifest = yaml.safe_load(in_handle)
else:
manifest = {}
manifest[name] = {"... | [
"def",
"_update_manifest",
"(",
"manifest_file",
",",
"name",
",",
"version",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"manifest_file",
")",
":",
"with",
"open",
"(",
"manifest_file",
")",
"as",
"in_handle",
":",
"manifest",
"=",
"yaml",
".... | Update the toolplus manifest file with updated name and version | [
"Update",
"the",
"toolplus",
"manifest",
"file",
"with",
"updated",
"name",
"and",
"version"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L543-L553 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _update_system_file | def _update_system_file(system_file, name, new_kvs):
"""Update the bcbio_system.yaml file with new resource information.
"""
if os.path.exists(system_file):
bak_file = system_file + ".bak%s" % datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
shutil.copyfile(system_file, bak_file)
... | python | def _update_system_file(system_file, name, new_kvs):
"""Update the bcbio_system.yaml file with new resource information.
"""
if os.path.exists(system_file):
bak_file = system_file + ".bak%s" % datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
shutil.copyfile(system_file, bak_file)
... | [
"def",
"_update_system_file",
"(",
"system_file",
",",
"name",
",",
"new_kvs",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"system_file",
")",
":",
"bak_file",
"=",
"system_file",
"+",
"\".bak%s\"",
"%",
"datetime",
".",
"datetime",
".",
"now",
... | Update the bcbio_system.yaml file with new resource information. | [
"Update",
"the",
"bcbio_system",
".",
"yaml",
"file",
"with",
"new",
"resource",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L555-L578 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _install_kraken_db | def _install_kraken_db(datadir, args):
"""Install kraken minimal DB in genome folder.
"""
import requests
kraken = os.path.join(datadir, "genomes/kraken")
url = "https://ccb.jhu.edu/software/kraken/dl/minikraken.tgz"
compress = os.path.join(kraken, os.path.basename(url))
base, ext = utils.sp... | python | def _install_kraken_db(datadir, args):
"""Install kraken minimal DB in genome folder.
"""
import requests
kraken = os.path.join(datadir, "genomes/kraken")
url = "https://ccb.jhu.edu/software/kraken/dl/minikraken.tgz"
compress = os.path.join(kraken, os.path.basename(url))
base, ext = utils.sp... | [
"def",
"_install_kraken_db",
"(",
"datadir",
",",
"args",
")",
":",
"import",
"requests",
"kraken",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"\"genomes/kraken\"",
")",
"url",
"=",
"\"https://ccb.jhu.edu/software/kraken/dl/minikraken.tgz\"",
"compres... | Install kraken minimal DB in genome folder. | [
"Install",
"kraken",
"minimal",
"DB",
"in",
"genome",
"folder",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L580-L616 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _get_install_config | def _get_install_config():
"""Return the YAML configuration file used to store upgrade information.
"""
try:
data_dir = _get_data_dir()
except ValueError:
return None
config_dir = utils.safe_makedir(os.path.join(data_dir, "config"))
return os.path.join(config_dir, "install-params... | python | def _get_install_config():
"""Return the YAML configuration file used to store upgrade information.
"""
try:
data_dir = _get_data_dir()
except ValueError:
return None
config_dir = utils.safe_makedir(os.path.join(data_dir, "config"))
return os.path.join(config_dir, "install-params... | [
"def",
"_get_install_config",
"(",
")",
":",
"try",
":",
"data_dir",
"=",
"_get_data_dir",
"(",
")",
"except",
"ValueError",
":",
"return",
"None",
"config_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
... | Return the YAML configuration file used to store upgrade information. | [
"Return",
"the",
"YAML",
"configuration",
"file",
"used",
"to",
"store",
"upgrade",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L620-L628 | train |
bcbio/bcbio-nextgen | bcbio/install.py | save_install_defaults | def save_install_defaults(args):
"""Save installation information to make future upgrades easier.
"""
install_config = _get_install_config()
if install_config is None:
return
if utils.file_exists(install_config):
with open(install_config) as in_handle:
cur_config = yaml.s... | python | def save_install_defaults(args):
"""Save installation information to make future upgrades easier.
"""
install_config = _get_install_config()
if install_config is None:
return
if utils.file_exists(install_config):
with open(install_config) as in_handle:
cur_config = yaml.s... | [
"def",
"save_install_defaults",
"(",
"args",
")",
":",
"install_config",
"=",
"_get_install_config",
"(",
")",
"if",
"install_config",
"is",
"None",
":",
"return",
"if",
"utils",
".",
"file_exists",
"(",
"install_config",
")",
":",
"with",
"open",
"(",
"instal... | Save installation information to make future upgrades easier. | [
"Save",
"installation",
"information",
"to",
"make",
"future",
"upgrades",
"easier",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L630-L659 | train |
bcbio/bcbio-nextgen | bcbio/install.py | add_install_defaults | def add_install_defaults(args):
"""Add any saved installation defaults to the upgrade.
"""
# Ensure we install data if we've specified any secondary installation targets
if len(args.genomes) > 0 or len(args.aligners) > 0 or len(args.datatarget) > 0:
args.install_data = True
install_config = ... | python | def add_install_defaults(args):
"""Add any saved installation defaults to the upgrade.
"""
# Ensure we install data if we've specified any secondary installation targets
if len(args.genomes) > 0 or len(args.aligners) > 0 or len(args.datatarget) > 0:
args.install_data = True
install_config = ... | [
"def",
"add_install_defaults",
"(",
"args",
")",
":",
"# Ensure we install data if we've specified any secondary installation targets",
"if",
"len",
"(",
"args",
".",
"genomes",
")",
">",
"0",
"or",
"len",
"(",
"args",
".",
"aligners",
")",
">",
"0",
"or",
"len",
... | Add any saved installation defaults to the upgrade. | [
"Add",
"any",
"saved",
"installation",
"defaults",
"to",
"the",
"upgrade",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L661-L697 | train |
bcbio/bcbio-nextgen | bcbio/install.py | _datatarget_defaults | def _datatarget_defaults(args, default_args):
"""Set data installation targets, handling defaults.
Sets variation, rnaseq, smallrna as default targets if we're not
isolated to a single method.
Provides back compatibility for toolplus specifications.
"""
default_data = default_args.get("datatar... | python | def _datatarget_defaults(args, default_args):
"""Set data installation targets, handling defaults.
Sets variation, rnaseq, smallrna as default targets if we're not
isolated to a single method.
Provides back compatibility for toolplus specifications.
"""
default_data = default_args.get("datatar... | [
"def",
"_datatarget_defaults",
"(",
"args",
",",
"default_args",
")",
":",
"default_data",
"=",
"default_args",
".",
"get",
"(",
"\"datatarget\"",
",",
"[",
"]",
")",
"# back-compatible toolplus specifications",
"for",
"x",
"in",
"default_args",
".",
"get",
"(",
... | Set data installation targets, handling defaults.
Sets variation, rnaseq, smallrna as default targets if we're not
isolated to a single method.
Provides back compatibility for toolplus specifications. | [
"Set",
"data",
"installation",
"targets",
"handling",
"defaults",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L699-L730 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _merge_wf_inputs | def _merge_wf_inputs(new, out, wf_outputs, to_ignore, parallel, nested_inputs):
"""Merge inputs for a sub-workflow, adding any not present inputs in out.
Skips inputs that are internally generated or generated and ignored, keeping
only as inputs those that we do not generate internally.
"""
interna... | python | def _merge_wf_inputs(new, out, wf_outputs, to_ignore, parallel, nested_inputs):
"""Merge inputs for a sub-workflow, adding any not present inputs in out.
Skips inputs that are internally generated or generated and ignored, keeping
only as inputs those that we do not generate internally.
"""
interna... | [
"def",
"_merge_wf_inputs",
"(",
"new",
",",
"out",
",",
"wf_outputs",
",",
"to_ignore",
",",
"parallel",
",",
"nested_inputs",
")",
":",
"internal_generated_ids",
"=",
"[",
"]",
"for",
"vignore",
"in",
"to_ignore",
":",
"vignore_id",
"=",
"_get_string_vid",
"(... | Merge inputs for a sub-workflow, adding any not present inputs in out.
Skips inputs that are internally generated or generated and ignored, keeping
only as inputs those that we do not generate internally. | [
"Merge",
"inputs",
"for",
"a",
"sub",
"-",
"workflow",
"adding",
"any",
"not",
"present",
"inputs",
"in",
"out",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L72-L100 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _merge_wf_outputs | def _merge_wf_outputs(new, cur, parallel):
"""Merge outputs for a sub-workflow, replacing variables changed in later steps.
ignore_ids are those used internally in a sub-workflow but not exposed to subsequent steps
"""
new_ids = set([])
out = []
for v in new:
outv = {}
outv["sou... | python | def _merge_wf_outputs(new, cur, parallel):
"""Merge outputs for a sub-workflow, replacing variables changed in later steps.
ignore_ids are those used internally in a sub-workflow but not exposed to subsequent steps
"""
new_ids = set([])
out = []
for v in new:
outv = {}
outv["sou... | [
"def",
"_merge_wf_outputs",
"(",
"new",
",",
"cur",
",",
"parallel",
")",
":",
"new_ids",
"=",
"set",
"(",
"[",
"]",
")",
"out",
"=",
"[",
"]",
"for",
"v",
"in",
"new",
":",
"outv",
"=",
"{",
"}",
"outv",
"[",
"\"source\"",
"]",
"=",
"v",
"[",
... | Merge outputs for a sub-workflow, replacing variables changed in later steps.
ignore_ids are those used internally in a sub-workflow but not exposed to subsequent steps | [
"Merge",
"outputs",
"for",
"a",
"sub",
"-",
"workflow",
"replacing",
"variables",
"changed",
"in",
"later",
"steps",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L102-L123 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _extract_from_subworkflow | def _extract_from_subworkflow(vs, step):
"""Remove internal variable names when moving from sub-workflow to main.
"""
substep_ids = set([x.name for x in step.workflow])
out = []
for var in vs:
internal = False
parts = var["id"].split("/")
if len(parts) > 1:
if par... | python | def _extract_from_subworkflow(vs, step):
"""Remove internal variable names when moving from sub-workflow to main.
"""
substep_ids = set([x.name for x in step.workflow])
out = []
for var in vs:
internal = False
parts = var["id"].split("/")
if len(parts) > 1:
if par... | [
"def",
"_extract_from_subworkflow",
"(",
"vs",
",",
"step",
")",
":",
"substep_ids",
"=",
"set",
"(",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"step",
".",
"workflow",
"]",
")",
"out",
"=",
"[",
"]",
"for",
"var",
"in",
"vs",
":",
"internal",
"=",
... | Remove internal variable names when moving from sub-workflow to main. | [
"Remove",
"internal",
"variable",
"names",
"when",
"moving",
"from",
"sub",
"-",
"workflow",
"to",
"main",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L125-L139 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | is_cwl_record | def is_cwl_record(d):
"""Check if an input is a CWL record, from any level of nesting.
"""
if isinstance(d, dict):
if d.get("type") == "record":
return d
else:
recs = list(filter(lambda x: x is not None, [is_cwl_record(v) for v in d.values()]))
return recs... | python | def is_cwl_record(d):
"""Check if an input is a CWL record, from any level of nesting.
"""
if isinstance(d, dict):
if d.get("type") == "record":
return d
else:
recs = list(filter(lambda x: x is not None, [is_cwl_record(v) for v in d.values()]))
return recs... | [
"def",
"is_cwl_record",
"(",
"d",
")",
":",
"if",
"isinstance",
"(",
"d",
",",
"dict",
")",
":",
"if",
"d",
".",
"get",
"(",
"\"type\"",
")",
"==",
"\"record\"",
":",
"return",
"d",
"else",
":",
"recs",
"=",
"list",
"(",
"filter",
"(",
"lambda",
... | Check if an input is a CWL record, from any level of nesting. | [
"Check",
"if",
"an",
"input",
"is",
"a",
"CWL",
"record",
"from",
"any",
"level",
"of",
"nesting",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L150-L160 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _get_step_inputs | def _get_step_inputs(step, file_vs, std_vs, parallel_ids, wf=None):
"""Retrieve inputs for a step from existing variables.
Potentially nests inputs to deal with merging split variables. If
we split previously and are merging now, then we only nest those
coming from the split process.
"""
inputs... | python | def _get_step_inputs(step, file_vs, std_vs, parallel_ids, wf=None):
"""Retrieve inputs for a step from existing variables.
Potentially nests inputs to deal with merging split variables. If
we split previously and are merging now, then we only nest those
coming from the split process.
"""
inputs... | [
"def",
"_get_step_inputs",
"(",
"step",
",",
"file_vs",
",",
"std_vs",
",",
"parallel_ids",
",",
"wf",
"=",
"None",
")",
":",
"inputs",
"=",
"[",
"]",
"skip_inputs",
"=",
"set",
"(",
"[",
"]",
")",
"for",
"orig_input",
"in",
"[",
"_get_variable",
"(",
... | Retrieve inputs for a step from existing variables.
Potentially nests inputs to deal with merging split variables. If
we split previously and are merging now, then we only nest those
coming from the split process. | [
"Retrieve",
"inputs",
"for",
"a",
"step",
"from",
"existing",
"variables",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L162-L197 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _nest_variable | def _nest_variable(v, check_records=False):
"""Nest a variable when moving from scattered back to consolidated.
check_records -- avoid re-nesting a record input if it comes from a previous
step and is already nested, don't need to re-array.
"""
if (check_records and is_cwl_record(v) and len(v["id"]... | python | def _nest_variable(v, check_records=False):
"""Nest a variable when moving from scattered back to consolidated.
check_records -- avoid re-nesting a record input if it comes from a previous
step and is already nested, don't need to re-array.
"""
if (check_records and is_cwl_record(v) and len(v["id"]... | [
"def",
"_nest_variable",
"(",
"v",
",",
"check_records",
"=",
"False",
")",
":",
"if",
"(",
"check_records",
"and",
"is_cwl_record",
"(",
"v",
")",
"and",
"len",
"(",
"v",
"[",
"\"id\"",
"]",
".",
"split",
"(",
"\"/\"",
")",
")",
">",
"1",
"and",
"... | Nest a variable when moving from scattered back to consolidated.
check_records -- avoid re-nesting a record input if it comes from a previous
step and is already nested, don't need to re-array. | [
"Nest",
"a",
"variable",
"when",
"moving",
"from",
"scattered",
"back",
"to",
"consolidated",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L251-L263 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _clean_output | def _clean_output(v):
"""Remove output specific variables to allow variables to be inputs to next steps.
"""
out = copy.deepcopy(v)
outb = out.pop("outputBinding", {})
if "secondaryFiles" in outb:
out["secondaryFiles"] = outb["secondaryFiles"]
return out | python | def _clean_output(v):
"""Remove output specific variables to allow variables to be inputs to next steps.
"""
out = copy.deepcopy(v)
outb = out.pop("outputBinding", {})
if "secondaryFiles" in outb:
out["secondaryFiles"] = outb["secondaryFiles"]
return out | [
"def",
"_clean_output",
"(",
"v",
")",
":",
"out",
"=",
"copy",
".",
"deepcopy",
"(",
"v",
")",
"outb",
"=",
"out",
".",
"pop",
"(",
"\"outputBinding\"",
",",
"{",
"}",
")",
"if",
"\"secondaryFiles\"",
"in",
"outb",
":",
"out",
"[",
"\"secondaryFiles\"... | Remove output specific variables to allow variables to be inputs to next steps. | [
"Remove",
"output",
"specific",
"variables",
"to",
"allow",
"variables",
"to",
"be",
"inputs",
"to",
"next",
"steps",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L265-L272 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _get_variable | def _get_variable(vid, variables):
"""Retrieve an input variable from our existing pool of options.
"""
if isinstance(vid, six.string_types):
vid = get_base_id(vid)
else:
vid = _get_string_vid(vid)
for v in variables:
if vid == get_base_id(v["id"]):
return copy.de... | python | def _get_variable(vid, variables):
"""Retrieve an input variable from our existing pool of options.
"""
if isinstance(vid, six.string_types):
vid = get_base_id(vid)
else:
vid = _get_string_vid(vid)
for v in variables:
if vid == get_base_id(v["id"]):
return copy.de... | [
"def",
"_get_variable",
"(",
"vid",
",",
"variables",
")",
":",
"if",
"isinstance",
"(",
"vid",
",",
"six",
".",
"string_types",
")",
":",
"vid",
"=",
"get_base_id",
"(",
"vid",
")",
"else",
":",
"vid",
"=",
"_get_string_vid",
"(",
"vid",
")",
"for",
... | Retrieve an input variable from our existing pool of options. | [
"Retrieve",
"an",
"input",
"variable",
"from",
"our",
"existing",
"pool",
"of",
"options",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L280-L290 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _handle_special_inputs | def _handle_special_inputs(inputs, variables):
"""Adjust input variables based on special cases.
This case handles inputs where we are optional or can have flexible choices.
XXX Need to better expose this at a top level definition.
"""
from bcbio import structural
optional = [["config", "algor... | python | def _handle_special_inputs(inputs, variables):
"""Adjust input variables based on special cases.
This case handles inputs where we are optional or can have flexible choices.
XXX Need to better expose this at a top level definition.
"""
from bcbio import structural
optional = [["config", "algor... | [
"def",
"_handle_special_inputs",
"(",
"inputs",
",",
"variables",
")",
":",
"from",
"bcbio",
"import",
"structural",
"optional",
"=",
"[",
"[",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"coverage\"",
"]",
",",
"[",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"... | Adjust input variables based on special cases.
This case handles inputs where we are optional or can have flexible choices.
XXX Need to better expose this at a top level definition. | [
"Adjust",
"input",
"variables",
"based",
"on",
"special",
"cases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L292-L332 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _create_record | def _create_record(name, field_defs, step_name, inputs, unlist, file_vs, std_vs, parallel):
"""Create an output record by rearranging inputs.
Batching processes create records that reformat the inputs for
parallelization.
"""
if field_defs:
fields = []
inherit = []
inherit_a... | python | def _create_record(name, field_defs, step_name, inputs, unlist, file_vs, std_vs, parallel):
"""Create an output record by rearranging inputs.
Batching processes create records that reformat the inputs for
parallelization.
"""
if field_defs:
fields = []
inherit = []
inherit_a... | [
"def",
"_create_record",
"(",
"name",
",",
"field_defs",
",",
"step_name",
",",
"inputs",
",",
"unlist",
",",
"file_vs",
",",
"std_vs",
",",
"parallel",
")",
":",
"if",
"field_defs",
":",
"fields",
"=",
"[",
"]",
"inherit",
"=",
"[",
"]",
"inherit_all",
... | Create an output record by rearranging inputs.
Batching processes create records that reformat the inputs for
parallelization. | [
"Create",
"an",
"output",
"record",
"by",
"rearranging",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L348-L382 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _infer_record_outputs | def _infer_record_outputs(inputs, unlist, file_vs, std_vs, parallel, to_include=None,
exclude=None):
"""Infer the outputs of a record from the original inputs
"""
fields = []
unlist = set([_get_string_vid(x) for x in unlist])
input_vids = set([_get_string_vid(v) for v in _h... | python | def _infer_record_outputs(inputs, unlist, file_vs, std_vs, parallel, to_include=None,
exclude=None):
"""Infer the outputs of a record from the original inputs
"""
fields = []
unlist = set([_get_string_vid(x) for x in unlist])
input_vids = set([_get_string_vid(v) for v in _h... | [
"def",
"_infer_record_outputs",
"(",
"inputs",
",",
"unlist",
",",
"file_vs",
",",
"std_vs",
",",
"parallel",
",",
"to_include",
"=",
"None",
",",
"exclude",
"=",
"None",
")",
":",
"fields",
"=",
"[",
"]",
"unlist",
"=",
"set",
"(",
"[",
"_get_string_vid... | Infer the outputs of a record from the original inputs | [
"Infer",
"the",
"outputs",
"of",
"a",
"record",
"from",
"the",
"original",
"inputs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L390-L419 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _create_variable | def _create_variable(orig_v, step, variables):
"""Create a new output variable, potentially over-writing existing or creating new.
"""
# get current variable, and convert to be the output of our process step
try:
v = _get_variable(orig_v["id"], variables)
except ValueError:
v = copy.... | python | def _create_variable(orig_v, step, variables):
"""Create a new output variable, potentially over-writing existing or creating new.
"""
# get current variable, and convert to be the output of our process step
try:
v = _get_variable(orig_v["id"], variables)
except ValueError:
v = copy.... | [
"def",
"_create_variable",
"(",
"orig_v",
",",
"step",
",",
"variables",
")",
":",
"# get current variable, and convert to be the output of our process step",
"try",
":",
"v",
"=",
"_get_variable",
"(",
"orig_v",
"[",
"\"id\"",
"]",
",",
"variables",
")",
"except",
... | Create a new output variable, potentially over-writing existing or creating new. | [
"Create",
"a",
"new",
"output",
"variable",
"potentially",
"over",
"-",
"writing",
"existing",
"or",
"creating",
"new",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L421-L437 | train |
bcbio/bcbio-nextgen | bcbio/cwl/workflow.py | _merge_variables | def _merge_variables(new, cur):
"""Add any new variables to the world representation in cur.
Replaces any variables adjusted by previous steps.
"""
new_added = set([])
out = []
for cur_var in cur:
updated = False
for new_var in new:
if get_base_id(new_var["id"]) == g... | python | def _merge_variables(new, cur):
"""Add any new variables to the world representation in cur.
Replaces any variables adjusted by previous steps.
"""
new_added = set([])
out = []
for cur_var in cur:
updated = False
for new_var in new:
if get_base_id(new_var["id"]) == g... | [
"def",
"_merge_variables",
"(",
"new",
",",
"cur",
")",
":",
"new_added",
"=",
"set",
"(",
"[",
"]",
")",
"out",
"=",
"[",
"]",
"for",
"cur_var",
"in",
"cur",
":",
"updated",
"=",
"False",
"for",
"new_var",
"in",
"new",
":",
"if",
"get_base_id",
"(... | Add any new variables to the world representation in cur.
Replaces any variables adjusted by previous steps. | [
"Add",
"any",
"new",
"variables",
"to",
"the",
"world",
"representation",
"in",
"cur",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L439-L459 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/disambiguate/__init__.py | split | def split(*items):
"""Split samples into all possible genomes for alignment.
"""
out = []
for data in [x[0] for x in items]:
dis_orgs = data["config"]["algorithm"].get("disambiguate")
if dis_orgs:
if not data.get("disambiguate", None):
data["disambiguate"] = {... | python | def split(*items):
"""Split samples into all possible genomes for alignment.
"""
out = []
for data in [x[0] for x in items]:
dis_orgs = data["config"]["algorithm"].get("disambiguate")
if dis_orgs:
if not data.get("disambiguate", None):
data["disambiguate"] = {... | [
"def",
"split",
"(",
"*",
"items",
")",
":",
"out",
"=",
"[",
"]",
"for",
"data",
"in",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"items",
"]",
":",
"dis_orgs",
"=",
"data",
"[",
"\"config\"",
"]",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
... | Split samples into all possible genomes for alignment. | [
"Split",
"samples",
"into",
"all",
"possible",
"genomes",
"for",
"alignment",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L28-L51 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/disambiguate/__init__.py | resolve | def resolve(items, run_parallel):
"""Combine aligned and split samples into final set of disambiguated reads.
"""
out = []
to_process = collections.defaultdict(list)
for data in [x[0] for x in items]:
if "disambiguate" in data:
split_part = tuple([int(x) for x in data["align_spli... | python | def resolve(items, run_parallel):
"""Combine aligned and split samples into final set of disambiguated reads.
"""
out = []
to_process = collections.defaultdict(list)
for data in [x[0] for x in items]:
if "disambiguate" in data:
split_part = tuple([int(x) for x in data["align_spli... | [
"def",
"resolve",
"(",
"items",
",",
"run_parallel",
")",
":",
"out",
"=",
"[",
"]",
"to_process",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"data",
"in",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"items",
"]",
":",
"if",
... | Combine aligned and split samples into final set of disambiguated reads. | [
"Combine",
"aligned",
"and",
"split",
"samples",
"into",
"final",
"set",
"of",
"disambiguated",
"reads",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L53-L77 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/disambiguate/__init__.py | merge_extras | def merge_extras(items, config):
"""Merge extra disambiguated reads into a final BAM file.
"""
final = {}
for extra_name in items[0]["disambiguate"].keys():
in_files = []
for data in items:
in_files.append(data["disambiguate"][extra_name])
out_file = "%s-allmerged%s" ... | python | def merge_extras(items, config):
"""Merge extra disambiguated reads into a final BAM file.
"""
final = {}
for extra_name in items[0]["disambiguate"].keys():
in_files = []
for data in items:
in_files.append(data["disambiguate"][extra_name])
out_file = "%s-allmerged%s" ... | [
"def",
"merge_extras",
"(",
"items",
",",
"config",
")",
":",
"final",
"=",
"{",
"}",
"for",
"extra_name",
"in",
"items",
"[",
"0",
"]",
"[",
"\"disambiguate\"",
"]",
".",
"keys",
"(",
")",
":",
"in_files",
"=",
"[",
"]",
"for",
"data",
"in",
"item... | Merge extra disambiguated reads into a final BAM file. | [
"Merge",
"extra",
"disambiguated",
"reads",
"into",
"a",
"final",
"BAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L79-L99 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/disambiguate/__init__.py | _merge_summary | def _merge_summary(in_files, out_file, data):
"""Create one big summary file for disambiguation from multiple splits.
"""
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
with open(tx_out_file, "w") as out_handle:
for i, in_file in... | python | def _merge_summary(in_files, out_file, data):
"""Create one big summary file for disambiguation from multiple splits.
"""
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
with open(tx_out_file, "w") as out_handle:
for i, in_file in... | [
"def",
"_merge_summary",
"(",
"in_files",
",",
"out_file",
",",
"data",
")",
":",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"with",
"open",
... | Create one big summary file for disambiguation from multiple splits. | [
"Create",
"one",
"big",
"summary",
"file",
"for",
"disambiguation",
"from",
"multiple",
"splits",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L101-L115 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/disambiguate/__init__.py | _run_python | def _run_python(work_bam_a, work_bam_b, out_dir, aligner, prefix, items):
"""Run python version of disambiguation
"""
Args = collections.namedtuple("Args", "A B output_dir intermediate_dir "
"no_sort prefix aligner")
args = Args(work_bam_a, work_bam_b, out_dir, out_di... | python | def _run_python(work_bam_a, work_bam_b, out_dir, aligner, prefix, items):
"""Run python version of disambiguation
"""
Args = collections.namedtuple("Args", "A B output_dir intermediate_dir "
"no_sort prefix aligner")
args = Args(work_bam_a, work_bam_b, out_dir, out_di... | [
"def",
"_run_python",
"(",
"work_bam_a",
",",
"work_bam_b",
",",
"out_dir",
",",
"aligner",
",",
"prefix",
",",
"items",
")",
":",
"Args",
"=",
"collections",
".",
"namedtuple",
"(",
"\"Args\"",
",",
"\"A B output_dir intermediate_dir \"",
"\"no_sort prefix aligner\... | Run python version of disambiguation | [
"Run",
"python",
"version",
"of",
"disambiguation"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L153-L159 | train |
bcbio/bcbio-nextgen | bcbio/cwl/main.py | run | def run(args):
"""Run a CWL preparation pipeline.
"""
dirs, config, run_info_yaml = run_info.prep_system(args.sample_config, args.systemconfig)
integrations = args.integrations if hasattr(args, "integrations") else {}
world = run_info.organize(dirs, config, run_info_yaml, is_cwl=True, integrations=i... | python | def run(args):
"""Run a CWL preparation pipeline.
"""
dirs, config, run_info_yaml = run_info.prep_system(args.sample_config, args.systemconfig)
integrations = args.integrations if hasattr(args, "integrations") else {}
world = run_info.organize(dirs, config, run_info_yaml, is_cwl=True, integrations=i... | [
"def",
"run",
"(",
"args",
")",
":",
"dirs",
",",
"config",
",",
"run_info_yaml",
"=",
"run_info",
".",
"prep_system",
"(",
"args",
".",
"sample_config",
",",
"args",
".",
"systemconfig",
")",
"integrations",
"=",
"args",
".",
"integrations",
"if",
"hasatt... | Run a CWL preparation pipeline. | [
"Run",
"a",
"CWL",
"preparation",
"pipeline",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/main.py#L6-L12 | train |
bcbio/bcbio-nextgen | bcbio/variation/coverage.py | assign_interval | def assign_interval(data):
"""Identify coverage based on percent of genome covered and relation to targets.
Classifies coverage into 3 categories:
- genome: Full genome coverage
- regional: Regional coverage, like exome capture, with off-target reads
- amplicon: Amplication based regional cov... | python | def assign_interval(data):
"""Identify coverage based on percent of genome covered and relation to targets.
Classifies coverage into 3 categories:
- genome: Full genome coverage
- regional: Regional coverage, like exome capture, with off-target reads
- amplicon: Amplication based regional cov... | [
"def",
"assign_interval",
"(",
"data",
")",
":",
"if",
"not",
"dd",
".",
"get_coverage_interval",
"(",
"data",
")",
":",
"vrs",
"=",
"dd",
".",
"get_variant_regions_merged",
"(",
"data",
")",
"callable_file",
"=",
"dd",
".",
"get_sample_callable",
"(",
"data... | Identify coverage based on percent of genome covered and relation to targets.
Classifies coverage into 3 categories:
- genome: Full genome coverage
- regional: Regional coverage, like exome capture, with off-target reads
- amplicon: Amplication based regional coverage without off-target reads | [
"Identify",
"coverage",
"based",
"on",
"percent",
"of",
"genome",
"covered",
"and",
"relation",
"to",
"targets",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L29-L62 | train |
bcbio/bcbio-nextgen | bcbio/variation/coverage.py | calculate | def calculate(bam_file, data, sv_bed):
"""Calculate coverage in parallel using mosdepth.
Removes duplicates and secondary reads from the counts:
if ( b->core.flag & (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) ) continue;
"""
params = {"min": dd.get_coverage_depth_min(data)}
variant_r... | python | def calculate(bam_file, data, sv_bed):
"""Calculate coverage in parallel using mosdepth.
Removes duplicates and secondary reads from the counts:
if ( b->core.flag & (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) ) continue;
"""
params = {"min": dd.get_coverage_depth_min(data)}
variant_r... | [
"def",
"calculate",
"(",
"bam_file",
",",
"data",
",",
"sv_bed",
")",
":",
"params",
"=",
"{",
"\"min\"",
":",
"dd",
".",
"get_coverage_depth_min",
"(",
"data",
")",
"}",
"variant_regions",
"=",
"dd",
".",
"get_variant_regions_merged",
"(",
"data",
")",
"i... | Calculate coverage in parallel using mosdepth.
Removes duplicates and secondary reads from the counts:
if ( b->core.flag & (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) ) continue; | [
"Calculate",
"coverage",
"in",
"parallel",
"using",
"mosdepth",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L73-L111 | train |
bcbio/bcbio-nextgen | bcbio/variation/coverage.py | _create_genome_regions | def _create_genome_regions(data):
"""Create whole genome contigs we want to process, only non-alts.
Skips problem contigs like HLAs for downstream analysis.
"""
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "coverage", dd.get_sample_name(data)))
variant_regions = os.path.join(wo... | python | def _create_genome_regions(data):
"""Create whole genome contigs we want to process, only non-alts.
Skips problem contigs like HLAs for downstream analysis.
"""
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "coverage", dd.get_sample_name(data)))
variant_regions = os.path.join(wo... | [
"def",
"_create_genome_regions",
"(",
"data",
")",
":",
"work_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"coverage\"",
",",
"dd",
".",
"get_sample_name",
"(",
"da... | Create whole genome contigs we want to process, only non-alts.
Skips problem contigs like HLAs for downstream analysis. | [
"Create",
"whole",
"genome",
"contigs",
"we",
"want",
"to",
"process",
"only",
"non",
"-",
"alts",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L113-L124 | train |
bcbio/bcbio-nextgen | bcbio/variation/coverage.py | _subset_to_variant_regions | def _subset_to_variant_regions(callable_file, variant_regions, data):
"""Subset output callable file to only variant regions of interest.
"""
out_file = "%s-vrsubset.bed" % utils.splitext_plus(callable_file)[0]
if not utils.file_uptodate(out_file, callable_file):
with file_transaction(data, out_... | python | def _subset_to_variant_regions(callable_file, variant_regions, data):
"""Subset output callable file to only variant regions of interest.
"""
out_file = "%s-vrsubset.bed" % utils.splitext_plus(callable_file)[0]
if not utils.file_uptodate(out_file, callable_file):
with file_transaction(data, out_... | [
"def",
"_subset_to_variant_regions",
"(",
"callable_file",
",",
"variant_regions",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s-vrsubset.bed\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"callable_file",
")",
"[",
"0",
"]",
"if",
"not",
"utils",
".",
"file_uptod... | Subset output callable file to only variant regions of interest. | [
"Subset",
"output",
"callable",
"file",
"to",
"only",
"variant",
"regions",
"of",
"interest",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L126-L134 | train |
bcbio/bcbio-nextgen | bcbio/variation/coverage.py | _average_genome_coverage | def _average_genome_coverage(data, bam_file):
"""Quickly calculate average coverage for whole genome files using indices.
Includes all reads, with duplicates. Uses sampling of 10M reads.
"""
total = sum([c.size for c in ref.file_contigs(dd.get_ref_file(data), data["config"])])
read_counts = sum(x.a... | python | def _average_genome_coverage(data, bam_file):
"""Quickly calculate average coverage for whole genome files using indices.
Includes all reads, with duplicates. Uses sampling of 10M reads.
"""
total = sum([c.size for c in ref.file_contigs(dd.get_ref_file(data), data["config"])])
read_counts = sum(x.a... | [
"def",
"_average_genome_coverage",
"(",
"data",
",",
"bam_file",
")",
":",
"total",
"=",
"sum",
"(",
"[",
"c",
".",
"size",
"for",
"c",
"in",
"ref",
".",
"file_contigs",
"(",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
",",
"data",
"[",
"\"config\"",
... | Quickly calculate average coverage for whole genome files using indices.
Includes all reads, with duplicates. Uses sampling of 10M reads. | [
"Quickly",
"calculate",
"average",
"coverage",
"for",
"whole",
"genome",
"files",
"using",
"indices",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L171-L181 | train |
bcbio/bcbio-nextgen | bcbio/variation/coverage.py | regions_coverage | def regions_coverage(bed_file, target_name, data):
"""Generate coverage over regions of interest using mosdepth.
"""
ready_bed = tz.get_in(["depth", target_name, "regions"], data)
if ready_bed:
return ready_bed
else:
return run_mosdepth(data, target_name, bed_file).regions | python | def regions_coverage(bed_file, target_name, data):
"""Generate coverage over regions of interest using mosdepth.
"""
ready_bed = tz.get_in(["depth", target_name, "regions"], data)
if ready_bed:
return ready_bed
else:
return run_mosdepth(data, target_name, bed_file).regions | [
"def",
"regions_coverage",
"(",
"bed_file",
",",
"target_name",
",",
"data",
")",
":",
"ready_bed",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"depth\"",
",",
"target_name",
",",
"\"regions\"",
"]",
",",
"data",
")",
"if",
"ready_bed",
":",
"return",
"ready_bed... | Generate coverage over regions of interest using mosdepth. | [
"Generate",
"coverage",
"over",
"regions",
"of",
"interest",
"using",
"mosdepth",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L197-L204 | train |
bcbio/bcbio-nextgen | bcbio/variation/coverage.py | coverage_region_detailed_stats | def coverage_region_detailed_stats(target_name, bed_file, data, out_dir):
"""
Calculate coverage at different completeness cutoff
for region in coverage option.
"""
if bed_file and utils.file_exists(bed_file):
ready_depth = tz.get_in(["depth", target_name], data)
if ready_depth:
... | python | def coverage_region_detailed_stats(target_name, bed_file, data, out_dir):
"""
Calculate coverage at different completeness cutoff
for region in coverage option.
"""
if bed_file and utils.file_exists(bed_file):
ready_depth = tz.get_in(["depth", target_name], data)
if ready_depth:
... | [
"def",
"coverage_region_detailed_stats",
"(",
"target_name",
",",
"bed_file",
",",
"data",
",",
"out_dir",
")",
":",
"if",
"bed_file",
"and",
"utils",
".",
"file_exists",
"(",
"bed_file",
")",
":",
"ready_depth",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"depth\... | Calculate coverage at different completeness cutoff
for region in coverage option. | [
"Calculate",
"coverage",
"at",
"different",
"completeness",
"cutoff",
"for",
"region",
"in",
"coverage",
"option",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L249-L269 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/loh.py | get_coords | def get_coords(data):
"""Retrieve coordinates of genes of interest for prioritization.
Can read from CIViC input data or a supplied BED file of chrom, start, end
and gene information.
"""
for category, vtypes in [("LOH", {"LOSS", "HETEROZYGOSITY"}),
("amplification", {"... | python | def get_coords(data):
"""Retrieve coordinates of genes of interest for prioritization.
Can read from CIViC input data or a supplied BED file of chrom, start, end
and gene information.
"""
for category, vtypes in [("LOH", {"LOSS", "HETEROZYGOSITY"}),
("amplification", {"... | [
"def",
"get_coords",
"(",
"data",
")",
":",
"for",
"category",
",",
"vtypes",
"in",
"[",
"(",
"\"LOH\"",
",",
"{",
"\"LOSS\"",
",",
"\"HETEROZYGOSITY\"",
"}",
")",
",",
"(",
"\"amplification\"",
",",
"{",
"\"AMPLIFICATION\"",
"}",
")",
"]",
":",
"out",
... | Retrieve coordinates of genes of interest for prioritization.
Can read from CIViC input data or a supplied BED file of chrom, start, end
and gene information. | [
"Retrieve",
"coordinates",
"of",
"genes",
"of",
"interest",
"for",
"prioritization",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L29-L49 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/loh.py | _civic_regions | def _civic_regions(civic_file, variant_types=None, diseases=None, drugs=None):
"""Retrieve gene regions and names filtered by variant_types and diseases.
"""
if isinstance(diseases, six.string_types):
diseases = [diseases]
with utils.open_gzipsafe(civic_file) as in_handle:
reader = csv.r... | python | def _civic_regions(civic_file, variant_types=None, diseases=None, drugs=None):
"""Retrieve gene regions and names filtered by variant_types and diseases.
"""
if isinstance(diseases, six.string_types):
diseases = [diseases]
with utils.open_gzipsafe(civic_file) as in_handle:
reader = csv.r... | [
"def",
"_civic_regions",
"(",
"civic_file",
",",
"variant_types",
"=",
"None",
",",
"diseases",
"=",
"None",
",",
"drugs",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"diseases",
",",
"six",
".",
"string_types",
")",
":",
"diseases",
"=",
"[",
"disea... | Retrieve gene regions and names filtered by variant_types and diseases. | [
"Retrieve",
"gene",
"regions",
"and",
"names",
"filtered",
"by",
"variant_types",
"and",
"diseases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L58-L70 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/loh.py | summary_status | def summary_status(call, data):
"""Retrieve status in regions of interest, along with heterogeneity metrics.
Provides output with overall purity and ploidy, along with region
specific calls.
"""
out_file = None
if call.get("vrn_file") and os.path.exists(call.get("vrn_file")):
out_file =... | python | def summary_status(call, data):
"""Retrieve status in regions of interest, along with heterogeneity metrics.
Provides output with overall purity and ploidy, along with region
specific calls.
"""
out_file = None
if call.get("vrn_file") and os.path.exists(call.get("vrn_file")):
out_file =... | [
"def",
"summary_status",
"(",
"call",
",",
"data",
")",
":",
"out_file",
"=",
"None",
"if",
"call",
".",
"get",
"(",
"\"vrn_file\"",
")",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"call",
".",
"get",
"(",
"\"vrn_file\"",
")",
")",
":",
"out_file"... | Retrieve status in regions of interest, along with heterogeneity metrics.
Provides output with overall purity and ploidy, along with region
specific calls. | [
"Retrieve",
"status",
"in",
"regions",
"of",
"interest",
"along",
"with",
"heterogeneity",
"metrics",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L72-L95 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/loh.py | _check_copy_number_changes | def _check_copy_number_changes(svtype, cn, minor_cn, data):
"""Check if copy number changes match the expected svtype.
"""
if svtype == "LOH" and minor_cn == 0:
return svtype
elif svtype == "amplification" and cn > dd.get_ploidy(data):
return svtype
else:
return "std" | python | def _check_copy_number_changes(svtype, cn, minor_cn, data):
"""Check if copy number changes match the expected svtype.
"""
if svtype == "LOH" and minor_cn == 0:
return svtype
elif svtype == "amplification" and cn > dd.get_ploidy(data):
return svtype
else:
return "std" | [
"def",
"_check_copy_number_changes",
"(",
"svtype",
",",
"cn",
",",
"minor_cn",
",",
"data",
")",
":",
"if",
"svtype",
"==",
"\"LOH\"",
"and",
"minor_cn",
"==",
"0",
":",
"return",
"svtype",
"elif",
"svtype",
"==",
"\"amplification\"",
"and",
"cn",
">",
"d... | Check if copy number changes match the expected svtype. | [
"Check",
"if",
"copy",
"number",
"changes",
"match",
"the",
"expected",
"svtype",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L97-L105 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/loh.py | _titancna_summary | def _titancna_summary(call, data):
"""Summarize purity, ploidy and LOH for TitanCNA.
"""
out = {}
for svtype, coords in get_coords(data):
cur_calls = {k: collections.defaultdict(int) for k in coords.keys()}
with open(call["subclones"]) as in_handle:
header = in_handle.readlin... | python | def _titancna_summary(call, data):
"""Summarize purity, ploidy and LOH for TitanCNA.
"""
out = {}
for svtype, coords in get_coords(data):
cur_calls = {k: collections.defaultdict(int) for k in coords.keys()}
with open(call["subclones"]) as in_handle:
header = in_handle.readlin... | [
"def",
"_titancna_summary",
"(",
"call",
",",
"data",
")",
":",
"out",
"=",
"{",
"}",
"for",
"svtype",
",",
"coords",
"in",
"get_coords",
"(",
"data",
")",
":",
"cur_calls",
"=",
"{",
"k",
":",
"collections",
".",
"defaultdict",
"(",
"int",
")",
"for... | Summarize purity, ploidy and LOH for TitanCNA. | [
"Summarize",
"purity",
"ploidy",
"and",
"LOH",
"for",
"TitanCNA",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L110-L132 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/loh.py | _purecn_summary | def _purecn_summary(call, data):
"""Summarize purity, ploidy and LOH for PureCN.
"""
out = {}
for svtype, coords in get_coords(data):
cur_calls = {k: collections.defaultdict(int) for k in coords.keys()}
with open(call["loh"]) as in_handle:
in_handle.readline() # header
... | python | def _purecn_summary(call, data):
"""Summarize purity, ploidy and LOH for PureCN.
"""
out = {}
for svtype, coords in get_coords(data):
cur_calls = {k: collections.defaultdict(int) for k in coords.keys()}
with open(call["loh"]) as in_handle:
in_handle.readline() # header
... | [
"def",
"_purecn_summary",
"(",
"call",
",",
"data",
")",
":",
"out",
"=",
"{",
"}",
"for",
"svtype",
",",
"coords",
"in",
"get_coords",
"(",
"data",
")",
":",
"cur_calls",
"=",
"{",
"k",
":",
"collections",
".",
"defaultdict",
"(",
"int",
")",
"for",... | Summarize purity, ploidy and LOH for PureCN. | [
"Summarize",
"purity",
"ploidy",
"and",
"LOH",
"for",
"PureCN",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L134-L155 | train |
bcbio/bcbio-nextgen | scripts/utils/plink_to_vcf.py | fix_vcf_line | def fix_vcf_line(parts, ref_base):
"""Orient VCF allele calls with respect to reference base.
Handles cases with ref and variant swaps. strand complements.
"""
swap = {"1/1": "0/0", "0/1": "0/1", "0/0": "1/1", "./.": "./."}
complements = {"G": "C", "A": "T", "C": "G", "T": "A", "N": "N"}
varinf... | python | def fix_vcf_line(parts, ref_base):
"""Orient VCF allele calls with respect to reference base.
Handles cases with ref and variant swaps. strand complements.
"""
swap = {"1/1": "0/0", "0/1": "0/1", "0/0": "1/1", "./.": "./."}
complements = {"G": "C", "A": "T", "C": "G", "T": "A", "N": "N"}
varinf... | [
"def",
"fix_vcf_line",
"(",
"parts",
",",
"ref_base",
")",
":",
"swap",
"=",
"{",
"\"1/1\"",
":",
"\"0/0\"",
",",
"\"0/1\"",
":",
"\"0/1\"",
",",
"\"0/0\"",
":",
"\"1/1\"",
",",
"\"./.\"",
":",
"\"./.\"",
"}",
"complements",
"=",
"{",
"\"G\"",
":",
"\"... | Orient VCF allele calls with respect to reference base.
Handles cases with ref and variant swaps. strand complements. | [
"Orient",
"VCF",
"allele",
"calls",
"with",
"respect",
"to",
"reference",
"base",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/plink_to_vcf.py#L79-L117 | train |
bcbio/bcbio-nextgen | scripts/utils/plink_to_vcf.py | fix_nonref_positions | def fix_nonref_positions(in_file, ref_file):
"""Fix Genotyping VCF positions where the bases are all variants.
The plink/pseq output does not handle these correctly, and
has all reference/variant bases reversed.
"""
ignore_chrs = ["."]
ref2bit = twobit.TwoBitFile(open(ref_file))
out_file = ... | python | def fix_nonref_positions(in_file, ref_file):
"""Fix Genotyping VCF positions where the bases are all variants.
The plink/pseq output does not handle these correctly, and
has all reference/variant bases reversed.
"""
ignore_chrs = ["."]
ref2bit = twobit.TwoBitFile(open(ref_file))
out_file = ... | [
"def",
"fix_nonref_positions",
"(",
"in_file",
",",
"ref_file",
")",
":",
"ignore_chrs",
"=",
"[",
"\".\"",
"]",
"ref2bit",
"=",
"twobit",
".",
"TwoBitFile",
"(",
"open",
"(",
"ref_file",
")",
")",
"out_file",
"=",
"in_file",
".",
"replace",
"(",
"\"-raw.v... | Fix Genotyping VCF positions where the bases are all variants.
The plink/pseq output does not handle these correctly, and
has all reference/variant bases reversed. | [
"Fix",
"Genotyping",
"VCF",
"positions",
"where",
"the",
"bases",
"are",
"all",
"variants",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/plink_to_vcf.py#L119-L154 | train |
bcbio/bcbio-nextgen | bcbio/structural/cn_mops.py | run | def run(items, background=None):
"""Detect copy number variations from batched set of samples using cn.mops.
"""
if not background: background = []
names = [tz.get_in(["rgnames", "sample"], x) for x in items + background]
work_bams = [x["align_bam"] for x in items + background]
if len(items + ba... | python | def run(items, background=None):
"""Detect copy number variations from batched set of samples using cn.mops.
"""
if not background: background = []
names = [tz.get_in(["rgnames", "sample"], x) for x in items + background]
work_bams = [x["align_bam"] for x in items + background]
if len(items + ba... | [
"def",
"run",
"(",
"items",
",",
"background",
"=",
"None",
")",
":",
"if",
"not",
"background",
":",
"background",
"=",
"[",
"]",
"names",
"=",
"[",
"tz",
".",
"get_in",
"(",
"[",
"\"rgnames\"",
",",
"\"sample\"",
"]",
",",
"x",
")",
"for",
"x",
... | Detect copy number variations from batched set of samples using cn.mops. | [
"Detect",
"copy",
"number",
"variations",
"from",
"batched",
"set",
"of",
"samples",
"using",
"cn",
".",
"mops",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L22-L48 | train |
bcbio/bcbio-nextgen | bcbio/structural/cn_mops.py | _combine_out_files | def _combine_out_files(chr_files, work_dir, data):
"""Concatenate all CNV calls into a single file.
"""
out_file = "%s.bed" % sshared.outname_from_inputs(chr_files)
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
with open(tx_out_file, "w") a... | python | def _combine_out_files(chr_files, work_dir, data):
"""Concatenate all CNV calls into a single file.
"""
out_file = "%s.bed" % sshared.outname_from_inputs(chr_files)
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
with open(tx_out_file, "w") a... | [
"def",
"_combine_out_files",
"(",
"chr_files",
",",
"work_dir",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s.bed\"",
"%",
"sshared",
".",
"outname_from_inputs",
"(",
"chr_files",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"wit... | Concatenate all CNV calls into a single file. | [
"Concatenate",
"all",
"CNV",
"calls",
"into",
"a",
"single",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L50-L63 | train |
bcbio/bcbio-nextgen | bcbio/structural/cn_mops.py | _prep_sample_cnvs | def _prep_sample_cnvs(cnv_file, data):
"""Convert a multiple sample CNV file into a single BED file for a sample.
Handles matching and fixing names where R converts numerical IDs (1234) into
strings by adding an X (X1234), and converts other characters into '.'s.
http://stat.ethz.ch/R-manual/R-devel/li... | python | def _prep_sample_cnvs(cnv_file, data):
"""Convert a multiple sample CNV file into a single BED file for a sample.
Handles matching and fixing names where R converts numerical IDs (1234) into
strings by adding an X (X1234), and converts other characters into '.'s.
http://stat.ethz.ch/R-manual/R-devel/li... | [
"def",
"_prep_sample_cnvs",
"(",
"cnv_file",
",",
"data",
")",
":",
"import",
"pybedtools",
"sample_name",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"rgnames\"",
",",
"\"sample\"",
"]",
",",
"data",
")",
"def",
"make_names",
"(",
"name",
")",
":",
"return",
... | Convert a multiple sample CNV file into a single BED file for a sample.
Handles matching and fixing names where R converts numerical IDs (1234) into
strings by adding an X (X1234), and converts other characters into '.'s.
http://stat.ethz.ch/R-manual/R-devel/library/base/html/make.names.html | [
"Convert",
"a",
"multiple",
"sample",
"CNV",
"file",
"into",
"a",
"single",
"BED",
"file",
"for",
"a",
"sample",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L65-L87 | train |
bcbio/bcbio-nextgen | bcbio/structural/cn_mops.py | _run_on_chrom | def _run_on_chrom(chrom, work_bams, names, work_dir, items):
"""Run cn.mops on work BAMs for a specific chromosome.
"""
local_sitelib = utils.R_sitelib()
batch = sshared.get_cur_batch(items)
ext = "-%s-cnv" % batch if batch else "-cnv"
out_file = os.path.join(work_dir, "%s%s-%s.bed" % (os.path.s... | python | def _run_on_chrom(chrom, work_bams, names, work_dir, items):
"""Run cn.mops on work BAMs for a specific chromosome.
"""
local_sitelib = utils.R_sitelib()
batch = sshared.get_cur_batch(items)
ext = "-%s-cnv" % batch if batch else "-cnv"
out_file = os.path.join(work_dir, "%s%s-%s.bed" % (os.path.s... | [
"def",
"_run_on_chrom",
"(",
"chrom",
",",
"work_bams",
",",
"names",
",",
"work_dir",
",",
"items",
")",
":",
"local_sitelib",
"=",
"utils",
".",
"R_sitelib",
"(",
")",
"batch",
"=",
"sshared",
".",
"get_cur_batch",
"(",
"items",
")",
"ext",
"=",
"\"-%s... | Run cn.mops on work BAMs for a specific chromosome. | [
"Run",
"cn",
".",
"mops",
"on",
"work",
"BAMs",
"for",
"a",
"specific",
"chromosome",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L91-L117 | train |
bcbio/bcbio-nextgen | bcbio/structural/cn_mops.py | _get_regional_bed_file | def _get_regional_bed_file(data):
"""If we are running a non-genome analysis, pull the regional file for analysis.
"""
variant_regions = bedutils.merge_overlaps(tz.get_in(["config", "algorithm", "variant_regions"], data),
data)
is_genome = data["config"]["al... | python | def _get_regional_bed_file(data):
"""If we are running a non-genome analysis, pull the regional file for analysis.
"""
variant_regions = bedutils.merge_overlaps(tz.get_in(["config", "algorithm", "variant_regions"], data),
data)
is_genome = data["config"]["al... | [
"def",
"_get_regional_bed_file",
"(",
"data",
")",
":",
"variant_regions",
"=",
"bedutils",
".",
"merge_overlaps",
"(",
"tz",
".",
"get_in",
"(",
"[",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"variant_regions\"",
"]",
",",
"data",
")",
",",
"data",
")",
"i... | If we are running a non-genome analysis, pull the regional file for analysis. | [
"If",
"we",
"are",
"running",
"a",
"non",
"-",
"genome",
"analysis",
"pull",
"the",
"regional",
"file",
"for",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L134-L141 | train |
bcbio/bcbio-nextgen | bcbio/structural/cn_mops.py | _population_load_script | def _population_load_script(work_bams, names, chrom, pairmode, items):
"""Prepare BAMs for assessing CNVs in a population.
"""
bed_file = _get_regional_bed_file(items[0])
if bed_file:
return _population_prep_targeted.format(bam_file_str=",".join(work_bams), names_str=",".join(names),
... | python | def _population_load_script(work_bams, names, chrom, pairmode, items):
"""Prepare BAMs for assessing CNVs in a population.
"""
bed_file = _get_regional_bed_file(items[0])
if bed_file:
return _population_prep_targeted.format(bam_file_str=",".join(work_bams), names_str=",".join(names),
... | [
"def",
"_population_load_script",
"(",
"work_bams",
",",
"names",
",",
"chrom",
",",
"pairmode",
",",
"items",
")",
":",
"bed_file",
"=",
"_get_regional_bed_file",
"(",
"items",
"[",
"0",
"]",
")",
"if",
"bed_file",
":",
"return",
"_population_prep_targeted",
... | Prepare BAMs for assessing CNVs in a population. | [
"Prepare",
"BAMs",
"for",
"assessing",
"CNVs",
"in",
"a",
"population",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L143-L152 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/postalign.py | tobam_cl | def tobam_cl(data, out_file, is_paired=False):
"""Prepare command line for producing de-duplicated sorted output.
- If no deduplication, sort and prepare a BAM file.
- If paired, then use samblaster and prepare discordant outputs.
- If unpaired, use biobambam's bammarkduplicates
"""
do_dedup = ... | python | def tobam_cl(data, out_file, is_paired=False):
"""Prepare command line for producing de-duplicated sorted output.
- If no deduplication, sort and prepare a BAM file.
- If paired, then use samblaster and prepare discordant outputs.
- If unpaired, use biobambam's bammarkduplicates
"""
do_dedup = ... | [
"def",
"tobam_cl",
"(",
"data",
",",
"out_file",
",",
"is_paired",
"=",
"False",
")",
":",
"do_dedup",
"=",
"_check_dedup",
"(",
"data",
")",
"umi_consensus",
"=",
"dd",
".",
"get_umi_consensus",
"(",
"data",
")",
"with",
"file_transaction",
"(",
"data",
"... | Prepare command line for producing de-duplicated sorted output.
- If no deduplication, sort and prepare a BAM file.
- If paired, then use samblaster and prepare discordant outputs.
- If unpaired, use biobambam's bammarkduplicates | [
"Prepare",
"command",
"line",
"for",
"producing",
"de",
"-",
"duplicated",
"sorted",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L30-L52 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/postalign.py | _get_cores_memory | def _get_cores_memory(data, downscale=2):
"""Retrieve cores and memory, using samtools as baseline.
For memory, scaling down because we share with alignment and de-duplication.
"""
resources = config_utils.get_resources("samtools", data["config"])
num_cores = data["config"]["algorithm"].get("num_co... | python | def _get_cores_memory(data, downscale=2):
"""Retrieve cores and memory, using samtools as baseline.
For memory, scaling down because we share with alignment and de-duplication.
"""
resources = config_utils.get_resources("samtools", data["config"])
num_cores = data["config"]["algorithm"].get("num_co... | [
"def",
"_get_cores_memory",
"(",
"data",
",",
"downscale",
"=",
"2",
")",
":",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"samtools\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"num_cores",
"=",
"data",
"[",
"\"config\"",
"]",
"[",
"\"... | Retrieve cores and memory, using samtools as baseline.
For memory, scaling down because we share with alignment and de-duplication. | [
"Retrieve",
"cores",
"and",
"memory",
"using",
"samtools",
"as",
"baseline",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L69-L78 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/postalign.py | sam_to_sortbam_cl | def sam_to_sortbam_cl(data, tx_out_file, name_sort=False):
"""Convert to sorted BAM output.
Set name_sort to True to sort reads by queryname
"""
samtools = config_utils.get_program("samtools", data["config"])
cores, mem = _get_cores_memory(data, downscale=2)
tmp_file = "%s-sorttmp" % utils.spli... | python | def sam_to_sortbam_cl(data, tx_out_file, name_sort=False):
"""Convert to sorted BAM output.
Set name_sort to True to sort reads by queryname
"""
samtools = config_utils.get_program("samtools", data["config"])
cores, mem = _get_cores_memory(data, downscale=2)
tmp_file = "%s-sorttmp" % utils.spli... | [
"def",
"sam_to_sortbam_cl",
"(",
"data",
",",
"tx_out_file",
",",
"name_sort",
"=",
"False",
")",
":",
"samtools",
"=",
"config_utils",
".",
"get_program",
"(",
"\"samtools\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"cores",
",",
"mem",
"=",
"_get_cores_m... | Convert to sorted BAM output.
Set name_sort to True to sort reads by queryname | [
"Convert",
"to",
"sorted",
"BAM",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L80-L90 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/postalign.py | samblaster_dedup_sort | def samblaster_dedup_sort(data, tx_out_file, tx_sr_file, tx_disc_file):
"""Deduplicate and sort with samblaster, produces split read and discordant pair files.
"""
samblaster = config_utils.get_program("samblaster", data["config"])
samtools = config_utils.get_program("samtools", data["config"])
tmp_... | python | def samblaster_dedup_sort(data, tx_out_file, tx_sr_file, tx_disc_file):
"""Deduplicate and sort with samblaster, produces split read and discordant pair files.
"""
samblaster = config_utils.get_program("samblaster", data["config"])
samtools = config_utils.get_program("samtools", data["config"])
tmp_... | [
"def",
"samblaster_dedup_sort",
"(",
"data",
",",
"tx_out_file",
",",
"tx_sr_file",
",",
"tx_disc_file",
")",
":",
"samblaster",
"=",
"config_utils",
".",
"get_program",
"(",
"\"samblaster\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"samtools",
"=",
"config_ut... | Deduplicate and sort with samblaster, produces split read and discordant pair files. | [
"Deduplicate",
"and",
"sort",
"with",
"samblaster",
"produces",
"split",
"read",
"and",
"discordant",
"pair",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L92-L116 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/postalign.py | _biobambam_dedup_sort | def _biobambam_dedup_sort(data, tx_out_file):
"""Perform streaming deduplication and sorting with biobambam's bamsormadup
"""
samtools = config_utils.get_program("samtools", data["config"])
cores, mem = _get_cores_memory(data, downscale=2)
tmp_file = "%s-sorttmp" % utils.splitext_plus(tx_out_file)[0... | python | def _biobambam_dedup_sort(data, tx_out_file):
"""Perform streaming deduplication and sorting with biobambam's bamsormadup
"""
samtools = config_utils.get_program("samtools", data["config"])
cores, mem = _get_cores_memory(data, downscale=2)
tmp_file = "%s-sorttmp" % utils.splitext_plus(tx_out_file)[0... | [
"def",
"_biobambam_dedup_sort",
"(",
"data",
",",
"tx_out_file",
")",
":",
"samtools",
"=",
"config_utils",
".",
"get_program",
"(",
"\"samtools\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"cores",
",",
"mem",
"=",
"_get_cores_memory",
"(",
"data",
",",
"d... | Perform streaming deduplication and sorting with biobambam's bamsormadup | [
"Perform",
"streaming",
"deduplication",
"and",
"sorting",
"with",
"biobambam",
"s",
"bamsormadup"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L118-L134 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.