id int32 0 252k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
223,600 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _find_input_files | def _find_input_files(var, out):
"""Find input files within the given CWL object.
"""
if isinstance(var, (list, tuple)):
for x in var:
out = _find_input_files(x, out)
elif isinstance(var, dict):
if var.get("class") == "File":
out.append(var["path"])
ou... | python | def _find_input_files(var, out):
"""Find input files within the given CWL object.
"""
if isinstance(var, (list, tuple)):
for x in var:
out = _find_input_files(x, out)
elif isinstance(var, dict):
if var.get("class") == "File":
out.append(var["path"])
ou... | [
"def",
"_find_input_files",
"(",
"var",
",",
"out",
")",
":",
"if",
"isinstance",
"(",
"var",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"x",
"in",
"var",
":",
"out",
"=",
"_find_input_files",
"(",
"x",
",",
"out",
")",
"elif",
"isinstan... | Find input files within the given CWL object. | [
"Find",
"input",
"files",
"within",
"the",
"given",
"CWL",
"object",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L209-L221 |
223,601 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _read_from_cwlinput | def _read_from_cwlinput(in_file, work_dir, runtime, parallel, input_order, output_cwl_keys):
"""Read data records from a JSON dump of inputs. Avoids command line flattening of records.
"""
with open(in_file) as in_handle:
inputs = json.load(in_handle)
items_by_key = {}
input_files = []
p... | python | def _read_from_cwlinput(in_file, work_dir, runtime, parallel, input_order, output_cwl_keys):
"""Read data records from a JSON dump of inputs. Avoids command line flattening of records.
"""
with open(in_file) as in_handle:
inputs = json.load(in_handle)
items_by_key = {}
input_files = []
p... | [
"def",
"_read_from_cwlinput",
"(",
"in_file",
",",
"work_dir",
",",
"runtime",
",",
"parallel",
",",
"input_order",
",",
"output_cwl_keys",
")",
":",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",
":",
"inputs",
"=",
"json",
".",
"load",
"(",
"in_... | Read data records from a JSON dump of inputs. Avoids command line flattening of records. | [
"Read",
"data",
"records",
"from",
"a",
"JSON",
"dump",
"of",
"inputs",
".",
"Avoids",
"command",
"line",
"flattening",
"of",
"records",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L223-L249 |
223,602 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _maybe_nest_bare_single | def _maybe_nest_bare_single(items_by_key, parallel):
"""Nest single inputs to avoid confusing single items and lists like files.
"""
if (parallel == "multi-parallel" and
(sum([1 for x in items_by_key.values() if not _is_nested_item(x)]) >=
sum([1 for x in items_by_key.values() if _is_ne... | python | def _maybe_nest_bare_single(items_by_key, parallel):
"""Nest single inputs to avoid confusing single items and lists like files.
"""
if (parallel == "multi-parallel" and
(sum([1 for x in items_by_key.values() if not _is_nested_item(x)]) >=
sum([1 for x in items_by_key.values() if _is_ne... | [
"def",
"_maybe_nest_bare_single",
"(",
"items_by_key",
",",
"parallel",
")",
":",
"if",
"(",
"parallel",
"==",
"\"multi-parallel\"",
"and",
"(",
"sum",
"(",
"[",
"1",
"for",
"x",
"in",
"items_by_key",
".",
"values",
"(",
")",
"if",
"not",
"_is_nested_item",
... | Nest single inputs to avoid confusing single items and lists like files. | [
"Nest",
"single",
"inputs",
"to",
"avoid",
"confusing",
"single",
"items",
"and",
"lists",
"like",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L254-L265 |
223,603 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _check_for_single_nested | def _check_for_single_nested(target, items_by_key, input_order):
"""Check for single nested inputs that match our target count and unnest.
Handles complex var inputs where some have an extra layer of nesting.
"""
out = utils.deepish_copy(items_by_key)
for (k, t) in input_order.items():
if t... | python | def _check_for_single_nested(target, items_by_key, input_order):
"""Check for single nested inputs that match our target count and unnest.
Handles complex var inputs where some have an extra layer of nesting.
"""
out = utils.deepish_copy(items_by_key)
for (k, t) in input_order.items():
if t... | [
"def",
"_check_for_single_nested",
"(",
"target",
",",
"items_by_key",
",",
"input_order",
")",
":",
"out",
"=",
"utils",
".",
"deepish_copy",
"(",
"items_by_key",
")",
"for",
"(",
"k",
",",
"t",
")",
"in",
"input_order",
".",
"items",
"(",
")",
":",
"if... | Check for single nested inputs that match our target count and unnest.
Handles complex var inputs where some have an extra layer of nesting. | [
"Check",
"for",
"single",
"nested",
"inputs",
"that",
"match",
"our",
"target",
"count",
"and",
"unnest",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L273-L284 |
223,604 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _concat_records | def _concat_records(items_by_key, input_order):
"""Concatenate records into a single key to avoid merging.
Handles heterogeneous records that will then be sorted out in
the processing fuction.
"""
all_records = []
for (k, t) in input_order.items():
if t == "record":
all_reco... | python | def _concat_records(items_by_key, input_order):
"""Concatenate records into a single key to avoid merging.
Handles heterogeneous records that will then be sorted out in
the processing fuction.
"""
all_records = []
for (k, t) in input_order.items():
if t == "record":
all_reco... | [
"def",
"_concat_records",
"(",
"items_by_key",
",",
"input_order",
")",
":",
"all_records",
"=",
"[",
"]",
"for",
"(",
"k",
",",
"t",
")",
"in",
"input_order",
".",
"items",
"(",
")",
":",
"if",
"t",
"==",
"\"record\"",
":",
"all_records",
".",
"append... | Concatenate records into a single key to avoid merging.
Handles heterogeneous records that will then be sorted out in
the processing fuction. | [
"Concatenate",
"records",
"into",
"a",
"single",
"key",
"to",
"avoid",
"merging",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L286-L306 |
223,605 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _nest_vars_in_rec | def _nest_vars_in_rec(var_items, rec_items, input_order, items_by_key, parallel):
"""Nest multiple variable inputs into a single record or list of batch records.
Custom CWL implementations extract and merge these.
"""
num_items = var_items
var_items = list(var_items)[0]
if rec_items:
re... | python | def _nest_vars_in_rec(var_items, rec_items, input_order, items_by_key, parallel):
"""Nest multiple variable inputs into a single record or list of batch records.
Custom CWL implementations extract and merge these.
"""
num_items = var_items
var_items = list(var_items)[0]
if rec_items:
re... | [
"def",
"_nest_vars_in_rec",
"(",
"var_items",
",",
"rec_items",
",",
"input_order",
",",
"items_by_key",
",",
"parallel",
")",
":",
"num_items",
"=",
"var_items",
"var_items",
"=",
"list",
"(",
"var_items",
")",
"[",
"0",
"]",
"if",
"rec_items",
":",
"rec_it... | Nest multiple variable inputs into a single record or list of batch records.
Custom CWL implementations extract and merge these. | [
"Nest",
"multiple",
"variable",
"inputs",
"into",
"a",
"single",
"record",
"or",
"list",
"of",
"batch",
"records",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L364-L380 |
223,606 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _expand_rec_to_vars | def _expand_rec_to_vars(var_items, rec_items, input_order, items_by_key, parallel):
"""Expand record to apply to number of variants.
Alternative approach to _nest_vars_in_rec
to combining a single record with multiple variants.
"""
num_items = var_items
var_items = list(var_items)[0]
if rec... | python | def _expand_rec_to_vars(var_items, rec_items, input_order, items_by_key, parallel):
"""Expand record to apply to number of variants.
Alternative approach to _nest_vars_in_rec
to combining a single record with multiple variants.
"""
num_items = var_items
var_items = list(var_items)[0]
if rec... | [
"def",
"_expand_rec_to_vars",
"(",
"var_items",
",",
"rec_items",
",",
"input_order",
",",
"items_by_key",
",",
"parallel",
")",
":",
"num_items",
"=",
"var_items",
"var_items",
"=",
"list",
"(",
"var_items",
")",
"[",
"0",
"]",
"if",
"rec_items",
":",
"for"... | Expand record to apply to number of variants.
Alternative approach to _nest_vars_in_rec
to combining a single record with multiple variants. | [
"Expand",
"record",
"to",
"apply",
"to",
"number",
"of",
"variants",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L382-L397 |
223,607 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _read_cwl_record | def _read_cwl_record(rec):
"""Read CWL records, handling multiple nesting and batching cases.
"""
keys = set([])
out = []
if isinstance(rec, dict):
is_batched = all([isinstance(v, (list, tuple)) for v in rec.values()])
cur = [{} for _ in range(len(rec.values()[0]) if is_batched else ... | python | def _read_cwl_record(rec):
"""Read CWL records, handling multiple nesting and batching cases.
"""
keys = set([])
out = []
if isinstance(rec, dict):
is_batched = all([isinstance(v, (list, tuple)) for v in rec.values()])
cur = [{} for _ in range(len(rec.values()[0]) if is_batched else ... | [
"def",
"_read_cwl_record",
"(",
"rec",
")",
":",
"keys",
"=",
"set",
"(",
"[",
"]",
")",
"out",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"rec",
",",
"dict",
")",
":",
"is_batched",
"=",
"all",
"(",
"[",
"isinstance",
"(",
"v",
",",
"(",
"list",
... | Read CWL records, handling multiple nesting and batching cases. | [
"Read",
"CWL",
"records",
"handling",
"multiple",
"nesting",
"and",
"batching",
"cases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L399-L425 |
223,608 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _finalize_cwl_in | def _finalize_cwl_in(data, work_dir, passed_keys, output_cwl_keys, runtime):
"""Finalize data object with inputs from CWL.
"""
data["dirs"] = {"work": work_dir}
if not tz.get_in(["config", "algorithm"], data):
if "config" not in data:
data["config"] = {}
data["config"]["algor... | python | def _finalize_cwl_in(data, work_dir, passed_keys, output_cwl_keys, runtime):
"""Finalize data object with inputs from CWL.
"""
data["dirs"] = {"work": work_dir}
if not tz.get_in(["config", "algorithm"], data):
if "config" not in data:
data["config"] = {}
data["config"]["algor... | [
"def",
"_finalize_cwl_in",
"(",
"data",
",",
"work_dir",
",",
"passed_keys",
",",
"output_cwl_keys",
",",
"runtime",
")",
":",
"data",
"[",
"\"dirs\"",
"]",
"=",
"{",
"\"work\"",
":",
"work_dir",
"}",
"if",
"not",
"tz",
".",
"get_in",
"(",
"[",
"\"config... | Finalize data object with inputs from CWL. | [
"Finalize",
"data",
"object",
"with",
"inputs",
"from",
"CWL",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L427-L442 |
223,609 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _convert_value | def _convert_value(val):
"""Handle multiple input type values.
"""
def _is_number(x, op):
try:
op(x)
return True
except ValueError:
return False
if isinstance(val, (list, tuple)):
return [_convert_value(x) for x in val]
elif val is None:
... | python | def _convert_value(val):
"""Handle multiple input type values.
"""
def _is_number(x, op):
try:
op(x)
return True
except ValueError:
return False
if isinstance(val, (list, tuple)):
return [_convert_value(x) for x in val]
elif val is None:
... | [
"def",
"_convert_value",
"(",
"val",
")",
":",
"def",
"_is_number",
"(",
"x",
",",
"op",
")",
":",
"try",
":",
"op",
"(",
"x",
")",
"return",
"True",
"except",
"ValueError",
":",
"return",
"False",
"if",
"isinstance",
"(",
"val",
",",
"(",
"list",
... | Handle multiple input type values. | [
"Handle",
"multiple",
"input",
"type",
"values",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L444-L472 |
223,610 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _get_output_cwl_keys | def _get_output_cwl_keys(fnargs):
"""Retrieve output_cwl_keys from potentially nested input arguments.
"""
for d in utils.flatten(fnargs):
if isinstance(d, dict) and d.get("output_cwl_keys"):
return d["output_cwl_keys"]
raise ValueError("Did not find output_cwl_keys in %s" % (pprint.... | python | def _get_output_cwl_keys(fnargs):
"""Retrieve output_cwl_keys from potentially nested input arguments.
"""
for d in utils.flatten(fnargs):
if isinstance(d, dict) and d.get("output_cwl_keys"):
return d["output_cwl_keys"]
raise ValueError("Did not find output_cwl_keys in %s" % (pprint.... | [
"def",
"_get_output_cwl_keys",
"(",
"fnargs",
")",
":",
"for",
"d",
"in",
"utils",
".",
"flatten",
"(",
"fnargs",
")",
":",
"if",
"isinstance",
"(",
"d",
",",
"dict",
")",
"and",
"d",
".",
"get",
"(",
"\"output_cwl_keys\"",
")",
":",
"return",
"d",
"... | Retrieve output_cwl_keys from potentially nested input arguments. | [
"Retrieve",
"output_cwl_keys",
"from",
"potentially",
"nested",
"input",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L492-L498 |
223,611 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _combine_cwl_records | def _combine_cwl_records(recs, record_name, parallel):
"""Provide a list of nexted CWL records keyed by output key.
Handles batches, where we return a list of records, and single items
where we return one record.
"""
if parallel not in ["multi-batch", "single-split", "multi-combined", "batch-single... | python | def _combine_cwl_records(recs, record_name, parallel):
"""Provide a list of nexted CWL records keyed by output key.
Handles batches, where we return a list of records, and single items
where we return one record.
"""
if parallel not in ["multi-batch", "single-split", "multi-combined", "batch-single... | [
"def",
"_combine_cwl_records",
"(",
"recs",
",",
"record_name",
",",
"parallel",
")",
":",
"if",
"parallel",
"not",
"in",
"[",
"\"multi-batch\"",
",",
"\"single-split\"",
",",
"\"multi-combined\"",
",",
"\"batch-single\"",
"]",
":",
"assert",
"len",
"(",
"recs",... | Provide a list of nexted CWL records keyed by output key.
Handles batches, where we return a list of records, and single items
where we return one record. | [
"Provide",
"a",
"list",
"of",
"nexted",
"CWL",
"records",
"keyed",
"by",
"output",
"key",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L500-L510 |
223,612 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _collapse_to_cwl_record_single | def _collapse_to_cwl_record_single(data, want_attrs, input_files):
"""Convert a single sample into a CWL record.
"""
out = {}
for key in want_attrs:
key_parts = key.split("__")
out[key] = _to_cwl(tz.get_in(key_parts, data), input_files)
return out | python | def _collapse_to_cwl_record_single(data, want_attrs, input_files):
"""Convert a single sample into a CWL record.
"""
out = {}
for key in want_attrs:
key_parts = key.split("__")
out[key] = _to_cwl(tz.get_in(key_parts, data), input_files)
return out | [
"def",
"_collapse_to_cwl_record_single",
"(",
"data",
",",
"want_attrs",
",",
"input_files",
")",
":",
"out",
"=",
"{",
"}",
"for",
"key",
"in",
"want_attrs",
":",
"key_parts",
"=",
"key",
".",
"split",
"(",
"\"__\"",
")",
"out",
"[",
"key",
"]",
"=",
... | Convert a single sample into a CWL record. | [
"Convert",
"a",
"single",
"sample",
"into",
"a",
"CWL",
"record",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L512-L519 |
223,613 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _nested_cwl_record | def _nested_cwl_record(xs, want_attrs, input_files):
"""Convert arbitrarily nested samples into a nested list of dictionaries.
nests only at the record level, rather than within records. For batching
a top level list is all of the batches and sub-lists are samples within the
batch.
"""
if isins... | python | def _nested_cwl_record(xs, want_attrs, input_files):
"""Convert arbitrarily nested samples into a nested list of dictionaries.
nests only at the record level, rather than within records. For batching
a top level list is all of the batches and sub-lists are samples within the
batch.
"""
if isins... | [
"def",
"_nested_cwl_record",
"(",
"xs",
",",
"want_attrs",
",",
"input_files",
")",
":",
"if",
"isinstance",
"(",
"xs",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"_nested_cwl_record",
"(",
"x",
",",
"want_attrs",
",",
"input_files",
"... | Convert arbitrarily nested samples into a nested list of dictionaries.
nests only at the record level, rather than within records. For batching
a top level list is all of the batches and sub-lists are samples within the
batch. | [
"Convert",
"arbitrarily",
"nested",
"samples",
"into",
"a",
"nested",
"list",
"of",
"dictionaries",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L521-L532 |
223,614 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _collapse_to_cwl_record | def _collapse_to_cwl_record(samples, want_attrs, input_files):
"""Convert nested samples from batches into a CWL record, based on input keys.
"""
input_keys = sorted(list(set().union(*[d["cwl_keys"] for d in samples])), key=lambda x: (-len(x), tuple(x)))
out = {}
for key in input_keys:
if ke... | python | def _collapse_to_cwl_record(samples, want_attrs, input_files):
"""Convert nested samples from batches into a CWL record, based on input keys.
"""
input_keys = sorted(list(set().union(*[d["cwl_keys"] for d in samples])), key=lambda x: (-len(x), tuple(x)))
out = {}
for key in input_keys:
if ke... | [
"def",
"_collapse_to_cwl_record",
"(",
"samples",
",",
"want_attrs",
",",
"input_files",
")",
":",
"input_keys",
"=",
"sorted",
"(",
"list",
"(",
"set",
"(",
")",
".",
"union",
"(",
"*",
"[",
"d",
"[",
"\"cwl_keys\"",
"]",
"for",
"d",
"in",
"samples",
... | Convert nested samples from batches into a CWL record, based on input keys. | [
"Convert",
"nested",
"samples",
"from",
"batches",
"into",
"a",
"CWL",
"record",
"based",
"on",
"input",
"keys",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L534-L550 |
223,615 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _file_and_exists | def _file_and_exists(val, input_files):
"""Check if an input is a file and exists.
Checks both locally (staged) and from input files (re-passed but never localized).
"""
return ((os.path.exists(val) and os.path.isfile(val)) or
val in input_files) | python | def _file_and_exists(val, input_files):
"""Check if an input is a file and exists.
Checks both locally (staged) and from input files (re-passed but never localized).
"""
return ((os.path.exists(val) and os.path.isfile(val)) or
val in input_files) | [
"def",
"_file_and_exists",
"(",
"val",
",",
"input_files",
")",
":",
"return",
"(",
"(",
"os",
".",
"path",
".",
"exists",
"(",
"val",
")",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"val",
")",
")",
"or",
"val",
"in",
"input_files",
")"
] | Check if an input is a file and exists.
Checks both locally (staged) and from input files (re-passed but never localized). | [
"Check",
"if",
"an",
"input",
"is",
"a",
"file",
"and",
"exists",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L552-L558 |
223,616 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _to_cwl | def _to_cwl(val, input_files):
"""Convert a value into CWL formatted JSON, handling files and complex things.
"""
if isinstance(val, six.string_types):
if _file_and_exists(val, input_files):
val = {"class": "File", "path": val}
secondary = []
for idx in [".bai", "... | python | def _to_cwl(val, input_files):
"""Convert a value into CWL formatted JSON, handling files and complex things.
"""
if isinstance(val, six.string_types):
if _file_and_exists(val, input_files):
val = {"class": "File", "path": val}
secondary = []
for idx in [".bai", "... | [
"def",
"_to_cwl",
"(",
"val",
",",
"input_files",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"six",
".",
"string_types",
")",
":",
"if",
"_file_and_exists",
"(",
"val",
",",
"input_files",
")",
":",
"val",
"=",
"{",
"\"class\"",
":",
"\"File\"",
",... | Convert a value into CWL formatted JSON, handling files and complex things. | [
"Convert",
"a",
"value",
"into",
"CWL",
"formatted",
"JSON",
"handling",
"files",
"and",
"complex",
"things",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L560-L603 |
223,617 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _remove_duplicate_files | def _remove_duplicate_files(xs):
"""Remove files specified multiple times in a list.
"""
seen = set([])
out = []
for x in xs:
if x["path"] not in seen:
out.append(x)
seen.add(x["path"])
return out | python | def _remove_duplicate_files(xs):
"""Remove files specified multiple times in a list.
"""
seen = set([])
out = []
for x in xs:
if x["path"] not in seen:
out.append(x)
seen.add(x["path"])
return out | [
"def",
"_remove_duplicate_files",
"(",
"xs",
")",
":",
"seen",
"=",
"set",
"(",
"[",
"]",
")",
"out",
"=",
"[",
"]",
"for",
"x",
"in",
"xs",
":",
"if",
"x",
"[",
"\"path\"",
"]",
"not",
"in",
"seen",
":",
"out",
".",
"append",
"(",
"x",
")",
... | Remove files specified multiple times in a list. | [
"Remove",
"files",
"specified",
"multiple",
"times",
"in",
"a",
"list",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L605-L614 |
223,618 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _update_nested | def _update_nested(key, val, data, allow_overwriting=False):
"""Update the data object, avoiding over-writing with nested dictionaries.
"""
if isinstance(val, dict):
for sub_key, sub_val in val.items():
data = _update_nested(key + [sub_key], sub_val, data, allow_overwriting=allow_overwri... | python | def _update_nested(key, val, data, allow_overwriting=False):
"""Update the data object, avoiding over-writing with nested dictionaries.
"""
if isinstance(val, dict):
for sub_key, sub_val in val.items():
data = _update_nested(key + [sub_key], sub_val, data, allow_overwriting=allow_overwri... | [
"def",
"_update_nested",
"(",
"key",
",",
"val",
",",
"data",
",",
"allow_overwriting",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"for",
"sub_key",
",",
"sub_val",
"in",
"val",
".",
"items",
"(",
")",
":",
"data",... | Update the data object, avoiding over-writing with nested dictionaries. | [
"Update",
"the",
"data",
"object",
"avoiding",
"over",
"-",
"writing",
"with",
"nested",
"dictionaries",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L623-L638 |
223,619 | bcbio/bcbio-nextgen | bcbio/server/main.py | start | def start(args):
"""Run server with provided command line arguments.
"""
application = tornado.web.Application([(r"/run", run.get_handler(args)),
(r"/status", run.StatusHandler)])
application.runmonitor = RunMonitor()
application.listen(args.port)
torna... | python | def start(args):
"""Run server with provided command line arguments.
"""
application = tornado.web.Application([(r"/run", run.get_handler(args)),
(r"/status", run.StatusHandler)])
application.runmonitor = RunMonitor()
application.listen(args.port)
torna... | [
"def",
"start",
"(",
"args",
")",
":",
"application",
"=",
"tornado",
".",
"web",
".",
"Application",
"(",
"[",
"(",
"r\"/run\"",
",",
"run",
".",
"get_handler",
"(",
"args",
")",
")",
",",
"(",
"r\"/status\"",
",",
"run",
".",
"StatusHandler",
")",
... | Run server with provided command line arguments. | [
"Run",
"server",
"with",
"provided",
"command",
"line",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/server/main.py#L8-L15 |
223,620 | bcbio/bcbio-nextgen | bcbio/server/main.py | add_subparser | def add_subparser(subparsers):
"""Add command line arguments as server subparser.
"""
parser = subparsers.add_parser("server", help="Run a bcbio-nextgen server allowing remote job execution.")
parser.add_argument("-c", "--config", help=("Global YAML configuration file specifying system details."
... | python | def add_subparser(subparsers):
"""Add command line arguments as server subparser.
"""
parser = subparsers.add_parser("server", help="Run a bcbio-nextgen server allowing remote job execution.")
parser.add_argument("-c", "--config", help=("Global YAML configuration file specifying system details."
... | [
"def",
"add_subparser",
"(",
"subparsers",
")",
":",
"parser",
"=",
"subparsers",
".",
"add_parser",
"(",
"\"server\"",
",",
"help",
"=",
"\"Run a bcbio-nextgen server allowing remote job execution.\"",
")",
"parser",
".",
"add_argument",
"(",
"\"-c\"",
",",
"\"--conf... | Add command line arguments as server subparser. | [
"Add",
"command",
"line",
"arguments",
"as",
"server",
"subparser",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/server/main.py#L29-L41 |
223,621 | bcbio/bcbio-nextgen | bcbio/provenance/data.py | write_versions | def write_versions(dirs, items):
"""Write data versioning for genomes present in the configuration.
"""
genomes = {}
for d in items:
genomes[d["genome_build"]] = d.get("reference", {}).get("versions")
out_file = _get_out_file(dirs)
found_versions = False
if genomes and out_file:
... | python | def write_versions(dirs, items):
"""Write data versioning for genomes present in the configuration.
"""
genomes = {}
for d in items:
genomes[d["genome_build"]] = d.get("reference", {}).get("versions")
out_file = _get_out_file(dirs)
found_versions = False
if genomes and out_file:
... | [
"def",
"write_versions",
"(",
"dirs",
",",
"items",
")",
":",
"genomes",
"=",
"{",
"}",
"for",
"d",
"in",
"items",
":",
"genomes",
"[",
"d",
"[",
"\"genome_build\"",
"]",
"]",
"=",
"d",
".",
"get",
"(",
"\"reference\"",
",",
"{",
"}",
")",
".",
"... | Write data versioning for genomes present in the configuration. | [
"Write",
"data",
"versioning",
"for",
"genomes",
"present",
"in",
"the",
"configuration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/data.py#L8-L34 |
223,622 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | combine_calls | def combine_calls(*args):
"""Combine multiple callsets into a final set of merged calls.
"""
if len(args) == 3:
is_cwl = False
batch_id, samples, data = args
caller_names, vrn_files = _organize_variants(samples, batch_id)
else:
is_cwl = True
samples = [utils.to_si... | python | def combine_calls(*args):
"""Combine multiple callsets into a final set of merged calls.
"""
if len(args) == 3:
is_cwl = False
batch_id, samples, data = args
caller_names, vrn_files = _organize_variants(samples, batch_id)
else:
is_cwl = True
samples = [utils.to_si... | [
"def",
"combine_calls",
"(",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"3",
":",
"is_cwl",
"=",
"False",
"batch_id",
",",
"samples",
",",
"data",
"=",
"args",
"caller_names",
",",
"vrn_files",
"=",
"_organize_variants",
"(",
"samples",
... | Combine multiple callsets into a final set of merged calls. | [
"Combine",
"multiple",
"callsets",
"into",
"a",
"final",
"set",
"of",
"merged",
"calls",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L57-L110 |
223,623 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | combine_calls_parallel | def combine_calls_parallel(samples, run_parallel):
"""Combine calls using batched Ensemble approach.
"""
batch_groups, extras = _group_by_batches(samples, _has_ensemble)
out = []
if batch_groups:
processed = run_parallel("combine_calls", ((b, xs, xs[0]) for b, xs in batch_groups.items()))
... | python | def combine_calls_parallel(samples, run_parallel):
"""Combine calls using batched Ensemble approach.
"""
batch_groups, extras = _group_by_batches(samples, _has_ensemble)
out = []
if batch_groups:
processed = run_parallel("combine_calls", ((b, xs, xs[0]) for b, xs in batch_groups.items()))
... | [
"def",
"combine_calls_parallel",
"(",
"samples",
",",
"run_parallel",
")",
":",
"batch_groups",
",",
"extras",
"=",
"_group_by_batches",
"(",
"samples",
",",
"_has_ensemble",
")",
"out",
"=",
"[",
"]",
"if",
"batch_groups",
":",
"processed",
"=",
"run_parallel",... | Combine calls using batched Ensemble approach. | [
"Combine",
"calls",
"using",
"batched",
"Ensemble",
"approach",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L112-L123 |
223,624 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | _group_by_batches | def _group_by_batches(samples, check_fn):
"""Group calls by batches, processing families together during ensemble calling.
"""
batch_groups = collections.defaultdict(list)
extras = []
for data in [x[0] for x in samples]:
if check_fn(data):
batch_groups[multi.get_batch_for_key(dat... | python | def _group_by_batches(samples, check_fn):
"""Group calls by batches, processing families together during ensemble calling.
"""
batch_groups = collections.defaultdict(list)
extras = []
for data in [x[0] for x in samples]:
if check_fn(data):
batch_groups[multi.get_batch_for_key(dat... | [
"def",
"_group_by_batches",
"(",
"samples",
",",
"check_fn",
")",
":",
"batch_groups",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"extras",
"=",
"[",
"]",
"for",
"data",
"in",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"samples",
"]",
... | Group calls by batches, processing families together during ensemble calling. | [
"Group",
"calls",
"by",
"batches",
"processing",
"families",
"together",
"during",
"ensemble",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L133-L143 |
223,625 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | _organize_variants | def _organize_variants(samples, batch_id):
"""Retrieve variant calls for all samples, merging batched samples into single VCF.
"""
caller_names = [x["variantcaller"] for x in samples[0]["variants"]]
calls = collections.defaultdict(list)
for data in samples:
for vrn in data["variants"]:
... | python | def _organize_variants(samples, batch_id):
"""Retrieve variant calls for all samples, merging batched samples into single VCF.
"""
caller_names = [x["variantcaller"] for x in samples[0]["variants"]]
calls = collections.defaultdict(list)
for data in samples:
for vrn in data["variants"]:
... | [
"def",
"_organize_variants",
"(",
"samples",
",",
"batch_id",
")",
":",
"caller_names",
"=",
"[",
"x",
"[",
"\"variantcaller\"",
"]",
"for",
"x",
"in",
"samples",
"[",
"0",
"]",
"[",
"\"variants\"",
"]",
"]",
"calls",
"=",
"collections",
".",
"defaultdict"... | Retrieve variant calls for all samples, merging batched samples into single VCF. | [
"Retrieve",
"variant",
"calls",
"for",
"all",
"samples",
"merging",
"batched",
"samples",
"into",
"single",
"VCF",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L145-L161 |
223,626 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | _handle_somatic_ensemble | def _handle_somatic_ensemble(vrn_file, data):
"""For somatic ensemble, discard normal samples and filtered variants from vcfs.
Only needed for bcbio.variation based ensemble calling.
"""
if tz.get_in(["metadata", "phenotype"], data, "").lower().startswith("tumor"):
vrn_file_temp = vrn_file.repl... | python | def _handle_somatic_ensemble(vrn_file, data):
"""For somatic ensemble, discard normal samples and filtered variants from vcfs.
Only needed for bcbio.variation based ensemble calling.
"""
if tz.get_in(["metadata", "phenotype"], data, "").lower().startswith("tumor"):
vrn_file_temp = vrn_file.repl... | [
"def",
"_handle_somatic_ensemble",
"(",
"vrn_file",
",",
"data",
")",
":",
"if",
"tz",
".",
"get_in",
"(",
"[",
"\"metadata\"",
",",
"\"phenotype\"",
"]",
",",
"data",
",",
"\"\"",
")",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"\"tumor\"",
")",
... | For somatic ensemble, discard normal samples and filtered variants from vcfs.
Only needed for bcbio.variation based ensemble calling. | [
"For",
"somatic",
"ensemble",
"discard",
"normal",
"samples",
"and",
"filtered",
"variants",
"from",
"vcfs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L163-L174 |
223,627 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | _run_ensemble | def _run_ensemble(batch_id, vrn_files, config_file, base_dir, ref_file, data):
"""Run an ensemble call using merging and SVM-based approach in bcbio.variation
"""
out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf".format(batch_id))
out_bed_file = os.path.join(base_dir, "{0}-callregions.bed".format... | python | def _run_ensemble(batch_id, vrn_files, config_file, base_dir, ref_file, data):
"""Run an ensemble call using merging and SVM-based approach in bcbio.variation
"""
out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf".format(batch_id))
out_bed_file = os.path.join(base_dir, "{0}-callregions.bed".format... | [
"def",
"_run_ensemble",
"(",
"batch_id",
",",
"vrn_files",
",",
"config_file",
",",
"base_dir",
",",
"ref_file",
",",
"data",
")",
":",
"out_vcf_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"base_dir",
",",
"\"{0}-ensemble.vcf\"",
".",
"format",
"(",
"... | Run an ensemble call using merging and SVM-based approach in bcbio.variation | [
"Run",
"an",
"ensemble",
"call",
"using",
"merging",
"and",
"SVM",
"-",
"based",
"approach",
"in",
"bcbio",
".",
"variation"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L190-L208 |
223,628 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | _write_config_file | def _write_config_file(batch_id, caller_names, base_dir, data):
"""Write YAML configuration to generate an ensemble set of combined calls.
"""
config_dir = utils.safe_makedir(os.path.join(base_dir, "config"))
config_file = os.path.join(config_dir, "{0}-ensemble.yaml".format(batch_id))
algorithm = da... | python | def _write_config_file(batch_id, caller_names, base_dir, data):
"""Write YAML configuration to generate an ensemble set of combined calls.
"""
config_dir = utils.safe_makedir(os.path.join(base_dir, "config"))
config_file = os.path.join(config_dir, "{0}-ensemble.yaml".format(batch_id))
algorithm = da... | [
"def",
"_write_config_file",
"(",
"batch_id",
",",
"caller_names",
",",
"base_dir",
",",
"data",
")",
":",
"config_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"base_dir",
",",
"\"config\"",
")",
")",
"config_file",
"=... | Write YAML configuration to generate an ensemble set of combined calls. | [
"Write",
"YAML",
"configuration",
"to",
"generate",
"an",
"ensemble",
"set",
"of",
"combined",
"calls",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L210-L224 |
223,629 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | _get_num_pass | def _get_num_pass(data, n):
"""Calculate the number of samples needed to pass ensemble calling.
"""
numpass = tz.get_in(["config", "algorithm", "ensemble", "numpass"], data)
if numpass:
return int(numpass)
trusted_pct = tz.get_in(["config", "algorithm", "ensemble", "trusted_pct"], data)
... | python | def _get_num_pass(data, n):
"""Calculate the number of samples needed to pass ensemble calling.
"""
numpass = tz.get_in(["config", "algorithm", "ensemble", "numpass"], data)
if numpass:
return int(numpass)
trusted_pct = tz.get_in(["config", "algorithm", "ensemble", "trusted_pct"], data)
... | [
"def",
"_get_num_pass",
"(",
"data",
",",
"n",
")",
":",
"numpass",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"ensemble\"",
",",
"\"numpass\"",
"]",
",",
"data",
")",
"if",
"numpass",
":",
"return",
"int",
"(",
"num... | Calculate the number of samples needed to pass ensemble calling. | [
"Calculate",
"the",
"number",
"of",
"samples",
"needed",
"to",
"pass",
"ensemble",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L226-L235 |
223,630 | bcbio/bcbio-nextgen | bcbio/variation/ensemble.py | _run_ensemble_intersection | def _run_ensemble_intersection(batch_id, vrn_files, callers, base_dir, edata):
"""Run intersection n out of x based ensemble method using bcbio.variation.recall.
"""
out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf.gz".format(batch_id))
if not utils.file_exists(out_vcf_file):
num_pass = _... | python | def _run_ensemble_intersection(batch_id, vrn_files, callers, base_dir, edata):
"""Run intersection n out of x based ensemble method using bcbio.variation.recall.
"""
out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf.gz".format(batch_id))
if not utils.file_exists(out_vcf_file):
num_pass = _... | [
"def",
"_run_ensemble_intersection",
"(",
"batch_id",
",",
"vrn_files",
",",
"callers",
",",
"base_dir",
",",
"edata",
")",
":",
"out_vcf_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"base_dir",
",",
"\"{0}-ensemble.vcf.gz\"",
".",
"format",
"(",
"batch_id... | Run intersection n out of x based ensemble method using bcbio.variation.recall. | [
"Run",
"intersection",
"n",
"out",
"of",
"x",
"based",
"ensemble",
"method",
"using",
"bcbio",
".",
"variation",
".",
"recall",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L237-L263 |
223,631 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | _get_callable_regions | def _get_callable_regions(data):
"""Retrieve regions to parallelize by from callable regions or chromosomes.
"""
import pybedtools
callable_files = data.get("callable_regions")
if callable_files:
assert len(callable_files) == 1
regions = [(r.chrom, int(r.start), int(r.stop)) for r in... | python | def _get_callable_regions(data):
"""Retrieve regions to parallelize by from callable regions or chromosomes.
"""
import pybedtools
callable_files = data.get("callable_regions")
if callable_files:
assert len(callable_files) == 1
regions = [(r.chrom, int(r.start), int(r.stop)) for r in... | [
"def",
"_get_callable_regions",
"(",
"data",
")",
":",
"import",
"pybedtools",
"callable_files",
"=",
"data",
".",
"get",
"(",
"\"callable_regions\"",
")",
"if",
"callable_files",
":",
"assert",
"len",
"(",
"callable_files",
")",
"==",
"1",
"regions",
"=",
"["... | Retrieve regions to parallelize by from callable regions or chromosomes. | [
"Retrieve",
"regions",
"to",
"parallelize",
"by",
"from",
"callable",
"regions",
"or",
"chromosomes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L75-L92 |
223,632 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | _split_by_callable_region | def _split_by_callable_region(data):
"""Split by callable or variant regions.
We expect joint calling to be deep in numbers of samples per region, so prefer
splitting aggressively by regions.
"""
batch = tz.get_in(("metadata", "batch"), data)
jointcaller = tz.get_in(("config", "algorithm", "joi... | python | def _split_by_callable_region(data):
"""Split by callable or variant regions.
We expect joint calling to be deep in numbers of samples per region, so prefer
splitting aggressively by regions.
"""
batch = tz.get_in(("metadata", "batch"), data)
jointcaller = tz.get_in(("config", "algorithm", "joi... | [
"def",
"_split_by_callable_region",
"(",
"data",
")",
":",
"batch",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"metadata\"",
",",
"\"batch\"",
")",
",",
"data",
")",
"jointcaller",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"config\"",
",",
"\"algorithm\"",
",",
"... | Split by callable or variant regions.
We expect joint calling to be deep in numbers of samples per region, so prefer
splitting aggressively by regions. | [
"Split",
"by",
"callable",
"or",
"variant",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L94-L114 |
223,633 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | _is_jointcaller_compatible | def _is_jointcaller_compatible(data):
"""Match variant caller inputs to compatible joint callers.
"""
jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)
variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data)
if isinstance(variantcaller, (list, tuple)) and len(va... | python | def _is_jointcaller_compatible(data):
"""Match variant caller inputs to compatible joint callers.
"""
jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)
variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data)
if isinstance(variantcaller, (list, tuple)) and len(va... | [
"def",
"_is_jointcaller_compatible",
"(",
"data",
")",
":",
"jointcaller",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"jointcaller\"",
")",
",",
"data",
")",
"variantcaller",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"config\"... | Match variant caller inputs to compatible joint callers. | [
"Match",
"variant",
"caller",
"inputs",
"to",
"compatible",
"joint",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L116-L123 |
223,634 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | square_off | def square_off(samples, run_parallel):
"""Perform joint calling at all variants within a batch.
"""
to_process = []
extras = []
for data in [utils.to_single_data(x) for x in samples]:
added = False
if tz.get_in(("metadata", "batch"), data):
for add in genotype.handle_mult... | python | def square_off(samples, run_parallel):
"""Perform joint calling at all variants within a batch.
"""
to_process = []
extras = []
for data in [utils.to_single_data(x) for x in samples]:
added = False
if tz.get_in(("metadata", "batch"), data):
for add in genotype.handle_mult... | [
"def",
"square_off",
"(",
"samples",
",",
"run_parallel",
")",
":",
"to_process",
"=",
"[",
"]",
"extras",
"=",
"[",
"]",
"for",
"data",
"in",
"[",
"utils",
".",
"to_single_data",
"(",
"x",
")",
"for",
"x",
"in",
"samples",
"]",
":",
"added",
"=",
... | Perform joint calling at all variants within a batch. | [
"Perform",
"joint",
"calling",
"at",
"all",
"variants",
"within",
"a",
"batch",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L125-L143 |
223,635 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | _combine_to_jointcaller | def _combine_to_jointcaller(processed):
"""Add joint calling information to variants, while collapsing independent regions.
"""
by_vrn_file = collections.OrderedDict()
for data in (x[0] for x in processed):
key = (tz.get_in(("config", "algorithm", "jointcaller"), data), data["vrn_file"])
... | python | def _combine_to_jointcaller(processed):
"""Add joint calling information to variants, while collapsing independent regions.
"""
by_vrn_file = collections.OrderedDict()
for data in (x[0] for x in processed):
key = (tz.get_in(("config", "algorithm", "jointcaller"), data), data["vrn_file"])
... | [
"def",
"_combine_to_jointcaller",
"(",
"processed",
")",
":",
"by_vrn_file",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"for",
"data",
"in",
"(",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"processed",
")",
":",
"key",
"=",
"(",
"tz",
".",
"get_in",
... | Add joint calling information to variants, while collapsing independent regions. | [
"Add",
"joint",
"calling",
"information",
"to",
"variants",
"while",
"collapsing",
"independent",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L145-L158 |
223,636 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | square_batch_region | def square_batch_region(data, region, bam_files, vrn_files, out_file):
"""Perform squaring of a batch in a supplied region, with input BAMs
"""
from bcbio.variation import sentieon, strelka2
if not utils.file_exists(out_file):
jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)... | python | def square_batch_region(data, region, bam_files, vrn_files, out_file):
"""Perform squaring of a batch in a supplied region, with input BAMs
"""
from bcbio.variation import sentieon, strelka2
if not utils.file_exists(out_file):
jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)... | [
"def",
"square_batch_region",
"(",
"data",
",",
"region",
",",
"bam_files",
",",
"vrn_files",
",",
"out_file",
")",
":",
"from",
"bcbio",
".",
"variation",
"import",
"sentieon",
",",
"strelka2",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",... | Perform squaring of a batch in a supplied region, with input BAMs | [
"Perform",
"squaring",
"of",
"a",
"batch",
"in",
"a",
"supplied",
"region",
"with",
"input",
"BAMs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L172-L194 |
223,637 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | _fix_orig_vcf_refs | def _fix_orig_vcf_refs(data):
"""Supply references to initial variantcalls if run in addition to batching.
"""
variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data)
if variantcaller:
data["vrn_file_orig"] = data["vrn_file"]
for i, sub in enumerate(data.get("group_orig", [... | python | def _fix_orig_vcf_refs(data):
"""Supply references to initial variantcalls if run in addition to batching.
"""
variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data)
if variantcaller:
data["vrn_file_orig"] = data["vrn_file"]
for i, sub in enumerate(data.get("group_orig", [... | [
"def",
"_fix_orig_vcf_refs",
"(",
"data",
")",
":",
"variantcaller",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"variantcaller\"",
")",
",",
"data",
")",
"if",
"variantcaller",
":",
"data",
"[",
"\"vrn_file_orig\"",
"]",
"... | Supply references to initial variantcalls if run in addition to batching. | [
"Supply",
"references",
"to",
"initial",
"variantcalls",
"if",
"run",
"in",
"addition",
"to",
"batching",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L196-L207 |
223,638 | bcbio/bcbio-nextgen | bcbio/variation/joint.py | _square_batch_bcbio_variation | def _square_batch_bcbio_variation(data, region, bam_files, vrn_files, out_file,
todo="square"):
"""Run squaring or merging analysis using bcbio.variation.recall.
"""
ref_file = tz.get_in(("reference", "fasta", "base"), data)
cores = tz.get_in(("config", "algorithm", "nu... | python | def _square_batch_bcbio_variation(data, region, bam_files, vrn_files, out_file,
todo="square"):
"""Run squaring or merging analysis using bcbio.variation.recall.
"""
ref_file = tz.get_in(("reference", "fasta", "base"), data)
cores = tz.get_in(("config", "algorithm", "nu... | [
"def",
"_square_batch_bcbio_variation",
"(",
"data",
",",
"region",
",",
"bam_files",
",",
"vrn_files",
",",
"out_file",
",",
"todo",
"=",
"\"square\"",
")",
":",
"ref_file",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"reference\"",
",",
"\"fasta\"",
",",
"\"base... | Run squaring or merging analysis using bcbio.variation.recall. | [
"Run",
"squaring",
"or",
"merging",
"analysis",
"using",
"bcbio",
".",
"variation",
".",
"recall",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L209-L236 |
223,639 | bcbio/bcbio-nextgen | bcbio/structural/seq2c.py | run | def run(items):
"""Normalization and log2 ratio calculation plus CNV calling for full cohort.
- Combine coverage of each region for each sample
- Prepare read counts for each sample
- Normalize coverages in cohort by gene and sample, and calculate log2 ratios
- Call amplifications and deletions
... | python | def run(items):
"""Normalization and log2 ratio calculation plus CNV calling for full cohort.
- Combine coverage of each region for each sample
- Prepare read counts for each sample
- Normalize coverages in cohort by gene and sample, and calculate log2 ratios
- Call amplifications and deletions
... | [
"def",
"run",
"(",
"items",
")",
":",
"items",
"=",
"[",
"utils",
".",
"to_single_data",
"(",
"x",
")",
"for",
"x",
"in",
"items",
"]",
"work_dir",
"=",
"_sv_workdir",
"(",
"items",
"[",
"0",
"]",
")",
"input_backs",
"=",
"list",
"(",
"set",
"(",
... | Normalization and log2 ratio calculation plus CNV calling for full cohort.
- Combine coverage of each region for each sample
- Prepare read counts for each sample
- Normalize coverages in cohort by gene and sample, and calculate log2 ratios
- Call amplifications and deletions | [
"Normalization",
"and",
"log2",
"ratio",
"calculation",
"plus",
"CNV",
"calling",
"for",
"full",
"cohort",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L41-L65 |
223,640 | bcbio/bcbio-nextgen | bcbio/structural/seq2c.py | prep_seq2c_bed | def prep_seq2c_bed(data):
"""Selecting the bed file, cleaning, and properly annotating for Seq2C
"""
if dd.get_background_cnv_reference(data, "seq2c"):
bed_file = _background_to_bed(dd.get_background_cnv_reference(data, "seq2c"), data)
else:
bed_file = regions.get_sv_bed(data)
if bed... | python | def prep_seq2c_bed(data):
"""Selecting the bed file, cleaning, and properly annotating for Seq2C
"""
if dd.get_background_cnv_reference(data, "seq2c"):
bed_file = _background_to_bed(dd.get_background_cnv_reference(data, "seq2c"), data)
else:
bed_file = regions.get_sv_bed(data)
if bed... | [
"def",
"prep_seq2c_bed",
"(",
"data",
")",
":",
"if",
"dd",
".",
"get_background_cnv_reference",
"(",
"data",
",",
"\"seq2c\"",
")",
":",
"bed_file",
"=",
"_background_to_bed",
"(",
"dd",
".",
"get_background_cnv_reference",
"(",
"data",
",",
"\"seq2c\"",
")",
... | Selecting the bed file, cleaning, and properly annotating for Seq2C | [
"Selecting",
"the",
"bed",
"file",
"cleaning",
"and",
"properly",
"annotating",
"for",
"Seq2C"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L67-L102 |
223,641 | bcbio/bcbio-nextgen | bcbio/structural/seq2c.py | _background_to_bed | def _background_to_bed(back_file, data):
"""Convert a seq2c background file with calls into BED regions for coverage.
seq2c background files are a concatenation of mapping and sample_coverages from
potentially multiple samples. We use the coverage information from the first
sample to translate into BED... | python | def _background_to_bed(back_file, data):
"""Convert a seq2c background file with calls into BED regions for coverage.
seq2c background files are a concatenation of mapping and sample_coverages from
potentially multiple samples. We use the coverage information from the first
sample to translate into BED... | [
"def",
"_background_to_bed",
"(",
"back_file",
",",
"data",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"b... | Convert a seq2c background file with calls into BED regions for coverage.
seq2c background files are a concatenation of mapping and sample_coverages from
potentially multiple samples. We use the coverage information from the first
sample to translate into BED. | [
"Convert",
"a",
"seq2c",
"background",
"file",
"with",
"calls",
"into",
"BED",
"regions",
"for",
"coverage",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L104-L122 |
223,642 | bcbio/bcbio-nextgen | bcbio/structural/seq2c.py | _get_seq2c_options | def _get_seq2c_options(data):
"""Get adjustable, through resources, or default options for seq2c.
"""
cov2lr_possible_opts = ["-F"]
defaults = {}
ropts = config_utils.get_resources("seq2c", data["config"]).get("options", [])
assert len(ropts) % 2 == 0, "Expect even number of options for seq2c" %... | python | def _get_seq2c_options(data):
"""Get adjustable, through resources, or default options for seq2c.
"""
cov2lr_possible_opts = ["-F"]
defaults = {}
ropts = config_utils.get_resources("seq2c", data["config"]).get("options", [])
assert len(ropts) % 2 == 0, "Expect even number of options for seq2c" %... | [
"def",
"_get_seq2c_options",
"(",
"data",
")",
":",
"cov2lr_possible_opts",
"=",
"[",
"\"-F\"",
"]",
"defaults",
"=",
"{",
"}",
"ropts",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"seq2c\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
".",
"get",
"(",... | Get adjustable, through resources, or default options for seq2c. | [
"Get",
"adjustable",
"through",
"resources",
"or",
"default",
"options",
"for",
"seq2c",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L124-L138 |
223,643 | bcbio/bcbio-nextgen | bcbio/structural/seq2c.py | to_vcf | def to_vcf(in_tsv, data):
"""Convert seq2c output file into BED output.
"""
call_convert = {"Amp": "DUP", "Del": "DEL"}
out_file = "%s.vcf" % utils.splitext_plus(in_tsv)[0]
if not utils.file_uptodate(out_file, in_tsv):
with file_transaction(data, out_file) as tx_out_file:
with op... | python | def to_vcf(in_tsv, data):
"""Convert seq2c output file into BED output.
"""
call_convert = {"Amp": "DUP", "Del": "DEL"}
out_file = "%s.vcf" % utils.splitext_plus(in_tsv)[0]
if not utils.file_uptodate(out_file, in_tsv):
with file_transaction(data, out_file) as tx_out_file:
with op... | [
"def",
"to_vcf",
"(",
"in_tsv",
",",
"data",
")",
":",
"call_convert",
"=",
"{",
"\"Amp\"",
":",
"\"DUP\"",
",",
"\"Del\"",
":",
"\"DEL\"",
"}",
"out_file",
"=",
"\"%s.vcf\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"in_tsv",
")",
"[",
"0",
"]",
"if",... | Convert seq2c output file into BED output. | [
"Convert",
"seq2c",
"output",
"file",
"into",
"BED",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L198-L218 |
223,644 | bcbio/bcbio-nextgen | bcbio/structural/seq2c.py | _combine_coverages | def _combine_coverages(items, work_dir, input_backs=None):
"""Combine coverage cnns calculated for individual inputs into single file.
Optionally moves over pre-calculated coverage samples from a background file.
"""
out_file = os.path.join(work_dir, "sample_coverages.txt")
if not utils.file_exists... | python | def _combine_coverages(items, work_dir, input_backs=None):
"""Combine coverage cnns calculated for individual inputs into single file.
Optionally moves over pre-calculated coverage samples from a background file.
"""
out_file = os.path.join(work_dir, "sample_coverages.txt")
if not utils.file_exists... | [
"def",
"_combine_coverages",
"(",
"items",
",",
"work_dir",
",",
"input_backs",
"=",
"None",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"sample_coverages.txt\"",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"o... | Combine coverage cnns calculated for individual inputs into single file.
Optionally moves over pre-calculated coverage samples from a background file. | [
"Combine",
"coverage",
"cnns",
"calculated",
"for",
"individual",
"inputs",
"into",
"single",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L290-L309 |
223,645 | bcbio/bcbio-nextgen | bcbio/structural/seq2c.py | _calculate_mapping_reads | def _calculate_mapping_reads(items, work_dir, input_backs=None):
"""Calculate read counts from samtools idxstats for each sample.
Optionally moves over pre-calculated mapping counts from a background file.
"""
out_file = os.path.join(work_dir, "mapping_reads.txt")
if not utils.file_exists(out_file)... | python | def _calculate_mapping_reads(items, work_dir, input_backs=None):
"""Calculate read counts from samtools idxstats for each sample.
Optionally moves over pre-calculated mapping counts from a background file.
"""
out_file = os.path.join(work_dir, "mapping_reads.txt")
if not utils.file_exists(out_file)... | [
"def",
"_calculate_mapping_reads",
"(",
"items",
",",
"work_dir",
",",
"input_backs",
"=",
"None",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"mapping_reads.txt\"",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
... | Calculate read counts from samtools idxstats for each sample.
Optionally moves over pre-calculated mapping counts from a background file. | [
"Calculate",
"read",
"counts",
"from",
"samtools",
"idxstats",
"for",
"each",
"sample",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L311-L335 |
223,646 | bcbio/bcbio-nextgen | bcbio/pipeline/genome.py | get_resources | def get_resources(genome, ref_file, data):
"""Retrieve genome information from a genome-references.yaml file.
"""
base_dir = os.path.normpath(os.path.dirname(ref_file))
resource_file = os.path.join(base_dir, "%s-resources.yaml" % genome.replace("-test", ""))
if not os.path.exists(resource_file):
... | python | def get_resources(genome, ref_file, data):
"""Retrieve genome information from a genome-references.yaml file.
"""
base_dir = os.path.normpath(os.path.dirname(ref_file))
resource_file = os.path.join(base_dir, "%s-resources.yaml" % genome.replace("-test", ""))
if not os.path.exists(resource_file):
... | [
"def",
"get_resources",
"(",
"genome",
",",
"ref_file",
",",
"data",
")",
":",
"base_dir",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"ref_file",
")",
")",
"resource_file",
"=",
"os",
".",
"path",
".",
"join... | Retrieve genome information from a genome-references.yaml file. | [
"Retrieve",
"genome",
"information",
"from",
"a",
"genome",
"-",
"references",
".",
"yaml",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L24-L42 |
223,647 | bcbio/bcbio-nextgen | bcbio/pipeline/genome.py | add_required_resources | def add_required_resources(resources):
"""Add default or empty values for required resources referenced in CWL
"""
required = [["variation", "cosmic"], ["variation", "clinvar"], ["variation", "dbsnp"],
["variation", "lcr"], ["variation", "polyx"],
["variation", "encode_blackl... | python | def add_required_resources(resources):
"""Add default or empty values for required resources referenced in CWL
"""
required = [["variation", "cosmic"], ["variation", "clinvar"], ["variation", "dbsnp"],
["variation", "lcr"], ["variation", "polyx"],
["variation", "encode_blackl... | [
"def",
"add_required_resources",
"(",
"resources",
")",
":",
"required",
"=",
"[",
"[",
"\"variation\"",
",",
"\"cosmic\"",
"]",
",",
"[",
"\"variation\"",
",",
"\"clinvar\"",
"]",
",",
"[",
"\"variation\"",
",",
"\"dbsnp\"",
"]",
",",
"[",
"\"variation\"",
... | Add default or empty values for required resources referenced in CWL | [
"Add",
"default",
"or",
"empty",
"values",
"for",
"required",
"resources",
"referenced",
"in",
"CWL"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L44-L58 |
223,648 | bcbio/bcbio-nextgen | bcbio/pipeline/genome.py | ensure_annotations | def ensure_annotations(resources, data):
"""Prepare any potentially missing annotations for downstream processing in a local directory.
"""
transcript_gff = tz.get_in(["rnaseq", "transcripts"], resources)
if transcript_gff and utils.file_exists(transcript_gff):
out_dir = os.path.join(tz.get_in([... | python | def ensure_annotations(resources, data):
"""Prepare any potentially missing annotations for downstream processing in a local directory.
"""
transcript_gff = tz.get_in(["rnaseq", "transcripts"], resources)
if transcript_gff and utils.file_exists(transcript_gff):
out_dir = os.path.join(tz.get_in([... | [
"def",
"ensure_annotations",
"(",
"resources",
",",
"data",
")",
":",
"transcript_gff",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"rnaseq\"",
",",
"\"transcripts\"",
"]",
",",
"resources",
")",
"if",
"transcript_gff",
"and",
"utils",
".",
"file_exists",
"(",
"tr... | Prepare any potentially missing annotations for downstream processing in a local directory. | [
"Prepare",
"any",
"potentially",
"missing",
"annotations",
"for",
"downstream",
"processing",
"in",
"a",
"local",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L60-L68 |
223,649 | bcbio/bcbio-nextgen | bcbio/pipeline/genome.py | abs_file_paths | def abs_file_paths(xs, base_dir=None, ignore_keys=None, fileonly_keys=None, cur_key=None,
do_download=True):
"""Normalize any file paths found in a subdirectory of configuration input.
base_dir -- directory to normalize relative paths to
ignore_keys -- algorithm key names to ignore norma... | python | def abs_file_paths(xs, base_dir=None, ignore_keys=None, fileonly_keys=None, cur_key=None,
do_download=True):
"""Normalize any file paths found in a subdirectory of configuration input.
base_dir -- directory to normalize relative paths to
ignore_keys -- algorithm key names to ignore norma... | [
"def",
"abs_file_paths",
"(",
"xs",
",",
"base_dir",
"=",
"None",
",",
"ignore_keys",
"=",
"None",
",",
"fileonly_keys",
"=",
"None",
",",
"cur_key",
"=",
"None",
",",
"do_download",
"=",
"True",
")",
":",
"ignore_keys",
"=",
"set",
"(",
"[",
"]",
")",... | Normalize any file paths found in a subdirectory of configuration input.
base_dir -- directory to normalize relative paths to
ignore_keys -- algorithm key names to ignore normalize for (keywords, not files/directories)
fileonly_keys -- algorithm key names to only expand files (not directories)
cur_key ... | [
"Normalize",
"any",
"file",
"paths",
"found",
"in",
"a",
"subdirectory",
"of",
"configuration",
"input",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L72-L113 |
223,650 | bcbio/bcbio-nextgen | bcbio/pipeline/genome.py | _get_galaxy_tool_info | def _get_galaxy_tool_info(galaxy_base):
"""Retrieve Galaxy tool-data information from defaults or galaxy config file.
"""
ini_file = os.path.join(galaxy_base, "universe_wsgi.ini")
info = {"tool_data_table_config_path": os.path.join(galaxy_base, "tool_data_table_conf.xml"),
"tool_data_path": ... | python | def _get_galaxy_tool_info(galaxy_base):
"""Retrieve Galaxy tool-data information from defaults or galaxy config file.
"""
ini_file = os.path.join(galaxy_base, "universe_wsgi.ini")
info = {"tool_data_table_config_path": os.path.join(galaxy_base, "tool_data_table_conf.xml"),
"tool_data_path": ... | [
"def",
"_get_galaxy_tool_info",
"(",
"galaxy_base",
")",
":",
"ini_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"galaxy_base",
",",
"\"universe_wsgi.ini\"",
")",
"info",
"=",
"{",
"\"tool_data_table_config_path\"",
":",
"os",
".",
"path",
".",
"join",
"(",... | Retrieve Galaxy tool-data information from defaults or galaxy config file. | [
"Retrieve",
"Galaxy",
"tool",
"-",
"data",
"information",
"from",
"defaults",
"or",
"galaxy",
"config",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L195-L207 |
223,651 | bcbio/bcbio-nextgen | bcbio/pipeline/genome.py | get_builds | def get_builds(galaxy_base):
"""Retrieve configured genome builds and reference files, using Galaxy configuration files.
Allows multiple dbkey specifications in the same file, using the most recently added.
"""
name = "samtools"
galaxy_config = _get_galaxy_tool_info(galaxy_base)
galaxy_dt = _ge... | python | def get_builds(galaxy_base):
"""Retrieve configured genome builds and reference files, using Galaxy configuration files.
Allows multiple dbkey specifications in the same file, using the most recently added.
"""
name = "samtools"
galaxy_config = _get_galaxy_tool_info(galaxy_base)
galaxy_dt = _ge... | [
"def",
"get_builds",
"(",
"galaxy_base",
")",
":",
"name",
"=",
"\"samtools\"",
"galaxy_config",
"=",
"_get_galaxy_tool_info",
"(",
"galaxy_base",
")",
"galaxy_dt",
"=",
"_get_galaxy_data_table",
"(",
"name",
",",
"galaxy_config",
"[",
"\"tool_data_table_config_path\"",... | Retrieve configured genome builds and reference files, using Galaxy configuration files.
Allows multiple dbkey specifications in the same file, using the most recently added. | [
"Retrieve",
"configured",
"genome",
"builds",
"and",
"reference",
"files",
"using",
"Galaxy",
"configuration",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L268-L285 |
223,652 | bcbio/bcbio-nextgen | bcbio/variation/varscan.py | _get_jvm_opts | def _get_jvm_opts(config, tmp_dir):
"""Retrieve common options for running VarScan.
Handles jvm_opts, setting user and country to English to avoid issues
with different locales producing non-compliant VCF.
"""
resources = config_utils.get_resources("varscan", config)
jvm_opts = resources.get("jv... | python | def _get_jvm_opts(config, tmp_dir):
"""Retrieve common options for running VarScan.
Handles jvm_opts, setting user and country to English to avoid issues
with different locales producing non-compliant VCF.
"""
resources = config_utils.get_resources("varscan", config)
jvm_opts = resources.get("jv... | [
"def",
"_get_jvm_opts",
"(",
"config",
",",
"tmp_dir",
")",
":",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"varscan\"",
",",
"config",
")",
"jvm_opts",
"=",
"resources",
".",
"get",
"(",
"\"jvm_opts\"",
",",
"[",
"\"-Xmx750m\"",
",",
"\"... | Retrieve common options for running VarScan.
Handles jvm_opts, setting user and country to English to avoid issues
with different locales producing non-compliant VCF. | [
"Retrieve",
"common",
"options",
"for",
"running",
"VarScan",
".",
"Handles",
"jvm_opts",
"setting",
"user",
"and",
"country",
"to",
"English",
"to",
"avoid",
"issues",
"with",
"different",
"locales",
"producing",
"non",
"-",
"compliant",
"VCF",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L36-L48 |
223,653 | bcbio/bcbio-nextgen | bcbio/variation/varscan.py | _varscan_options_from_config | def _varscan_options_from_config(config):
"""Retrieve additional options for VarScan from the configuration.
"""
opts = ["--min-coverage 5", "--p-value 0.98", "--strand-filter 1"]
resources = config_utils.get_resources("varscan", config)
if resources.get("options"):
opts += [str(x) for x in ... | python | def _varscan_options_from_config(config):
"""Retrieve additional options for VarScan from the configuration.
"""
opts = ["--min-coverage 5", "--p-value 0.98", "--strand-filter 1"]
resources = config_utils.get_resources("varscan", config)
if resources.get("options"):
opts += [str(x) for x in ... | [
"def",
"_varscan_options_from_config",
"(",
"config",
")",
":",
"opts",
"=",
"[",
"\"--min-coverage 5\"",
",",
"\"--p-value 0.98\"",
",",
"\"--strand-filter 1\"",
"]",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"varscan\"",
",",
"config",
")",
"i... | Retrieve additional options for VarScan from the configuration. | [
"Retrieve",
"additional",
"options",
"for",
"VarScan",
"from",
"the",
"configuration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L51-L58 |
223,654 | bcbio/bcbio-nextgen | bcbio/variation/varscan.py | spv_freq_filter | def spv_freq_filter(line, tumor_index):
"""Filter VarScan calls based on the SPV value and frequency.
Removes calls with SPV < 0.05 and a tumor FREQ > 0.35.
False positives dominate these higher frequency, low SPV calls. They appear
to be primarily non-somatic/germline variants not removed by other fi... | python | def spv_freq_filter(line, tumor_index):
"""Filter VarScan calls based on the SPV value and frequency.
Removes calls with SPV < 0.05 and a tumor FREQ > 0.35.
False positives dominate these higher frequency, low SPV calls. They appear
to be primarily non-somatic/germline variants not removed by other fi... | [
"def",
"spv_freq_filter",
"(",
"line",
",",
"tumor_index",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#CHROM\"",
")",
":",
"headers",
"=",
"[",
"(",
"'##FILTER=<ID=SpvFreq,Description=\"High frequency (tumor FREQ > 0.35) '",
"'and low p-value for somatic (SPV < 0.05... | Filter VarScan calls based on the SPV value and frequency.
Removes calls with SPV < 0.05 and a tumor FREQ > 0.35.
False positives dominate these higher frequency, low SPV calls. They appear
to be primarily non-somatic/germline variants not removed by other filters. | [
"Filter",
"VarScan",
"calls",
"based",
"on",
"the",
"SPV",
"value",
"and",
"frequency",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L61-L91 |
223,655 | bcbio/bcbio-nextgen | bcbio/variation/varscan.py | _create_sample_list | def _create_sample_list(in_bams, vcf_file):
"""Pull sample names from input BAMs and create input sample list.
"""
out_file = "%s-sample_list.txt" % os.path.splitext(vcf_file)[0]
with open(out_file, "w") as out_handle:
for in_bam in in_bams:
with pysam.Samfile(in_bam, "rb") as work_b... | python | def _create_sample_list(in_bams, vcf_file):
"""Pull sample names from input BAMs and create input sample list.
"""
out_file = "%s-sample_list.txt" % os.path.splitext(vcf_file)[0]
with open(out_file, "w") as out_handle:
for in_bam in in_bams:
with pysam.Samfile(in_bam, "rb") as work_b... | [
"def",
"_create_sample_list",
"(",
"in_bams",
",",
"vcf_file",
")",
":",
"out_file",
"=",
"\"%s-sample_list.txt\"",
"%",
"os",
".",
"path",
".",
"splitext",
"(",
"vcf_file",
")",
"[",
"0",
"]",
"with",
"open",
"(",
"out_file",
",",
"\"w\"",
")",
"as",
"o... | Pull sample names from input BAMs and create input sample list. | [
"Pull",
"sample",
"names",
"from",
"input",
"BAMs",
"and",
"create",
"input",
"sample",
"list",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L274-L283 |
223,656 | bcbio/bcbio-nextgen | bcbio/variation/varscan.py | _varscan_work | def _varscan_work(align_bams, ref_file, items, target_regions, out_file):
"""Perform SNP and indel genotyping with VarScan.
"""
config = items[0]["config"]
orig_out_file = out_file
out_file = orig_out_file.replace(".vcf.gz", ".vcf")
max_read_depth = "1000"
sample_list = _create_sample_list... | python | def _varscan_work(align_bams, ref_file, items, target_regions, out_file):
"""Perform SNP and indel genotyping with VarScan.
"""
config = items[0]["config"]
orig_out_file = out_file
out_file = orig_out_file.replace(".vcf.gz", ".vcf")
max_read_depth = "1000"
sample_list = _create_sample_list... | [
"def",
"_varscan_work",
"(",
"align_bams",
",",
"ref_file",
",",
"items",
",",
"target_regions",
",",
"out_file",
")",
":",
"config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
"orig_out_file",
"=",
"out_file",
"out_file",
"=",
"orig_out_file",
"."... | Perform SNP and indel genotyping with VarScan. | [
"Perform",
"SNP",
"and",
"indel",
"genotyping",
"with",
"VarScan",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L286-L327 |
223,657 | bcbio/bcbio-nextgen | bcbio/distributed/ipythontasks.py | apply | def apply(object, args=None, kwargs=None):
"""Python3 apply replacement for double unpacking of inputs during apply.
Thanks to: https://github.com/stefanholek/apply
"""
if args is None:
args = ()
if kwargs is None:
kwargs = {}
return object(*args, **kwargs) | python | def apply(object, args=None, kwargs=None):
"""Python3 apply replacement for double unpacking of inputs during apply.
Thanks to: https://github.com/stefanholek/apply
"""
if args is None:
args = ()
if kwargs is None:
kwargs = {}
return object(*args, **kwargs) | [
"def",
"apply",
"(",
"object",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"(",
")",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"return",
"object",
"(",
"*",
"ar... | Python3 apply replacement for double unpacking of inputs during apply.
Thanks to: https://github.com/stefanholek/apply | [
"Python3",
"apply",
"replacement",
"for",
"double",
"unpacking",
"of",
"inputs",
"during",
"apply",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/ipythontasks.py#L71-L80 |
223,658 | bcbio/bcbio-nextgen | bcbio/structural/annotate.py | add_genes | def add_genes(in_file, data, max_distance=10000, work_dir=None):
"""Add gene annotations to a BED file from pre-prepared RNA-seq data.
max_distance -- only keep annotations within this distance of event
"""
gene_file = regions.get_sv_bed(data, "exons", out_dir=os.path.dirname(in_file))
if gene_file... | python | def add_genes(in_file, data, max_distance=10000, work_dir=None):
"""Add gene annotations to a BED file from pre-prepared RNA-seq data.
max_distance -- only keep annotations within this distance of event
"""
gene_file = regions.get_sv_bed(data, "exons", out_dir=os.path.dirname(in_file))
if gene_file... | [
"def",
"add_genes",
"(",
"in_file",
",",
"data",
",",
"max_distance",
"=",
"10000",
",",
"work_dir",
"=",
"None",
")",
":",
"gene_file",
"=",
"regions",
".",
"get_sv_bed",
"(",
"data",
",",
"\"exons\"",
",",
"out_dir",
"=",
"os",
".",
"path",
".",
"dir... | Add gene annotations to a BED file from pre-prepared RNA-seq data.
max_distance -- only keep annotations within this distance of event | [
"Add",
"gene",
"annotations",
"to",
"a",
"BED",
"file",
"from",
"pre",
"-",
"prepared",
"RNA",
"-",
"seq",
"data",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/annotate.py#L17-L33 |
223,659 | bcbio/bcbio-nextgen | bcbio/structural/annotate.py | _add_genes_to_bed | def _add_genes_to_bed(in_file, gene_file, fai_file, out_file, data, max_distance=10000):
"""Re-usable subcomponent that annotates BED file genes from another BED
"""
try:
input_rec = next(iter(pybedtools.BedTool(in_file)))
except StopIteration: # empty file
utils.copy_plus(in_file, out_... | python | def _add_genes_to_bed(in_file, gene_file, fai_file, out_file, data, max_distance=10000):
"""Re-usable subcomponent that annotates BED file genes from another BED
"""
try:
input_rec = next(iter(pybedtools.BedTool(in_file)))
except StopIteration: # empty file
utils.copy_plus(in_file, out_... | [
"def",
"_add_genes_to_bed",
"(",
"in_file",
",",
"gene_file",
",",
"fai_file",
",",
"out_file",
",",
"data",
",",
"max_distance",
"=",
"10000",
")",
":",
"try",
":",
"input_rec",
"=",
"next",
"(",
"iter",
"(",
"pybedtools",
".",
"BedTool",
"(",
"in_file",
... | Re-usable subcomponent that annotates BED file genes from another BED | [
"Re",
"-",
"usable",
"subcomponent",
"that",
"annotates",
"BED",
"file",
"genes",
"from",
"another",
"BED"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/annotate.py#L35-L72 |
223,660 | bcbio/bcbio-nextgen | bcbio/distributed/clusterk.py | create | def create(parallel):
"""Create a queue based on the provided parallel arguments.
TODO Startup/tear-down. Currently using default queue for testing
"""
queue = {k: v for k, v in parallel.items() if k in ["queue", "cores_per_job", "mem"]}
yield queue | python | def create(parallel):
"""Create a queue based on the provided parallel arguments.
TODO Startup/tear-down. Currently using default queue for testing
"""
queue = {k: v for k, v in parallel.items() if k in ["queue", "cores_per_job", "mem"]}
yield queue | [
"def",
"create",
"(",
"parallel",
")",
":",
"queue",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"parallel",
".",
"items",
"(",
")",
"if",
"k",
"in",
"[",
"\"queue\"",
",",
"\"cores_per_job\"",
",",
"\"mem\"",
"]",
"}",
"yield",
"queue"
] | Create a queue based on the provided parallel arguments.
TODO Startup/tear-down. Currently using default queue for testing | [
"Create",
"a",
"queue",
"based",
"on",
"the",
"provided",
"parallel",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clusterk.py#L11-L17 |
223,661 | bcbio/bcbio-nextgen | bcbio/distributed/clusterk.py | runner | def runner(queue, parallel):
"""Run individual jobs on an existing queue.
"""
def run(fn_name, items):
logger.info("clusterk: %s" % fn_name)
assert "wrapper" in parallel, "Clusterk requires bcbio-nextgen-vm wrapper"
fn = getattr(__import__("{base}.clusterktasks".format(base=parallel[... | python | def runner(queue, parallel):
"""Run individual jobs on an existing queue.
"""
def run(fn_name, items):
logger.info("clusterk: %s" % fn_name)
assert "wrapper" in parallel, "Clusterk requires bcbio-nextgen-vm wrapper"
fn = getattr(__import__("{base}.clusterktasks".format(base=parallel[... | [
"def",
"runner",
"(",
"queue",
",",
"parallel",
")",
":",
"def",
"run",
"(",
"fn_name",
",",
"items",
")",
":",
"logger",
".",
"info",
"(",
"\"clusterk: %s\"",
"%",
"fn_name",
")",
"assert",
"\"wrapper\"",
"in",
"parallel",
",",
"\"Clusterk requires bcbio-ne... | Run individual jobs on an existing queue. | [
"Run",
"individual",
"jobs",
"on",
"an",
"existing",
"queue",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clusterk.py#L19-L34 |
223,662 | bcbio/bcbio-nextgen | bcbio/structural/prioritize.py | is_gene_list | def is_gene_list(bed_file):
"""Check if the file is only a list of genes, not a BED
"""
with utils.open_gzipsafe(bed_file) as in_handle:
for line in in_handle:
if not line.startswith("#"):
if len(line.split()) == 1:
return True
else:
... | python | def is_gene_list(bed_file):
"""Check if the file is only a list of genes, not a BED
"""
with utils.open_gzipsafe(bed_file) as in_handle:
for line in in_handle:
if not line.startswith("#"):
if len(line.split()) == 1:
return True
else:
... | [
"def",
"is_gene_list",
"(",
"bed_file",
")",
":",
"with",
"utils",
".",
"open_gzipsafe",
"(",
"bed_file",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"in_handle",
":",
"if",
"not",
"line",
".",
"startswith",
"(",
"\"#\"",
")",
":",
"if",
"len",
"... | Check if the file is only a list of genes, not a BED | [
"Check",
"if",
"the",
"file",
"is",
"only",
"a",
"list",
"of",
"genes",
"not",
"a",
"BED"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L51-L60 |
223,663 | bcbio/bcbio-nextgen | bcbio/structural/prioritize.py | _find_gene_list_from_bed | def _find_gene_list_from_bed(bed_file, base_file, data):
"""Retrieve list of gene names from input BED file.
"""
# Check for a gene list, we can just return that.
if is_gene_list(bed_file):
return bed_file
out_file = "%s-genes.txt" % utils.splitext_plus(base_file)[0]
if not os.path.exist... | python | def _find_gene_list_from_bed(bed_file, base_file, data):
"""Retrieve list of gene names from input BED file.
"""
# Check for a gene list, we can just return that.
if is_gene_list(bed_file):
return bed_file
out_file = "%s-genes.txt" % utils.splitext_plus(base_file)[0]
if not os.path.exist... | [
"def",
"_find_gene_list_from_bed",
"(",
"bed_file",
",",
"base_file",
",",
"data",
")",
":",
"# Check for a gene list, we can just return that.",
"if",
"is_gene_list",
"(",
"bed_file",
")",
":",
"return",
"bed_file",
"out_file",
"=",
"\"%s-genes.txt\"",
"%",
"utils",
... | Retrieve list of gene names from input BED file. | [
"Retrieve",
"list",
"of",
"gene",
"names",
"from",
"input",
"BED",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L62-L82 |
223,664 | bcbio/bcbio-nextgen | bcbio/structural/prioritize.py | _combine_files | def _combine_files(tsv_files, work_dir, data):
"""Combine multiple priority tsv files into a final sorted output.
"""
header = "\t".join(["caller", "sample", "chrom", "start", "end", "svtype",
"lof", "annotation", "split_read_support", "paired_support_PE", "paired_support_PR"])
s... | python | def _combine_files(tsv_files, work_dir, data):
"""Combine multiple priority tsv files into a final sorted output.
"""
header = "\t".join(["caller", "sample", "chrom", "start", "end", "svtype",
"lof", "annotation", "split_read_support", "paired_support_PE", "paired_support_PR"])
s... | [
"def",
"_combine_files",
"(",
"tsv_files",
",",
"work_dir",
",",
"data",
")",
":",
"header",
"=",
"\"\\t\"",
".",
"join",
"(",
"[",
"\"caller\"",
",",
"\"sample\"",
",",
"\"chrom\"",
",",
"\"start\"",
",",
"\"end\"",
",",
"\"svtype\"",
",",
"\"lof\"",
",",... | Combine multiple priority tsv files into a final sorted output. | [
"Combine",
"multiple",
"priority",
"tsv",
"files",
"into",
"a",
"final",
"sorted",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L145-L159 |
223,665 | bcbio/bcbio-nextgen | bcbio/structural/prioritize.py | _cnvkit_prioritize | def _cnvkit_prioritize(sample, genes, allele_file, metrics_file):
"""Summarize non-diploid calls with copy numbers and confidence intervals.
"""
mdf = pd.read_table(metrics_file)
mdf.columns = [x.lower() for x in mdf.columns]
if len(genes) > 0:
mdf = mdf[mdf["gene"].str.contains("|".join(gen... | python | def _cnvkit_prioritize(sample, genes, allele_file, metrics_file):
"""Summarize non-diploid calls with copy numbers and confidence intervals.
"""
mdf = pd.read_table(metrics_file)
mdf.columns = [x.lower() for x in mdf.columns]
if len(genes) > 0:
mdf = mdf[mdf["gene"].str.contains("|".join(gen... | [
"def",
"_cnvkit_prioritize",
"(",
"sample",
",",
"genes",
",",
"allele_file",
",",
"metrics_file",
")",
":",
"mdf",
"=",
"pd",
".",
"read_table",
"(",
"metrics_file",
")",
"mdf",
".",
"columns",
"=",
"[",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"in",
... | Summarize non-diploid calls with copy numbers and confidence intervals. | [
"Summarize",
"non",
"-",
"diploid",
"calls",
"with",
"copy",
"numbers",
"and",
"confidence",
"intervals",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L167-L190 |
223,666 | bcbio/bcbio-nextgen | bcbio/structural/prioritize.py | _cnv_prioritize | def _cnv_prioritize(data):
"""Perform confidence interval based prioritization for CNVs.
"""
supported = {"cnvkit": {"inputs": ["call_file", "segmetrics"], "fn": _cnvkit_prioritize}}
pcall = None
priority_files = None
for call in data.get("sv", []):
if call["variantcaller"] in supported:... | python | def _cnv_prioritize(data):
"""Perform confidence interval based prioritization for CNVs.
"""
supported = {"cnvkit": {"inputs": ["call_file", "segmetrics"], "fn": _cnvkit_prioritize}}
pcall = None
priority_files = None
for call in data.get("sv", []):
if call["variantcaller"] in supported:... | [
"def",
"_cnv_prioritize",
"(",
"data",
")",
":",
"supported",
"=",
"{",
"\"cnvkit\"",
":",
"{",
"\"inputs\"",
":",
"[",
"\"call_file\"",
",",
"\"segmetrics\"",
"]",
",",
"\"fn\"",
":",
"_cnvkit_prioritize",
"}",
"}",
"pcall",
"=",
"None",
"priority_files",
"... | Perform confidence interval based prioritization for CNVs. | [
"Perform",
"confidence",
"interval",
"based",
"prioritization",
"for",
"CNVs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L192-L217 |
223,667 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | get_default_jvm_opts | def get_default_jvm_opts(tmp_dir=None, parallel_gc=False):
"""Retrieve default JVM tuning options
Avoids issues with multiple spun up Java processes running into out of memory errors.
Parallel GC can use a lot of cores on big machines and primarily helps reduce task latency
and responsiveness which are... | python | def get_default_jvm_opts(tmp_dir=None, parallel_gc=False):
"""Retrieve default JVM tuning options
Avoids issues with multiple spun up Java processes running into out of memory errors.
Parallel GC can use a lot of cores on big machines and primarily helps reduce task latency
and responsiveness which are... | [
"def",
"get_default_jvm_opts",
"(",
"tmp_dir",
"=",
"None",
",",
"parallel_gc",
"=",
"False",
")",
":",
"opts",
"=",
"[",
"\"-XX:+UseSerialGC\"",
"]",
"if",
"not",
"parallel_gc",
"else",
"[",
"]",
"if",
"tmp_dir",
":",
"opts",
".",
"append",
"(",
"\"-Djava... | Retrieve default JVM tuning options
Avoids issues with multiple spun up Java processes running into out of memory errors.
Parallel GC can use a lot of cores on big machines and primarily helps reduce task latency
and responsiveness which are not needed for batch jobs.
https://github.com/bcbio/bcbio-nex... | [
"Retrieve",
"default",
"JVM",
"tuning",
"options"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L23-L38 |
223,668 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | _get_gatk_opts | def _get_gatk_opts(config, names, tmp_dir=None, memscale=None, include_gatk=True, parallel_gc=False):
"""Retrieve GATK memory specifications, moving down a list of potential specifications.
"""
if include_gatk and "gatk4" in dd.get_tools_off({"config": config}):
opts = ["-U", "LENIENT_VCF_PROCESSING... | python | def _get_gatk_opts(config, names, tmp_dir=None, memscale=None, include_gatk=True, parallel_gc=False):
"""Retrieve GATK memory specifications, moving down a list of potential specifications.
"""
if include_gatk and "gatk4" in dd.get_tools_off({"config": config}):
opts = ["-U", "LENIENT_VCF_PROCESSING... | [
"def",
"_get_gatk_opts",
"(",
"config",
",",
"names",
",",
"tmp_dir",
"=",
"None",
",",
"memscale",
"=",
"None",
",",
"include_gatk",
"=",
"True",
",",
"parallel_gc",
"=",
"False",
")",
":",
"if",
"include_gatk",
"and",
"\"gatk4\"",
"in",
"dd",
".",
"get... | Retrieve GATK memory specifications, moving down a list of potential specifications. | [
"Retrieve",
"GATK",
"memory",
"specifications",
"moving",
"down",
"a",
"list",
"of",
"potential",
"specifications",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L40-L57 |
223,669 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | _clean_java_out | def _clean_java_out(version_str):
"""Remove extra environmental information reported in java when querying for versions.
Java will report information like _JAVA_OPTIONS environmental variables in the output.
"""
out = []
for line in version_str.decode().split("\n"):
if line.startswith("Pick... | python | def _clean_java_out(version_str):
"""Remove extra environmental information reported in java when querying for versions.
Java will report information like _JAVA_OPTIONS environmental variables in the output.
"""
out = []
for line in version_str.decode().split("\n"):
if line.startswith("Pick... | [
"def",
"_clean_java_out",
"(",
"version_str",
")",
":",
"out",
"=",
"[",
"]",
"for",
"line",
"in",
"version_str",
".",
"decode",
"(",
")",
".",
"split",
"(",
"\"\\n\"",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"Picked up\"",
")",
":",
"pass",
... | Remove extra environmental information reported in java when querying for versions.
Java will report information like _JAVA_OPTIONS environmental variables in the output. | [
"Remove",
"extra",
"environmental",
"information",
"reported",
"in",
"java",
"when",
"querying",
"for",
"versions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L69-L82 |
223,670 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | get_mutect_version | def get_mutect_version(mutect_jar):
"""Retrieves version from input jar name since there is not an easy way to get MuTect version.
Check mutect jar for SomaticIndelDetector, which is an Appistry feature
"""
cl = ["java", "-Xms128m", "-Xmx256m"] + get_default_jvm_opts() + ["-jar", mutect_jar, "-h"]
w... | python | def get_mutect_version(mutect_jar):
"""Retrieves version from input jar name since there is not an easy way to get MuTect version.
Check mutect jar for SomaticIndelDetector, which is an Appistry feature
"""
cl = ["java", "-Xms128m", "-Xmx256m"] + get_default_jvm_opts() + ["-jar", mutect_jar, "-h"]
w... | [
"def",
"get_mutect_version",
"(",
"mutect_jar",
")",
":",
"cl",
"=",
"[",
"\"java\"",
",",
"\"-Xms128m\"",
",",
"\"-Xmx256m\"",
"]",
"+",
"get_default_jvm_opts",
"(",
")",
"+",
"[",
"\"-jar\"",
",",
"mutect_jar",
",",
"\"-h\"",
"]",
"with",
"closing",
"(",
... | Retrieves version from input jar name since there is not an easy way to get MuTect version.
Check mutect jar for SomaticIndelDetector, which is an Appistry feature | [
"Retrieves",
"version",
"from",
"input",
"jar",
"name",
"since",
"there",
"is",
"not",
"an",
"easy",
"way",
"to",
"get",
"MuTect",
"version",
".",
"Check",
"mutect",
"jar",
"for",
"SomaticIndelDetector",
"which",
"is",
"an",
"Appistry",
"feature"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L110-L129 |
223,671 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | gatk_cmd | def gatk_cmd(name, jvm_opts, params, config=None):
"""Retrieve PATH to gatk using locally installed java.
"""
if name == "gatk":
if isinstance(config, dict) and "config" not in config:
data = {"config": config}
else:
data = config
if not data or "gatk4" not in... | python | def gatk_cmd(name, jvm_opts, params, config=None):
"""Retrieve PATH to gatk using locally installed java.
"""
if name == "gatk":
if isinstance(config, dict) and "config" not in config:
data = {"config": config}
else:
data = config
if not data or "gatk4" not in... | [
"def",
"gatk_cmd",
"(",
"name",
",",
"jvm_opts",
",",
"params",
",",
"config",
"=",
"None",
")",
":",
"if",
"name",
"==",
"\"gatk\"",
":",
"if",
"isinstance",
"(",
"config",
",",
"dict",
")",
"and",
"\"config\"",
"not",
"in",
"config",
":",
"data",
"... | Retrieve PATH to gatk using locally installed java. | [
"Retrieve",
"PATH",
"to",
"gatk",
"using",
"locally",
"installed",
"java",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L530-L549 |
223,672 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | _gatk4_cmd | def _gatk4_cmd(jvm_opts, params, data):
"""Retrieve unified command for GATK4, using 'gatk'. GATK3 is 'gatk3'.
"""
gatk_cmd = utils.which(os.path.join(os.path.dirname(os.path.realpath(sys.executable)), "gatk"))
return "%s && export PATH=%s:\"$PATH\" && gatk --java-options '%s' %s" % \
(utils.cle... | python | def _gatk4_cmd(jvm_opts, params, data):
"""Retrieve unified command for GATK4, using 'gatk'. GATK3 is 'gatk3'.
"""
gatk_cmd = utils.which(os.path.join(os.path.dirname(os.path.realpath(sys.executable)), "gatk"))
return "%s && export PATH=%s:\"$PATH\" && gatk --java-options '%s' %s" % \
(utils.cle... | [
"def",
"_gatk4_cmd",
"(",
"jvm_opts",
",",
"params",
",",
"data",
")",
":",
"gatk_cmd",
"=",
"utils",
".",
"which",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"sys",
... | Retrieve unified command for GATK4, using 'gatk'. GATK3 is 'gatk3'. | [
"Retrieve",
"unified",
"command",
"for",
"GATK4",
"using",
"gatk",
".",
"GATK3",
"is",
"gatk3",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L551-L557 |
223,673 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | runner_from_path | def runner_from_path(cmd, config):
"""Simple command line runner that expects a bash cmd in the PATH.
This makes Picard tools back compatible with new approach of a single
jar + bash script.
"""
if cmd.endswith("picard"):
return PicardCmdRunner(cmd, config)
else:
raise ValueErro... | python | def runner_from_path(cmd, config):
"""Simple command line runner that expects a bash cmd in the PATH.
This makes Picard tools back compatible with new approach of a single
jar + bash script.
"""
if cmd.endswith("picard"):
return PicardCmdRunner(cmd, config)
else:
raise ValueErro... | [
"def",
"runner_from_path",
"(",
"cmd",
",",
"config",
")",
":",
"if",
"cmd",
".",
"endswith",
"(",
"\"picard\"",
")",
":",
"return",
"PicardCmdRunner",
"(",
"cmd",
",",
"config",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Do not support PATH running for ... | Simple command line runner that expects a bash cmd in the PATH.
This makes Picard tools back compatible with new approach of a single
jar + bash script. | [
"Simple",
"command",
"line",
"runner",
"that",
"expects",
"a",
"bash",
"cmd",
"in",
"the",
"PATH",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L587-L596 |
223,674 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner._set_default_versions | def _set_default_versions(self, config):
"""Retrieve pre-computed version information for expensive to retrieve versions.
Starting up GATK takes a lot of resources so we do it once at start of analysis.
"""
out = []
for name in ["gatk", "gatk4", "picard", "mutect"]:
v... | python | def _set_default_versions(self, config):
"""Retrieve pre-computed version information for expensive to retrieve versions.
Starting up GATK takes a lot of resources so we do it once at start of analysis.
"""
out = []
for name in ["gatk", "gatk4", "picard", "mutect"]:
v... | [
"def",
"_set_default_versions",
"(",
"self",
",",
"config",
")",
":",
"out",
"=",
"[",
"]",
"for",
"name",
"in",
"[",
"\"gatk\"",
",",
"\"gatk4\"",
",",
"\"picard\"",
",",
"\"mutect\"",
"]",
":",
"v",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"resources\""... | Retrieve pre-computed version information for expensive to retrieve versions.
Starting up GATK takes a lot of resources so we do it once at start of analysis. | [
"Retrieve",
"pre",
"-",
"computed",
"version",
"information",
"for",
"expensive",
"to",
"retrieve",
"versions",
".",
"Starting",
"up",
"GATK",
"takes",
"a",
"lot",
"of",
"resources",
"so",
"we",
"do",
"it",
"once",
"at",
"start",
"of",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L171-L184 |
223,675 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.new_resources | def new_resources(self, program):
"""Set new resource usage for the given program.
This allows customization of memory usage for particular sub-programs
of GATK like HaplotypeCaller.
"""
resources = config_utils.get_resources(program, self._config)
if resources.get("jvm_o... | python | def new_resources(self, program):
"""Set new resource usage for the given program.
This allows customization of memory usage for particular sub-programs
of GATK like HaplotypeCaller.
"""
resources = config_utils.get_resources(program, self._config)
if resources.get("jvm_o... | [
"def",
"new_resources",
"(",
"self",
",",
"program",
")",
":",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"program",
",",
"self",
".",
"_config",
")",
"if",
"resources",
".",
"get",
"(",
"\"jvm_opts\"",
")",
":",
"self",
".",
"_jvm_opts",... | Set new resource usage for the given program.
This allows customization of memory usage for particular sub-programs
of GATK like HaplotypeCaller. | [
"Set",
"new",
"resource",
"usage",
"for",
"the",
"given",
"program",
".",
"This",
"allows",
"customization",
"of",
"memory",
"usage",
"for",
"particular",
"sub",
"-",
"programs",
"of",
"GATK",
"like",
"HaplotypeCaller",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L186-L193 |
223,676 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.run_fn | def run_fn(self, name, *args, **kwds):
"""Run pre-built functionality that used Broad tools by name.
See the gatkrun, picardrun module for available functions.
"""
fn = None
to_check = [picardrun]
for ns in to_check:
try:
fn = getattr(ns, name... | python | def run_fn(self, name, *args, **kwds):
"""Run pre-built functionality that used Broad tools by name.
See the gatkrun, picardrun module for available functions.
"""
fn = None
to_check = [picardrun]
for ns in to_check:
try:
fn = getattr(ns, name... | [
"def",
"run_fn",
"(",
"self",
",",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"fn",
"=",
"None",
"to_check",
"=",
"[",
"picardrun",
"]",
"for",
"ns",
"in",
"to_check",
":",
"try",
":",
"fn",
"=",
"getattr",
"(",
"ns",
",",
"name... | Run pre-built functionality that used Broad tools by name.
See the gatkrun, picardrun module for available functions. | [
"Run",
"pre",
"-",
"built",
"functionality",
"that",
"used",
"Broad",
"tools",
"by",
"name",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L195-L209 |
223,677 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.cl_picard | def cl_picard(self, command, options, memscale=None):
"""Prepare a Picard commandline.
"""
options = ["%s=%s" % (x, y) for x, y in options]
options.append("VALIDATION_STRINGENCY=SILENT")
return self._get_picard_cmd(command, memscale=memscale) + options | python | def cl_picard(self, command, options, memscale=None):
"""Prepare a Picard commandline.
"""
options = ["%s=%s" % (x, y) for x, y in options]
options.append("VALIDATION_STRINGENCY=SILENT")
return self._get_picard_cmd(command, memscale=memscale) + options | [
"def",
"cl_picard",
"(",
"self",
",",
"command",
",",
"options",
",",
"memscale",
"=",
"None",
")",
":",
"options",
"=",
"[",
"\"%s=%s\"",
"%",
"(",
"x",
",",
"y",
")",
"for",
"x",
",",
"y",
"in",
"options",
"]",
"options",
".",
"append",
"(",
"\... | Prepare a Picard commandline. | [
"Prepare",
"a",
"Picard",
"commandline",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L211-L216 |
223,678 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.run | def run(self, command, options, pipe=False, get_stdout=False, memscale=None):
"""Run a Picard command with the provided option pairs.
"""
cl = self.cl_picard(command, options, memscale=memscale)
if pipe:
subprocess.Popen(cl)
elif get_stdout:
p = subprocess... | python | def run(self, command, options, pipe=False, get_stdout=False, memscale=None):
"""Run a Picard command with the provided option pairs.
"""
cl = self.cl_picard(command, options, memscale=memscale)
if pipe:
subprocess.Popen(cl)
elif get_stdout:
p = subprocess... | [
"def",
"run",
"(",
"self",
",",
"command",
",",
"options",
",",
"pipe",
"=",
"False",
",",
"get_stdout",
"=",
"False",
",",
"memscale",
"=",
"None",
")",
":",
"cl",
"=",
"self",
".",
"cl_picard",
"(",
"command",
",",
"options",
",",
"memscale",
"=",
... | Run a Picard command with the provided option pairs. | [
"Run",
"a",
"Picard",
"command",
"with",
"the",
"provided",
"option",
"pairs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L218-L231 |
223,679 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.cl_mutect | def cl_mutect(self, params, tmp_dir):
"""Define parameters to run the mutect paired algorithm.
"""
gatk_jar = self._get_jar("muTect", ["mutect"])
# Decrease memory slightly from configuration to avoid memory allocation errors
jvm_opts = config_utils.adjust_opts(self._jvm_opts,
... | python | def cl_mutect(self, params, tmp_dir):
"""Define parameters to run the mutect paired algorithm.
"""
gatk_jar = self._get_jar("muTect", ["mutect"])
# Decrease memory slightly from configuration to avoid memory allocation errors
jvm_opts = config_utils.adjust_opts(self._jvm_opts,
... | [
"def",
"cl_mutect",
"(",
"self",
",",
"params",
",",
"tmp_dir",
")",
":",
"gatk_jar",
"=",
"self",
".",
"_get_jar",
"(",
"\"muTect\"",
",",
"[",
"\"mutect\"",
"]",
")",
"# Decrease memory slightly from configuration to avoid memory allocation errors",
"jvm_opts",
"=",... | Define parameters to run the mutect paired algorithm. | [
"Define",
"parameters",
"to",
"run",
"the",
"mutect",
"paired",
"algorithm",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L330-L339 |
223,680 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.run_gatk | def run_gatk(self, params, tmp_dir=None, log_error=True,
data=None, region=None, memscale=None, parallel_gc=False, ld_preload=False):
"""Top level interface to running a GATK command.
ld_preload injects required libraries for Java JNI calls:
https://gatkforums.broadinstitute.or... | python | def run_gatk(self, params, tmp_dir=None, log_error=True,
data=None, region=None, memscale=None, parallel_gc=False, ld_preload=False):
"""Top level interface to running a GATK command.
ld_preload injects required libraries for Java JNI calls:
https://gatkforums.broadinstitute.or... | [
"def",
"run_gatk",
"(",
"self",
",",
"params",
",",
"tmp_dir",
"=",
"None",
",",
"log_error",
"=",
"True",
",",
"data",
"=",
"None",
",",
"region",
"=",
"None",
",",
"memscale",
"=",
"None",
",",
"parallel_gc",
"=",
"False",
",",
"ld_preload",
"=",
"... | Top level interface to running a GATK command.
ld_preload injects required libraries for Java JNI calls:
https://gatkforums.broadinstitute.org/gatk/discussion/8810/something-about-create-pon-workflow | [
"Top",
"level",
"interface",
"to",
"running",
"a",
"GATK",
"command",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L341-L365 |
223,681 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.get_gatk_version | def get_gatk_version(self):
"""Retrieve GATK version, handling locally and config cached versions.
Calling version can be expensive due to all the startup and shutdown
of JVMs, so we prefer cached version information.
"""
if self._gatk_version is None:
self._set_defau... | python | def get_gatk_version(self):
"""Retrieve GATK version, handling locally and config cached versions.
Calling version can be expensive due to all the startup and shutdown
of JVMs, so we prefer cached version information.
"""
if self._gatk_version is None:
self._set_defau... | [
"def",
"get_gatk_version",
"(",
"self",
")",
":",
"if",
"self",
".",
"_gatk_version",
"is",
"None",
":",
"self",
".",
"_set_default_versions",
"(",
"self",
".",
"_config",
")",
"if",
"\"gatk4\"",
"not",
"in",
"dd",
".",
"get_tools_off",
"(",
"{",
"\"config... | Retrieve GATK version, handling locally and config cached versions.
Calling version can be expensive due to all the startup and shutdown
of JVMs, so we prefer cached version information. | [
"Retrieve",
"GATK",
"version",
"handling",
"locally",
"and",
"config",
"cached",
"versions",
".",
"Calling",
"version",
"can",
"be",
"expensive",
"due",
"to",
"all",
"the",
"startup",
"and",
"shutdown",
"of",
"JVMs",
"so",
"we",
"prefer",
"cached",
"version",
... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L376-L398 |
223,682 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.get_mutect_version | def get_mutect_version(self):
"""Retrieve the Mutect version.
"""
if self._mutect_version is None:
mutect_jar = self._get_jar("muTect", ["mutect"])
self._mutect_version = get_mutect_version(mutect_jar)
return self._mutect_version | python | def get_mutect_version(self):
"""Retrieve the Mutect version.
"""
if self._mutect_version is None:
mutect_jar = self._get_jar("muTect", ["mutect"])
self._mutect_version = get_mutect_version(mutect_jar)
return self._mutect_version | [
"def",
"get_mutect_version",
"(",
"self",
")",
":",
"if",
"self",
".",
"_mutect_version",
"is",
"None",
":",
"mutect_jar",
"=",
"self",
".",
"_get_jar",
"(",
"\"muTect\"",
",",
"[",
"\"mutect\"",
"]",
")",
"self",
".",
"_mutect_version",
"=",
"get_mutect_ver... | Retrieve the Mutect version. | [
"Retrieve",
"the",
"Mutect",
"version",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L400-L406 |
223,683 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner.gatk_major_version | def gatk_major_version(self):
"""Retrieve the GATK major version, handling multiple GATK distributions.
Has special cases for GATK nightly builds, Appistry releases and
GATK prior to 2.3.
"""
full_version = self.get_gatk_version()
# Working with a recent version if using... | python | def gatk_major_version(self):
"""Retrieve the GATK major version, handling multiple GATK distributions.
Has special cases for GATK nightly builds, Appistry releases and
GATK prior to 2.3.
"""
full_version = self.get_gatk_version()
# Working with a recent version if using... | [
"def",
"gatk_major_version",
"(",
"self",
")",
":",
"full_version",
"=",
"self",
".",
"get_gatk_version",
"(",
")",
"# Working with a recent version if using nightlies",
"if",
"full_version",
".",
"startswith",
"(",
"\"nightly-\"",
")",
":",
"return",
"\"3.6\"",
"part... | Retrieve the GATK major version, handling multiple GATK distributions.
Has special cases for GATK nightly builds, Appistry releases and
GATK prior to 2.3. | [
"Retrieve",
"the",
"GATK",
"major",
"version",
"handling",
"multiple",
"GATK",
"distributions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L420-L444 |
223,684 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner._get_picard_cmd | def _get_picard_cmd(self, command, memscale=None):
"""Retrieve the base Picard command, handling both shell scripts and directory of jars.
"""
resources = config_utils.get_resources("picard", self._config)
if memscale:
jvm_opts = get_picard_opts(self._config, memscale=memscal... | python | def _get_picard_cmd(self, command, memscale=None):
"""Retrieve the base Picard command, handling both shell scripts and directory of jars.
"""
resources = config_utils.get_resources("picard", self._config)
if memscale:
jvm_opts = get_picard_opts(self._config, memscale=memscal... | [
"def",
"_get_picard_cmd",
"(",
"self",
",",
"command",
",",
"memscale",
"=",
"None",
")",
":",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"picard\"",
",",
"self",
".",
"_config",
")",
"if",
"memscale",
":",
"jvm_opts",
"=",
"get_picard_op... | Retrieve the base Picard command, handling both shell scripts and directory of jars. | [
"Retrieve",
"the",
"base",
"Picard",
"command",
"handling",
"both",
"shell",
"scripts",
"and",
"directory",
"of",
"jars",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L446-L461 |
223,685 | bcbio/bcbio-nextgen | bcbio/broad/__init__.py | BroadRunner._get_jar | def _get_jar(self, command, alts=None, allow_missing=False):
"""Retrieve the jar for running the specified command.
"""
dirs = []
for bdir in [self._gatk_dir, self._picard_ref]:
dirs.extend([bdir,
os.path.join(bdir, os.pardir, "gatk")])
if alt... | python | def _get_jar(self, command, alts=None, allow_missing=False):
"""Retrieve the jar for running the specified command.
"""
dirs = []
for bdir in [self._gatk_dir, self._picard_ref]:
dirs.extend([bdir,
os.path.join(bdir, os.pardir, "gatk")])
if alt... | [
"def",
"_get_jar",
"(",
"self",
",",
"command",
",",
"alts",
"=",
"None",
",",
"allow_missing",
"=",
"False",
")",
":",
"dirs",
"=",
"[",
"]",
"for",
"bdir",
"in",
"[",
"self",
".",
"_gatk_dir",
",",
"self",
".",
"_picard_ref",
"]",
":",
"dirs",
".... | Retrieve the jar for running the specified command. | [
"Retrieve",
"the",
"jar",
"for",
"running",
"the",
"specified",
"command",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L463-L484 |
223,686 | bcbio/bcbio-nextgen | bcbio/utils.py | cpmap | def cpmap(cores=1):
"""Configurable parallel map context manager.
Returns appropriate map compatible function based on configuration:
- Local single core (the default)
- Multiple local cores
"""
if int(cores) == 1:
yield itertools.imap
else:
if futures is None:
r... | python | def cpmap(cores=1):
"""Configurable parallel map context manager.
Returns appropriate map compatible function based on configuration:
- Local single core (the default)
- Multiple local cores
"""
if int(cores) == 1:
yield itertools.imap
else:
if futures is None:
r... | [
"def",
"cpmap",
"(",
"cores",
"=",
"1",
")",
":",
"if",
"int",
"(",
"cores",
")",
"==",
"1",
":",
"yield",
"itertools",
".",
"imap",
"else",
":",
"if",
"futures",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"\"concurrent.futures not available\"",
")"... | Configurable parallel map context manager.
Returns appropriate map compatible function based on configuration:
- Local single core (the default)
- Multiple local cores | [
"Configurable",
"parallel",
"map",
"context",
"manager",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L34-L48 |
223,687 | bcbio/bcbio-nextgen | bcbio/utils.py | map_wrap | def map_wrap(f):
"""Wrap standard function to easily pass into 'map' processing.
"""
@functools.wraps(f)
def wrapper(*args, **kwargs):
return f(*args, **kwargs)
return wrapper | python | def map_wrap(f):
"""Wrap standard function to easily pass into 'map' processing.
"""
@functools.wraps(f)
def wrapper(*args, **kwargs):
return f(*args, **kwargs)
return wrapper | [
"def",
"map_wrap",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"wrapper"
] | Wrap standard function to easily pass into 'map' processing. | [
"Wrap",
"standard",
"function",
"to",
"easily",
"pass",
"into",
"map",
"processing",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L50-L56 |
223,688 | bcbio/bcbio-nextgen | bcbio/utils.py | unpack_worlds | def unpack_worlds(items):
"""Handle all the ways we can pass multiple samples for back-compatibility.
"""
# Unpack nested lists of samples grouped together (old IPython style)
if isinstance(items[0], (list, tuple)) and len(items[0]) == 1:
out = []
for d in items:
assert len(d... | python | def unpack_worlds(items):
"""Handle all the ways we can pass multiple samples for back-compatibility.
"""
# Unpack nested lists of samples grouped together (old IPython style)
if isinstance(items[0], (list, tuple)) and len(items[0]) == 1:
out = []
for d in items:
assert len(d... | [
"def",
"unpack_worlds",
"(",
"items",
")",
":",
"# Unpack nested lists of samples grouped together (old IPython style)",
"if",
"isinstance",
"(",
"items",
"[",
"0",
"]",
",",
"(",
"list",
",",
"tuple",
")",
")",
"and",
"len",
"(",
"items",
"[",
"0",
"]",
")",
... | Handle all the ways we can pass multiple samples for back-compatibility. | [
"Handle",
"all",
"the",
"ways",
"we",
"can",
"pass",
"multiple",
"samples",
"for",
"back",
"-",
"compatibility",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L160-L174 |
223,689 | bcbio/bcbio-nextgen | bcbio/utils.py | safe_makedir | def safe_makedir(dname):
"""Make a directory if it doesn't exist, handling concurrent race conditions.
"""
if not dname:
return dname
num_tries = 0
max_tries = 5
while not os.path.exists(dname):
# we could get an error here if multiple processes are creating
# the directo... | python | def safe_makedir(dname):
"""Make a directory if it doesn't exist, handling concurrent race conditions.
"""
if not dname:
return dname
num_tries = 0
max_tries = 5
while not os.path.exists(dname):
# we could get an error here if multiple processes are creating
# the directo... | [
"def",
"safe_makedir",
"(",
"dname",
")",
":",
"if",
"not",
"dname",
":",
"return",
"dname",
"num_tries",
"=",
"0",
"max_tries",
"=",
"5",
"while",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dname",
")",
":",
"# we could get an error here if multiple pro... | Make a directory if it doesn't exist, handling concurrent race conditions. | [
"Make",
"a",
"directory",
"if",
"it",
"doesn",
"t",
"exist",
"handling",
"concurrent",
"race",
"conditions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L176-L193 |
223,690 | bcbio/bcbio-nextgen | bcbio/utils.py | tmpfile | def tmpfile(*args, **kwargs):
"""Make a tempfile, safely cleaning up file descriptors on completion.
"""
(fd, fname) = tempfile.mkstemp(*args, **kwargs)
try:
yield fname
finally:
os.close(fd)
if os.path.exists(fname):
os.remove(fname) | python | def tmpfile(*args, **kwargs):
"""Make a tempfile, safely cleaning up file descriptors on completion.
"""
(fd, fname) = tempfile.mkstemp(*args, **kwargs)
try:
yield fname
finally:
os.close(fd)
if os.path.exists(fname):
os.remove(fname) | [
"def",
"tmpfile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"fd",
",",
"fname",
")",
"=",
"tempfile",
".",
"mkstemp",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"yield",
"fname",
"finally",
":",
"os",
".",
"clos... | Make a tempfile, safely cleaning up file descriptors on completion. | [
"Make",
"a",
"tempfile",
"safely",
"cleaning",
"up",
"file",
"descriptors",
"on",
"completion",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L221-L230 |
223,691 | bcbio/bcbio-nextgen | bcbio/utils.py | file_exists | def file_exists(fname):
"""Check if a file exists and is non-empty.
"""
try:
return fname and os.path.exists(fname) and os.path.getsize(fname) > 0
except OSError:
return False | python | def file_exists(fname):
"""Check if a file exists and is non-empty.
"""
try:
return fname and os.path.exists(fname) and os.path.getsize(fname) > 0
except OSError:
return False | [
"def",
"file_exists",
"(",
"fname",
")",
":",
"try",
":",
"return",
"fname",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
"and",
"os",
".",
"path",
".",
"getsize",
"(",
"fname",
")",
">",
"0",
"except",
"OSError",
":",
"return",
"Fal... | Check if a file exists and is non-empty. | [
"Check",
"if",
"a",
"file",
"exists",
"and",
"is",
"non",
"-",
"empty",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L232-L238 |
223,692 | bcbio/bcbio-nextgen | bcbio/utils.py | get_size | def get_size(path):
""" Returns the size in bytes if `path` is a file,
or the size of all files in `path` if it's a directory.
Analogous to `du -s`.
"""
if os.path.isfile(path):
return os.path.getsize(path)
return sum(get_size(os.path.join(path, f)) for f in os.listdir(path)) | python | def get_size(path):
""" Returns the size in bytes if `path` is a file,
or the size of all files in `path` if it's a directory.
Analogous to `du -s`.
"""
if os.path.isfile(path):
return os.path.getsize(path)
return sum(get_size(os.path.join(path, f)) for f in os.listdir(path)) | [
"def",
"get_size",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"getsize",
"(",
"path",
")",
"return",
"sum",
"(",
"get_size",
"(",
"os",
".",
"path",
".",
"join",
"(",
... | Returns the size in bytes if `path` is a file,
or the size of all files in `path` if it's a directory.
Analogous to `du -s`. | [
"Returns",
"the",
"size",
"in",
"bytes",
"if",
"path",
"is",
"a",
"file",
"or",
"the",
"size",
"of",
"all",
"files",
"in",
"path",
"if",
"it",
"s",
"a",
"directory",
".",
"Analogous",
"to",
"du",
"-",
"s",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L241-L248 |
223,693 | bcbio/bcbio-nextgen | bcbio/utils.py | read_galaxy_amqp_config | def read_galaxy_amqp_config(galaxy_config, base_dir):
"""Read connection information on the RabbitMQ server from Galaxy config.
"""
galaxy_config = add_full_path(galaxy_config, base_dir)
config = six.moves.configparser.ConfigParser()
config.read(galaxy_config)
amqp_config = {}
for option in ... | python | def read_galaxy_amqp_config(galaxy_config, base_dir):
"""Read connection information on the RabbitMQ server from Galaxy config.
"""
galaxy_config = add_full_path(galaxy_config, base_dir)
config = six.moves.configparser.ConfigParser()
config.read(galaxy_config)
amqp_config = {}
for option in ... | [
"def",
"read_galaxy_amqp_config",
"(",
"galaxy_config",
",",
"base_dir",
")",
":",
"galaxy_config",
"=",
"add_full_path",
"(",
"galaxy_config",
",",
"base_dir",
")",
"config",
"=",
"six",
".",
"moves",
".",
"configparser",
".",
"ConfigParser",
"(",
")",
"config"... | Read connection information on the RabbitMQ server from Galaxy config. | [
"Read",
"connection",
"information",
"on",
"the",
"RabbitMQ",
"server",
"from",
"Galaxy",
"config",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L279-L288 |
223,694 | bcbio/bcbio-nextgen | bcbio/utils.py | move_safe | def move_safe(origin, target):
"""
Move file, skip if exists
"""
if origin == target:
return origin
if file_exists(target):
return target
shutil.move(origin, target)
return target | python | def move_safe(origin, target):
"""
Move file, skip if exists
"""
if origin == target:
return origin
if file_exists(target):
return target
shutil.move(origin, target)
return target | [
"def",
"move_safe",
"(",
"origin",
",",
"target",
")",
":",
"if",
"origin",
"==",
"target",
":",
"return",
"origin",
"if",
"file_exists",
"(",
"target",
")",
":",
"return",
"target",
"shutil",
".",
"move",
"(",
"origin",
",",
"target",
")",
"return",
"... | Move file, skip if exists | [
"Move",
"file",
"skip",
"if",
"exists"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L315-L324 |
223,695 | bcbio/bcbio-nextgen | bcbio/utils.py | file_plus_index | def file_plus_index(fname):
"""Convert a file name into the file plus required indexes.
"""
exts = {".vcf": ".idx", ".bam": ".bai", ".vcf.gz": ".tbi", ".bed.gz": ".tbi",
".fq.gz": ".gbi"}
ext = splitext_plus(fname)[-1]
if ext in exts:
return [fname, fname + exts[ext]]
else:
... | python | def file_plus_index(fname):
"""Convert a file name into the file plus required indexes.
"""
exts = {".vcf": ".idx", ".bam": ".bai", ".vcf.gz": ".tbi", ".bed.gz": ".tbi",
".fq.gz": ".gbi"}
ext = splitext_plus(fname)[-1]
if ext in exts:
return [fname, fname + exts[ext]]
else:
... | [
"def",
"file_plus_index",
"(",
"fname",
")",
":",
"exts",
"=",
"{",
"\".vcf\"",
":",
"\".idx\"",
",",
"\".bam\"",
":",
"\".bai\"",
",",
"\".vcf.gz\"",
":",
"\".tbi\"",
",",
"\".bed.gz\"",
":",
"\".tbi\"",
",",
"\".fq.gz\"",
":",
"\".gbi\"",
"}",
"ext",
"="... | Convert a file name into the file plus required indexes. | [
"Convert",
"a",
"file",
"name",
"into",
"the",
"file",
"plus",
"required",
"indexes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L326-L335 |
223,696 | bcbio/bcbio-nextgen | bcbio/utils.py | remove_plus | def remove_plus(orig):
"""Remove a fils, including biological index files.
"""
for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]:
if os.path.exists(orig + ext):
remove_safe(orig + ext) | python | def remove_plus(orig):
"""Remove a fils, including biological index files.
"""
for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]:
if os.path.exists(orig + ext):
remove_safe(orig + ext) | [
"def",
"remove_plus",
"(",
"orig",
")",
":",
"for",
"ext",
"in",
"[",
"\"\"",
",",
"\".idx\"",
",",
"\".gbi\"",
",",
"\".tbi\"",
",",
"\".bai\"",
"]",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"orig",
"+",
"ext",
")",
":",
"remove_safe",
"(... | Remove a fils, including biological index files. | [
"Remove",
"a",
"fils",
"including",
"biological",
"index",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L337-L342 |
223,697 | bcbio/bcbio-nextgen | bcbio/utils.py | copy_plus | def copy_plus(orig, new):
"""Copy a fils, including biological index files.
"""
for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]:
if os.path.exists(orig + ext) and (not os.path.lexists(new + ext) or not os.path.exists(new + ext)):
shutil.copyfile(orig + ext, new + ext) | python | def copy_plus(orig, new):
"""Copy a fils, including biological index files.
"""
for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]:
if os.path.exists(orig + ext) and (not os.path.lexists(new + ext) or not os.path.exists(new + ext)):
shutil.copyfile(orig + ext, new + ext) | [
"def",
"copy_plus",
"(",
"orig",
",",
"new",
")",
":",
"for",
"ext",
"in",
"[",
"\"\"",
",",
"\".idx\"",
",",
"\".gbi\"",
",",
"\".tbi\"",
",",
"\".bai\"",
"]",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"orig",
"+",
"ext",
")",
"and",
"("... | Copy a fils, including biological index files. | [
"Copy",
"a",
"fils",
"including",
"biological",
"index",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L344-L349 |
223,698 | bcbio/bcbio-nextgen | bcbio/utils.py | merge_config_files | def merge_config_files(fnames):
"""Merge configuration files, preferring definitions in latter files.
"""
def _load_yaml(fname):
with open(fname) as in_handle:
config = yaml.safe_load(in_handle)
return config
out = _load_yaml(fnames[0])
for fname in fnames[1:]:
cu... | python | def merge_config_files(fnames):
"""Merge configuration files, preferring definitions in latter files.
"""
def _load_yaml(fname):
with open(fname) as in_handle:
config = yaml.safe_load(in_handle)
return config
out = _load_yaml(fnames[0])
for fname in fnames[1:]:
cu... | [
"def",
"merge_config_files",
"(",
"fnames",
")",
":",
"def",
"_load_yaml",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_handle",
")",
"return",
"config",
"out",
"=",
... | Merge configuration files, preferring definitions in latter files. | [
"Merge",
"configuration",
"files",
"preferring",
"definitions",
"in",
"latter",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L475-L490 |
223,699 | bcbio/bcbio-nextgen | bcbio/utils.py | deepish_copy | def deepish_copy(org):
"""Improved speed deep copy for dictionaries of simple python types.
Thanks to Gregg Lind:
http://writeonly.wordpress.com/2009/05/07/deepcopy-is-a-pig-for-simple-data/
"""
out = dict().fromkeys(org)
for k, v in org.items():
if isinstance(v, dict):
out[... | python | def deepish_copy(org):
"""Improved speed deep copy for dictionaries of simple python types.
Thanks to Gregg Lind:
http://writeonly.wordpress.com/2009/05/07/deepcopy-is-a-pig-for-simple-data/
"""
out = dict().fromkeys(org)
for k, v in org.items():
if isinstance(v, dict):
out[... | [
"def",
"deepish_copy",
"(",
"org",
")",
":",
"out",
"=",
"dict",
"(",
")",
".",
"fromkeys",
"(",
"org",
")",
"for",
"k",
",",
"v",
"in",
"org",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
":",
"out",
"[",
"k",... | Improved speed deep copy for dictionaries of simple python types.
Thanks to Gregg Lind:
http://writeonly.wordpress.com/2009/05/07/deepcopy-is-a-pig-for-simple-data/ | [
"Improved",
"speed",
"deep",
"copy",
"for",
"dictionaries",
"of",
"simple",
"python",
"types",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L492-L510 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.