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,400
bcbio/bcbio-nextgen
bcbio/install.py
_datatarget_defaults
def _datatarget_defaults(args, default_args): """Set data installation targets, handling defaults. Sets variation, rnaseq, smallrna as default targets if we're not isolated to a single method. Provides back compatibility for toolplus specifications. """ default_data = default_args.get("datatar...
python
def _datatarget_defaults(args, default_args): """Set data installation targets, handling defaults. Sets variation, rnaseq, smallrna as default targets if we're not isolated to a single method. Provides back compatibility for toolplus specifications. """ default_data = default_args.get("datatar...
[ "def", "_datatarget_defaults", "(", "args", ",", "default_args", ")", ":", "default_data", "=", "default_args", ".", "get", "(", "\"datatarget\"", ",", "[", "]", ")", "# back-compatible toolplus specifications", "for", "x", "in", "default_args", ".", "get", "(", ...
Set data installation targets, handling defaults. Sets variation, rnaseq, smallrna as default targets if we're not isolated to a single method. Provides back compatibility for toolplus specifications.
[ "Set", "data", "installation", "targets", "handling", "defaults", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L699-L730
223,401
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_merge_wf_inputs
def _merge_wf_inputs(new, out, wf_outputs, to_ignore, parallel, nested_inputs): """Merge inputs for a sub-workflow, adding any not present inputs in out. Skips inputs that are internally generated or generated and ignored, keeping only as inputs those that we do not generate internally. """ interna...
python
def _merge_wf_inputs(new, out, wf_outputs, to_ignore, parallel, nested_inputs): """Merge inputs for a sub-workflow, adding any not present inputs in out. Skips inputs that are internally generated or generated and ignored, keeping only as inputs those that we do not generate internally. """ interna...
[ "def", "_merge_wf_inputs", "(", "new", ",", "out", ",", "wf_outputs", ",", "to_ignore", ",", "parallel", ",", "nested_inputs", ")", ":", "internal_generated_ids", "=", "[", "]", "for", "vignore", "in", "to_ignore", ":", "vignore_id", "=", "_get_string_vid", "(...
Merge inputs for a sub-workflow, adding any not present inputs in out. Skips inputs that are internally generated or generated and ignored, keeping only as inputs those that we do not generate internally.
[ "Merge", "inputs", "for", "a", "sub", "-", "workflow", "adding", "any", "not", "present", "inputs", "in", "out", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L72-L100
223,402
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_merge_wf_outputs
def _merge_wf_outputs(new, cur, parallel): """Merge outputs for a sub-workflow, replacing variables changed in later steps. ignore_ids are those used internally in a sub-workflow but not exposed to subsequent steps """ new_ids = set([]) out = [] for v in new: outv = {} outv["sou...
python
def _merge_wf_outputs(new, cur, parallel): """Merge outputs for a sub-workflow, replacing variables changed in later steps. ignore_ids are those used internally in a sub-workflow but not exposed to subsequent steps """ new_ids = set([]) out = [] for v in new: outv = {} outv["sou...
[ "def", "_merge_wf_outputs", "(", "new", ",", "cur", ",", "parallel", ")", ":", "new_ids", "=", "set", "(", "[", "]", ")", "out", "=", "[", "]", "for", "v", "in", "new", ":", "outv", "=", "{", "}", "outv", "[", "\"source\"", "]", "=", "v", "[", ...
Merge outputs for a sub-workflow, replacing variables changed in later steps. ignore_ids are those used internally in a sub-workflow but not exposed to subsequent steps
[ "Merge", "outputs", "for", "a", "sub", "-", "workflow", "replacing", "variables", "changed", "in", "later", "steps", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L102-L123
223,403
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_extract_from_subworkflow
def _extract_from_subworkflow(vs, step): """Remove internal variable names when moving from sub-workflow to main. """ substep_ids = set([x.name for x in step.workflow]) out = [] for var in vs: internal = False parts = var["id"].split("/") if len(parts) > 1: if par...
python
def _extract_from_subworkflow(vs, step): """Remove internal variable names when moving from sub-workflow to main. """ substep_ids = set([x.name for x in step.workflow]) out = [] for var in vs: internal = False parts = var["id"].split("/") if len(parts) > 1: if par...
[ "def", "_extract_from_subworkflow", "(", "vs", ",", "step", ")", ":", "substep_ids", "=", "set", "(", "[", "x", ".", "name", "for", "x", "in", "step", ".", "workflow", "]", ")", "out", "=", "[", "]", "for", "var", "in", "vs", ":", "internal", "=", ...
Remove internal variable names when moving from sub-workflow to main.
[ "Remove", "internal", "variable", "names", "when", "moving", "from", "sub", "-", "workflow", "to", "main", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L125-L139
223,404
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
is_cwl_record
def is_cwl_record(d): """Check if an input is a CWL record, from any level of nesting. """ if isinstance(d, dict): if d.get("type") == "record": return d else: recs = list(filter(lambda x: x is not None, [is_cwl_record(v) for v in d.values()])) return recs...
python
def is_cwl_record(d): """Check if an input is a CWL record, from any level of nesting. """ if isinstance(d, dict): if d.get("type") == "record": return d else: recs = list(filter(lambda x: x is not None, [is_cwl_record(v) for v in d.values()])) return recs...
[ "def", "is_cwl_record", "(", "d", ")", ":", "if", "isinstance", "(", "d", ",", "dict", ")", ":", "if", "d", ".", "get", "(", "\"type\"", ")", "==", "\"record\"", ":", "return", "d", "else", ":", "recs", "=", "list", "(", "filter", "(", "lambda", ...
Check if an input is a CWL record, from any level of nesting.
[ "Check", "if", "an", "input", "is", "a", "CWL", "record", "from", "any", "level", "of", "nesting", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L150-L160
223,405
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_get_step_inputs
def _get_step_inputs(step, file_vs, std_vs, parallel_ids, wf=None): """Retrieve inputs for a step from existing variables. Potentially nests inputs to deal with merging split variables. If we split previously and are merging now, then we only nest those coming from the split process. """ inputs...
python
def _get_step_inputs(step, file_vs, std_vs, parallel_ids, wf=None): """Retrieve inputs for a step from existing variables. Potentially nests inputs to deal with merging split variables. If we split previously and are merging now, then we only nest those coming from the split process. """ inputs...
[ "def", "_get_step_inputs", "(", "step", ",", "file_vs", ",", "std_vs", ",", "parallel_ids", ",", "wf", "=", "None", ")", ":", "inputs", "=", "[", "]", "skip_inputs", "=", "set", "(", "[", "]", ")", "for", "orig_input", "in", "[", "_get_variable", "(", ...
Retrieve inputs for a step from existing variables. Potentially nests inputs to deal with merging split variables. If we split previously and are merging now, then we only nest those coming from the split process.
[ "Retrieve", "inputs", "for", "a", "step", "from", "existing", "variables", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L162-L197
223,406
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_nest_variable
def _nest_variable(v, check_records=False): """Nest a variable when moving from scattered back to consolidated. check_records -- avoid re-nesting a record input if it comes from a previous step and is already nested, don't need to re-array. """ if (check_records and is_cwl_record(v) and len(v["id"]...
python
def _nest_variable(v, check_records=False): """Nest a variable when moving from scattered back to consolidated. check_records -- avoid re-nesting a record input if it comes from a previous step and is already nested, don't need to re-array. """ if (check_records and is_cwl_record(v) and len(v["id"]...
[ "def", "_nest_variable", "(", "v", ",", "check_records", "=", "False", ")", ":", "if", "(", "check_records", "and", "is_cwl_record", "(", "v", ")", "and", "len", "(", "v", "[", "\"id\"", "]", ".", "split", "(", "\"/\"", ")", ")", ">", "1", "and", "...
Nest a variable when moving from scattered back to consolidated. check_records -- avoid re-nesting a record input if it comes from a previous step and is already nested, don't need to re-array.
[ "Nest", "a", "variable", "when", "moving", "from", "scattered", "back", "to", "consolidated", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L251-L263
223,407
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_clean_output
def _clean_output(v): """Remove output specific variables to allow variables to be inputs to next steps. """ out = copy.deepcopy(v) outb = out.pop("outputBinding", {}) if "secondaryFiles" in outb: out["secondaryFiles"] = outb["secondaryFiles"] return out
python
def _clean_output(v): """Remove output specific variables to allow variables to be inputs to next steps. """ out = copy.deepcopy(v) outb = out.pop("outputBinding", {}) if "secondaryFiles" in outb: out["secondaryFiles"] = outb["secondaryFiles"] return out
[ "def", "_clean_output", "(", "v", ")", ":", "out", "=", "copy", ".", "deepcopy", "(", "v", ")", "outb", "=", "out", ".", "pop", "(", "\"outputBinding\"", ",", "{", "}", ")", "if", "\"secondaryFiles\"", "in", "outb", ":", "out", "[", "\"secondaryFiles\"...
Remove output specific variables to allow variables to be inputs to next steps.
[ "Remove", "output", "specific", "variables", "to", "allow", "variables", "to", "be", "inputs", "to", "next", "steps", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L265-L272
223,408
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_get_variable
def _get_variable(vid, variables): """Retrieve an input variable from our existing pool of options. """ if isinstance(vid, six.string_types): vid = get_base_id(vid) else: vid = _get_string_vid(vid) for v in variables: if vid == get_base_id(v["id"]): return copy.de...
python
def _get_variable(vid, variables): """Retrieve an input variable from our existing pool of options. """ if isinstance(vid, six.string_types): vid = get_base_id(vid) else: vid = _get_string_vid(vid) for v in variables: if vid == get_base_id(v["id"]): return copy.de...
[ "def", "_get_variable", "(", "vid", ",", "variables", ")", ":", "if", "isinstance", "(", "vid", ",", "six", ".", "string_types", ")", ":", "vid", "=", "get_base_id", "(", "vid", ")", "else", ":", "vid", "=", "_get_string_vid", "(", "vid", ")", "for", ...
Retrieve an input variable from our existing pool of options.
[ "Retrieve", "an", "input", "variable", "from", "our", "existing", "pool", "of", "options", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L280-L290
223,409
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_handle_special_inputs
def _handle_special_inputs(inputs, variables): """Adjust input variables based on special cases. This case handles inputs where we are optional or can have flexible choices. XXX Need to better expose this at a top level definition. """ from bcbio import structural optional = [["config", "algor...
python
def _handle_special_inputs(inputs, variables): """Adjust input variables based on special cases. This case handles inputs where we are optional or can have flexible choices. XXX Need to better expose this at a top level definition. """ from bcbio import structural optional = [["config", "algor...
[ "def", "_handle_special_inputs", "(", "inputs", ",", "variables", ")", ":", "from", "bcbio", "import", "structural", "optional", "=", "[", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"coverage\"", "]", ",", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"...
Adjust input variables based on special cases. This case handles inputs where we are optional or can have flexible choices. XXX Need to better expose this at a top level definition.
[ "Adjust", "input", "variables", "based", "on", "special", "cases", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L292-L332
223,410
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_create_record
def _create_record(name, field_defs, step_name, inputs, unlist, file_vs, std_vs, parallel): """Create an output record by rearranging inputs. Batching processes create records that reformat the inputs for parallelization. """ if field_defs: fields = [] inherit = [] inherit_a...
python
def _create_record(name, field_defs, step_name, inputs, unlist, file_vs, std_vs, parallel): """Create an output record by rearranging inputs. Batching processes create records that reformat the inputs for parallelization. """ if field_defs: fields = [] inherit = [] inherit_a...
[ "def", "_create_record", "(", "name", ",", "field_defs", ",", "step_name", ",", "inputs", ",", "unlist", ",", "file_vs", ",", "std_vs", ",", "parallel", ")", ":", "if", "field_defs", ":", "fields", "=", "[", "]", "inherit", "=", "[", "]", "inherit_all", ...
Create an output record by rearranging inputs. Batching processes create records that reformat the inputs for parallelization.
[ "Create", "an", "output", "record", "by", "rearranging", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L348-L382
223,411
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_infer_record_outputs
def _infer_record_outputs(inputs, unlist, file_vs, std_vs, parallel, to_include=None, exclude=None): """Infer the outputs of a record from the original inputs """ fields = [] unlist = set([_get_string_vid(x) for x in unlist]) input_vids = set([_get_string_vid(v) for v in _h...
python
def _infer_record_outputs(inputs, unlist, file_vs, std_vs, parallel, to_include=None, exclude=None): """Infer the outputs of a record from the original inputs """ fields = [] unlist = set([_get_string_vid(x) for x in unlist]) input_vids = set([_get_string_vid(v) for v in _h...
[ "def", "_infer_record_outputs", "(", "inputs", ",", "unlist", ",", "file_vs", ",", "std_vs", ",", "parallel", ",", "to_include", "=", "None", ",", "exclude", "=", "None", ")", ":", "fields", "=", "[", "]", "unlist", "=", "set", "(", "[", "_get_string_vid...
Infer the outputs of a record from the original inputs
[ "Infer", "the", "outputs", "of", "a", "record", "from", "the", "original", "inputs" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L390-L419
223,412
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_create_variable
def _create_variable(orig_v, step, variables): """Create a new output variable, potentially over-writing existing or creating new. """ # get current variable, and convert to be the output of our process step try: v = _get_variable(orig_v["id"], variables) except ValueError: v = copy....
python
def _create_variable(orig_v, step, variables): """Create a new output variable, potentially over-writing existing or creating new. """ # get current variable, and convert to be the output of our process step try: v = _get_variable(orig_v["id"], variables) except ValueError: v = copy....
[ "def", "_create_variable", "(", "orig_v", ",", "step", ",", "variables", ")", ":", "# get current variable, and convert to be the output of our process step", "try", ":", "v", "=", "_get_variable", "(", "orig_v", "[", "\"id\"", "]", ",", "variables", ")", "except", ...
Create a new output variable, potentially over-writing existing or creating new.
[ "Create", "a", "new", "output", "variable", "potentially", "over", "-", "writing", "existing", "or", "creating", "new", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L421-L437
223,413
bcbio/bcbio-nextgen
bcbio/cwl/workflow.py
_merge_variables
def _merge_variables(new, cur): """Add any new variables to the world representation in cur. Replaces any variables adjusted by previous steps. """ new_added = set([]) out = [] for cur_var in cur: updated = False for new_var in new: if get_base_id(new_var["id"]) == g...
python
def _merge_variables(new, cur): """Add any new variables to the world representation in cur. Replaces any variables adjusted by previous steps. """ new_added = set([]) out = [] for cur_var in cur: updated = False for new_var in new: if get_base_id(new_var["id"]) == g...
[ "def", "_merge_variables", "(", "new", ",", "cur", ")", ":", "new_added", "=", "set", "(", "[", "]", ")", "out", "=", "[", "]", "for", "cur_var", "in", "cur", ":", "updated", "=", "False", "for", "new_var", "in", "new", ":", "if", "get_base_id", "(...
Add any new variables to the world representation in cur. Replaces any variables adjusted by previous steps.
[ "Add", "any", "new", "variables", "to", "the", "world", "representation", "in", "cur", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/workflow.py#L439-L459
223,414
bcbio/bcbio-nextgen
bcbio/pipeline/disambiguate/__init__.py
split
def split(*items): """Split samples into all possible genomes for alignment. """ out = [] for data in [x[0] for x in items]: dis_orgs = data["config"]["algorithm"].get("disambiguate") if dis_orgs: if not data.get("disambiguate", None): data["disambiguate"] = {...
python
def split(*items): """Split samples into all possible genomes for alignment. """ out = [] for data in [x[0] for x in items]: dis_orgs = data["config"]["algorithm"].get("disambiguate") if dis_orgs: if not data.get("disambiguate", None): data["disambiguate"] = {...
[ "def", "split", "(", "*", "items", ")", ":", "out", "=", "[", "]", "for", "data", "in", "[", "x", "[", "0", "]", "for", "x", "in", "items", "]", ":", "dis_orgs", "=", "data", "[", "\"config\"", "]", "[", "\"algorithm\"", "]", ".", "get", "(", ...
Split samples into all possible genomes for alignment.
[ "Split", "samples", "into", "all", "possible", "genomes", "for", "alignment", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L28-L51
223,415
bcbio/bcbio-nextgen
bcbio/pipeline/disambiguate/__init__.py
resolve
def resolve(items, run_parallel): """Combine aligned and split samples into final set of disambiguated reads. """ out = [] to_process = collections.defaultdict(list) for data in [x[0] for x in items]: if "disambiguate" in data: split_part = tuple([int(x) for x in data["align_spli...
python
def resolve(items, run_parallel): """Combine aligned and split samples into final set of disambiguated reads. """ out = [] to_process = collections.defaultdict(list) for data in [x[0] for x in items]: if "disambiguate" in data: split_part = tuple([int(x) for x in data["align_spli...
[ "def", "resolve", "(", "items", ",", "run_parallel", ")", ":", "out", "=", "[", "]", "to_process", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "data", "in", "[", "x", "[", "0", "]", "for", "x", "in", "items", "]", ":", "if", ...
Combine aligned and split samples into final set of disambiguated reads.
[ "Combine", "aligned", "and", "split", "samples", "into", "final", "set", "of", "disambiguated", "reads", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L53-L77
223,416
bcbio/bcbio-nextgen
bcbio/pipeline/disambiguate/__init__.py
merge_extras
def merge_extras(items, config): """Merge extra disambiguated reads into a final BAM file. """ final = {} for extra_name in items[0]["disambiguate"].keys(): in_files = [] for data in items: in_files.append(data["disambiguate"][extra_name]) out_file = "%s-allmerged%s" ...
python
def merge_extras(items, config): """Merge extra disambiguated reads into a final BAM file. """ final = {} for extra_name in items[0]["disambiguate"].keys(): in_files = [] for data in items: in_files.append(data["disambiguate"][extra_name]) out_file = "%s-allmerged%s" ...
[ "def", "merge_extras", "(", "items", ",", "config", ")", ":", "final", "=", "{", "}", "for", "extra_name", "in", "items", "[", "0", "]", "[", "\"disambiguate\"", "]", ".", "keys", "(", ")", ":", "in_files", "=", "[", "]", "for", "data", "in", "item...
Merge extra disambiguated reads into a final BAM file.
[ "Merge", "extra", "disambiguated", "reads", "into", "a", "final", "BAM", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L79-L99
223,417
bcbio/bcbio-nextgen
bcbio/pipeline/disambiguate/__init__.py
_merge_summary
def _merge_summary(in_files, out_file, data): """Create one big summary file for disambiguation from multiple splits. """ if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_file: with open(tx_out_file, "w") as out_handle: for i, in_file in...
python
def _merge_summary(in_files, out_file, data): """Create one big summary file for disambiguation from multiple splits. """ if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_file: with open(tx_out_file, "w") as out_handle: for i, in_file in...
[ "def", "_merge_summary", "(", "in_files", ",", "out_file", ",", "data", ")", ":", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "with", "file_transaction", "(", "data", ",", "out_file", ")", "as", "tx_out_file", ":", "with", "open", ...
Create one big summary file for disambiguation from multiple splits.
[ "Create", "one", "big", "summary", "file", "for", "disambiguation", "from", "multiple", "splits", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L101-L115
223,418
bcbio/bcbio-nextgen
bcbio/pipeline/disambiguate/__init__.py
_run_python
def _run_python(work_bam_a, work_bam_b, out_dir, aligner, prefix, items): """Run python version of disambiguation """ Args = collections.namedtuple("Args", "A B output_dir intermediate_dir " "no_sort prefix aligner") args = Args(work_bam_a, work_bam_b, out_dir, out_di...
python
def _run_python(work_bam_a, work_bam_b, out_dir, aligner, prefix, items): """Run python version of disambiguation """ Args = collections.namedtuple("Args", "A B output_dir intermediate_dir " "no_sort prefix aligner") args = Args(work_bam_a, work_bam_b, out_dir, out_di...
[ "def", "_run_python", "(", "work_bam_a", ",", "work_bam_b", ",", "out_dir", ",", "aligner", ",", "prefix", ",", "items", ")", ":", "Args", "=", "collections", ".", "namedtuple", "(", "\"Args\"", ",", "\"A B output_dir intermediate_dir \"", "\"no_sort prefix aligner\...
Run python version of disambiguation
[ "Run", "python", "version", "of", "disambiguation" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/disambiguate/__init__.py#L153-L159
223,419
bcbio/bcbio-nextgen
bcbio/cwl/main.py
run
def run(args): """Run a CWL preparation pipeline. """ dirs, config, run_info_yaml = run_info.prep_system(args.sample_config, args.systemconfig) integrations = args.integrations if hasattr(args, "integrations") else {} world = run_info.organize(dirs, config, run_info_yaml, is_cwl=True, integrations=i...
python
def run(args): """Run a CWL preparation pipeline. """ dirs, config, run_info_yaml = run_info.prep_system(args.sample_config, args.systemconfig) integrations = args.integrations if hasattr(args, "integrations") else {} world = run_info.organize(dirs, config, run_info_yaml, is_cwl=True, integrations=i...
[ "def", "run", "(", "args", ")", ":", "dirs", ",", "config", ",", "run_info_yaml", "=", "run_info", ".", "prep_system", "(", "args", ".", "sample_config", ",", "args", ".", "systemconfig", ")", "integrations", "=", "args", ".", "integrations", "if", "hasatt...
Run a CWL preparation pipeline.
[ "Run", "a", "CWL", "preparation", "pipeline", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/main.py#L6-L12
223,420
bcbio/bcbio-nextgen
bcbio/variation/coverage.py
assign_interval
def assign_interval(data): """Identify coverage based on percent of genome covered and relation to targets. Classifies coverage into 3 categories: - genome: Full genome coverage - regional: Regional coverage, like exome capture, with off-target reads - amplicon: Amplication based regional cov...
python
def assign_interval(data): """Identify coverage based on percent of genome covered and relation to targets. Classifies coverage into 3 categories: - genome: Full genome coverage - regional: Regional coverage, like exome capture, with off-target reads - amplicon: Amplication based regional cov...
[ "def", "assign_interval", "(", "data", ")", ":", "if", "not", "dd", ".", "get_coverage_interval", "(", "data", ")", ":", "vrs", "=", "dd", ".", "get_variant_regions_merged", "(", "data", ")", "callable_file", "=", "dd", ".", "get_sample_callable", "(", "data...
Identify coverage based on percent of genome covered and relation to targets. Classifies coverage into 3 categories: - genome: Full genome coverage - regional: Regional coverage, like exome capture, with off-target reads - amplicon: Amplication based regional coverage without off-target reads
[ "Identify", "coverage", "based", "on", "percent", "of", "genome", "covered", "and", "relation", "to", "targets", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L29-L62
223,421
bcbio/bcbio-nextgen
bcbio/variation/coverage.py
calculate
def calculate(bam_file, data, sv_bed): """Calculate coverage in parallel using mosdepth. Removes duplicates and secondary reads from the counts: if ( b->core.flag & (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) ) continue; """ params = {"min": dd.get_coverage_depth_min(data)} variant_r...
python
def calculate(bam_file, data, sv_bed): """Calculate coverage in parallel using mosdepth. Removes duplicates and secondary reads from the counts: if ( b->core.flag & (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) ) continue; """ params = {"min": dd.get_coverage_depth_min(data)} variant_r...
[ "def", "calculate", "(", "bam_file", ",", "data", ",", "sv_bed", ")", ":", "params", "=", "{", "\"min\"", ":", "dd", ".", "get_coverage_depth_min", "(", "data", ")", "}", "variant_regions", "=", "dd", ".", "get_variant_regions_merged", "(", "data", ")", "i...
Calculate coverage in parallel using mosdepth. Removes duplicates and secondary reads from the counts: if ( b->core.flag & (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) ) continue;
[ "Calculate", "coverage", "in", "parallel", "using", "mosdepth", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L73-L111
223,422
bcbio/bcbio-nextgen
bcbio/variation/coverage.py
_create_genome_regions
def _create_genome_regions(data): """Create whole genome contigs we want to process, only non-alts. Skips problem contigs like HLAs for downstream analysis. """ work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "coverage", dd.get_sample_name(data))) variant_regions = os.path.join(wo...
python
def _create_genome_regions(data): """Create whole genome contigs we want to process, only non-alts. Skips problem contigs like HLAs for downstream analysis. """ work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "coverage", dd.get_sample_name(data))) variant_regions = os.path.join(wo...
[ "def", "_create_genome_regions", "(", "data", ")", ":", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "dd", ".", "get_work_dir", "(", "data", ")", ",", "\"coverage\"", ",", "dd", ".", "get_sample_name", "(", "da...
Create whole genome contigs we want to process, only non-alts. Skips problem contigs like HLAs for downstream analysis.
[ "Create", "whole", "genome", "contigs", "we", "want", "to", "process", "only", "non", "-", "alts", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L113-L124
223,423
bcbio/bcbio-nextgen
bcbio/variation/coverage.py
_subset_to_variant_regions
def _subset_to_variant_regions(callable_file, variant_regions, data): """Subset output callable file to only variant regions of interest. """ out_file = "%s-vrsubset.bed" % utils.splitext_plus(callable_file)[0] if not utils.file_uptodate(out_file, callable_file): with file_transaction(data, out_...
python
def _subset_to_variant_regions(callable_file, variant_regions, data): """Subset output callable file to only variant regions of interest. """ out_file = "%s-vrsubset.bed" % utils.splitext_plus(callable_file)[0] if not utils.file_uptodate(out_file, callable_file): with file_transaction(data, out_...
[ "def", "_subset_to_variant_regions", "(", "callable_file", ",", "variant_regions", ",", "data", ")", ":", "out_file", "=", "\"%s-vrsubset.bed\"", "%", "utils", ".", "splitext_plus", "(", "callable_file", ")", "[", "0", "]", "if", "not", "utils", ".", "file_uptod...
Subset output callable file to only variant regions of interest.
[ "Subset", "output", "callable", "file", "to", "only", "variant", "regions", "of", "interest", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L126-L134
223,424
bcbio/bcbio-nextgen
bcbio/variation/coverage.py
_average_genome_coverage
def _average_genome_coverage(data, bam_file): """Quickly calculate average coverage for whole genome files using indices. Includes all reads, with duplicates. Uses sampling of 10M reads. """ total = sum([c.size for c in ref.file_contigs(dd.get_ref_file(data), data["config"])]) read_counts = sum(x.a...
python
def _average_genome_coverage(data, bam_file): """Quickly calculate average coverage for whole genome files using indices. Includes all reads, with duplicates. Uses sampling of 10M reads. """ total = sum([c.size for c in ref.file_contigs(dd.get_ref_file(data), data["config"])]) read_counts = sum(x.a...
[ "def", "_average_genome_coverage", "(", "data", ",", "bam_file", ")", ":", "total", "=", "sum", "(", "[", "c", ".", "size", "for", "c", "in", "ref", ".", "file_contigs", "(", "dd", ".", "get_ref_file", "(", "data", ")", ",", "data", "[", "\"config\"", ...
Quickly calculate average coverage for whole genome files using indices. Includes all reads, with duplicates. Uses sampling of 10M reads.
[ "Quickly", "calculate", "average", "coverage", "for", "whole", "genome", "files", "using", "indices", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L171-L181
223,425
bcbio/bcbio-nextgen
bcbio/variation/coverage.py
regions_coverage
def regions_coverage(bed_file, target_name, data): """Generate coverage over regions of interest using mosdepth. """ ready_bed = tz.get_in(["depth", target_name, "regions"], data) if ready_bed: return ready_bed else: return run_mosdepth(data, target_name, bed_file).regions
python
def regions_coverage(bed_file, target_name, data): """Generate coverage over regions of interest using mosdepth. """ ready_bed = tz.get_in(["depth", target_name, "regions"], data) if ready_bed: return ready_bed else: return run_mosdepth(data, target_name, bed_file).regions
[ "def", "regions_coverage", "(", "bed_file", ",", "target_name", ",", "data", ")", ":", "ready_bed", "=", "tz", ".", "get_in", "(", "[", "\"depth\"", ",", "target_name", ",", "\"regions\"", "]", ",", "data", ")", "if", "ready_bed", ":", "return", "ready_bed...
Generate coverage over regions of interest using mosdepth.
[ "Generate", "coverage", "over", "regions", "of", "interest", "using", "mosdepth", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L197-L204
223,426
bcbio/bcbio-nextgen
bcbio/variation/coverage.py
coverage_region_detailed_stats
def coverage_region_detailed_stats(target_name, bed_file, data, out_dir): """ Calculate coverage at different completeness cutoff for region in coverage option. """ if bed_file and utils.file_exists(bed_file): ready_depth = tz.get_in(["depth", target_name], data) if ready_depth: ...
python
def coverage_region_detailed_stats(target_name, bed_file, data, out_dir): """ Calculate coverage at different completeness cutoff for region in coverage option. """ if bed_file and utils.file_exists(bed_file): ready_depth = tz.get_in(["depth", target_name], data) if ready_depth: ...
[ "def", "coverage_region_detailed_stats", "(", "target_name", ",", "bed_file", ",", "data", ",", "out_dir", ")", ":", "if", "bed_file", "and", "utils", ".", "file_exists", "(", "bed_file", ")", ":", "ready_depth", "=", "tz", ".", "get_in", "(", "[", "\"depth\...
Calculate coverage at different completeness cutoff for region in coverage option.
[ "Calculate", "coverage", "at", "different", "completeness", "cutoff", "for", "region", "in", "coverage", "option", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/coverage.py#L249-L269
223,427
bcbio/bcbio-nextgen
bcbio/heterogeneity/loh.py
get_coords
def get_coords(data): """Retrieve coordinates of genes of interest for prioritization. Can read from CIViC input data or a supplied BED file of chrom, start, end and gene information. """ for category, vtypes in [("LOH", {"LOSS", "HETEROZYGOSITY"}), ("amplification", {"...
python
def get_coords(data): """Retrieve coordinates of genes of interest for prioritization. Can read from CIViC input data or a supplied BED file of chrom, start, end and gene information. """ for category, vtypes in [("LOH", {"LOSS", "HETEROZYGOSITY"}), ("amplification", {"...
[ "def", "get_coords", "(", "data", ")", ":", "for", "category", ",", "vtypes", "in", "[", "(", "\"LOH\"", ",", "{", "\"LOSS\"", ",", "\"HETEROZYGOSITY\"", "}", ")", ",", "(", "\"amplification\"", ",", "{", "\"AMPLIFICATION\"", "}", ")", "]", ":", "out", ...
Retrieve coordinates of genes of interest for prioritization. Can read from CIViC input data or a supplied BED file of chrom, start, end and gene information.
[ "Retrieve", "coordinates", "of", "genes", "of", "interest", "for", "prioritization", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L29-L49
223,428
bcbio/bcbio-nextgen
bcbio/heterogeneity/loh.py
_civic_regions
def _civic_regions(civic_file, variant_types=None, diseases=None, drugs=None): """Retrieve gene regions and names filtered by variant_types and diseases. """ if isinstance(diseases, six.string_types): diseases = [diseases] with utils.open_gzipsafe(civic_file) as in_handle: reader = csv.r...
python
def _civic_regions(civic_file, variant_types=None, diseases=None, drugs=None): """Retrieve gene regions and names filtered by variant_types and diseases. """ if isinstance(diseases, six.string_types): diseases = [diseases] with utils.open_gzipsafe(civic_file) as in_handle: reader = csv.r...
[ "def", "_civic_regions", "(", "civic_file", ",", "variant_types", "=", "None", ",", "diseases", "=", "None", ",", "drugs", "=", "None", ")", ":", "if", "isinstance", "(", "diseases", ",", "six", ".", "string_types", ")", ":", "diseases", "=", "[", "disea...
Retrieve gene regions and names filtered by variant_types and diseases.
[ "Retrieve", "gene", "regions", "and", "names", "filtered", "by", "variant_types", "and", "diseases", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L58-L70
223,429
bcbio/bcbio-nextgen
bcbio/heterogeneity/loh.py
summary_status
def summary_status(call, data): """Retrieve status in regions of interest, along with heterogeneity metrics. Provides output with overall purity and ploidy, along with region specific calls. """ out_file = None if call.get("vrn_file") and os.path.exists(call.get("vrn_file")): out_file =...
python
def summary_status(call, data): """Retrieve status in regions of interest, along with heterogeneity metrics. Provides output with overall purity and ploidy, along with region specific calls. """ out_file = None if call.get("vrn_file") and os.path.exists(call.get("vrn_file")): out_file =...
[ "def", "summary_status", "(", "call", ",", "data", ")", ":", "out_file", "=", "None", "if", "call", ".", "get", "(", "\"vrn_file\"", ")", "and", "os", ".", "path", ".", "exists", "(", "call", ".", "get", "(", "\"vrn_file\"", ")", ")", ":", "out_file"...
Retrieve status in regions of interest, along with heterogeneity metrics. Provides output with overall purity and ploidy, along with region specific calls.
[ "Retrieve", "status", "in", "regions", "of", "interest", "along", "with", "heterogeneity", "metrics", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L72-L95
223,430
bcbio/bcbio-nextgen
bcbio/heterogeneity/loh.py
_check_copy_number_changes
def _check_copy_number_changes(svtype, cn, minor_cn, data): """Check if copy number changes match the expected svtype. """ if svtype == "LOH" and minor_cn == 0: return svtype elif svtype == "amplification" and cn > dd.get_ploidy(data): return svtype else: return "std"
python
def _check_copy_number_changes(svtype, cn, minor_cn, data): """Check if copy number changes match the expected svtype. """ if svtype == "LOH" and minor_cn == 0: return svtype elif svtype == "amplification" and cn > dd.get_ploidy(data): return svtype else: return "std"
[ "def", "_check_copy_number_changes", "(", "svtype", ",", "cn", ",", "minor_cn", ",", "data", ")", ":", "if", "svtype", "==", "\"LOH\"", "and", "minor_cn", "==", "0", ":", "return", "svtype", "elif", "svtype", "==", "\"amplification\"", "and", "cn", ">", "d...
Check if copy number changes match the expected svtype.
[ "Check", "if", "copy", "number", "changes", "match", "the", "expected", "svtype", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L97-L105
223,431
bcbio/bcbio-nextgen
bcbio/heterogeneity/loh.py
_titancna_summary
def _titancna_summary(call, data): """Summarize purity, ploidy and LOH for TitanCNA. """ out = {} for svtype, coords in get_coords(data): cur_calls = {k: collections.defaultdict(int) for k in coords.keys()} with open(call["subclones"]) as in_handle: header = in_handle.readlin...
python
def _titancna_summary(call, data): """Summarize purity, ploidy and LOH for TitanCNA. """ out = {} for svtype, coords in get_coords(data): cur_calls = {k: collections.defaultdict(int) for k in coords.keys()} with open(call["subclones"]) as in_handle: header = in_handle.readlin...
[ "def", "_titancna_summary", "(", "call", ",", "data", ")", ":", "out", "=", "{", "}", "for", "svtype", ",", "coords", "in", "get_coords", "(", "data", ")", ":", "cur_calls", "=", "{", "k", ":", "collections", ".", "defaultdict", "(", "int", ")", "for...
Summarize purity, ploidy and LOH for TitanCNA.
[ "Summarize", "purity", "ploidy", "and", "LOH", "for", "TitanCNA", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L110-L132
223,432
bcbio/bcbio-nextgen
bcbio/heterogeneity/loh.py
_purecn_summary
def _purecn_summary(call, data): """Summarize purity, ploidy and LOH for PureCN. """ out = {} for svtype, coords in get_coords(data): cur_calls = {k: collections.defaultdict(int) for k in coords.keys()} with open(call["loh"]) as in_handle: in_handle.readline() # header ...
python
def _purecn_summary(call, data): """Summarize purity, ploidy and LOH for PureCN. """ out = {} for svtype, coords in get_coords(data): cur_calls = {k: collections.defaultdict(int) for k in coords.keys()} with open(call["loh"]) as in_handle: in_handle.readline() # header ...
[ "def", "_purecn_summary", "(", "call", ",", "data", ")", ":", "out", "=", "{", "}", "for", "svtype", ",", "coords", "in", "get_coords", "(", "data", ")", ":", "cur_calls", "=", "{", "k", ":", "collections", ".", "defaultdict", "(", "int", ")", "for",...
Summarize purity, ploidy and LOH for PureCN.
[ "Summarize", "purity", "ploidy", "and", "LOH", "for", "PureCN", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/loh.py#L134-L155
223,433
bcbio/bcbio-nextgen
scripts/utils/plink_to_vcf.py
fix_vcf_line
def fix_vcf_line(parts, ref_base): """Orient VCF allele calls with respect to reference base. Handles cases with ref and variant swaps. strand complements. """ swap = {"1/1": "0/0", "0/1": "0/1", "0/0": "1/1", "./.": "./."} complements = {"G": "C", "A": "T", "C": "G", "T": "A", "N": "N"} varinf...
python
def fix_vcf_line(parts, ref_base): """Orient VCF allele calls with respect to reference base. Handles cases with ref and variant swaps. strand complements. """ swap = {"1/1": "0/0", "0/1": "0/1", "0/0": "1/1", "./.": "./."} complements = {"G": "C", "A": "T", "C": "G", "T": "A", "N": "N"} varinf...
[ "def", "fix_vcf_line", "(", "parts", ",", "ref_base", ")", ":", "swap", "=", "{", "\"1/1\"", ":", "\"0/0\"", ",", "\"0/1\"", ":", "\"0/1\"", ",", "\"0/0\"", ":", "\"1/1\"", ",", "\"./.\"", ":", "\"./.\"", "}", "complements", "=", "{", "\"G\"", ":", "\"...
Orient VCF allele calls with respect to reference base. Handles cases with ref and variant swaps. strand complements.
[ "Orient", "VCF", "allele", "calls", "with", "respect", "to", "reference", "base", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/plink_to_vcf.py#L79-L117
223,434
bcbio/bcbio-nextgen
scripts/utils/plink_to_vcf.py
fix_nonref_positions
def fix_nonref_positions(in_file, ref_file): """Fix Genotyping VCF positions where the bases are all variants. The plink/pseq output does not handle these correctly, and has all reference/variant bases reversed. """ ignore_chrs = ["."] ref2bit = twobit.TwoBitFile(open(ref_file)) out_file = ...
python
def fix_nonref_positions(in_file, ref_file): """Fix Genotyping VCF positions where the bases are all variants. The plink/pseq output does not handle these correctly, and has all reference/variant bases reversed. """ ignore_chrs = ["."] ref2bit = twobit.TwoBitFile(open(ref_file)) out_file = ...
[ "def", "fix_nonref_positions", "(", "in_file", ",", "ref_file", ")", ":", "ignore_chrs", "=", "[", "\".\"", "]", "ref2bit", "=", "twobit", ".", "TwoBitFile", "(", "open", "(", "ref_file", ")", ")", "out_file", "=", "in_file", ".", "replace", "(", "\"-raw.v...
Fix Genotyping VCF positions where the bases are all variants. The plink/pseq output does not handle these correctly, and has all reference/variant bases reversed.
[ "Fix", "Genotyping", "VCF", "positions", "where", "the", "bases", "are", "all", "variants", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/plink_to_vcf.py#L119-L154
223,435
bcbio/bcbio-nextgen
bcbio/structural/cn_mops.py
run
def run(items, background=None): """Detect copy number variations from batched set of samples using cn.mops. """ if not background: background = [] names = [tz.get_in(["rgnames", "sample"], x) for x in items + background] work_bams = [x["align_bam"] for x in items + background] if len(items + ba...
python
def run(items, background=None): """Detect copy number variations from batched set of samples using cn.mops. """ if not background: background = [] names = [tz.get_in(["rgnames", "sample"], x) for x in items + background] work_bams = [x["align_bam"] for x in items + background] if len(items + ba...
[ "def", "run", "(", "items", ",", "background", "=", "None", ")", ":", "if", "not", "background", ":", "background", "=", "[", "]", "names", "=", "[", "tz", ".", "get_in", "(", "[", "\"rgnames\"", ",", "\"sample\"", "]", ",", "x", ")", "for", "x", ...
Detect copy number variations from batched set of samples using cn.mops.
[ "Detect", "copy", "number", "variations", "from", "batched", "set", "of", "samples", "using", "cn", ".", "mops", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L22-L48
223,436
bcbio/bcbio-nextgen
bcbio/structural/cn_mops.py
_combine_out_files
def _combine_out_files(chr_files, work_dir, data): """Concatenate all CNV calls into a single file. """ out_file = "%s.bed" % sshared.outname_from_inputs(chr_files) if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_file: with open(tx_out_file, "w") a...
python
def _combine_out_files(chr_files, work_dir, data): """Concatenate all CNV calls into a single file. """ out_file = "%s.bed" % sshared.outname_from_inputs(chr_files) if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_file: with open(tx_out_file, "w") a...
[ "def", "_combine_out_files", "(", "chr_files", ",", "work_dir", ",", "data", ")", ":", "out_file", "=", "\"%s.bed\"", "%", "sshared", ".", "outname_from_inputs", "(", "chr_files", ")", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "wit...
Concatenate all CNV calls into a single file.
[ "Concatenate", "all", "CNV", "calls", "into", "a", "single", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L50-L63
223,437
bcbio/bcbio-nextgen
bcbio/structural/cn_mops.py
_prep_sample_cnvs
def _prep_sample_cnvs(cnv_file, data): """Convert a multiple sample CNV file into a single BED file for a sample. Handles matching and fixing names where R converts numerical IDs (1234) into strings by adding an X (X1234), and converts other characters into '.'s. http://stat.ethz.ch/R-manual/R-devel/li...
python
def _prep_sample_cnvs(cnv_file, data): """Convert a multiple sample CNV file into a single BED file for a sample. Handles matching and fixing names where R converts numerical IDs (1234) into strings by adding an X (X1234), and converts other characters into '.'s. http://stat.ethz.ch/R-manual/R-devel/li...
[ "def", "_prep_sample_cnvs", "(", "cnv_file", ",", "data", ")", ":", "import", "pybedtools", "sample_name", "=", "tz", ".", "get_in", "(", "[", "\"rgnames\"", ",", "\"sample\"", "]", ",", "data", ")", "def", "make_names", "(", "name", ")", ":", "return", ...
Convert a multiple sample CNV file into a single BED file for a sample. Handles matching and fixing names where R converts numerical IDs (1234) into strings by adding an X (X1234), and converts other characters into '.'s. http://stat.ethz.ch/R-manual/R-devel/library/base/html/make.names.html
[ "Convert", "a", "multiple", "sample", "CNV", "file", "into", "a", "single", "BED", "file", "for", "a", "sample", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L65-L87
223,438
bcbio/bcbio-nextgen
bcbio/structural/cn_mops.py
_run_on_chrom
def _run_on_chrom(chrom, work_bams, names, work_dir, items): """Run cn.mops on work BAMs for a specific chromosome. """ local_sitelib = utils.R_sitelib() batch = sshared.get_cur_batch(items) ext = "-%s-cnv" % batch if batch else "-cnv" out_file = os.path.join(work_dir, "%s%s-%s.bed" % (os.path.s...
python
def _run_on_chrom(chrom, work_bams, names, work_dir, items): """Run cn.mops on work BAMs for a specific chromosome. """ local_sitelib = utils.R_sitelib() batch = sshared.get_cur_batch(items) ext = "-%s-cnv" % batch if batch else "-cnv" out_file = os.path.join(work_dir, "%s%s-%s.bed" % (os.path.s...
[ "def", "_run_on_chrom", "(", "chrom", ",", "work_bams", ",", "names", ",", "work_dir", ",", "items", ")", ":", "local_sitelib", "=", "utils", ".", "R_sitelib", "(", ")", "batch", "=", "sshared", ".", "get_cur_batch", "(", "items", ")", "ext", "=", "\"-%s...
Run cn.mops on work BAMs for a specific chromosome.
[ "Run", "cn", ".", "mops", "on", "work", "BAMs", "for", "a", "specific", "chromosome", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L91-L117
223,439
bcbio/bcbio-nextgen
bcbio/structural/cn_mops.py
_get_regional_bed_file
def _get_regional_bed_file(data): """If we are running a non-genome analysis, pull the regional file for analysis. """ variant_regions = bedutils.merge_overlaps(tz.get_in(["config", "algorithm", "variant_regions"], data), data) is_genome = data["config"]["al...
python
def _get_regional_bed_file(data): """If we are running a non-genome analysis, pull the regional file for analysis. """ variant_regions = bedutils.merge_overlaps(tz.get_in(["config", "algorithm", "variant_regions"], data), data) is_genome = data["config"]["al...
[ "def", "_get_regional_bed_file", "(", "data", ")", ":", "variant_regions", "=", "bedutils", ".", "merge_overlaps", "(", "tz", ".", "get_in", "(", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"variant_regions\"", "]", ",", "data", ")", ",", "data", ")", "i...
If we are running a non-genome analysis, pull the regional file for analysis.
[ "If", "we", "are", "running", "a", "non", "-", "genome", "analysis", "pull", "the", "regional", "file", "for", "analysis", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L134-L141
223,440
bcbio/bcbio-nextgen
bcbio/structural/cn_mops.py
_population_load_script
def _population_load_script(work_bams, names, chrom, pairmode, items): """Prepare BAMs for assessing CNVs in a population. """ bed_file = _get_regional_bed_file(items[0]) if bed_file: return _population_prep_targeted.format(bam_file_str=",".join(work_bams), names_str=",".join(names), ...
python
def _population_load_script(work_bams, names, chrom, pairmode, items): """Prepare BAMs for assessing CNVs in a population. """ bed_file = _get_regional_bed_file(items[0]) if bed_file: return _population_prep_targeted.format(bam_file_str=",".join(work_bams), names_str=",".join(names), ...
[ "def", "_population_load_script", "(", "work_bams", ",", "names", ",", "chrom", ",", "pairmode", ",", "items", ")", ":", "bed_file", "=", "_get_regional_bed_file", "(", "items", "[", "0", "]", ")", "if", "bed_file", ":", "return", "_population_prep_targeted", ...
Prepare BAMs for assessing CNVs in a population.
[ "Prepare", "BAMs", "for", "assessing", "CNVs", "in", "a", "population", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cn_mops.py#L143-L152
223,441
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
tobam_cl
def tobam_cl(data, out_file, is_paired=False): """Prepare command line for producing de-duplicated sorted output. - If no deduplication, sort and prepare a BAM file. - If paired, then use samblaster and prepare discordant outputs. - If unpaired, use biobambam's bammarkduplicates """ do_dedup = ...
python
def tobam_cl(data, out_file, is_paired=False): """Prepare command line for producing de-duplicated sorted output. - If no deduplication, sort and prepare a BAM file. - If paired, then use samblaster and prepare discordant outputs. - If unpaired, use biobambam's bammarkduplicates """ do_dedup = ...
[ "def", "tobam_cl", "(", "data", ",", "out_file", ",", "is_paired", "=", "False", ")", ":", "do_dedup", "=", "_check_dedup", "(", "data", ")", "umi_consensus", "=", "dd", ".", "get_umi_consensus", "(", "data", ")", "with", "file_transaction", "(", "data", "...
Prepare command line for producing de-duplicated sorted output. - If no deduplication, sort and prepare a BAM file. - If paired, then use samblaster and prepare discordant outputs. - If unpaired, use biobambam's bammarkduplicates
[ "Prepare", "command", "line", "for", "producing", "de", "-", "duplicated", "sorted", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L30-L52
223,442
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
_get_cores_memory
def _get_cores_memory(data, downscale=2): """Retrieve cores and memory, using samtools as baseline. For memory, scaling down because we share with alignment and de-duplication. """ resources = config_utils.get_resources("samtools", data["config"]) num_cores = data["config"]["algorithm"].get("num_co...
python
def _get_cores_memory(data, downscale=2): """Retrieve cores and memory, using samtools as baseline. For memory, scaling down because we share with alignment and de-duplication. """ resources = config_utils.get_resources("samtools", data["config"]) num_cores = data["config"]["algorithm"].get("num_co...
[ "def", "_get_cores_memory", "(", "data", ",", "downscale", "=", "2", ")", ":", "resources", "=", "config_utils", ".", "get_resources", "(", "\"samtools\"", ",", "data", "[", "\"config\"", "]", ")", "num_cores", "=", "data", "[", "\"config\"", "]", "[", "\"...
Retrieve cores and memory, using samtools as baseline. For memory, scaling down because we share with alignment and de-duplication.
[ "Retrieve", "cores", "and", "memory", "using", "samtools", "as", "baseline", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L69-L78
223,443
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
sam_to_sortbam_cl
def sam_to_sortbam_cl(data, tx_out_file, name_sort=False): """Convert to sorted BAM output. Set name_sort to True to sort reads by queryname """ samtools = config_utils.get_program("samtools", data["config"]) cores, mem = _get_cores_memory(data, downscale=2) tmp_file = "%s-sorttmp" % utils.spli...
python
def sam_to_sortbam_cl(data, tx_out_file, name_sort=False): """Convert to sorted BAM output. Set name_sort to True to sort reads by queryname """ samtools = config_utils.get_program("samtools", data["config"]) cores, mem = _get_cores_memory(data, downscale=2) tmp_file = "%s-sorttmp" % utils.spli...
[ "def", "sam_to_sortbam_cl", "(", "data", ",", "tx_out_file", ",", "name_sort", "=", "False", ")", ":", "samtools", "=", "config_utils", ".", "get_program", "(", "\"samtools\"", ",", "data", "[", "\"config\"", "]", ")", "cores", ",", "mem", "=", "_get_cores_m...
Convert to sorted BAM output. Set name_sort to True to sort reads by queryname
[ "Convert", "to", "sorted", "BAM", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L80-L90
223,444
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
samblaster_dedup_sort
def samblaster_dedup_sort(data, tx_out_file, tx_sr_file, tx_disc_file): """Deduplicate and sort with samblaster, produces split read and discordant pair files. """ samblaster = config_utils.get_program("samblaster", data["config"]) samtools = config_utils.get_program("samtools", data["config"]) tmp_...
python
def samblaster_dedup_sort(data, tx_out_file, tx_sr_file, tx_disc_file): """Deduplicate and sort with samblaster, produces split read and discordant pair files. """ samblaster = config_utils.get_program("samblaster", data["config"]) samtools = config_utils.get_program("samtools", data["config"]) tmp_...
[ "def", "samblaster_dedup_sort", "(", "data", ",", "tx_out_file", ",", "tx_sr_file", ",", "tx_disc_file", ")", ":", "samblaster", "=", "config_utils", ".", "get_program", "(", "\"samblaster\"", ",", "data", "[", "\"config\"", "]", ")", "samtools", "=", "config_ut...
Deduplicate and sort with samblaster, produces split read and discordant pair files.
[ "Deduplicate", "and", "sort", "with", "samblaster", "produces", "split", "read", "and", "discordant", "pair", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L92-L116
223,445
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
_biobambam_dedup_sort
def _biobambam_dedup_sort(data, tx_out_file): """Perform streaming deduplication and sorting with biobambam's bamsormadup """ samtools = config_utils.get_program("samtools", data["config"]) cores, mem = _get_cores_memory(data, downscale=2) tmp_file = "%s-sorttmp" % utils.splitext_plus(tx_out_file)[0...
python
def _biobambam_dedup_sort(data, tx_out_file): """Perform streaming deduplication and sorting with biobambam's bamsormadup """ samtools = config_utils.get_program("samtools", data["config"]) cores, mem = _get_cores_memory(data, downscale=2) tmp_file = "%s-sorttmp" % utils.splitext_plus(tx_out_file)[0...
[ "def", "_biobambam_dedup_sort", "(", "data", ",", "tx_out_file", ")", ":", "samtools", "=", "config_utils", ".", "get_program", "(", "\"samtools\"", ",", "data", "[", "\"config\"", "]", ")", "cores", ",", "mem", "=", "_get_cores_memory", "(", "data", ",", "d...
Perform streaming deduplication and sorting with biobambam's bamsormadup
[ "Perform", "streaming", "deduplication", "and", "sorting", "with", "biobambam", "s", "bamsormadup" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L118-L134
223,446
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
_sam_to_grouped_umi_cl
def _sam_to_grouped_umi_cl(data, umi_consensus, tx_out_file): """Mark duplicates on aligner output and convert to grouped UMIs by position. Works with either a separate umi_file or UMI embedded in the read names. """ tmp_file = "%s-sorttmp" % utils.splitext_plus(tx_out_file)[0] jvm_opts = _get_fgbi...
python
def _sam_to_grouped_umi_cl(data, umi_consensus, tx_out_file): """Mark duplicates on aligner output and convert to grouped UMIs by position. Works with either a separate umi_file or UMI embedded in the read names. """ tmp_file = "%s-sorttmp" % utils.splitext_plus(tx_out_file)[0] jvm_opts = _get_fgbi...
[ "def", "_sam_to_grouped_umi_cl", "(", "data", ",", "umi_consensus", ",", "tx_out_file", ")", ":", "tmp_file", "=", "\"%s-sorttmp\"", "%", "utils", ".", "splitext_plus", "(", "tx_out_file", ")", "[", "0", "]", "jvm_opts", "=", "_get_fgbio_jvm_opts", "(", "data", ...
Mark duplicates on aligner output and convert to grouped UMIs by position. Works with either a separate umi_file or UMI embedded in the read names.
[ "Mark", "duplicates", "on", "aligner", "output", "and", "convert", "to", "grouped", "UMIs", "by", "position", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L136-L155
223,447
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
umi_consensus
def umi_consensus(data): """Convert UMI grouped reads into fastq pair for re-alignment. """ align_bam = dd.get_work_bam(data) umi_method, umi_tag = _check_umi_type(align_bam) f1_out = "%s-cumi-1.fq.gz" % utils.splitext_plus(align_bam)[0] f2_out = "%s-cumi-2.fq.gz" % utils.splitext_plus(align_bam...
python
def umi_consensus(data): """Convert UMI grouped reads into fastq pair for re-alignment. """ align_bam = dd.get_work_bam(data) umi_method, umi_tag = _check_umi_type(align_bam) f1_out = "%s-cumi-1.fq.gz" % utils.splitext_plus(align_bam)[0] f2_out = "%s-cumi-2.fq.gz" % utils.splitext_plus(align_bam...
[ "def", "umi_consensus", "(", "data", ")", ":", "align_bam", "=", "dd", ".", "get_work_bam", "(", "data", ")", "umi_method", ",", "umi_tag", "=", "_check_umi_type", "(", "align_bam", ")", "f1_out", "=", "\"%s-cumi-1.fq.gz\"", "%", "utils", ".", "splitext_plus",...
Convert UMI grouped reads into fastq pair for re-alignment.
[ "Convert", "UMI", "grouped", "reads", "into", "fastq", "pair", "for", "re", "-", "alignment", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L188-L215
223,448
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
_get_fgbio_options
def _get_fgbio_options(data, estimated_defaults, umi_method): """Get adjustable, through resources, or default options for fgbio. """ group_opts = ["--edits", "--min-map-q"] cons_opts = ["--min-input-base-quality"] if umi_method != "paired": cons_opts += ["--min-reads", "--max-reads"] fi...
python
def _get_fgbio_options(data, estimated_defaults, umi_method): """Get adjustable, through resources, or default options for fgbio. """ group_opts = ["--edits", "--min-map-q"] cons_opts = ["--min-input-base-quality"] if umi_method != "paired": cons_opts += ["--min-reads", "--max-reads"] fi...
[ "def", "_get_fgbio_options", "(", "data", ",", "estimated_defaults", ",", "umi_method", ")", ":", "group_opts", "=", "[", "\"--edits\"", ",", "\"--min-map-q\"", "]", "cons_opts", "=", "[", "\"--min-input-base-quality\"", "]", "if", "umi_method", "!=", "\"paired\"", ...
Get adjustable, through resources, or default options for fgbio.
[ "Get", "adjustable", "through", "resources", "or", "default", "options", "for", "fgbio", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L235-L263
223,449
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
_check_dedup
def _check_dedup(data): """Check configuration for de-duplication. Defaults to no de-duplication for RNA-seq and small RNA, the back compatible default. Allow overwriting with explicit `mark_duplicates: true` setting. Also defaults to false for no alignment inputs. """ if dd.get_analysis(da...
python
def _check_dedup(data): """Check configuration for de-duplication. Defaults to no de-duplication for RNA-seq and small RNA, the back compatible default. Allow overwriting with explicit `mark_duplicates: true` setting. Also defaults to false for no alignment inputs. """ if dd.get_analysis(da...
[ "def", "_check_dedup", "(", "data", ")", ":", "if", "dd", ".", "get_analysis", "(", "data", ")", ".", "lower", "(", ")", "in", "[", "\"rna-seq\"", ",", "\"smallrna-seq\"", "]", "or", "not", "dd", ".", "get_aligner", "(", "data", ")", ":", "dup_param", ...
Check configuration for de-duplication. Defaults to no de-duplication for RNA-seq and small RNA, the back compatible default. Allow overwriting with explicit `mark_duplicates: true` setting. Also defaults to false for no alignment inputs.
[ "Check", "configuration", "for", "de", "-", "duplication", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L265-L281
223,450
bcbio/bcbio-nextgen
bcbio/ngsalign/postalign.py
dedup_bam
def dedup_bam(in_bam, data): """Perform non-stream based deduplication of BAM input files using biobambam. """ if _check_dedup(data): out_file = os.path.join(utils.safe_makedir(os.path.join(os.getcwd(), "align", dd.get_sample_name(data))), "%s-dedup%s" % utils.splitex...
python
def dedup_bam(in_bam, data): """Perform non-stream based deduplication of BAM input files using biobambam. """ if _check_dedup(data): out_file = os.path.join(utils.safe_makedir(os.path.join(os.getcwd(), "align", dd.get_sample_name(data))), "%s-dedup%s" % utils.splitex...
[ "def", "dedup_bam", "(", "in_bam", ",", "data", ")", ":", "if", "_check_dedup", "(", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd"...
Perform non-stream based deduplication of BAM input files using biobambam.
[ "Perform", "non", "-", "stream", "based", "deduplication", "of", "BAM", "input", "files", "using", "biobambam", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/postalign.py#L283-L301
223,451
bcbio/bcbio-nextgen
bcbio/structural/titancna.py
_finalize_sv
def _finalize_sv(solution_file, data): """Add output files from TitanCNA calling optional solution. """ out = {"variantcaller": "titancna"} with open(solution_file) as in_handle: solution = dict(zip(in_handle.readline().strip("\r\n").split("\t"), in_handle.readline()....
python
def _finalize_sv(solution_file, data): """Add output files from TitanCNA calling optional solution. """ out = {"variantcaller": "titancna"} with open(solution_file) as in_handle: solution = dict(zip(in_handle.readline().strip("\r\n").split("\t"), in_handle.readline()....
[ "def", "_finalize_sv", "(", "solution_file", ",", "data", ")", ":", "out", "=", "{", "\"variantcaller\"", ":", "\"titancna\"", "}", "with", "open", "(", "solution_file", ")", "as", "in_handle", ":", "solution", "=", "dict", "(", "zip", "(", "in_handle", "....
Add output files from TitanCNA calling optional solution.
[ "Add", "output", "files", "from", "TitanCNA", "calling", "optional", "solution", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/titancna.py#L52-L73
223,452
bcbio/bcbio-nextgen
bcbio/structural/titancna.py
_should_run
def _should_run(het_file): """Check for enough input data to proceed with analysis. """ has_hets = False with open(het_file) as in_handle: for i, line in enumerate(in_handle): if i > 1: has_hets = True break return has_hets
python
def _should_run(het_file): """Check for enough input data to proceed with analysis. """ has_hets = False with open(het_file) as in_handle: for i, line in enumerate(in_handle): if i > 1: has_hets = True break return has_hets
[ "def", "_should_run", "(", "het_file", ")", ":", "has_hets", "=", "False", "with", "open", "(", "het_file", ")", "as", "in_handle", ":", "for", "i", ",", "line", "in", "enumerate", "(", "in_handle", ")", ":", "if", "i", ">", "1", ":", "has_hets", "="...
Check for enough input data to proceed with analysis.
[ "Check", "for", "enough", "input", "data", "to", "proceed", "with", "analysis", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/titancna.py#L75-L84
223,453
bcbio/bcbio-nextgen
bcbio/structural/titancna.py
_titan_cn_file
def _titan_cn_file(cnr_file, work_dir, data): """Convert CNVkit or GATK4 normalized input into TitanCNA ready format. """ out_file = os.path.join(work_dir, "%s.cn" % (utils.splitext_plus(os.path.basename(cnr_file))[0])) support_cols = {"cnvkit": ["chromosome", "start", "end", "log2"], ...
python
def _titan_cn_file(cnr_file, work_dir, data): """Convert CNVkit or GATK4 normalized input into TitanCNA ready format. """ out_file = os.path.join(work_dir, "%s.cn" % (utils.splitext_plus(os.path.basename(cnr_file))[0])) support_cols = {"cnvkit": ["chromosome", "start", "end", "log2"], ...
[ "def", "_titan_cn_file", "(", "cnr_file", ",", "work_dir", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"%s.cn\"", "%", "(", "utils", ".", "splitext_plus", "(", "os", ".", "path", ".", "basename", "(",...
Convert CNVkit or GATK4 normalized input into TitanCNA ready format.
[ "Convert", "CNVkit", "or", "GATK4", "normalized", "input", "into", "TitanCNA", "ready", "format", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/titancna.py#L164-L181
223,454
bcbio/bcbio-nextgen
bcbio/structural/titancna.py
to_vcf
def to_vcf(in_file, caller, header_fn, vcf_fn, data, sep="\t"): """Convert output TitanCNA segs file into bgzipped VCF. """ out_file = "%s.vcf" % utils.splitext_plus(in_file)[0] if not utils.file_exists(out_file + ".gz") and not utils.file_exists(out_file): with file_transaction(data, out_file) ...
python
def to_vcf(in_file, caller, header_fn, vcf_fn, data, sep="\t"): """Convert output TitanCNA segs file into bgzipped VCF. """ out_file = "%s.vcf" % utils.splitext_plus(in_file)[0] if not utils.file_exists(out_file + ".gz") and not utils.file_exists(out_file): with file_transaction(data, out_file) ...
[ "def", "to_vcf", "(", "in_file", ",", "caller", ",", "header_fn", ",", "vcf_fn", ",", "data", ",", "sep", "=", "\"\\t\"", ")", ":", "out_file", "=", "\"%s.vcf\"", "%", "utils", ".", "splitext_plus", "(", "in_file", ")", "[", "0", "]", "if", "not", "u...
Convert output TitanCNA segs file into bgzipped VCF.
[ "Convert", "output", "TitanCNA", "segs", "file", "into", "bgzipped", "VCF", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/titancna.py#L214-L232
223,455
bcbio/bcbio-nextgen
bcbio/structural/metasv.py
run
def run(items): """Run MetaSV if we have enough supported callers, adding output to the set of calls. """ assert len(items) == 1, "Expect one input to MetaSV ensemble calling" data = items[0] work_dir = _sv_workdir(data) out_file = os.path.join(work_dir, "variants.vcf.gz") cmd = _get_cmd() +...
python
def run(items): """Run MetaSV if we have enough supported callers, adding output to the set of calls. """ assert len(items) == 1, "Expect one input to MetaSV ensemble calling" data = items[0] work_dir = _sv_workdir(data) out_file = os.path.join(work_dir, "variants.vcf.gz") cmd = _get_cmd() +...
[ "def", "run", "(", "items", ")", ":", "assert", "len", "(", "items", ")", "==", "1", ",", "\"Expect one input to MetaSV ensemble calling\"", "data", "=", "items", "[", "0", "]", "work_dir", "=", "_sv_workdir", "(", "data", ")", "out_file", "=", "os", ".", ...
Run MetaSV if we have enough supported callers, adding output to the set of calls.
[ "Run", "MetaSV", "if", "we", "have", "enough", "supported", "callers", "adding", "output", "to", "the", "set", "of", "calls", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/metasv.py#L18-L52
223,456
bcbio/bcbio-nextgen
bcbio/rnaseq/count.py
combine_count_files
def combine_count_files(files, out_file=None, ext=".fpkm"): """ combine a set of count files into a single combined file """ files = list(files) if not files: return None assert all([file_exists(x) for x in files]), \ "Some count files in %s do not exist." % files for f in fi...
python
def combine_count_files(files, out_file=None, ext=".fpkm"): """ combine a set of count files into a single combined file """ files = list(files) if not files: return None assert all([file_exists(x) for x in files]), \ "Some count files in %s do not exist." % files for f in fi...
[ "def", "combine_count_files", "(", "files", ",", "out_file", "=", "None", ",", "ext", "=", "\".fpkm\"", ")", ":", "files", "=", "list", "(", "files", ")", "if", "not", "files", ":", "return", "None", "assert", "all", "(", "[", "file_exists", "(", "x", ...
combine a set of count files into a single combined file
[ "combine", "a", "set", "of", "count", "files", "into", "a", "single", "combined", "file" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/count.py#L13-L51
223,457
bcbio/bcbio-nextgen
scripts/utils/cwltool2nextflow.py
nf_step_to_process
def nf_step_to_process(step, out_handle): """Convert CWL step into a nextflow process. """ pprint.pprint(step) directives = [] for req in step["task_definition"]["requirements"]: if req["requirement_type"] == "docker": directives.append("container '%s'" % req["value"]) e...
python
def nf_step_to_process(step, out_handle): """Convert CWL step into a nextflow process. """ pprint.pprint(step) directives = [] for req in step["task_definition"]["requirements"]: if req["requirement_type"] == "docker": directives.append("container '%s'" % req["value"]) e...
[ "def", "nf_step_to_process", "(", "step", ",", "out_handle", ")", ":", "pprint", ".", "pprint", "(", "step", ")", "directives", "=", "[", "]", "for", "req", "in", "step", "[", "\"task_definition\"", "]", "[", "\"requirements\"", "]", ":", "if", "req", "[...
Convert CWL step into a nextflow process.
[ "Convert", "CWL", "step", "into", "a", "nextflow", "process", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/cwltool2nextflow.py#L53-L74
223,458
bcbio/bcbio-nextgen
scripts/utils/cwltool2nextflow.py
nf_input_to_cl
def nf_input_to_cl(inp): """Convert an input description into command line argument. """ sep = " " if inp.get("separate") else "" val = "'%s'" % inp.get("default") if inp.get("default") else "$%s" % inp["name"] return "%s%s%s" % (inp["prefix"], sep, val)
python
def nf_input_to_cl(inp): """Convert an input description into command line argument. """ sep = " " if inp.get("separate") else "" val = "'%s'" % inp.get("default") if inp.get("default") else "$%s" % inp["name"] return "%s%s%s" % (inp["prefix"], sep, val)
[ "def", "nf_input_to_cl", "(", "inp", ")", ":", "sep", "=", "\" \"", "if", "inp", ".", "get", "(", "\"separate\"", ")", "else", "\"\"", "val", "=", "\"'%s'\"", "%", "inp", ".", "get", "(", "\"default\"", ")", "if", "inp", ".", "get", "(", "\"default\"...
Convert an input description into command line argument.
[ "Convert", "an", "input", "description", "into", "command", "line", "argument", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/cwltool2nextflow.py#L107-L112
223,459
bcbio/bcbio-nextgen
scripts/utils/cwltool2nextflow.py
_wf_to_dict
def _wf_to_dict(wf): """Parse a workflow into cwl2wdl style dictionary. """ inputs, outputs = _get_wf_inout(wf) out = {"name": _id_to_name(wf.tool["id"]).replace("-", "_"), "inputs": inputs, "outputs": outputs, "steps": [], "subworkflows": [], "requirements": []} for step in wf...
python
def _wf_to_dict(wf): """Parse a workflow into cwl2wdl style dictionary. """ inputs, outputs = _get_wf_inout(wf) out = {"name": _id_to_name(wf.tool["id"]).replace("-", "_"), "inputs": inputs, "outputs": outputs, "steps": [], "subworkflows": [], "requirements": []} for step in wf...
[ "def", "_wf_to_dict", "(", "wf", ")", ":", "inputs", ",", "outputs", "=", "_get_wf_inout", "(", "wf", ")", "out", "=", "{", "\"name\"", ":", "_id_to_name", "(", "wf", ".", "tool", "[", "\"id\"", "]", ")", ".", "replace", "(", "\"-\"", ",", "\"_\"", ...
Parse a workflow into cwl2wdl style dictionary.
[ "Parse", "a", "workflow", "into", "cwl2wdl", "style", "dictionary", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/cwltool2nextflow.py#L116-L134
223,460
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_get_validate
def _get_validate(data): """Retrieve items to validate, from single samples or from combined joint calls. """ if data.get("vrn_file") and tz.get_in(["config", "algorithm", "validate"], data): return utils.deepish_copy(data) elif "group_orig" in data: for sub in multi.get_orig_items(data)...
python
def _get_validate(data): """Retrieve items to validate, from single samples or from combined joint calls. """ if data.get("vrn_file") and tz.get_in(["config", "algorithm", "validate"], data): return utils.deepish_copy(data) elif "group_orig" in data: for sub in multi.get_orig_items(data)...
[ "def", "_get_validate", "(", "data", ")", ":", "if", "data", ".", "get", "(", "\"vrn_file\"", ")", "and", "tz", ".", "get_in", "(", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"validate\"", "]", ",", "data", ")", ":", "return", "utils", ".", "deepi...
Retrieve items to validate, from single samples or from combined joint calls.
[ "Retrieve", "items", "to", "validate", "from", "single", "samples", "or", "from", "combined", "joint", "calls", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L31-L42
223,461
bcbio/bcbio-nextgen
bcbio/variation/validate.py
normalize_input_path
def normalize_input_path(x, data): """Normalize path for input files, handling relative paths. Looks for non-absolute paths in local and fastq directories """ if x is None: return None elif os.path.isabs(x): return os.path.normpath(x) else: for d in [data["dirs"].get("fas...
python
def normalize_input_path(x, data): """Normalize path for input files, handling relative paths. Looks for non-absolute paths in local and fastq directories """ if x is None: return None elif os.path.isabs(x): return os.path.normpath(x) else: for d in [data["dirs"].get("fas...
[ "def", "normalize_input_path", "(", "x", ",", "data", ")", ":", "if", "x", "is", "None", ":", "return", "None", "elif", "os", ".", "path", ".", "isabs", "(", "x", ")", ":", "return", "os", ".", "path", ".", "normpath", "(", "x", ")", "else", ":",...
Normalize path for input files, handling relative paths. Looks for non-absolute paths in local and fastq directories
[ "Normalize", "path", "for", "input", "files", "handling", "relative", "paths", ".", "Looks", "for", "non", "-", "absolute", "paths", "in", "local", "and", "fastq", "directories" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L44-L58
223,462
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_get_caller_supplement
def _get_caller_supplement(caller, data): """Some callers like MuTect incorporate a second caller for indels. """ if caller == "mutect": icaller = tz.get_in(["config", "algorithm", "indelcaller"], data) if icaller: caller = "%s/%s" % (caller, icaller) return caller
python
def _get_caller_supplement(caller, data): """Some callers like MuTect incorporate a second caller for indels. """ if caller == "mutect": icaller = tz.get_in(["config", "algorithm", "indelcaller"], data) if icaller: caller = "%s/%s" % (caller, icaller) return caller
[ "def", "_get_caller_supplement", "(", "caller", ",", "data", ")", ":", "if", "caller", "==", "\"mutect\"", ":", "icaller", "=", "tz", ".", "get_in", "(", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"indelcaller\"", "]", ",", "data", ")", "if", "icaller...
Some callers like MuTect incorporate a second caller for indels.
[ "Some", "callers", "like", "MuTect", "incorporate", "a", "second", "caller", "for", "indels", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L84-L91
223,463
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_pick_lead_item
def _pick_lead_item(items): """Choose lead item for a set of samples. Picks tumors for tumor/normal pairs and first sample for batch groups. """ paired = vcfutils.get_paired(items) if paired: return paired.tumor_data else: return list(items)[0]
python
def _pick_lead_item(items): """Choose lead item for a set of samples. Picks tumors for tumor/normal pairs and first sample for batch groups. """ paired = vcfutils.get_paired(items) if paired: return paired.tumor_data else: return list(items)[0]
[ "def", "_pick_lead_item", "(", "items", ")", ":", "paired", "=", "vcfutils", ".", "get_paired", "(", "items", ")", "if", "paired", ":", "return", "paired", ".", "tumor_data", "else", ":", "return", "list", "(", "items", ")", "[", "0", "]" ]
Choose lead item for a set of samples. Picks tumors for tumor/normal pairs and first sample for batch groups.
[ "Choose", "lead", "item", "for", "a", "set", "of", "samples", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L93-L102
223,464
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_normalize_cwl_inputs
def _normalize_cwl_inputs(items): """Extract variation and validation data from CWL input list of batched samples. """ with_validate = {} vrn_files = [] ready_items = [] batch_samples = [] for data in (cwlutils.normalize_missing(utils.to_single_data(d)) for d in items): batch_samples...
python
def _normalize_cwl_inputs(items): """Extract variation and validation data from CWL input list of batched samples. """ with_validate = {} vrn_files = [] ready_items = [] batch_samples = [] for data in (cwlutils.normalize_missing(utils.to_single_data(d)) for d in items): batch_samples...
[ "def", "_normalize_cwl_inputs", "(", "items", ")", ":", "with_validate", "=", "{", "}", "vrn_files", "=", "[", "]", "ready_items", "=", "[", "]", "batch_samples", "=", "[", "]", "for", "data", "in", "(", "cwlutils", ".", "normalize_missing", "(", "utils", ...
Extract variation and validation data from CWL input list of batched samples.
[ "Extract", "variation", "and", "validation", "data", "from", "CWL", "input", "list", "of", "batched", "samples", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L104-L128
223,465
bcbio/bcbio-nextgen
bcbio/variation/validate.py
compare_to_rm
def compare_to_rm(data): """Compare final variant calls against reference materials of known calls. """ if isinstance(data, (list, tuple)) and cwlutils.is_cwl_run(utils.to_single_data(data[0])): data = _normalize_cwl_inputs(data) toval_data = _get_validate(data) toval_data = cwlutils.unpack_...
python
def compare_to_rm(data): """Compare final variant calls against reference materials of known calls. """ if isinstance(data, (list, tuple)) and cwlutils.is_cwl_run(utils.to_single_data(data[0])): data = _normalize_cwl_inputs(data) toval_data = _get_validate(data) toval_data = cwlutils.unpack_...
[ "def", "compare_to_rm", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "(", "list", ",", "tuple", ")", ")", "and", "cwlutils", ".", "is_cwl_run", "(", "utils", ".", "to_single_data", "(", "data", "[", "0", "]", ")", ")", ":", "data", ...
Compare final variant calls against reference materials of known calls.
[ "Compare", "final", "variant", "calls", "against", "reference", "materials", "of", "known", "calls", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L139-L184
223,466
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_annotate_validations
def _annotate_validations(eval_files, data): """Add annotations about potential problem regions to validation VCFs. """ for key in ["tp", "tp-calls", "fp", "fn"]: if eval_files.get(key): eval_files[key] = annotation.add_genome_context(eval_files[key], data) return eval_files
python
def _annotate_validations(eval_files, data): """Add annotations about potential problem regions to validation VCFs. """ for key in ["tp", "tp-calls", "fp", "fn"]: if eval_files.get(key): eval_files[key] = annotation.add_genome_context(eval_files[key], data) return eval_files
[ "def", "_annotate_validations", "(", "eval_files", ",", "data", ")", ":", "for", "key", "in", "[", "\"tp\"", ",", "\"tp-calls\"", ",", "\"fp\"", ",", "\"fn\"", "]", ":", "if", "eval_files", ".", "get", "(", "key", ")", ":", "eval_files", "[", "key", "]...
Add annotations about potential problem regions to validation VCFs.
[ "Add", "annotations", "about", "potential", "problem", "regions", "to", "validation", "VCFs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L186-L192
223,467
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_setup_call_false
def _setup_call_false(vrn_file, rm_bed, base_dir, data, call_type): """Create set of false positives or ngatives for inputs with empty truth sets. """ out_file = os.path.join(base_dir, "%s.vcf.gz" % call_type) if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_fi...
python
def _setup_call_false(vrn_file, rm_bed, base_dir, data, call_type): """Create set of false positives or ngatives for inputs with empty truth sets. """ out_file = os.path.join(base_dir, "%s.vcf.gz" % call_type) if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_fi...
[ "def", "_setup_call_false", "(", "vrn_file", ",", "rm_bed", ",", "base_dir", ",", "data", ",", "call_type", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "base_dir", ",", "\"%s.vcf.gz\"", "%", "call_type", ")", "if", "not", "utils", "."...
Create set of false positives or ngatives for inputs with empty truth sets.
[ "Create", "set", "of", "false", "positives", "or", "ngatives", "for", "inputs", "with", "empty", "truth", "sets", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L196-L206
223,468
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_rtg_add_summary_file
def _rtg_add_summary_file(eval_files, base_dir, data): """Parse output TP FP and FN files to generate metrics for plotting. """ out_file = os.path.join(base_dir, "validate-summary.csv") if not utils.file_uptodate(out_file, eval_files.get("tp", eval_files.get("fp", eval_files["fn"]))): with file_...
python
def _rtg_add_summary_file(eval_files, base_dir, data): """Parse output TP FP and FN files to generate metrics for plotting. """ out_file = os.path.join(base_dir, "validate-summary.csv") if not utils.file_uptodate(out_file, eval_files.get("tp", eval_files.get("fp", eval_files["fn"]))): with file_...
[ "def", "_rtg_add_summary_file", "(", "eval_files", ",", "base_dir", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "base_dir", ",", "\"validate-summary.csv\"", ")", "if", "not", "utils", ".", "file_uptodate", "(", "out_file", ",...
Parse output TP FP and FN files to generate metrics for plotting.
[ "Parse", "output", "TP", "FP", "and", "FN", "files", "to", "generate", "metrics", "for", "plotting", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L214-L235
223,469
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_prepare_inputs
def _prepare_inputs(vrn_file, rm_file, rm_interval_file, base_dir, data): """Prepare input VCF and BED files for validation. """ if not rm_file.endswith(".vcf.gz") or not os.path.exists(rm_file + ".tbi"): rm_file = vcfutils.bgzip_and_index(rm_file, data["config"], out_dir=base_dir) if len(vcfuti...
python
def _prepare_inputs(vrn_file, rm_file, rm_interval_file, base_dir, data): """Prepare input VCF and BED files for validation. """ if not rm_file.endswith(".vcf.gz") or not os.path.exists(rm_file + ".tbi"): rm_file = vcfutils.bgzip_and_index(rm_file, data["config"], out_dir=base_dir) if len(vcfuti...
[ "def", "_prepare_inputs", "(", "vrn_file", ",", "rm_file", ",", "rm_interval_file", ",", "base_dir", ",", "data", ")", ":", "if", "not", "rm_file", ".", "endswith", "(", "\".vcf.gz\"", ")", "or", "not", "os", ".", "path", ".", "exists", "(", "rm_file", "...
Prepare input VCF and BED files for validation.
[ "Prepare", "input", "VCF", "and", "BED", "files", "for", "validation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L237-L251
223,470
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_pick_best_quality_score
def _pick_best_quality_score(vrn_file): """Flexible quality score selection, picking the best available. Implementation based on discussion: https://github.com/bcbio/bcbio-nextgen/commit/a538cecd86c0000d17d3f9d4f8ac9d2da04f9884#commitcomment-14539249 (RTG=AVR/GATK=VQSLOD/MuTect=t_lod_fstar, otherwise...
python
def _pick_best_quality_score(vrn_file): """Flexible quality score selection, picking the best available. Implementation based on discussion: https://github.com/bcbio/bcbio-nextgen/commit/a538cecd86c0000d17d3f9d4f8ac9d2da04f9884#commitcomment-14539249 (RTG=AVR/GATK=VQSLOD/MuTect=t_lod_fstar, otherwise...
[ "def", "_pick_best_quality_score", "(", "vrn_file", ")", ":", "# pysam fails on checking reference contigs if input is empty", "if", "not", "vcfutils", ".", "vcf_has_variants", "(", "vrn_file", ")", ":", "return", "\"DP\"", "to_check", "=", "25", "scores", "=", "collect...
Flexible quality score selection, picking the best available. Implementation based on discussion: https://github.com/bcbio/bcbio-nextgen/commit/a538cecd86c0000d17d3f9d4f8ac9d2da04f9884#commitcomment-14539249 (RTG=AVR/GATK=VQSLOD/MuTect=t_lod_fstar, otherwise GQ, otherwise QUAL, otherwise DP.) For Mu...
[ "Flexible", "quality", "score", "selection", "picking", "the", "best", "available", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L305-L342
223,471
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_get_merged_intervals
def _get_merged_intervals(rm_interval_file, vrn_file, base_dir, data): """Retrieve intervals to run validation on, merging reference and callable BED files. """ a_intervals = get_analysis_intervals(data, vrn_file, base_dir) if a_intervals: final_intervals = shared.remove_lcr_regions(a_intervals,...
python
def _get_merged_intervals(rm_interval_file, vrn_file, base_dir, data): """Retrieve intervals to run validation on, merging reference and callable BED files. """ a_intervals = get_analysis_intervals(data, vrn_file, base_dir) if a_intervals: final_intervals = shared.remove_lcr_regions(a_intervals,...
[ "def", "_get_merged_intervals", "(", "rm_interval_file", ",", "vrn_file", ",", "base_dir", ",", "data", ")", ":", "a_intervals", "=", "get_analysis_intervals", "(", "data", ",", "vrn_file", ",", "base_dir", ")", "if", "a_intervals", ":", "final_intervals", "=", ...
Retrieve intervals to run validation on, merging reference and callable BED files.
[ "Retrieve", "intervals", "to", "run", "validation", "on", "merging", "reference", "and", "callable", "BED", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L344-L380
223,472
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_callable_from_gvcf
def _callable_from_gvcf(data, vrn_file, out_dir): """Retrieve callable regions based on ref call regions in gVCF. Uses https://github.com/lijiayong/gvcf_regions """ methods = {"freebayes": "freebayes", "platypus": "platypus", "gatk-haplotype": "gatk"} gvcf_type = methods.get(dd.get_v...
python
def _callable_from_gvcf(data, vrn_file, out_dir): """Retrieve callable regions based on ref call regions in gVCF. Uses https://github.com/lijiayong/gvcf_regions """ methods = {"freebayes": "freebayes", "platypus": "platypus", "gatk-haplotype": "gatk"} gvcf_type = methods.get(dd.get_v...
[ "def", "_callable_from_gvcf", "(", "data", ",", "vrn_file", ",", "out_dir", ")", ":", "methods", "=", "{", "\"freebayes\"", ":", "\"freebayes\"", ",", "\"platypus\"", ":", "\"platypus\"", ",", "\"gatk-haplotype\"", ":", "\"gatk\"", "}", "gvcf_type", "=", "method...
Retrieve callable regions based on ref call regions in gVCF. Uses https://github.com/lijiayong/gvcf_regions
[ "Retrieve", "callable", "regions", "based", "on", "ref", "call", "regions", "in", "gVCF", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L382-L398
223,473
bcbio/bcbio-nextgen
bcbio/variation/validate.py
get_analysis_intervals
def get_analysis_intervals(data, vrn_file, base_dir): """Retrieve analysis regions for the current variant calling pipeline. """ from bcbio.bam import callable if vrn_file and vcfutils.is_gvcf_file(vrn_file): callable_bed = _callable_from_gvcf(data, vrn_file, base_dir) if callable_bed: ...
python
def get_analysis_intervals(data, vrn_file, base_dir): """Retrieve analysis regions for the current variant calling pipeline. """ from bcbio.bam import callable if vrn_file and vcfutils.is_gvcf_file(vrn_file): callable_bed = _callable_from_gvcf(data, vrn_file, base_dir) if callable_bed: ...
[ "def", "get_analysis_intervals", "(", "data", ",", "vrn_file", ",", "base_dir", ")", ":", "from", "bcbio", ".", "bam", "import", "callable", "if", "vrn_file", "and", "vcfutils", ".", "is_gvcf_file", "(", "vrn_file", ")", ":", "callable_bed", "=", "_callable_fr...
Retrieve analysis regions for the current variant calling pipeline.
[ "Retrieve", "analysis", "regions", "for", "the", "current", "variant", "calling", "pipeline", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L400-L424
223,474
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_get_location_list
def _get_location_list(interval_bed): """Retrieve list of locations to analyze from input BED file. """ import pybedtools regions = collections.OrderedDict() for region in pybedtools.BedTool(interval_bed): regions[str(region.chrom)] = None return regions.keys()
python
def _get_location_list(interval_bed): """Retrieve list of locations to analyze from input BED file. """ import pybedtools regions = collections.OrderedDict() for region in pybedtools.BedTool(interval_bed): regions[str(region.chrom)] = None return regions.keys()
[ "def", "_get_location_list", "(", "interval_bed", ")", ":", "import", "pybedtools", "regions", "=", "collections", ".", "OrderedDict", "(", ")", "for", "region", "in", "pybedtools", ".", "BedTool", "(", "interval_bed", ")", ":", "regions", "[", "str", "(", "...
Retrieve list of locations to analyze from input BED file.
[ "Retrieve", "list", "of", "locations", "to", "analyze", "from", "input", "BED", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L443-L450
223,475
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_run_bcbio_variation
def _run_bcbio_variation(vrn_file, rm_file, rm_interval_file, base_dir, sample, caller, data): """Run validation of a caller against the truth set using bcbio.variation. """ val_config_file = _create_validate_config_file(vrn_file, rm_file, rm_interval_file, ...
python
def _run_bcbio_variation(vrn_file, rm_file, rm_interval_file, base_dir, sample, caller, data): """Run validation of a caller against the truth set using bcbio.variation. """ val_config_file = _create_validate_config_file(vrn_file, rm_file, rm_interval_file, ...
[ "def", "_run_bcbio_variation", "(", "vrn_file", ",", "rm_file", ",", "rm_interval_file", ",", "base_dir", ",", "sample", ",", "caller", ",", "data", ")", ":", "val_config_file", "=", "_create_validate_config_file", "(", "vrn_file", ",", "rm_file", ",", "rm_interva...
Run validation of a caller against the truth set using bcbio.variation.
[ "Run", "validation", "of", "a", "caller", "against", "the", "truth", "set", "using", "bcbio", ".", "variation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L454-L468
223,476
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_create_validate_config
def _create_validate_config(vrn_file, rm_file, rm_interval_file, base_dir, data): """Create a bcbio.variation configuration input for validation. """ ref_call = {"file": str(rm_file), "name": "ref", "type": "grading-ref", "fix-sample-header": True, "remove-refcalls": True} a_intervals = ...
python
def _create_validate_config(vrn_file, rm_file, rm_interval_file, base_dir, data): """Create a bcbio.variation configuration input for validation. """ ref_call = {"file": str(rm_file), "name": "ref", "type": "grading-ref", "fix-sample-header": True, "remove-refcalls": True} a_intervals = ...
[ "def", "_create_validate_config", "(", "vrn_file", ",", "rm_file", ",", "rm_interval_file", ",", "base_dir", ",", "data", ")", ":", "ref_call", "=", "{", "\"file\"", ":", "str", "(", "rm_file", ")", ",", "\"name\"", ":", "\"ref\"", ",", "\"type\"", ":", "\...
Create a bcbio.variation configuration input for validation.
[ "Create", "a", "bcbio", ".", "variation", "configuration", "input", "for", "validation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L492-L514
223,477
bcbio/bcbio-nextgen
bcbio/variation/validate.py
summarize_grading
def summarize_grading(samples, vkey="validate"): """Provide summaries of grading results across all samples. Handles both traditional pipelines (validation part of variants) and CWL pipelines (validation at top level) """ samples = list(utils.flatten(samples)) if not _has_grading_info(samples, ...
python
def summarize_grading(samples, vkey="validate"): """Provide summaries of grading results across all samples. Handles both traditional pipelines (validation part of variants) and CWL pipelines (validation at top level) """ samples = list(utils.flatten(samples)) if not _has_grading_info(samples, ...
[ "def", "summarize_grading", "(", "samples", ",", "vkey", "=", "\"validate\"", ")", ":", "samples", "=", "list", "(", "utils", ".", "flatten", "(", "samples", ")", ")", "if", "not", "_has_grading_info", "(", "samples", ",", "vkey", ")", ":", "return", "["...
Provide summaries of grading results across all samples. Handles both traditional pipelines (validation part of variants) and CWL pipelines (validation at top level)
[ "Provide", "summaries", "of", "grading", "results", "across", "all", "samples", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L560-L613
223,478
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_summarize_combined
def _summarize_combined(samples, vkey): """Prepare summarized CSV and plot files for samples to combine together. Helps handle cases where we want to summarize over multiple samples. """ validate_dir = utils.safe_makedir(os.path.join(samples[0]["dirs"]["work"], vkey)) combined, _ = _group_validate_...
python
def _summarize_combined(samples, vkey): """Prepare summarized CSV and plot files for samples to combine together. Helps handle cases where we want to summarize over multiple samples. """ validate_dir = utils.safe_makedir(os.path.join(samples[0]["dirs"]["work"], vkey)) combined, _ = _group_validate_...
[ "def", "_summarize_combined", "(", "samples", ",", "vkey", ")", ":", "validate_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "samples", "[", "0", "]", "[", "\"dirs\"", "]", "[", "\"work\"", "]", ",", "vkey", ")", ...
Prepare summarized CSV and plot files for samples to combine together. Helps handle cases where we want to summarize over multiple samples.
[ "Prepare", "summarized", "CSV", "and", "plot", "files", "for", "samples", "to", "combine", "together", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L615-L643
223,479
bcbio/bcbio-nextgen
bcbio/variation/validate.py
combine_validations
def combine_validations(items, vkey="validate"): """Combine multiple batch validations into validation outputs. """ csvs = set([]) pngs = set([]) for v in [x.get(vkey) for x in items]: if v and v.get("grading_summary"): csvs.add(v.get("grading_summary")) if v and v.get("g...
python
def combine_validations(items, vkey="validate"): """Combine multiple batch validations into validation outputs. """ csvs = set([]) pngs = set([]) for v in [x.get(vkey) for x in items]: if v and v.get("grading_summary"): csvs.add(v.get("grading_summary")) if v and v.get("g...
[ "def", "combine_validations", "(", "items", ",", "vkey", "=", "\"validate\"", ")", ":", "csvs", "=", "set", "(", "[", "]", ")", "pngs", "=", "set", "(", "[", "]", ")", "for", "v", "in", "[", "x", ".", "get", "(", "vkey", ")", "for", "x", "in", ...
Combine multiple batch validations into validation outputs.
[ "Combine", "multiple", "batch", "validations", "into", "validation", "outputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L645-L668
223,480
bcbio/bcbio-nextgen
bcbio/variation/validate.py
freq_summary
def freq_summary(val_file, call_file, truth_file, target_name): """Summarize true and false positive calls by variant type and frequency. Resolve differences in true/false calls based on output from hap.py: https://github.com/sequencing/hap.py """ out_file = "%s-freqs.csv" % utils.splitext_plus(val...
python
def freq_summary(val_file, call_file, truth_file, target_name): """Summarize true and false positive calls by variant type and frequency. Resolve differences in true/false calls based on output from hap.py: https://github.com/sequencing/hap.py """ out_file = "%s-freqs.csv" % utils.splitext_plus(val...
[ "def", "freq_summary", "(", "val_file", ",", "call_file", ",", "truth_file", ",", "target_name", ")", ":", "out_file", "=", "\"%s-freqs.csv\"", "%", "utils", ".", "splitext_plus", "(", "val_file", ")", "[", "0", "]", "truth_freqs", "=", "_read_truth_freqs", "(...
Summarize true and false positive calls by variant type and frequency. Resolve differences in true/false calls based on output from hap.py: https://github.com/sequencing/hap.py
[ "Summarize", "true", "and", "false", "positive", "calls", "by", "variant", "type", "and", "frequency", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L684-L703
223,481
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_read_call_freqs
def _read_call_freqs(in_file, sample_name): """Identify frequencies for calls in the input file. """ from bcbio.heterogeneity import bubbletree out = {} with VariantFile(in_file) as call_in: for rec in call_in: if rec.filter.keys() == ["PASS"]: for name, sample in...
python
def _read_call_freqs(in_file, sample_name): """Identify frequencies for calls in the input file. """ from bcbio.heterogeneity import bubbletree out = {} with VariantFile(in_file) as call_in: for rec in call_in: if rec.filter.keys() == ["PASS"]: for name, sample in...
[ "def", "_read_call_freqs", "(", "in_file", ",", "sample_name", ")", ":", "from", "bcbio", ".", "heterogeneity", "import", "bubbletree", "out", "=", "{", "}", "with", "VariantFile", "(", "in_file", ")", "as", "call_in", ":", "for", "rec", "in", "call_in", "...
Identify frequencies for calls in the input file.
[ "Identify", "frequencies", "for", "calls", "in", "the", "input", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L721-L734
223,482
bcbio/bcbio-nextgen
bcbio/variation/validate.py
_read_truth_freqs
def _read_truth_freqs(in_file): """Read frequency of calls from truth VCF. Currently handles DREAM data, needs generalization for other datasets. """ out = {} with VariantFile(in_file) as bcf_in: for rec in bcf_in: freq = float(rec.info.get("VAF", 1.0)) out[_get_key(...
python
def _read_truth_freqs(in_file): """Read frequency of calls from truth VCF. Currently handles DREAM data, needs generalization for other datasets. """ out = {} with VariantFile(in_file) as bcf_in: for rec in bcf_in: freq = float(rec.info.get("VAF", 1.0)) out[_get_key(...
[ "def", "_read_truth_freqs", "(", "in_file", ")", ":", "out", "=", "{", "}", "with", "VariantFile", "(", "in_file", ")", "as", "bcf_in", ":", "for", "rec", "in", "bcf_in", ":", "freq", "=", "float", "(", "rec", ".", "info", ".", "get", "(", "\"VAF\"",...
Read frequency of calls from truth VCF. Currently handles DREAM data, needs generalization for other datasets.
[ "Read", "frequency", "of", "calls", "from", "truth", "VCF", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validate.py#L736-L746
223,483
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
to_rec
def to_rec(samples, default_keys=None): """Convert inputs into CWL records, useful for single item parallelization. """ recs = samples_to_records([normalize_missing(utils.to_single_data(x)) for x in samples], default_keys) return [[x] for x in recs]
python
def to_rec(samples, default_keys=None): """Convert inputs into CWL records, useful for single item parallelization. """ recs = samples_to_records([normalize_missing(utils.to_single_data(x)) for x in samples], default_keys) return [[x] for x in recs]
[ "def", "to_rec", "(", "samples", ",", "default_keys", "=", "None", ")", ":", "recs", "=", "samples_to_records", "(", "[", "normalize_missing", "(", "utils", ".", "to_single_data", "(", "x", ")", ")", "for", "x", "in", "samples", "]", ",", "default_keys", ...
Convert inputs into CWL records, useful for single item parallelization.
[ "Convert", "inputs", "into", "CWL", "records", "useful", "for", "single", "item", "parallelization", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L20-L24
223,484
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
to_rec_single
def to_rec_single(samples, default_keys=None): """Convert output into a list of single CWL records. """ out = [] for data in samples: recs = samples_to_records([normalize_missing(utils.to_single_data(data))], default_keys) assert len(recs) == 1 out.append(recs[0]) return out
python
def to_rec_single(samples, default_keys=None): """Convert output into a list of single CWL records. """ out = [] for data in samples: recs = samples_to_records([normalize_missing(utils.to_single_data(data))], default_keys) assert len(recs) == 1 out.append(recs[0]) return out
[ "def", "to_rec_single", "(", "samples", ",", "default_keys", "=", "None", ")", ":", "out", "=", "[", "]", "for", "data", "in", "samples", ":", "recs", "=", "samples_to_records", "(", "[", "normalize_missing", "(", "utils", ".", "to_single_data", "(", "data...
Convert output into a list of single CWL records.
[ "Convert", "output", "into", "a", "list", "of", "single", "CWL", "records", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L26-L34
223,485
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
handle_combined_input
def handle_combined_input(args): """Check for cases where we have a combined input nested list. In these cases the CWL will be double nested: [[[rec_a], [rec_b]]] and we remove the outer nesting. """ cur_args = args[:] while len(cur_args) == 1 and isinstance(cur_args[0], (list, tuple)): ...
python
def handle_combined_input(args): """Check for cases where we have a combined input nested list. In these cases the CWL will be double nested: [[[rec_a], [rec_b]]] and we remove the outer nesting. """ cur_args = args[:] while len(cur_args) == 1 and isinstance(cur_args[0], (list, tuple)): ...
[ "def", "handle_combined_input", "(", "args", ")", ":", "cur_args", "=", "args", "[", ":", "]", "while", "len", "(", "cur_args", ")", "==", "1", "and", "isinstance", "(", "cur_args", "[", "0", "]", ",", "(", "list", ",", "tuple", ")", ")", ":", "cur...
Check for cases where we have a combined input nested list. In these cases the CWL will be double nested: [[[rec_a], [rec_b]]] and we remove the outer nesting.
[ "Check", "for", "cases", "where", "we", "have", "a", "combined", "input", "nested", "list", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L39-L51
223,486
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
normalize_missing
def normalize_missing(xs): """Normalize missing values to avoid string 'None' inputs. """ if isinstance(xs, dict): for k, v in xs.items(): xs[k] = normalize_missing(v) elif isinstance(xs, (list, tuple)): xs = [normalize_missing(x) for x in xs] elif isinstance(xs, six.stri...
python
def normalize_missing(xs): """Normalize missing values to avoid string 'None' inputs. """ if isinstance(xs, dict): for k, v in xs.items(): xs[k] = normalize_missing(v) elif isinstance(xs, (list, tuple)): xs = [normalize_missing(x) for x in xs] elif isinstance(xs, six.stri...
[ "def", "normalize_missing", "(", "xs", ")", ":", "if", "isinstance", "(", "xs", ",", "dict", ")", ":", "for", "k", ",", "v", "in", "xs", ".", "items", "(", ")", ":", "xs", "[", "k", "]", "=", "normalize_missing", "(", "v", ")", "elif", "isinstanc...
Normalize missing values to avoid string 'None' inputs.
[ "Normalize", "missing", "values", "to", "avoid", "string", "None", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L53-L68
223,487
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
unpack_tarballs
def unpack_tarballs(xs, data, use_subdir=True): """Unpack workflow tarballs into ready to use directories. """ if isinstance(xs, dict): for k, v in xs.items(): xs[k] = unpack_tarballs(v, data, use_subdir) elif isinstance(xs, (list, tuple)): xs = [unpack_tarballs(x, data, use_...
python
def unpack_tarballs(xs, data, use_subdir=True): """Unpack workflow tarballs into ready to use directories. """ if isinstance(xs, dict): for k, v in xs.items(): xs[k] = unpack_tarballs(v, data, use_subdir) elif isinstance(xs, (list, tuple)): xs = [unpack_tarballs(x, data, use_...
[ "def", "unpack_tarballs", "(", "xs", ",", "data", ",", "use_subdir", "=", "True", ")", ":", "if", "isinstance", "(", "xs", ",", "dict", ")", ":", "for", "k", ",", "v", "in", "xs", ".", "items", "(", ")", ":", "xs", "[", "k", "]", "=", "unpack_t...
Unpack workflow tarballs into ready to use directories.
[ "Unpack", "workflow", "tarballs", "into", "ready", "to", "use", "directories", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L76-L108
223,488
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
_get_all_cwlkeys
def _get_all_cwlkeys(items, default_keys=None): """Retrieve cwlkeys from inputs, handling defaults which can be null. When inputs are null in some and present in others, this creates unequal keys in each sample, confusing decision making about which are primary and extras. """ if default_keys: ...
python
def _get_all_cwlkeys(items, default_keys=None): """Retrieve cwlkeys from inputs, handling defaults which can be null. When inputs are null in some and present in others, this creates unequal keys in each sample, confusing decision making about which are primary and extras. """ if default_keys: ...
[ "def", "_get_all_cwlkeys", "(", "items", ",", "default_keys", "=", "None", ")", ":", "if", "default_keys", ":", "default_keys", "=", "set", "(", "default_keys", ")", "else", ":", "default_keys", "=", "set", "(", "[", "\"metadata__batch\"", ",", "\"config__algo...
Retrieve cwlkeys from inputs, handling defaults which can be null. When inputs are null in some and present in others, this creates unequal keys in each sample, confusing decision making about which are primary and extras.
[ "Retrieve", "cwlkeys", "from", "inputs", "handling", "defaults", "which", "can", "be", "null", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L110-L133
223,489
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
split_data_cwl_items
def split_data_cwl_items(items, default_keys=None): """Split a set of CWL output dictionaries into data samples and CWL items. Handles cases where we're arrayed on multiple things, like a set of regional VCF calls and data objects. """ key_lens = set([]) for data in items: key_lens.add(...
python
def split_data_cwl_items(items, default_keys=None): """Split a set of CWL output dictionaries into data samples and CWL items. Handles cases where we're arrayed on multiple things, like a set of regional VCF calls and data objects. """ key_lens = set([]) for data in items: key_lens.add(...
[ "def", "split_data_cwl_items", "(", "items", ",", "default_keys", "=", "None", ")", ":", "key_lens", "=", "set", "(", "[", "]", ")", "for", "data", "in", "items", ":", "key_lens", ".", "add", "(", "len", "(", "_get_all_cwlkeys", "(", "[", "data", "]", ...
Split a set of CWL output dictionaries into data samples and CWL items. Handles cases where we're arrayed on multiple things, like a set of regional VCF calls and data objects.
[ "Split", "a", "set", "of", "CWL", "output", "dictionaries", "into", "data", "samples", "and", "CWL", "items", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L135-L168
223,490
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
samples_to_records
def samples_to_records(samples, default_keys=None): """Convert samples into output CWL records. """ from bcbio.pipeline import run_info RECORD_CONVERT_TO_LIST = set(["config__algorithm__tools_on", "config__algorithm__tools_off", "reference__genome_context"]) all_key...
python
def samples_to_records(samples, default_keys=None): """Convert samples into output CWL records. """ from bcbio.pipeline import run_info RECORD_CONVERT_TO_LIST = set(["config__algorithm__tools_on", "config__algorithm__tools_off", "reference__genome_context"]) all_key...
[ "def", "samples_to_records", "(", "samples", ",", "default_keys", "=", "None", ")", ":", "from", "bcbio", ".", "pipeline", "import", "run_info", "RECORD_CONVERT_TO_LIST", "=", "set", "(", "[", "\"config__algorithm__tools_on\"", ",", "\"config__algorithm__tools_off\"", ...
Convert samples into output CWL records.
[ "Convert", "samples", "into", "output", "CWL", "records", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L170-L195
223,491
bcbio/bcbio-nextgen
bcbio/cwl/cwlutils.py
assign_complex_to_samples
def assign_complex_to_samples(items): """Assign complex inputs like variants and align outputs to samples. Handles list inputs to record conversion where we have inputs from multiple locations and need to ensure they are properly assigned to samples in many environments. The unpleasant approach he...
python
def assign_complex_to_samples(items): """Assign complex inputs like variants and align outputs to samples. Handles list inputs to record conversion where we have inputs from multiple locations and need to ensure they are properly assigned to samples in many environments. The unpleasant approach he...
[ "def", "assign_complex_to_samples", "(", "items", ")", ":", "extract_fns", "=", "{", "(", "\"variants\"", ",", "\"samples\"", ")", ":", "_get_vcf_samples", ",", "(", "\"align_bam\"", ",", ")", ":", "_get_bam_samples", "}", "complex", "=", "{", "k", ":", "{",...
Assign complex inputs like variants and align outputs to samples. Handles list inputs to record conversion where we have inputs from multiple locations and need to ensure they are properly assigned to samples in many environments. The unpleasant approach here is to use standard file naming to match ...
[ "Assign", "complex", "inputs", "like", "variants", "and", "align", "outputs", "to", "samples", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/cwlutils.py#L197-L225
223,492
bcbio/bcbio-nextgen
bcbio/pipeline/variation.py
_normalize_vc_input
def _normalize_vc_input(data): """Normalize different types of variant calling inputs. Handles standard and ensemble inputs. """ if data.get("ensemble"): for k in ["batch_samples", "validate", "vrn_file"]: data[k] = data["ensemble"][k] data["config"]["algorithm"]["variantcal...
python
def _normalize_vc_input(data): """Normalize different types of variant calling inputs. Handles standard and ensemble inputs. """ if data.get("ensemble"): for k in ["batch_samples", "validate", "vrn_file"]: data[k] = data["ensemble"][k] data["config"]["algorithm"]["variantcal...
[ "def", "_normalize_vc_input", "(", "data", ")", ":", "if", "data", ".", "get", "(", "\"ensemble\"", ")", ":", "for", "k", "in", "[", "\"batch_samples\"", ",", "\"validate\"", ",", "\"vrn_file\"", "]", ":", "data", "[", "k", "]", "=", "data", "[", "\"en...
Normalize different types of variant calling inputs. Handles standard and ensemble inputs.
[ "Normalize", "different", "types", "of", "variant", "calling", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/variation.py#L65-L75
223,493
bcbio/bcbio-nextgen
bcbio/pipeline/variation.py
_get_orig_items
def _get_orig_items(data): """Retrieve original items in a batch, handling CWL and standard cases. """ if isinstance(data, dict): if dd.get_align_bam(data) and tz.get_in(["metadata", "batch"], data) and "group_orig" in data: return vmulti.get_orig_items(data) else: re...
python
def _get_orig_items(data): """Retrieve original items in a batch, handling CWL and standard cases. """ if isinstance(data, dict): if dd.get_align_bam(data) and tz.get_in(["metadata", "batch"], data) and "group_orig" in data: return vmulti.get_orig_items(data) else: re...
[ "def", "_get_orig_items", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "if", "dd", ".", "get_align_bam", "(", "data", ")", "and", "tz", ".", "get_in", "(", "[", "\"metadata\"", ",", "\"batch\"", "]", ",", "data", ")"...
Retrieve original items in a batch, handling CWL and standard cases.
[ "Retrieve", "original", "items", "in", "a", "batch", "handling", "CWL", "and", "standard", "cases", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/variation.py#L129-L138
223,494
bcbio/bcbio-nextgen
bcbio/pipeline/variation.py
_symlink_to_workdir
def _symlink_to_workdir(data, key): """For CWL support, symlink files into a working directory if in read-only imports. """ orig_file = tz.get_in(key, data) if orig_file and not orig_file.startswith(dd.get_work_dir(data)): variantcaller = genotype.get_variantcaller(data, require_bam=False) ...
python
def _symlink_to_workdir(data, key): """For CWL support, symlink files into a working directory if in read-only imports. """ orig_file = tz.get_in(key, data) if orig_file and not orig_file.startswith(dd.get_work_dir(data)): variantcaller = genotype.get_variantcaller(data, require_bam=False) ...
[ "def", "_symlink_to_workdir", "(", "data", ",", "key", ")", ":", "orig_file", "=", "tz", ".", "get_in", "(", "key", ",", "data", ")", "if", "orig_file", "and", "not", "orig_file", ".", "startswith", "(", "dd", ".", "get_work_dir", "(", "data", ")", ")"...
For CWL support, symlink files into a working directory if in read-only imports.
[ "For", "CWL", "support", "symlink", "files", "into", "a", "working", "directory", "if", "in", "read", "-", "only", "imports", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/variation.py#L140-L152
223,495
bcbio/bcbio-nextgen
bcbio/pipeline/variation.py
_get_batch_representative
def _get_batch_representative(items, key): """Retrieve a representative data item from a batch. Handles standard bcbio cases (a single data item) and CWL cases with batches that have a consistent variant file. """ if isinstance(items, dict): return items, items else: vals = set(...
python
def _get_batch_representative(items, key): """Retrieve a representative data item from a batch. Handles standard bcbio cases (a single data item) and CWL cases with batches that have a consistent variant file. """ if isinstance(items, dict): return items, items else: vals = set(...
[ "def", "_get_batch_representative", "(", "items", ",", "key", ")", ":", "if", "isinstance", "(", "items", ",", "dict", ")", ":", "return", "items", ",", "items", "else", ":", "vals", "=", "set", "(", "[", "]", ")", "out", "=", "[", "]", "for", "dat...
Retrieve a representative data item from a batch. Handles standard bcbio cases (a single data item) and CWL cases with batches that have a consistent variant file.
[ "Retrieve", "a", "representative", "data", "item", "from", "a", "batch", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/variation.py#L154-L171
223,496
bcbio/bcbio-nextgen
bcbio/distributed/objectstore.py
_get_storage_manager
def _get_storage_manager(resource): """Return a storage manager which can process this resource.""" for manager in (AmazonS3, ArvadosKeep, SevenBridges, DNAnexus, AzureBlob, GoogleCloud, RegularServer): if manager.check_resource(resource): return manager() raise ValueError("Unexpected o...
python
def _get_storage_manager(resource): """Return a storage manager which can process this resource.""" for manager in (AmazonS3, ArvadosKeep, SevenBridges, DNAnexus, AzureBlob, GoogleCloud, RegularServer): if manager.check_resource(resource): return manager() raise ValueError("Unexpected o...
[ "def", "_get_storage_manager", "(", "resource", ")", ":", "for", "manager", "in", "(", "AmazonS3", ",", "ArvadosKeep", ",", "SevenBridges", ",", "DNAnexus", ",", "AzureBlob", ",", "GoogleCloud", ",", "RegularServer", ")", ":", "if", "manager", ".", "check_reso...
Return a storage manager which can process this resource.
[ "Return", "a", "storage", "manager", "which", "can", "process", "this", "resource", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L624-L631
223,497
bcbio/bcbio-nextgen
bcbio/distributed/objectstore.py
default_region
def default_region(fname): """Return the default region for the received resource. Note: This feature is available only for AmazonS3 storage manager. """ manager = _get_storage_manager(fname) if hasattr(manager, "get_region"): return manager.get_region() raise NotImplementedErr...
python
def default_region(fname): """Return the default region for the received resource. Note: This feature is available only for AmazonS3 storage manager. """ manager = _get_storage_manager(fname) if hasattr(manager, "get_region"): return manager.get_region() raise NotImplementedErr...
[ "def", "default_region", "(", "fname", ")", ":", "manager", "=", "_get_storage_manager", "(", "fname", ")", "if", "hasattr", "(", "manager", ",", "\"get_region\"", ")", ":", "return", "manager", ".", "get_region", "(", ")", "raise", "NotImplementedError", "(",...
Return the default region for the received resource. Note: This feature is available only for AmazonS3 storage manager.
[ "Return", "the", "default", "region", "for", "the", "received", "resource", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L651-L661
223,498
bcbio/bcbio-nextgen
bcbio/distributed/objectstore.py
BlobHandle.blob_properties
def blob_properties(self): """Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. """ if not self._blob_properties: self._blob_properties = self._blob_service.get_blob_properties( container_name=self._container_name...
python
def blob_properties(self): """Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. """ if not self._blob_properties: self._blob_properties = self._blob_service.get_blob_properties( container_name=self._container_name...
[ "def", "blob_properties", "(", "self", ")", ":", "if", "not", "self", ".", "_blob_properties", ":", "self", ".", "_blob_properties", "=", "self", ".", "_blob_service", ".", "get_blob_properties", "(", "container_name", "=", "self", ".", "_container_name", ",", ...
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob.
[ "Returns", "all", "user", "-", "defined", "metadata", "standard", "HTTP", "properties", "and", "system", "properties", "for", "the", "blob", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L154-L162
223,499
bcbio/bcbio-nextgen
bcbio/distributed/objectstore.py
BlobHandle._chunk_offsets
def _chunk_offsets(self): """Iterator over chunk offests.""" index = 0 blob_size = self.blob_properties.get('content-length') while index < blob_size: yield index index = index + self._chunk_size
python
def _chunk_offsets(self): """Iterator over chunk offests.""" index = 0 blob_size = self.blob_properties.get('content-length') while index < blob_size: yield index index = index + self._chunk_size
[ "def", "_chunk_offsets", "(", "self", ")", ":", "index", "=", "0", "blob_size", "=", "self", ".", "blob_properties", ".", "get", "(", "'content-length'", ")", "while", "index", "<", "blob_size", ":", "yield", "index", "index", "=", "index", "+", "self", ...
Iterator over chunk offests.
[ "Iterator", "over", "chunk", "offests", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L164-L170