repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
bcbio/bcbio-nextgen | bcbio/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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | BlobHandle._chunk_iter | def _chunk_iter(self):
"""Iterator over the blob file."""
for chunk_offset in self._chunk_offsets():
yield self._download_chunk(chunk_offset=chunk_offset,
chunk_size=self._chunk_size) | python | def _chunk_iter(self):
"""Iterator over the blob file."""
for chunk_offset in self._chunk_offsets():
yield self._download_chunk(chunk_offset=chunk_offset,
chunk_size=self._chunk_size) | [
"def",
"_chunk_iter",
"(",
"self",
")",
":",
"for",
"chunk_offset",
"in",
"self",
".",
"_chunk_offsets",
"(",
")",
":",
"yield",
"self",
".",
"_download_chunk",
"(",
"chunk_offset",
"=",
"chunk_offset",
",",
"chunk_size",
"=",
"self",
".",
"_chunk_size",
")"... | Iterator over the blob file. | [
"Iterator",
"over",
"the",
"blob",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L172-L176 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.parse_remote | def parse_remote(cls, filename):
"""Parses a remote filename into bucket and key information.
Handles S3 with optional region name specified in key:
BUCKETNAME@REGIONNAME/KEY
"""
parts = filename.split("//")[-1].split("/", 1)
bucket, key = parts if len(parts) == 2 el... | python | def parse_remote(cls, filename):
"""Parses a remote filename into bucket and key information.
Handles S3 with optional region name specified in key:
BUCKETNAME@REGIONNAME/KEY
"""
parts = filename.split("//")[-1].split("/", 1)
bucket, key = parts if len(parts) == 2 el... | [
"def",
"parse_remote",
"(",
"cls",
",",
"filename",
")",
":",
"parts",
"=",
"filename",
".",
"split",
"(",
"\"//\"",
")",
"[",
"-",
"1",
"]",
".",
"split",
"(",
"\"/\"",
",",
"1",
")",
"bucket",
",",
"key",
"=",
"parts",
"if",
"len",
"(",
"parts"... | Parses a remote filename into bucket and key information.
Handles S3 with optional region name specified in key:
BUCKETNAME@REGIONNAME/KEY | [
"Parses",
"a",
"remote",
"filename",
"into",
"bucket",
"and",
"key",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L281-L294 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3._cl_aws_cli | def _cl_aws_cli(cls, file_info, region):
"""Command line required for download using the standard AWS
command line interface.
"""
s3file = cls._S3_FILE % {"bucket": file_info.bucket,
"key": file_info.key,
"region": ""}
... | python | def _cl_aws_cli(cls, file_info, region):
"""Command line required for download using the standard AWS
command line interface.
"""
s3file = cls._S3_FILE % {"bucket": file_info.bucket,
"key": file_info.key,
"region": ""}
... | [
"def",
"_cl_aws_cli",
"(",
"cls",
",",
"file_info",
",",
"region",
")",
":",
"s3file",
"=",
"cls",
".",
"_S3_FILE",
"%",
"{",
"\"bucket\"",
":",
"file_info",
".",
"bucket",
",",
"\"key\"",
":",
"file_info",
".",
"key",
",",
"\"region\"",
":",
"\"\"",
"... | Command line required for download using the standard AWS
command line interface. | [
"Command",
"line",
"required",
"for",
"download",
"using",
"the",
"standard",
"AWS",
"command",
"line",
"interface",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L297-L306 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3._cl_gof3r | def _cl_gof3r(file_info, region):
"""Command line required for download using gof3r."""
command = ["gof3r", "get", "--no-md5",
"-k", file_info.key,
"-b", file_info.bucket]
if region != "us-east-1":
command += ["--endpoint=s3-%s.amazonaws.com" % r... | python | def _cl_gof3r(file_info, region):
"""Command line required for download using gof3r."""
command = ["gof3r", "get", "--no-md5",
"-k", file_info.key,
"-b", file_info.bucket]
if region != "us-east-1":
command += ["--endpoint=s3-%s.amazonaws.com" % r... | [
"def",
"_cl_gof3r",
"(",
"file_info",
",",
"region",
")",
":",
"command",
"=",
"[",
"\"gof3r\"",
",",
"\"get\"",
",",
"\"--no-md5\"",
",",
"\"-k\"",
",",
"file_info",
".",
"key",
",",
"\"-b\"",
",",
"file_info",
".",
"bucket",
"]",
"if",
"region",
"!=",
... | Command line required for download using gof3r. | [
"Command",
"line",
"required",
"for",
"download",
"using",
"gof3r",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L309-L316 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.get_region | def get_region(cls, resource=None):
"""Retrieve region from standard environmental variables
or file name.
More information of the following link: http://goo.gl/Vb9Jky
"""
if resource:
resource_info = cls.parse_remote(resource)
if resource_info.region:
... | python | def get_region(cls, resource=None):
"""Retrieve region from standard environmental variables
or file name.
More information of the following link: http://goo.gl/Vb9Jky
"""
if resource:
resource_info = cls.parse_remote(resource)
if resource_info.region:
... | [
"def",
"get_region",
"(",
"cls",
",",
"resource",
"=",
"None",
")",
":",
"if",
"resource",
":",
"resource_info",
"=",
"cls",
".",
"parse_remote",
"(",
"resource",
")",
"if",
"resource_info",
".",
"region",
":",
"return",
"resource_info",
".",
"region",
"re... | Retrieve region from standard environmental variables
or file name.
More information of the following link: http://goo.gl/Vb9Jky | [
"Retrieve",
"region",
"from",
"standard",
"environmental",
"variables",
"or",
"file",
"name",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L338-L349 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.connect | def connect(cls, resource):
"""Connect to this Region's endpoint.
Returns a connection object pointing to the endpoint associated
to the received resource.
"""
import boto
return boto.s3.connect_to_region(cls.get_region(resource)) | python | def connect(cls, resource):
"""Connect to this Region's endpoint.
Returns a connection object pointing to the endpoint associated
to the received resource.
"""
import boto
return boto.s3.connect_to_region(cls.get_region(resource)) | [
"def",
"connect",
"(",
"cls",
",",
"resource",
")",
":",
"import",
"boto",
"return",
"boto",
".",
"s3",
".",
"connect_to_region",
"(",
"cls",
".",
"get_region",
"(",
"resource",
")",
")"
] | Connect to this Region's endpoint.
Returns a connection object pointing to the endpoint associated
to the received resource. | [
"Connect",
"to",
"this",
"Region",
"s",
"endpoint",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L362-L369 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.open | def open(cls, filename):
"""Return a handle like object for streaming from S3."""
import boto
file_info = cls.parse_remote(filename)
connection = cls.connect(filename)
try:
s3_bucket = connection.get_bucket(file_info.bucket)
except boto.exception.S3ResponseErr... | python | def open(cls, filename):
"""Return a handle like object for streaming from S3."""
import boto
file_info = cls.parse_remote(filename)
connection = cls.connect(filename)
try:
s3_bucket = connection.get_bucket(file_info.bucket)
except boto.exception.S3ResponseErr... | [
"def",
"open",
"(",
"cls",
",",
"filename",
")",
":",
"import",
"boto",
"file_info",
"=",
"cls",
".",
"parse_remote",
"(",
"filename",
")",
"connection",
"=",
"cls",
".",
"connect",
"(",
"filename",
")",
"try",
":",
"s3_bucket",
"=",
"connection",
".",
... | Return a handle like object for streaming from S3. | [
"Return",
"a",
"handle",
"like",
"object",
"for",
"streaming",
"from",
"S3",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L434-L453 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AzureBlob.parse_remote | def parse_remote(cls, filename):
"""Parses a remote filename into blob information."""
blob_file = cls._URL_FORMAT.search(filename)
return cls._REMOTE_FILE("blob",
storage=blob_file.group("storage"),
container=blob_file.group("conta... | python | def parse_remote(cls, filename):
"""Parses a remote filename into blob information."""
blob_file = cls._URL_FORMAT.search(filename)
return cls._REMOTE_FILE("blob",
storage=blob_file.group("storage"),
container=blob_file.group("conta... | [
"def",
"parse_remote",
"(",
"cls",
",",
"filename",
")",
":",
"blob_file",
"=",
"cls",
".",
"_URL_FORMAT",
".",
"search",
"(",
"filename",
")",
"return",
"cls",
".",
"_REMOTE_FILE",
"(",
"\"blob\"",
",",
"storage",
"=",
"blob_file",
".",
"group",
"(",
"\... | Parses a remote filename into blob information. | [
"Parses",
"a",
"remote",
"filename",
"into",
"blob",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L479-L485 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AzureBlob.connect | def connect(cls, resource):
"""Returns a connection object pointing to the endpoint
associated to the received resource.
"""
from azure import storage as azure_storage
file_info = cls.parse_remote(resource)
return azure_storage.BlobService(file_info.storage) | python | def connect(cls, resource):
"""Returns a connection object pointing to the endpoint
associated to the received resource.
"""
from azure import storage as azure_storage
file_info = cls.parse_remote(resource)
return azure_storage.BlobService(file_info.storage) | [
"def",
"connect",
"(",
"cls",
",",
"resource",
")",
":",
"from",
"azure",
"import",
"storage",
"as",
"azure_storage",
"file_info",
"=",
"cls",
".",
"parse_remote",
"(",
"resource",
")",
"return",
"azure_storage",
".",
"BlobService",
"(",
"file_info",
".",
"s... | Returns a connection object pointing to the endpoint
associated to the received resource. | [
"Returns",
"a",
"connection",
"object",
"pointing",
"to",
"the",
"endpoint",
"associated",
"to",
"the",
"received",
"resource",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L488-L494 | train |
bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AzureBlob.open | def open(cls, filename):
"""Provide a handle-like object for streaming."""
file_info = cls.parse_remote(filename)
blob_service = cls.connect(filename)
return BlobHandle(blob_service=blob_service,
container=file_info.container,
blob=file... | python | def open(cls, filename):
"""Provide a handle-like object for streaming."""
file_info = cls.parse_remote(filename)
blob_service = cls.connect(filename)
return BlobHandle(blob_service=blob_service,
container=file_info.container,
blob=file... | [
"def",
"open",
"(",
"cls",
",",
"filename",
")",
":",
"file_info",
"=",
"cls",
".",
"parse_remote",
"(",
"filename",
")",
"blob_service",
"=",
"cls",
".",
"connect",
"(",
"filename",
")",
"return",
"BlobHandle",
"(",
"blob_service",
"=",
"blob_service",
",... | Provide a handle-like object for streaming. | [
"Provide",
"a",
"handle",
"-",
"like",
"object",
"for",
"streaming",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L538-L545 | train |
bcbio/bcbio-nextgen | bcbio/bam/cram.py | compress | def compress(in_bam, data):
"""Compress a BAM file to CRAM, providing indexed CRAM file.
Does 8 bin compression of quality score and read name removal
using bamUtils squeeze if `cram` specified:
http://genome.sph.umich.edu/wiki/BamUtil:_squeeze
Otherwise does `cram-lossless` which only converts t... | python | def compress(in_bam, data):
"""Compress a BAM file to CRAM, providing indexed CRAM file.
Does 8 bin compression of quality score and read name removal
using bamUtils squeeze if `cram` specified:
http://genome.sph.umich.edu/wiki/BamUtil:_squeeze
Otherwise does `cram-lossless` which only converts t... | [
"def",
"compress",
"(",
"in_bam",
",",
"data",
")",
":",
"out_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"archive\"",
")",
")",
"out_file",
"=",
"os",
".",
... | Compress a BAM file to CRAM, providing indexed CRAM file.
Does 8 bin compression of quality score and read name removal
using bamUtils squeeze if `cram` specified:
http://genome.sph.umich.edu/wiki/BamUtil:_squeeze
Otherwise does `cram-lossless` which only converts to CRAM. | [
"Compress",
"a",
"BAM",
"file",
"to",
"CRAM",
"providing",
"indexed",
"CRAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/cram.py#L14-L52 | train |
bcbio/bcbio-nextgen | bcbio/bam/cram.py | index | def index(in_cram, config):
"""Ensure CRAM file has a .crai index file.
"""
out_file = in_cram + ".crai"
if not utils.file_uptodate(out_file, in_cram):
with file_transaction(config, in_cram + ".crai") as tx_out_file:
tx_in_file = os.path.splitext(tx_out_file)[0]
utils.sym... | python | def index(in_cram, config):
"""Ensure CRAM file has a .crai index file.
"""
out_file = in_cram + ".crai"
if not utils.file_uptodate(out_file, in_cram):
with file_transaction(config, in_cram + ".crai") as tx_out_file:
tx_in_file = os.path.splitext(tx_out_file)[0]
utils.sym... | [
"def",
"index",
"(",
"in_cram",
",",
"config",
")",
":",
"out_file",
"=",
"in_cram",
"+",
"\".crai\"",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"in_cram",
")",
":",
"with",
"file_transaction",
"(",
"config",
",",
"in_cram",
"+",
... | Ensure CRAM file has a .crai index file. | [
"Ensure",
"CRAM",
"file",
"has",
"a",
".",
"crai",
"index",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/cram.py#L54-L64 | train |
bcbio/bcbio-nextgen | bcbio/bam/cram.py | to_bam | def to_bam(in_file, out_file, data):
"""Convert CRAM file into BAM.
"""
if not utils.file_uptodate(out_file, in_file):
with file_transaction(data, out_file) as tx_out_file:
cmd = ["samtools", "view", "-O", "BAM", "-o", tx_out_file, in_file]
do.run(cmd, "Convert CRAM to BAM")
... | python | def to_bam(in_file, out_file, data):
"""Convert CRAM file into BAM.
"""
if not utils.file_uptodate(out_file, in_file):
with file_transaction(data, out_file) as tx_out_file:
cmd = ["samtools", "view", "-O", "BAM", "-o", tx_out_file, in_file]
do.run(cmd, "Convert CRAM to BAM")
... | [
"def",
"to_bam",
"(",
"in_file",
",",
"out_file",
",",
"data",
")",
":",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"in_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"cmd"... | Convert CRAM file into BAM. | [
"Convert",
"CRAM",
"file",
"into",
"BAM",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/cram.py#L66-L74 | train |
bcbio/bcbio-nextgen | bcbio/distributed/prun.py | start | def start(parallel, items, config, dirs=None, name=None, multiplier=1,
max_multicore=None):
"""Start a parallel cluster or machines to be used for running remote
functions.
Returns a function used to process, in parallel items with a given function.
Allows sharing of a single cluster across ... | python | def start(parallel, items, config, dirs=None, name=None, multiplier=1,
max_multicore=None):
"""Start a parallel cluster or machines to be used for running remote
functions.
Returns a function used to process, in parallel items with a given function.
Allows sharing of a single cluster across ... | [
"def",
"start",
"(",
"parallel",
",",
"items",
",",
"config",
",",
"dirs",
"=",
"None",
",",
"name",
"=",
"None",
",",
"multiplier",
"=",
"1",
",",
"max_multicore",
"=",
"None",
")",
":",
"if",
"name",
":",
"checkpoint_dir",
"=",
"utils",
".",
"safe_... | Start a parallel cluster or machines to be used for running remote
functions.
Returns a function used to process, in parallel items with a given function.
Allows sharing of a single cluster across multiple functions with
identical resource requirements. Uses local execution for non-distributed
clu... | [
"Start",
"a",
"parallel",
"cluster",
"or",
"machines",
"to",
"be",
"used",
"for",
"running",
"remote",
"functions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/prun.py#L12-L69 | train |
bcbio/bcbio-nextgen | scripts/utils/broad_redo_analysis.py | recalibrate_quality | def recalibrate_quality(bam_file, sam_ref, dbsnp_file, picard_dir):
"""Recalibrate alignments with GATK and provide pdf summary.
"""
cl = ["picard_gatk_recalibrate.py", picard_dir, sam_ref, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl)
out_file = glob.glob("%s*... | python | def recalibrate_quality(bam_file, sam_ref, dbsnp_file, picard_dir):
"""Recalibrate alignments with GATK and provide pdf summary.
"""
cl = ["picard_gatk_recalibrate.py", picard_dir, sam_ref, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl)
out_file = glob.glob("%s*... | [
"def",
"recalibrate_quality",
"(",
"bam_file",
",",
"sam_ref",
",",
"dbsnp_file",
",",
"picard_dir",
")",
":",
"cl",
"=",
"[",
"\"picard_gatk_recalibrate.py\"",
",",
"picard_dir",
",",
"sam_ref",
",",
"bam_file",
"]",
"if",
"dbsnp_file",
":",
"cl",
".",
"appen... | Recalibrate alignments with GATK and provide pdf summary. | [
"Recalibrate",
"alignments",
"with",
"GATK",
"and",
"provide",
"pdf",
"summary",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/broad_redo_analysis.py#L98-L106 | train |
bcbio/bcbio-nextgen | scripts/utils/broad_redo_analysis.py | run_genotyper | def run_genotyper(bam_file, ref_file, dbsnp_file, config_file):
"""Perform SNP genotyping and analysis using GATK.
"""
cl = ["gatk_genotyper.py", config_file, ref_file, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl) | python | def run_genotyper(bam_file, ref_file, dbsnp_file, config_file):
"""Perform SNP genotyping and analysis using GATK.
"""
cl = ["gatk_genotyper.py", config_file, ref_file, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl) | [
"def",
"run_genotyper",
"(",
"bam_file",
",",
"ref_file",
",",
"dbsnp_file",
",",
"config_file",
")",
":",
"cl",
"=",
"[",
"\"gatk_genotyper.py\"",
",",
"config_file",
",",
"ref_file",
",",
"bam_file",
"]",
"if",
"dbsnp_file",
":",
"cl",
".",
"append",
"(",
... | Perform SNP genotyping and analysis using GATK. | [
"Perform",
"SNP",
"genotyping",
"and",
"analysis",
"using",
"GATK",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/broad_redo_analysis.py#L108-L114 | train |
bcbio/bcbio-nextgen | bcbio/structural/battenberg.py | _do_run | def _do_run(paired):
"""Perform Battenberg caling with the paired dataset.
This purposely does not use a temporary directory for the output
since Battenberg does smart restarts.
"""
work_dir = _sv_workdir(paired.tumor_data)
out = _get_battenberg_out(paired, work_dir)
ignore_file = os.path.j... | python | def _do_run(paired):
"""Perform Battenberg caling with the paired dataset.
This purposely does not use a temporary directory for the output
since Battenberg does smart restarts.
"""
work_dir = _sv_workdir(paired.tumor_data)
out = _get_battenberg_out(paired, work_dir)
ignore_file = os.path.j... | [
"def",
"_do_run",
"(",
"paired",
")",
":",
"work_dir",
"=",
"_sv_workdir",
"(",
"paired",
".",
"tumor_data",
")",
"out",
"=",
"_get_battenberg_out",
"(",
"paired",
",",
"work_dir",
")",
"ignore_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
... | Perform Battenberg caling with the paired dataset.
This purposely does not use a temporary directory for the output
since Battenberg does smart restarts. | [
"Perform",
"Battenberg",
"caling",
"with",
"the",
"paired",
"dataset",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/battenberg.py#L40-L77 | train |
bcbio/bcbio-nextgen | bcbio/structural/battenberg.py | _make_ignore_file | def _make_ignore_file(work_dir, ref_file, ignore_file, impute_file):
"""Create input files with chromosomes to ignore and gender loci.
"""
gl_file = os.path.join(work_dir, "gender_loci.txt")
chroms = set([])
with open(impute_file) as in_handle:
for line in in_handle:
chrom = line... | python | def _make_ignore_file(work_dir, ref_file, ignore_file, impute_file):
"""Create input files with chromosomes to ignore and gender loci.
"""
gl_file = os.path.join(work_dir, "gender_loci.txt")
chroms = set([])
with open(impute_file) as in_handle:
for line in in_handle:
chrom = line... | [
"def",
"_make_ignore_file",
"(",
"work_dir",
",",
"ref_file",
",",
"ignore_file",
",",
"impute_file",
")",
":",
"gl_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"gender_loci.txt\"",
")",
"chroms",
"=",
"set",
"(",
"[",
"]",
")",
"w... | Create input files with chromosomes to ignore and gender loci. | [
"Create",
"input",
"files",
"with",
"chromosomes",
"to",
"ignore",
"and",
"gender",
"loci",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/battenberg.py#L79-L101 | train |
bcbio/bcbio-nextgen | bcbio/illumina/transfer.py | copy_flowcell | def copy_flowcell(dname, fastq_dir, sample_cfile, config):
"""Copy required files for processing using rsync, potentially to a remote server.
"""
with utils.chdir(dname):
reports = reduce(operator.add,
[glob.glob("*.xml"),
glob.glob("Data/Intensitie... | python | def copy_flowcell(dname, fastq_dir, sample_cfile, config):
"""Copy required files for processing using rsync, potentially to a remote server.
"""
with utils.chdir(dname):
reports = reduce(operator.add,
[glob.glob("*.xml"),
glob.glob("Data/Intensitie... | [
"def",
"copy_flowcell",
"(",
"dname",
",",
"fastq_dir",
",",
"sample_cfile",
",",
"config",
")",
":",
"with",
"utils",
".",
"chdir",
"(",
"dname",
")",
":",
"reports",
"=",
"reduce",
"(",
"operator",
".",
"add",
",",
"[",
"glob",
".",
"glob",
"(",
"\... | Copy required files for processing using rsync, potentially to a remote server. | [
"Copy",
"required",
"files",
"for",
"processing",
"using",
"rsync",
"potentially",
"to",
"a",
"remote",
"server",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/transfer.py#L12-L46 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | _umis_cmd | def _umis_cmd(data):
"""Return umis command line argument, with correct python and locale.
"""
return "%s %s %s" % (utils.locale_export(),
utils.get_program_python("umis"),
config_utils.get_program("umis", data["config"], default="umis")) | python | def _umis_cmd(data):
"""Return umis command line argument, with correct python and locale.
"""
return "%s %s %s" % (utils.locale_export(),
utils.get_program_python("umis"),
config_utils.get_program("umis", data["config"], default="umis")) | [
"def",
"_umis_cmd",
"(",
"data",
")",
":",
"return",
"\"%s %s %s\"",
"%",
"(",
"utils",
".",
"locale_export",
"(",
")",
",",
"utils",
".",
"get_program_python",
"(",
"\"umis\"",
")",
",",
"config_utils",
".",
"get_program",
"(",
"\"umis\"",
",",
"data",
"[... | Return umis command line argument, with correct python and locale. | [
"Return",
"umis",
"command",
"line",
"argument",
"with",
"correct",
"python",
"and",
"locale",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L119-L124 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | demultiplex_samples | def demultiplex_samples(data):
"""
demultiplex a fastqtransformed FASTQ file into separate sample barcode files
"""
work_dir = os.path.join(dd.get_work_dir(data), "umis")
sample_dir = os.path.join(work_dir, dd.get_sample_name(data))
demulti_dir = os.path.join(sample_dir, "demultiplexed")
fi... | python | def demultiplex_samples(data):
"""
demultiplex a fastqtransformed FASTQ file into separate sample barcode files
"""
work_dir = os.path.join(dd.get_work_dir(data), "umis")
sample_dir = os.path.join(work_dir, dd.get_sample_name(data))
demulti_dir = os.path.join(sample_dir, "demultiplexed")
fi... | [
"def",
"demultiplex_samples",
"(",
"data",
")",
":",
"work_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"umis\"",
")",
"sample_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"dd... | demultiplex a fastqtransformed FASTQ file into separate sample barcode files | [
"demultiplex",
"a",
"fastqtransformed",
"FASTQ",
"file",
"into",
"separate",
"sample",
"barcode",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L359-L391 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | split_demultiplexed_sampledata | def split_demultiplexed_sampledata(data, demultiplexed):
"""
splits demultiplexed samples into separate entries in the global sample
datadict
"""
datadicts = []
samplename = dd.get_sample_name(data)
for fastq in demultiplexed:
barcode = os.path.basename(fastq).split(".")[0]
d... | python | def split_demultiplexed_sampledata(data, demultiplexed):
"""
splits demultiplexed samples into separate entries in the global sample
datadict
"""
datadicts = []
samplename = dd.get_sample_name(data)
for fastq in demultiplexed:
barcode = os.path.basename(fastq).split(".")[0]
d... | [
"def",
"split_demultiplexed_sampledata",
"(",
"data",
",",
"demultiplexed",
")",
":",
"datadicts",
"=",
"[",
"]",
"samplename",
"=",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
"for",
"fastq",
"in",
"demultiplexed",
":",
"barcode",
"=",
"os",
".",
"path"... | splits demultiplexed samples into separate entries in the global sample
datadict | [
"splits",
"demultiplexed",
"samples",
"into",
"separate",
"entries",
"in",
"the",
"global",
"sample",
"datadict"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L393-L409 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | is_transformed | def is_transformed(fastq):
"""
check the first 100 reads to see if a FASTQ file has already been transformed
by umis
"""
with open_fastq(fastq) as in_handle:
for line in islice(in_handle, 400):
if "UMI_" in line:
return True
return False | python | def is_transformed(fastq):
"""
check the first 100 reads to see if a FASTQ file has already been transformed
by umis
"""
with open_fastq(fastq) as in_handle:
for line in islice(in_handle, 400):
if "UMI_" in line:
return True
return False | [
"def",
"is_transformed",
"(",
"fastq",
")",
":",
"with",
"open_fastq",
"(",
"fastq",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"islice",
"(",
"in_handle",
",",
"400",
")",
":",
"if",
"\"UMI_\"",
"in",
"line",
":",
"return",
"True",
"return",
"F... | check the first 100 reads to see if a FASTQ file has already been transformed
by umis | [
"check",
"the",
"first",
"100",
"reads",
"to",
"see",
"if",
"a",
"FASTQ",
"file",
"has",
"already",
"been",
"transformed",
"by",
"umis"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L504-L514 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | SparseMatrix.read | def read(self, filename, rowprefix=None, colprefix=None, delim=":"):
"""read a sparse matrix, loading row and column name files. if
specified, will add a prefix to the row or column names"""
self.matrix = scipy.io.mmread(filename)
with open(filename + ".rownames") as in_handle:
... | python | def read(self, filename, rowprefix=None, colprefix=None, delim=":"):
"""read a sparse matrix, loading row and column name files. if
specified, will add a prefix to the row or column names"""
self.matrix = scipy.io.mmread(filename)
with open(filename + ".rownames") as in_handle:
... | [
"def",
"read",
"(",
"self",
",",
"filename",
",",
"rowprefix",
"=",
"None",
",",
"colprefix",
"=",
"None",
",",
"delim",
"=",
"\":\"",
")",
":",
"self",
".",
"matrix",
"=",
"scipy",
".",
"io",
".",
"mmread",
"(",
"filename",
")",
"with",
"open",
"(... | read a sparse matrix, loading row and column name files. if
specified, will add a prefix to the row or column names | [
"read",
"a",
"sparse",
"matrix",
"loading",
"row",
"and",
"column",
"name",
"files",
".",
"if",
"specified",
"will",
"add",
"a",
"prefix",
"to",
"the",
"row",
"or",
"column",
"names"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L42-L54 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | SparseMatrix.write | def write(self, filename):
"""read a sparse matrix, loading row and column name files"""
if file_exists(filename):
return filename
out_files = [filename, filename + ".rownames", filename + ".colnames"]
with file_transaction(out_files) as tx_out_files:
with open(tx... | python | def write(self, filename):
"""read a sparse matrix, loading row and column name files"""
if file_exists(filename):
return filename
out_files = [filename, filename + ".rownames", filename + ".colnames"]
with file_transaction(out_files) as tx_out_files:
with open(tx... | [
"def",
"write",
"(",
"self",
",",
"filename",
")",
":",
"if",
"file_exists",
"(",
"filename",
")",
":",
"return",
"filename",
"out_files",
"=",
"[",
"filename",
",",
"filename",
"+",
"\".rownames\"",
",",
"filename",
"+",
"\".colnames\"",
"]",
"with",
"fil... | read a sparse matrix, loading row and column name files | [
"read",
"a",
"sparse",
"matrix",
"loading",
"row",
"and",
"column",
"name",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L56-L66 | train |
bcbio/bcbio-nextgen | bcbio/srna/sample.py | sample_annotation | def sample_annotation(data):
"""
Annotate miRNAs using miRBase database with seqbuster tool
"""
names = data["rgnames"]['sample']
tools = dd.get_expression_caller(data)
work_dir = os.path.join(dd.get_work_dir(data), "mirbase")
out_dir = os.path.join(work_dir, names)
utils.safe_makedir(ou... | python | def sample_annotation(data):
"""
Annotate miRNAs using miRBase database with seqbuster tool
"""
names = data["rgnames"]['sample']
tools = dd.get_expression_caller(data)
work_dir = os.path.join(dd.get_work_dir(data), "mirbase")
out_dir = os.path.join(work_dir, names)
utils.safe_makedir(ou... | [
"def",
"sample_annotation",
"(",
"data",
")",
":",
"names",
"=",
"data",
"[",
"\"rgnames\"",
"]",
"[",
"'sample'",
"]",
"tools",
"=",
"dd",
".",
"get_expression_caller",
"(",
"data",
")",
"work_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",... | Annotate miRNAs using miRBase database with seqbuster tool | [
"Annotate",
"miRNAs",
"using",
"miRBase",
"database",
"with",
"seqbuster",
"tool"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L106-L149 | train |
bcbio/bcbio-nextgen | bcbio/srna/sample.py | _prepare_file | def _prepare_file(fn, out_dir):
"""Cut the beginning of the reads to avoid detection of miRNAs"""
atropos = _get_atropos()
cmd = "{atropos} trim --max-reads 500000 -u 22 -se {fn} -o {tx_file}"
out_file = os.path.join(out_dir, append_stem(os.path.basename(fn), "end"))
if file_exists(out_file):
... | python | def _prepare_file(fn, out_dir):
"""Cut the beginning of the reads to avoid detection of miRNAs"""
atropos = _get_atropos()
cmd = "{atropos} trim --max-reads 500000 -u 22 -se {fn} -o {tx_file}"
out_file = os.path.join(out_dir, append_stem(os.path.basename(fn), "end"))
if file_exists(out_file):
... | [
"def",
"_prepare_file",
"(",
"fn",
",",
"out_dir",
")",
":",
"atropos",
"=",
"_get_atropos",
"(",
")",
"cmd",
"=",
"\"{atropos} trim --max-reads 500000 -u 22 -se {fn} -o {tx_file}\"",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"append_st... | Cut the beginning of the reads to avoid detection of miRNAs | [
"Cut",
"the",
"beginning",
"of",
"the",
"reads",
"to",
"avoid",
"detection",
"of",
"miRNAs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L151-L160 | train |
bcbio/bcbio-nextgen | bcbio/srna/sample.py | _collapse | def _collapse(in_file):
"""
Collpase reads into unique sequences with seqcluster
"""
seqcluster = op.join(utils.get_bcbio_bin(), "seqcluster")
out_file = "%s.fastq" % utils.splitext_plus(append_stem(in_file, "_trimmed"))[0]
out_dir = os.path.dirname(in_file)
if file_exists(out_file):
... | python | def _collapse(in_file):
"""
Collpase reads into unique sequences with seqcluster
"""
seqcluster = op.join(utils.get_bcbio_bin(), "seqcluster")
out_file = "%s.fastq" % utils.splitext_plus(append_stem(in_file, "_trimmed"))[0]
out_dir = os.path.dirname(in_file)
if file_exists(out_file):
... | [
"def",
"_collapse",
"(",
"in_file",
")",
":",
"seqcluster",
"=",
"op",
".",
"join",
"(",
"utils",
".",
"get_bcbio_bin",
"(",
")",
",",
"\"seqcluster\"",
")",
"out_file",
"=",
"\"%s.fastq\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"append_stem",
"(",
"in_... | Collpase reads into unique sequences with seqcluster | [
"Collpase",
"reads",
"into",
"unique",
"sequences",
"with",
"seqcluster"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L180-L191 | train |
bcbio/bcbio-nextgen | bcbio/srna/sample.py | _summary | def _summary(in_file):
"""
Calculate size distribution after adapter removal
"""
data = Counter()
out_file = in_file + "_size_stats"
if file_exists(out_file):
return out_file
with open(in_file) as in_handle:
for line in in_handle:
counts = int(line.strip().split("... | python | def _summary(in_file):
"""
Calculate size distribution after adapter removal
"""
data = Counter()
out_file = in_file + "_size_stats"
if file_exists(out_file):
return out_file
with open(in_file) as in_handle:
for line in in_handle:
counts = int(line.strip().split("... | [
"def",
"_summary",
"(",
"in_file",
")",
":",
"data",
"=",
"Counter",
"(",
")",
"out_file",
"=",
"in_file",
"+",
"\"_size_stats\"",
"if",
"file_exists",
"(",
"out_file",
")",
":",
"return",
"out_file",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",... | Calculate size distribution after adapter removal | [
"Calculate",
"size",
"distribution",
"after",
"adapter",
"removal"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L193-L213 | train |
bcbio/bcbio-nextgen | bcbio/srna/sample.py | _mirtop | def _mirtop(input_fn, sps, db, out_dir, config):
"""
Convert to GFF3 standard format
"""
hairpin = os.path.join(db, "hairpin.fa")
gtf = os.path.join(db, "mirbase.gff3")
if not file_exists(hairpin) or not file_exists(gtf):
logger.warning("%s or %s are not installed. Skipping." % (hairpin,... | python | def _mirtop(input_fn, sps, db, out_dir, config):
"""
Convert to GFF3 standard format
"""
hairpin = os.path.join(db, "hairpin.fa")
gtf = os.path.join(db, "mirbase.gff3")
if not file_exists(hairpin) or not file_exists(gtf):
logger.warning("%s or %s are not installed. Skipping." % (hairpin,... | [
"def",
"_mirtop",
"(",
"input_fn",
",",
"sps",
",",
"db",
",",
"out_dir",
",",
"config",
")",
":",
"hairpin",
"=",
"os",
".",
"path",
".",
"join",
"(",
"db",
",",
"\"hairpin.fa\"",
")",
"gtf",
"=",
"os",
".",
"path",
".",
"join",
"(",
"db",
",",
... | Convert to GFF3 standard format | [
"Convert",
"to",
"GFF3",
"standard",
"format"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L254-L281 | train |
bcbio/bcbio-nextgen | bcbio/srna/sample.py | _trna_annotation | def _trna_annotation(data):
"""
use tDRmapper to quantify tRNAs
"""
trna_ref = op.join(dd.get_srna_trna_file(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "trna", name))
in_file = op.basename(data["clean_fastq"])
tdrmapper = os.p... | python | def _trna_annotation(data):
"""
use tDRmapper to quantify tRNAs
"""
trna_ref = op.join(dd.get_srna_trna_file(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "trna", name))
in_file = op.basename(data["clean_fastq"])
tdrmapper = os.p... | [
"def",
"_trna_annotation",
"(",
"data",
")",
":",
"trna_ref",
"=",
"op",
".",
"join",
"(",
"dd",
".",
"get_srna_trna_file",
"(",
"data",
")",
")",
"name",
"=",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
"work_dir",
"=",
"utils",
".",
"safe_makedir",... | use tDRmapper to quantify tRNAs | [
"use",
"tDRmapper",
"to",
"quantify",
"tRNAs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L283-L305 | train |
bcbio/bcbio-nextgen | bcbio/srna/sample.py | _mint_trna_annotation | def _mint_trna_annotation(data):
"""
use MINTmap to quantify tRNAs
"""
trna_lookup = op.join(dd.get_srna_mint_lookup(data))
trna_space = op.join(dd.get_srna_mint_space(data))
trna_other = op.join(dd.get_srna_mint_other(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(... | python | def _mint_trna_annotation(data):
"""
use MINTmap to quantify tRNAs
"""
trna_lookup = op.join(dd.get_srna_mint_lookup(data))
trna_space = op.join(dd.get_srna_mint_space(data))
trna_other = op.join(dd.get_srna_mint_other(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(... | [
"def",
"_mint_trna_annotation",
"(",
"data",
")",
":",
"trna_lookup",
"=",
"op",
".",
"join",
"(",
"dd",
".",
"get_srna_mint_lookup",
"(",
"data",
")",
")",
"trna_space",
"=",
"op",
".",
"join",
"(",
"dd",
".",
"get_srna_mint_space",
"(",
"data",
")",
")... | use MINTmap to quantify tRNAs | [
"use",
"MINTmap",
"to",
"quantify",
"tRNAs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L307-L334 | train |
bcbio/bcbio-nextgen | bcbio/bam/fasta.py | sequence_length | def sequence_length(fasta):
"""
return a dict of the lengths of sequences in a fasta file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = {record.id: len(record) for record in sequences}
return records | python | def sequence_length(fasta):
"""
return a dict of the lengths of sequences in a fasta file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = {record.id: len(record) for record in sequences}
return records | [
"def",
"sequence_length",
"(",
"fasta",
")",
":",
"sequences",
"=",
"SeqIO",
".",
"parse",
"(",
"fasta",
",",
"\"fasta\"",
")",
"records",
"=",
"{",
"record",
".",
"id",
":",
"len",
"(",
"record",
")",
"for",
"record",
"in",
"sequences",
"}",
"return",... | return a dict of the lengths of sequences in a fasta file | [
"return",
"a",
"dict",
"of",
"the",
"lengths",
"of",
"sequences",
"in",
"a",
"fasta",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fasta.py#L5-L11 | train |
bcbio/bcbio-nextgen | bcbio/bam/fasta.py | sequence_names | def sequence_names(fasta):
"""
return a list of the sequence IDs in a FASTA file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = [record.id for record in sequences]
return records | python | def sequence_names(fasta):
"""
return a list of the sequence IDs in a FASTA file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = [record.id for record in sequences]
return records | [
"def",
"sequence_names",
"(",
"fasta",
")",
":",
"sequences",
"=",
"SeqIO",
".",
"parse",
"(",
"fasta",
",",
"\"fasta\"",
")",
"records",
"=",
"[",
"record",
".",
"id",
"for",
"record",
"in",
"sequences",
"]",
"return",
"records"
] | return a list of the sequence IDs in a FASTA file | [
"return",
"a",
"list",
"of",
"the",
"sequence",
"IDs",
"in",
"a",
"FASTA",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fasta.py#L13-L19 | train |
bcbio/bcbio-nextgen | bcbio/srna/mirdeep.py | _prepare_inputs | def _prepare_inputs(ma_fn, bam_file, out_dir):
"""
Convert to fastq with counts
"""
fixed_fa = os.path.join(out_dir, "file_reads.fa")
count_name =dict()
with file_transaction(fixed_fa) as out_tx:
with open(out_tx, 'w') as out_handle:
with open(ma_fn) as in_handle:
... | python | def _prepare_inputs(ma_fn, bam_file, out_dir):
"""
Convert to fastq with counts
"""
fixed_fa = os.path.join(out_dir, "file_reads.fa")
count_name =dict()
with file_transaction(fixed_fa) as out_tx:
with open(out_tx, 'w') as out_handle:
with open(ma_fn) as in_handle:
... | [
"def",
"_prepare_inputs",
"(",
"ma_fn",
",",
"bam_file",
",",
"out_dir",
")",
":",
"fixed_fa",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"file_reads.fa\"",
")",
"count_name",
"=",
"dict",
"(",
")",
"with",
"file_transaction",
"(",
"fixed_... | Convert to fastq with counts | [
"Convert",
"to",
"fastq",
"with",
"counts"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirdeep.py#L52-L74 | train |
bcbio/bcbio-nextgen | bcbio/srna/mirdeep.py | _parse_novel | def _parse_novel(csv_file, sps="new"):
"""Create input of novel miRNAs from miRDeep2"""
read = 0
seen = set()
safe_makedir("novel")
with open("novel/hairpin.fa", "w") as fa_handle, open("novel/miRNA.str", "w") as str_handle:
with open(csv_file) as in_handle:
for line in in_handle... | python | def _parse_novel(csv_file, sps="new"):
"""Create input of novel miRNAs from miRDeep2"""
read = 0
seen = set()
safe_makedir("novel")
with open("novel/hairpin.fa", "w") as fa_handle, open("novel/miRNA.str", "w") as str_handle:
with open(csv_file) as in_handle:
for line in in_handle... | [
"def",
"_parse_novel",
"(",
"csv_file",
",",
"sps",
"=",
"\"new\"",
")",
":",
"read",
"=",
"0",
"seen",
"=",
"set",
"(",
")",
"safe_makedir",
"(",
"\"novel\"",
")",
"with",
"open",
"(",
"\"novel/hairpin.fa\"",
",",
"\"w\"",
")",
"as",
"fa_handle",
",",
... | Create input of novel miRNAs from miRDeep2 | [
"Create",
"input",
"of",
"novel",
"miRNAs",
"from",
"miRDeep2"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirdeep.py#L76-L105 | train |
bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _run_smoove | def _run_smoove(full_bams, sr_bams, disc_bams, work_dir, items):
"""Run lumpy-sv using smoove.
"""
batch = sshared.get_cur_batch(items)
ext = "-%s-svs" % batch if batch else "-svs"
name = "%s%s" % (dd.get_sample_name(items[0]), ext)
out_file = os.path.join(work_dir, "%s-smoove.genotyped.vcf.gz" ... | python | def _run_smoove(full_bams, sr_bams, disc_bams, work_dir, items):
"""Run lumpy-sv using smoove.
"""
batch = sshared.get_cur_batch(items)
ext = "-%s-svs" % batch if batch else "-svs"
name = "%s%s" % (dd.get_sample_name(items[0]), ext)
out_file = os.path.join(work_dir, "%s-smoove.genotyped.vcf.gz" ... | [
"def",
"_run_smoove",
"(",
"full_bams",
",",
"sr_bams",
",",
"disc_bams",
",",
"work_dir",
",",
"items",
")",
":",
"batch",
"=",
"sshared",
".",
"get_cur_batch",
"(",
"items",
")",
"ext",
"=",
"\"-%s-svs\"",
"%",
"batch",
"if",
"batch",
"else",
"\"-svs\"",... | Run lumpy-sv using smoove. | [
"Run",
"lumpy",
"-",
"sv",
"using",
"smoove",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L28-L71 | train |
bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _filter_by_support | def _filter_by_support(in_file, data):
"""Filter call file based on supporting evidence, adding FILTER annotations to VCF.
Filters based on the following criteria:
- Minimum read support for the call (SU = total support)
- Large calls need split read evidence.
"""
rc_filter = ("FORMAT/SU < ... | python | def _filter_by_support(in_file, data):
"""Filter call file based on supporting evidence, adding FILTER annotations to VCF.
Filters based on the following criteria:
- Minimum read support for the call (SU = total support)
- Large calls need split read evidence.
"""
rc_filter = ("FORMAT/SU < ... | [
"def",
"_filter_by_support",
"(",
"in_file",
",",
"data",
")",
":",
"rc_filter",
"=",
"(",
"\"FORMAT/SU < 4 || \"",
"\"(FORMAT/SR == 0 && FORMAT/SU < 15 && ABS(SVLEN)>50000) || \"",
"\"(FORMAT/SR == 0 && FORMAT/SU < 5 && ABS(SVLEN)<2000) || \"",
"\"(FORMAT/SR == 0 && FORMAT/SU < 15 && AB... | Filter call file based on supporting evidence, adding FILTER annotations to VCF.
Filters based on the following criteria:
- Minimum read support for the call (SU = total support)
- Large calls need split read evidence. | [
"Filter",
"call",
"file",
"based",
"on",
"supporting",
"evidence",
"adding",
"FILTER",
"annotations",
"to",
"VCF",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L104-L116 | train |
bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _filter_by_background | def _filter_by_background(base_name, back_samples, gt_vcfs, data):
"""Filter base samples, marking any also present in the background.
"""
filtname = "InBackground"
filtdoc = "Variant also present in background samples with same genotype"
orig_vcf = gt_vcfs[base_name]
out_file = "%s-backfilter.v... | python | def _filter_by_background(base_name, back_samples, gt_vcfs, data):
"""Filter base samples, marking any also present in the background.
"""
filtname = "InBackground"
filtdoc = "Variant also present in background samples with same genotype"
orig_vcf = gt_vcfs[base_name]
out_file = "%s-backfilter.v... | [
"def",
"_filter_by_background",
"(",
"base_name",
",",
"back_samples",
",",
"gt_vcfs",
",",
"data",
")",
":",
"filtname",
"=",
"\"InBackground\"",
"filtdoc",
"=",
"\"Variant also present in background samples with same genotype\"",
"orig_vcf",
"=",
"gt_vcfs",
"[",
"base_n... | Filter base samples, marking any also present in the background. | [
"Filter",
"base",
"samples",
"marking",
"any",
"also",
"present",
"in",
"the",
"background",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L118-L139 | train |
bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _genotype_in_background | def _genotype_in_background(rec, base_name, back_samples):
"""Check if the genotype in the record of interest is present in the background records.
"""
def passes(rec):
return not rec.FILTER or len(rec.FILTER) == 0
return (passes(rec) and
any(rec.genotype(base_name).gt_alleles == rec... | python | def _genotype_in_background(rec, base_name, back_samples):
"""Check if the genotype in the record of interest is present in the background records.
"""
def passes(rec):
return not rec.FILTER or len(rec.FILTER) == 0
return (passes(rec) and
any(rec.genotype(base_name).gt_alleles == rec... | [
"def",
"_genotype_in_background",
"(",
"rec",
",",
"base_name",
",",
"back_samples",
")",
":",
"def",
"passes",
"(",
"rec",
")",
":",
"return",
"not",
"rec",
".",
"FILTER",
"or",
"len",
"(",
"rec",
".",
"FILTER",
")",
"==",
"0",
"return",
"(",
"passes"... | Check if the genotype in the record of interest is present in the background records. | [
"Check",
"if",
"the",
"genotype",
"in",
"the",
"record",
"of",
"interest",
"is",
"present",
"in",
"the",
"background",
"records",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L141-L148 | train |
bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | run | def run(items):
"""Perform detection of structural variations with lumpy.
"""
paired = vcfutils.get_paired(items)
work_dir = _sv_workdir(paired.tumor_data if paired and paired.tumor_data else items[0])
previous_evidence = {}
full_bams, sr_bams, disc_bams = [], [], []
for data in items:
... | python | def run(items):
"""Perform detection of structural variations with lumpy.
"""
paired = vcfutils.get_paired(items)
work_dir = _sv_workdir(paired.tumor_data if paired and paired.tumor_data else items[0])
previous_evidence = {}
full_bams, sr_bams, disc_bams = [], [], []
for data in items:
... | [
"def",
"run",
"(",
"items",
")",
":",
"paired",
"=",
"vcfutils",
".",
"get_paired",
"(",
"items",
")",
"work_dir",
"=",
"_sv_workdir",
"(",
"paired",
".",
"tumor_data",
"if",
"paired",
"and",
"paired",
".",
"tumor_data",
"else",
"items",
"[",
"0",
"]",
... | Perform detection of structural variations with lumpy. | [
"Perform",
"detection",
"of",
"structural",
"variations",
"with",
"lumpy",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L154-L200 | train |
bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _bedpes_from_cnv_caller | def _bedpes_from_cnv_caller(data, work_dir):
"""Retrieve BEDPEs deletion and duplications from CNV callers.
Currently integrates with CNVkit.
"""
supported = set(["cnvkit"])
cns_file = None
for sv in data.get("sv", []):
if sv["variantcaller"] in supported and "cns" in sv and "lumpy_usec... | python | def _bedpes_from_cnv_caller(data, work_dir):
"""Retrieve BEDPEs deletion and duplications from CNV callers.
Currently integrates with CNVkit.
"""
supported = set(["cnvkit"])
cns_file = None
for sv in data.get("sv", []):
if sv["variantcaller"] in supported and "cns" in sv and "lumpy_usec... | [
"def",
"_bedpes_from_cnv_caller",
"(",
"data",
",",
"work_dir",
")",
":",
"supported",
"=",
"set",
"(",
"[",
"\"cnvkit\"",
"]",
")",
"cns_file",
"=",
"None",
"for",
"sv",
"in",
"data",
".",
"get",
"(",
"\"sv\"",
",",
"[",
"]",
")",
":",
"if",
"sv",
... | Retrieve BEDPEs deletion and duplications from CNV callers.
Currently integrates with CNVkit. | [
"Retrieve",
"BEDPEs",
"deletion",
"and",
"duplications",
"from",
"CNV",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L202-L229 | train |
bcbio/bcbio-nextgen | bcbio/setpath.py | _prepend | def _prepend(original, to_prepend):
"""Prepend paths in a string representing a list of paths to another.
original and to_prepend are expected to be strings representing
os.pathsep-separated lists of filepaths.
If to_prepend is None, original is returned.
The list of paths represented in the retu... | python | def _prepend(original, to_prepend):
"""Prepend paths in a string representing a list of paths to another.
original and to_prepend are expected to be strings representing
os.pathsep-separated lists of filepaths.
If to_prepend is None, original is returned.
The list of paths represented in the retu... | [
"def",
"_prepend",
"(",
"original",
",",
"to_prepend",
")",
":",
"if",
"to_prepend",
"is",
"None",
":",
"return",
"original",
"sep",
"=",
"os",
".",
"pathsep",
"def",
"split_path_value",
"(",
"path_value",
")",
":",
"return",
"[",
"]",
"if",
"path_value",
... | Prepend paths in a string representing a list of paths to another.
original and to_prepend are expected to be strings representing
os.pathsep-separated lists of filepaths.
If to_prepend is None, original is returned.
The list of paths represented in the returned value consists of the first of
occ... | [
"Prepend",
"paths",
"in",
"a",
"string",
"representing",
"a",
"list",
"of",
"paths",
"to",
"another",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/setpath.py#L10-L48 | train |
bcbio/bcbio-nextgen | bcbio/setpath.py | remove_bcbiopath | def remove_bcbiopath():
"""Remove bcbio internal path from first element in PATH.
Useful when we need to access remote programs, like Java 7 for older
installations.
"""
to_remove = os.environ.get("BCBIOPATH", utils.get_bcbio_bin()) + ":"
if os.environ["PATH"].startswith(to_remove):
os.... | python | def remove_bcbiopath():
"""Remove bcbio internal path from first element in PATH.
Useful when we need to access remote programs, like Java 7 for older
installations.
"""
to_remove = os.environ.get("BCBIOPATH", utils.get_bcbio_bin()) + ":"
if os.environ["PATH"].startswith(to_remove):
os.... | [
"def",
"remove_bcbiopath",
"(",
")",
":",
"to_remove",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"BCBIOPATH\"",
",",
"utils",
".",
"get_bcbio_bin",
"(",
")",
")",
"+",
"\":\"",
"if",
"os",
".",
"environ",
"[",
"\"PATH\"",
"]",
".",
"startswith",
"(... | Remove bcbio internal path from first element in PATH.
Useful when we need to access remote programs, like Java 7 for older
installations. | [
"Remove",
"bcbio",
"internal",
"path",
"from",
"first",
"element",
"in",
"PATH",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/setpath.py#L64-L72 | train |
bcbio/bcbio-nextgen | bcbio/structural/regions.py | calculate_sv_bins | def calculate_sv_bins(*items):
"""Determine bin sizes and regions to use for samples.
Unified approach to prepare regional bins for coverage calculations across
multiple CNV callers. Splits into target and antitarget regions allowing
callers to take advantage of both. Provides consistent target/anti-ta... | python | def calculate_sv_bins(*items):
"""Determine bin sizes and regions to use for samples.
Unified approach to prepare regional bins for coverage calculations across
multiple CNV callers. Splits into target and antitarget regions allowing
callers to take advantage of both. Provides consistent target/anti-ta... | [
"def",
"calculate_sv_bins",
"(",
"*",
"items",
")",
":",
"calcfns",
"=",
"{",
"\"cnvkit\"",
":",
"_calculate_sv_bins_cnvkit",
",",
"\"gatk-cnv\"",
":",
"_calculate_sv_bins_gatk",
"}",
"from",
"bcbio",
".",
"structural",
"import",
"cnvkit",
"items",
"=",
"[",
"ut... | Determine bin sizes and regions to use for samples.
Unified approach to prepare regional bins for coverage calculations across
multiple CNV callers. Splits into target and antitarget regions allowing
callers to take advantage of both. Provides consistent target/anti-target
bin sizes across batches.
... | [
"Determine",
"bin",
"sizes",
"and",
"regions",
"to",
"use",
"for",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L27-L59 | train |
bcbio/bcbio-nextgen | bcbio/structural/regions.py | _calculate_sv_bins_gatk | def _calculate_sv_bins_gatk(data, cnv_group, size_calc_fn):
"""Calculate structural variant bins using GATK4 CNV callers region or even intervals approach.
"""
if dd.get_background_cnv_reference(data, "gatk-cnv"):
target_bed = gatkcnv.pon_to_bed(dd.get_background_cnv_reference(data, "gatk-cnv"), cnv... | python | def _calculate_sv_bins_gatk(data, cnv_group, size_calc_fn):
"""Calculate structural variant bins using GATK4 CNV callers region or even intervals approach.
"""
if dd.get_background_cnv_reference(data, "gatk-cnv"):
target_bed = gatkcnv.pon_to_bed(dd.get_background_cnv_reference(data, "gatk-cnv"), cnv... | [
"def",
"_calculate_sv_bins_gatk",
"(",
"data",
",",
"cnv_group",
",",
"size_calc_fn",
")",
":",
"if",
"dd",
".",
"get_background_cnv_reference",
"(",
"data",
",",
"\"gatk-cnv\"",
")",
":",
"target_bed",
"=",
"gatkcnv",
".",
"pon_to_bed",
"(",
"dd",
".",
"get_b... | Calculate structural variant bins using GATK4 CNV callers region or even intervals approach. | [
"Calculate",
"structural",
"variant",
"bins",
"using",
"GATK4",
"CNV",
"callers",
"region",
"or",
"even",
"intervals",
"approach",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L61-L69 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.