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 | scripts/utils/hla_loh_comparison.py | get_hla | def get_hla(sample, cromwell_dir, hla_glob):
"""Retrieve HLA calls and input fastqs for a sample.
"""
hla_dir = glob.glob(os.path.join(cromwell_dir, hla_glob, "align", sample, "hla"))[0]
fastq = os.path.join(hla_dir, "OptiType-HLA-A_B_C-input.fq")
calls = os.path.join(hla_dir, "%s-optitype.csv" % sa... | python | def get_hla(sample, cromwell_dir, hla_glob):
"""Retrieve HLA calls and input fastqs for a sample.
"""
hla_dir = glob.glob(os.path.join(cromwell_dir, hla_glob, "align", sample, "hla"))[0]
fastq = os.path.join(hla_dir, "OptiType-HLA-A_B_C-input.fq")
calls = os.path.join(hla_dir, "%s-optitype.csv" % sa... | [
"def",
"get_hla",
"(",
"sample",
",",
"cromwell_dir",
",",
"hla_glob",
")",
":",
"hla_dir",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"cromwell_dir",
",",
"hla_glob",
",",
"\"align\"",
",",
"sample",
",",
"\"hla\"",
")",
")",
... | Retrieve HLA calls and input fastqs for a sample. | [
"Retrieve",
"HLA",
"calls",
"and",
"input",
"fastqs",
"for",
"a",
"sample",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L278-L284 | train |
bcbio/bcbio-nextgen | scripts/utils/hla_loh_comparison.py | name_to_absolute | def name_to_absolute(x):
"""Convert standard hg38 HLA name into ABSOLUTE naming.
"""
for c in ["-", "*", ":"]:
x = x.replace(c, "_")
x = x.lower()
return x | python | def name_to_absolute(x):
"""Convert standard hg38 HLA name into ABSOLUTE naming.
"""
for c in ["-", "*", ":"]:
x = x.replace(c, "_")
x = x.lower()
return x | [
"def",
"name_to_absolute",
"(",
"x",
")",
":",
"for",
"c",
"in",
"[",
"\"-\"",
",",
"\"*\"",
",",
"\":\"",
"]",
":",
"x",
"=",
"x",
".",
"replace",
"(",
"c",
",",
"\"_\"",
")",
"x",
"=",
"x",
".",
"lower",
"(",
")",
"return",
"x"
] | Convert standard hg38 HLA name into ABSOLUTE naming. | [
"Convert",
"standard",
"hg38",
"HLA",
"name",
"into",
"ABSOLUTE",
"naming",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L286-L292 | train |
bcbio/bcbio-nextgen | scripts/utils/hla_loh_comparison.py | get_hla_choice | def get_hla_choice(h, hlas, normal_bam, tumor_bam):
"""Retrieve matching HLA with best read support in both tumor and normal
"""
def get_counts(bam_file):
counts = {}
for line in subprocess.check_output(["samtools", "idxstats", bam_file]).split("\n"):
if line.startswith(h):
... | python | def get_hla_choice(h, hlas, normal_bam, tumor_bam):
"""Retrieve matching HLA with best read support in both tumor and normal
"""
def get_counts(bam_file):
counts = {}
for line in subprocess.check_output(["samtools", "idxstats", bam_file]).split("\n"):
if line.startswith(h):
... | [
"def",
"get_hla_choice",
"(",
"h",
",",
"hlas",
",",
"normal_bam",
",",
"tumor_bam",
")",
":",
"def",
"get_counts",
"(",
"bam_file",
")",
":",
"counts",
"=",
"{",
"}",
"for",
"line",
"in",
"subprocess",
".",
"check_output",
"(",
"[",
"\"samtools\"",
",",... | Retrieve matching HLA with best read support in both tumor and normal | [
"Retrieve",
"matching",
"HLA",
"with",
"best",
"read",
"support",
"in",
"both",
"tumor",
"and",
"normal"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L294-L309 | train |
bcbio/bcbio-nextgen | scripts/utils/hla_loh_comparison.py | prep_hla | def prep_hla(work_dir, sample, calls, hlas, normal_bam, tumor_bam):
"""Convert HLAs into ABSOLUTE format for use with LOHHLA.
LOHHLA hard codes names to hla_a, hla_b, hla_c so need to move
"""
work_dir = utils.safe_makedir(os.path.join(work_dir, sample, "inputs"))
hla_file = os.path.join(work_dir, ... | python | def prep_hla(work_dir, sample, calls, hlas, normal_bam, tumor_bam):
"""Convert HLAs into ABSOLUTE format for use with LOHHLA.
LOHHLA hard codes names to hla_a, hla_b, hla_c so need to move
"""
work_dir = utils.safe_makedir(os.path.join(work_dir, sample, "inputs"))
hla_file = os.path.join(work_dir, ... | [
"def",
"prep_hla",
"(",
"work_dir",
",",
"sample",
",",
"calls",
",",
"hlas",
",",
"normal_bam",
",",
"tumor_bam",
")",
":",
"work_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"sample",
",",
"\"inp... | Convert HLAs into ABSOLUTE format for use with LOHHLA.
LOHHLA hard codes names to hla_a, hla_b, hla_c so need to move | [
"Convert",
"HLAs",
"into",
"ABSOLUTE",
"format",
"for",
"use",
"with",
"LOHHLA",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L311-L326 | train |
bcbio/bcbio-nextgen | scripts/utils/hla_loh_comparison.py | prep_ploidy | def prep_ploidy(work_dir, sample, bam_file, cromwell_dir, sv_glob):
"""Create LOHHLA compatible input ploidy file from PureCN output.
"""
purecn_file = _get_cromwell_file(cromwell_dir, sv_glob, dict(sample=sample, method="purecn", ext="purecn.csv"))
work_dir = utils.safe_makedir(os.path.join(work_dir, s... | python | def prep_ploidy(work_dir, sample, bam_file, cromwell_dir, sv_glob):
"""Create LOHHLA compatible input ploidy file from PureCN output.
"""
purecn_file = _get_cromwell_file(cromwell_dir, sv_glob, dict(sample=sample, method="purecn", ext="purecn.csv"))
work_dir = utils.safe_makedir(os.path.join(work_dir, s... | [
"def",
"prep_ploidy",
"(",
"work_dir",
",",
"sample",
",",
"bam_file",
",",
"cromwell_dir",
",",
"sv_glob",
")",
":",
"purecn_file",
"=",
"_get_cromwell_file",
"(",
"cromwell_dir",
",",
"sv_glob",
",",
"dict",
"(",
"sample",
"=",
"sample",
",",
"method",
"="... | Create LOHHLA compatible input ploidy file from PureCN output. | [
"Create",
"LOHHLA",
"compatible",
"input",
"ploidy",
"file",
"from",
"PureCN",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L328-L342 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/bowtie.py | _bowtie_args_from_config | def _bowtie_args_from_config(data):
"""Configurable high level options for bowtie.
"""
config = data['config']
qual_format = config["algorithm"].get("quality_format", "")
if qual_format.lower() == "illumina":
qual_flags = ["--phred64-quals"]
else:
qual_flags = []
multi_mapper... | python | def _bowtie_args_from_config(data):
"""Configurable high level options for bowtie.
"""
config = data['config']
qual_format = config["algorithm"].get("quality_format", "")
if qual_format.lower() == "illumina":
qual_flags = ["--phred64-quals"]
else:
qual_flags = []
multi_mapper... | [
"def",
"_bowtie_args_from_config",
"(",
"data",
")",
":",
"config",
"=",
"data",
"[",
"'config'",
"]",
"qual_format",
"=",
"config",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"quality_format\"",
",",
"\"\"",
")",
"if",
"qual_format",
".",
"lower",
"(",
... | Configurable high level options for bowtie. | [
"Configurable",
"high",
"level",
"options",
"for",
"bowtie",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bowtie.py#L13-L28 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/bowtie.py | align | def align(fastq_file, pair_file, ref_file, names, align_dir, data,
extra_args=None):
"""Do standard or paired end alignment with bowtie.
"""
num_hits = 1
if data["analysis"].lower().startswith("smallrna-seq"):
num_hits = 1000
config = data['config']
out_file = os.path.join(alig... | python | def align(fastq_file, pair_file, ref_file, names, align_dir, data,
extra_args=None):
"""Do standard or paired end alignment with bowtie.
"""
num_hits = 1
if data["analysis"].lower().startswith("smallrna-seq"):
num_hits = 1000
config = data['config']
out_file = os.path.join(alig... | [
"def",
"align",
"(",
"fastq_file",
",",
"pair_file",
",",
"ref_file",
",",
"names",
",",
"align_dir",
",",
"data",
",",
"extra_args",
"=",
"None",
")",
":",
"num_hits",
"=",
"1",
"if",
"data",
"[",
"\"analysis\"",
"]",
".",
"lower",
"(",
")",
".",
"s... | Do standard or paired end alignment with bowtie. | [
"Do",
"standard",
"or",
"paired",
"end",
"alignment",
"with",
"bowtie",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bowtie.py#L30-L74 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | subset_by_supported | def subset_by_supported(input_file, get_coords, calls_by_name, work_dir, data,
headers=("#",)):
"""Limit CNVkit input to calls with support from another caller.
get_coords is a function that return chrom, start, end from a line of the
input_file, allowing handling of multiple input ... | python | def subset_by_supported(input_file, get_coords, calls_by_name, work_dir, data,
headers=("#",)):
"""Limit CNVkit input to calls with support from another caller.
get_coords is a function that return chrom, start, end from a line of the
input_file, allowing handling of multiple input ... | [
"def",
"subset_by_supported",
"(",
"input_file",
",",
"get_coords",
",",
"calls_by_name",
",",
"work_dir",
",",
"data",
",",
"headers",
"=",
"(",
"\"#\"",
",",
")",
")",
":",
"support_files",
"=",
"[",
"(",
"c",
",",
"tz",
".",
"get_in",
"(",
"[",
"c",... | Limit CNVkit input to calls with support from another caller.
get_coords is a function that return chrom, start, end from a line of the
input_file, allowing handling of multiple input file types. | [
"Limit",
"CNVkit",
"input",
"to",
"calls",
"with",
"support",
"from",
"another",
"caller",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L43-L76 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | _input_to_bed | def _input_to_bed(theta_input, work_dir, get_coords, headers):
"""Convert input file to a BED file for comparisons
"""
theta_bed = os.path.join(work_dir, "%s.bed" % os.path.splitext(os.path.basename(theta_input))[0])
with open(theta_input) as in_handle:
with open(theta_bed, "w") as out_handle:
... | python | def _input_to_bed(theta_input, work_dir, get_coords, headers):
"""Convert input file to a BED file for comparisons
"""
theta_bed = os.path.join(work_dir, "%s.bed" % os.path.splitext(os.path.basename(theta_input))[0])
with open(theta_input) as in_handle:
with open(theta_bed, "w") as out_handle:
... | [
"def",
"_input_to_bed",
"(",
"theta_input",
",",
"work_dir",
",",
"get_coords",
",",
"headers",
")",
":",
"theta_bed",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s.bed\"",
"%",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"pa... | Convert input file to a BED file for comparisons | [
"Convert",
"input",
"file",
"to",
"a",
"BED",
"file",
"for",
"comparisons"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L88-L98 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | _run_theta | def _run_theta(cnv_info, data, work_dir, run_n3=True):
"""Run theta, calculating subpopulations and normal contamination.
"""
out = {"caller": "theta"}
max_normal = "0.9"
opts = ["-m", max_normal]
n2_result = _safe_run_theta(cnv_info["theta_input"], os.path.join(work_dir, "n2"), ".n2.results",
... | python | def _run_theta(cnv_info, data, work_dir, run_n3=True):
"""Run theta, calculating subpopulations and normal contamination.
"""
out = {"caller": "theta"}
max_normal = "0.9"
opts = ["-m", max_normal]
n2_result = _safe_run_theta(cnv_info["theta_input"], os.path.join(work_dir, "n2"), ".n2.results",
... | [
"def",
"_run_theta",
"(",
"cnv_info",
",",
"data",
",",
"work_dir",
",",
"run_n3",
"=",
"True",
")",
":",
"out",
"=",
"{",
"\"caller\"",
":",
"\"theta\"",
"}",
"max_normal",
"=",
"\"0.9\"",
"opts",
"=",
"[",
"\"-m\"",
",",
"max_normal",
"]",
"n2_result",... | Run theta, calculating subpopulations and normal contamination. | [
"Run",
"theta",
"calculating",
"subpopulations",
"and",
"normal",
"contamination",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L100-L120 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | _update_with_calls | def _update_with_calls(result_file, cnv_file):
"""Update bounds with calls from CNVkit, inferred copy numbers and p-values from THetA.
"""
results = {}
with open(result_file) as in_handle:
in_handle.readline() # header
_, _, cs, ps = in_handle.readline().strip().split()
for i, (... | python | def _update_with_calls(result_file, cnv_file):
"""Update bounds with calls from CNVkit, inferred copy numbers and p-values from THetA.
"""
results = {}
with open(result_file) as in_handle:
in_handle.readline() # header
_, _, cs, ps = in_handle.readline().strip().split()
for i, (... | [
"def",
"_update_with_calls",
"(",
"result_file",
",",
"cnv_file",
")",
":",
"results",
"=",
"{",
"}",
"with",
"open",
"(",
"result_file",
")",
"as",
"in_handle",
":",
"in_handle",
".",
"readline",
"(",
")",
"# header",
"_",
",",
"_",
",",
"cs",
",",
"p... | Update bounds with calls from CNVkit, inferred copy numbers and p-values from THetA. | [
"Update",
"bounds",
"with",
"calls",
"from",
"CNVkit",
"inferred",
"copy",
"numbers",
"and",
"p",
"-",
"values",
"from",
"THetA",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L122-L142 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | _merge_theta_calls | def _merge_theta_calls(bounds_file, result_file, cnv_file, data):
"""Create a final output file with merged CNVkit and THetA copy and population estimates.
"""
out_file = "%s-merged.txt" % (result_file.replace(".BEST.results", ""))
if not utils.file_uptodate(out_file, result_file):
with file_tra... | python | def _merge_theta_calls(bounds_file, result_file, cnv_file, data):
"""Create a final output file with merged CNVkit and THetA copy and population estimates.
"""
out_file = "%s-merged.txt" % (result_file.replace(".BEST.results", ""))
if not utils.file_uptodate(out_file, result_file):
with file_tra... | [
"def",
"_merge_theta_calls",
"(",
"bounds_file",
",",
"result_file",
",",
"cnv_file",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s-merged.txt\"",
"%",
"(",
"result_file",
".",
"replace",
"(",
"\".BEST.results\"",
",",
"\"\"",
")",
")",
"if",
"not",
"utils",
... | Create a final output file with merged CNVkit and THetA copy and population estimates. | [
"Create",
"a",
"final",
"output",
"file",
"with",
"merged",
"CNVkit",
"and",
"THetA",
"copy",
"and",
"population",
"estimates",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L144-L162 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | _select_model | def _select_model(n2_bounds, n2_result, n3_result, out_dir, data):
"""Run final model selection from n=2 and n=3 options.
"""
n2_out_file = n2_result.replace(".n2.results", ".BEST.results")
n3_out_file = n3_result.replace(".n3.results", ".BEST.results")
if not utils.file_exists(n2_out_file) and not ... | python | def _select_model(n2_bounds, n2_result, n3_result, out_dir, data):
"""Run final model selection from n=2 and n=3 options.
"""
n2_out_file = n2_result.replace(".n2.results", ".BEST.results")
n3_out_file = n3_result.replace(".n3.results", ".BEST.results")
if not utils.file_exists(n2_out_file) and not ... | [
"def",
"_select_model",
"(",
"n2_bounds",
",",
"n2_result",
",",
"n3_result",
",",
"out_dir",
",",
"data",
")",
":",
"n2_out_file",
"=",
"n2_result",
".",
"replace",
"(",
"\".n2.results\"",
",",
"\".BEST.results\"",
")",
"n3_out_file",
"=",
"n3_result",
".",
"... | Run final model selection from n=2 and n=3 options. | [
"Run",
"final",
"model",
"selection",
"from",
"n",
"=",
"2",
"and",
"n",
"=",
"3",
"options",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L164-L176 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | _safe_run_theta | def _safe_run_theta(input_file, out_dir, output_ext, args, data):
"""Run THetA, catching and continuing on any errors.
"""
out_file = os.path.join(out_dir, _split_theta_ext(input_file) + output_ext)
skip_file = out_file + ".skipped"
if utils.file_exists(skip_file):
return None
if not uti... | python | def _safe_run_theta(input_file, out_dir, output_ext, args, data):
"""Run THetA, catching and continuing on any errors.
"""
out_file = os.path.join(out_dir, _split_theta_ext(input_file) + output_ext)
skip_file = out_file + ".skipped"
if utils.file_exists(skip_file):
return None
if not uti... | [
"def",
"_safe_run_theta",
"(",
"input_file",
",",
"out_dir",
",",
"output_ext",
",",
"args",
",",
"data",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"_split_theta_ext",
"(",
"input_file",
")",
"+",
"output_ext",
")",
... | Run THetA, catching and continuing on any errors. | [
"Run",
"THetA",
"catching",
"and",
"continuing",
"on",
"any",
"errors",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L178-L201 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/theta.py | _get_cmd | def _get_cmd(cmd):
"""Retrieve required commands for running THetA with our local bcbio python.
"""
check_cmd = "RunTHetA.py"
try:
local_cmd = subprocess.check_output(["which", check_cmd]).strip()
except subprocess.CalledProcessError:
return None
return [sys.executable, "%s/%s" %... | python | def _get_cmd(cmd):
"""Retrieve required commands for running THetA with our local bcbio python.
"""
check_cmd = "RunTHetA.py"
try:
local_cmd = subprocess.check_output(["which", check_cmd]).strip()
except subprocess.CalledProcessError:
return None
return [sys.executable, "%s/%s" %... | [
"def",
"_get_cmd",
"(",
"cmd",
")",
":",
"check_cmd",
"=",
"\"RunTHetA.py\"",
"try",
":",
"local_cmd",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"\"which\"",
",",
"check_cmd",
"]",
")",
".",
"strip",
"(",
")",
"except",
"subprocess",
".",
"CalledPr... | Retrieve required commands for running THetA with our local bcbio python. | [
"Retrieve",
"required",
"commands",
"for",
"running",
"THetA",
"with",
"our",
"local",
"bcbio",
"python",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L213-L221 | train |
bcbio/bcbio-nextgen | bcbio/srna/mirge.py | run | def run(data):
"""Proxy function to run the tool"""
sample = data[0][0]
work_dir = dd.get_work_dir(sample)
out_dir = os.path.join(work_dir, "mirge")
lib = _find_lib(sample)
mirge = _find_mirge(sample)
bowtie = _find_bowtie(sample)
sps = dd.get_species(sample)
species = SPS.get(sps, "... | python | def run(data):
"""Proxy function to run the tool"""
sample = data[0][0]
work_dir = dd.get_work_dir(sample)
out_dir = os.path.join(work_dir, "mirge")
lib = _find_lib(sample)
mirge = _find_mirge(sample)
bowtie = _find_bowtie(sample)
sps = dd.get_species(sample)
species = SPS.get(sps, "... | [
"def",
"run",
"(",
"data",
")",
":",
"sample",
"=",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
"work_dir",
"=",
"dd",
".",
"get_work_dir",
"(",
"sample",
")",
"out_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"mirge\"",
")",
"lib... | Proxy function to run the tool | [
"Proxy",
"function",
"to",
"run",
"the",
"tool"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirge.py#L20-L41 | train |
bcbio/bcbio-nextgen | bcbio/srna/mirge.py | _create_sample_file | def _create_sample_file(data, out_dir):
"""from data list all the fastq files in a file"""
sample_file = os.path.join(out_dir, "sample_file.txt")
with open(sample_file, 'w') as outh:
for sample in data:
outh.write(sample[0]["clean_fastq"] + "\n")
return sample_file | python | def _create_sample_file(data, out_dir):
"""from data list all the fastq files in a file"""
sample_file = os.path.join(out_dir, "sample_file.txt")
with open(sample_file, 'w') as outh:
for sample in data:
outh.write(sample[0]["clean_fastq"] + "\n")
return sample_file | [
"def",
"_create_sample_file",
"(",
"data",
",",
"out_dir",
")",
":",
"sample_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"sample_file.txt\"",
")",
"with",
"open",
"(",
"sample_file",
",",
"'w'",
")",
"as",
"outh",
":",
"for",
"samp... | from data list all the fastq files in a file | [
"from",
"data",
"list",
"all",
"the",
"fastq",
"files",
"in",
"a",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirge.py#L55-L61 | train |
bcbio/bcbio-nextgen | bcbio/srna/mirge.py | _find_lib | def _find_lib(data):
"""Find mirge libs"""
options = " ".join(data.get('resources', {}).get('mirge', {}).get("options", ""))
if options.find("-lib") > -1 and utils.file_exists(options.split()[1]):
return options
if not options:
logger.warning("miRge libraries not found. Follow these inst... | python | def _find_lib(data):
"""Find mirge libs"""
options = " ".join(data.get('resources', {}).get('mirge', {}).get("options", ""))
if options.find("-lib") > -1 and utils.file_exists(options.split()[1]):
return options
if not options:
logger.warning("miRge libraries not found. Follow these inst... | [
"def",
"_find_lib",
"(",
"data",
")",
":",
"options",
"=",
"\" \"",
".",
"join",
"(",
"data",
".",
"get",
"(",
"'resources'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'mirge'",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"options\"",
",",
"\"\"",
")",
... | Find mirge libs | [
"Find",
"mirge",
"libs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirge.py#L71-L80 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/datadict.py | get_input_sequence_files | def get_input_sequence_files(data, default=None):
"""
returns the input sequencing files, these can be single or paired FASTQ
files or BAM files
"""
if "files" not in data or data.get("files") is None:
file1, file2 = None, None
elif len(data["files"]) == 2:
file1, file2 = data["f... | python | def get_input_sequence_files(data, default=None):
"""
returns the input sequencing files, these can be single or paired FASTQ
files or BAM files
"""
if "files" not in data or data.get("files") is None:
file1, file2 = None, None
elif len(data["files"]) == 2:
file1, file2 = data["f... | [
"def",
"get_input_sequence_files",
"(",
"data",
",",
"default",
"=",
"None",
")",
":",
"if",
"\"files\"",
"not",
"in",
"data",
"or",
"data",
".",
"get",
"(",
"\"files\"",
")",
"is",
"None",
":",
"file1",
",",
"file2",
"=",
"None",
",",
"None",
"elif",
... | returns the input sequencing files, these can be single or paired FASTQ
files or BAM files | [
"returns",
"the",
"input",
"sequencing",
"files",
"these",
"can",
"be",
"single",
"or",
"paired",
"FASTQ",
"files",
"or",
"BAM",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L223-L235 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/datadict.py | get_umi_consensus | def get_umi_consensus(data):
"""Retrieve UMI for consensus based preparation.
We specify this either as a separate fastq file or embedded
in the read name as `fastq_name`.`
"""
consensus_choices = (["fastq_name"])
umi = tz.get_in(["config", "algorithm", "umi_type"], data)
# don't run consen... | python | def get_umi_consensus(data):
"""Retrieve UMI for consensus based preparation.
We specify this either as a separate fastq file or embedded
in the read name as `fastq_name`.`
"""
consensus_choices = (["fastq_name"])
umi = tz.get_in(["config", "algorithm", "umi_type"], data)
# don't run consen... | [
"def",
"get_umi_consensus",
"(",
"data",
")",
":",
"consensus_choices",
"=",
"(",
"[",
"\"fastq_name\"",
"]",
")",
"umi",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"umi_type\"",
"]",
",",
"data",
")",
"# don't run consens... | Retrieve UMI for consensus based preparation.
We specify this either as a separate fastq file or embedded
in the read name as `fastq_name`.` | [
"Retrieve",
"UMI",
"for",
"consensus",
"based",
"preparation",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L237-L251 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/datadict.py | get_dexseq_gff | def get_dexseq_gff(config, default=None):
"""
some older versions of the genomes have the DEXseq gff file as
gff instead of gff3, so this handles that by looking for either one
"""
dexseq_gff = tz.get_in(tz.get_in(['dexseq_gff', 'keys'], LOOKUPS, {}),
config, None)
if ... | python | def get_dexseq_gff(config, default=None):
"""
some older versions of the genomes have the DEXseq gff file as
gff instead of gff3, so this handles that by looking for either one
"""
dexseq_gff = tz.get_in(tz.get_in(['dexseq_gff', 'keys'], LOOKUPS, {}),
config, None)
if ... | [
"def",
"get_dexseq_gff",
"(",
"config",
",",
"default",
"=",
"None",
")",
":",
"dexseq_gff",
"=",
"tz",
".",
"get_in",
"(",
"tz",
".",
"get_in",
"(",
"[",
"'dexseq_gff'",
",",
"'keys'",
"]",
",",
"LOOKUPS",
",",
"{",
"}",
")",
",",
"config",
",",
"... | some older versions of the genomes have the DEXseq gff file as
gff instead of gff3, so this handles that by looking for either one | [
"some",
"older",
"versions",
"of",
"the",
"genomes",
"have",
"the",
"DEXseq",
"gff",
"file",
"as",
"gff",
"instead",
"of",
"gff3",
"so",
"this",
"handles",
"that",
"by",
"looking",
"for",
"either",
"one"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L253-L275 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/datadict.py | get_in_samples | def get_in_samples(samples, fn):
"""
for a list of samples, return the value of a global option
"""
for sample in samples:
sample = to_single_data(sample)
if fn(sample, None):
return fn(sample)
return None | python | def get_in_samples(samples, fn):
"""
for a list of samples, return the value of a global option
"""
for sample in samples:
sample = to_single_data(sample)
if fn(sample, None):
return fn(sample)
return None | [
"def",
"get_in_samples",
"(",
"samples",
",",
"fn",
")",
":",
"for",
"sample",
"in",
"samples",
":",
"sample",
"=",
"to_single_data",
"(",
"sample",
")",
"if",
"fn",
"(",
"sample",
",",
"None",
")",
":",
"return",
"fn",
"(",
"sample",
")",
"return",
... | for a list of samples, return the value of a global option | [
"for",
"a",
"list",
"of",
"samples",
"return",
"the",
"value",
"of",
"a",
"global",
"option"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L329-L337 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/datadict.py | update_summary_qc | def update_summary_qc(data, key, base=None, secondary=None):
"""
updates summary_qc with a new section, keyed by key.
stick files into summary_qc if you want them propagated forward
and available for multiqc
"""
summary = get_summary_qc(data, {})
if base and secondary:
summary[key] =... | python | def update_summary_qc(data, key, base=None, secondary=None):
"""
updates summary_qc with a new section, keyed by key.
stick files into summary_qc if you want them propagated forward
and available for multiqc
"""
summary = get_summary_qc(data, {})
if base and secondary:
summary[key] =... | [
"def",
"update_summary_qc",
"(",
"data",
",",
"key",
",",
"base",
"=",
"None",
",",
"secondary",
"=",
"None",
")",
":",
"summary",
"=",
"get_summary_qc",
"(",
"data",
",",
"{",
"}",
")",
"if",
"base",
"and",
"secondary",
":",
"summary",
"[",
"key",
"... | updates summary_qc with a new section, keyed by key.
stick files into summary_qc if you want them propagated forward
and available for multiqc | [
"updates",
"summary_qc",
"with",
"a",
"new",
"section",
"keyed",
"by",
"key",
".",
"stick",
"files",
"into",
"summary_qc",
"if",
"you",
"want",
"them",
"propagated",
"forward",
"and",
"available",
"for",
"multiqc"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L351-L365 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/datadict.py | has_variantcalls | def has_variantcalls(data):
"""
returns True if the data dictionary is configured for variant calling
"""
analysis = get_analysis(data).lower()
variant_pipeline = analysis.startswith(("standard", "variant", "variant2"))
variantcaller = get_variantcaller(data)
return variant_pipeline or varia... | python | def has_variantcalls(data):
"""
returns True if the data dictionary is configured for variant calling
"""
analysis = get_analysis(data).lower()
variant_pipeline = analysis.startswith(("standard", "variant", "variant2"))
variantcaller = get_variantcaller(data)
return variant_pipeline or varia... | [
"def",
"has_variantcalls",
"(",
"data",
")",
":",
"analysis",
"=",
"get_analysis",
"(",
"data",
")",
".",
"lower",
"(",
")",
"variant_pipeline",
"=",
"analysis",
".",
"startswith",
"(",
"(",
"\"standard\"",
",",
"\"variant\"",
",",
"\"variant2\"",
")",
")",
... | returns True if the data dictionary is configured for variant calling | [
"returns",
"True",
"if",
"the",
"data",
"dictionary",
"is",
"configured",
"for",
"variant",
"calling"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L367-L374 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/qc.py | estimate_library_complexity | def estimate_library_complexity(df, algorithm="RNA-seq"):
"""
estimate library complexity from the number of reads vs.
number of unique start sites. returns "NA" if there are
not enough data points to fit the line
"""
DEFAULT_CUTOFFS = {"RNA-seq": (0.25, 0.40)}
cutoffs = DEFAULT_CUTOFFS[algo... | python | def estimate_library_complexity(df, algorithm="RNA-seq"):
"""
estimate library complexity from the number of reads vs.
number of unique start sites. returns "NA" if there are
not enough data points to fit the line
"""
DEFAULT_CUTOFFS = {"RNA-seq": (0.25, 0.40)}
cutoffs = DEFAULT_CUTOFFS[algo... | [
"def",
"estimate_library_complexity",
"(",
"df",
",",
"algorithm",
"=",
"\"RNA-seq\"",
")",
":",
"DEFAULT_CUTOFFS",
"=",
"{",
"\"RNA-seq\"",
":",
"(",
"0.25",
",",
"0.40",
")",
"}",
"cutoffs",
"=",
"DEFAULT_CUTOFFS",
"[",
"algorithm",
"]",
"if",
"len",
"(",
... | estimate library complexity from the number of reads vs.
number of unique start sites. returns "NA" if there are
not enough data points to fit the line | [
"estimate",
"library",
"complexity",
"from",
"the",
"number",
"of",
"reads",
"vs",
".",
"number",
"of",
"unique",
"start",
"sites",
".",
"returns",
"NA",
"if",
"there",
"are",
"not",
"enough",
"data",
"points",
"to",
"fit",
"the",
"line"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/qc.py#L42-L64 | train |
bcbio/bcbio-nextgen | bcbio/galaxy/api.py | GalaxyApiAccess.run_details | def run_details(self, run_bc, run_date=None):
"""Next Gen LIMS specific API functionality.
"""
try:
details = self._get("/nglims/api_run_details", dict(run=run_bc))
except ValueError:
raise ValueError("Could not find information in Galaxy for run: %s" % run_bc)
... | python | def run_details(self, run_bc, run_date=None):
"""Next Gen LIMS specific API functionality.
"""
try:
details = self._get("/nglims/api_run_details", dict(run=run_bc))
except ValueError:
raise ValueError("Could not find information in Galaxy for run: %s" % run_bc)
... | [
"def",
"run_details",
"(",
"self",
",",
"run_bc",
",",
"run_date",
"=",
"None",
")",
":",
"try",
":",
"details",
"=",
"self",
".",
"_get",
"(",
"\"/nglims/api_run_details\"",
",",
"dict",
"(",
"run",
"=",
"run_bc",
")",
")",
"except",
"ValueError",
":",
... | Next Gen LIMS specific API functionality. | [
"Next",
"Gen",
"LIMS",
"specific",
"API",
"functionality",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/galaxy/api.py#L52-L64 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/cleanbam.py | fixrg | def fixrg(in_bam, names, ref_file, dirs, data):
"""Fix read group in a file, using samtools addreplacerg.
addreplacerg does not remove the old read group, causing confusion when
checking. We use reheader to work around this
"""
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "bamc... | python | def fixrg(in_bam, names, ref_file, dirs, data):
"""Fix read group in a file, using samtools addreplacerg.
addreplacerg does not remove the old read group, causing confusion when
checking. We use reheader to work around this
"""
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "bamc... | [
"def",
"fixrg",
"(",
"in_bam",
",",
"names",
",",
"ref_file",
",",
"dirs",
",",
"data",
")",
":",
"work_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"bamclean\"... | Fix read group in a file, using samtools addreplacerg.
addreplacerg does not remove the old read group, causing confusion when
checking. We use reheader to work around this | [
"Fix",
"read",
"group",
"in",
"a",
"file",
"using",
"samtools",
"addreplacerg",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L20-L40 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/cleanbam.py | _target_chroms_and_header | def _target_chroms_and_header(bam_file, data):
"""Get a list of chromosomes to target and new updated ref_file header.
Could potentially handle remapping from chr1 -> 1 but currently disabled due
to speed issues.
"""
special_remaps = {"chrM": "MT", "MT": "chrM"}
target_chroms = dict([(x.name, i... | python | def _target_chroms_and_header(bam_file, data):
"""Get a list of chromosomes to target and new updated ref_file header.
Could potentially handle remapping from chr1 -> 1 but currently disabled due
to speed issues.
"""
special_remaps = {"chrM": "MT", "MT": "chrM"}
target_chroms = dict([(x.name, i... | [
"def",
"_target_chroms_and_header",
"(",
"bam_file",
",",
"data",
")",
":",
"special_remaps",
"=",
"{",
"\"chrM\"",
":",
"\"MT\"",
",",
"\"MT\"",
":",
"\"chrM\"",
"}",
"target_chroms",
"=",
"dict",
"(",
"[",
"(",
"x",
".",
"name",
",",
"i",
")",
"for",
... | Get a list of chromosomes to target and new updated ref_file header.
Could potentially handle remapping from chr1 -> 1 but currently disabled due
to speed issues. | [
"Get",
"a",
"list",
"of",
"chromosomes",
"to",
"target",
"and",
"new",
"updated",
"ref_file",
"header",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L75-L106 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/cleanbam.py | picard_prep | def picard_prep(in_bam, names, ref_file, dirs, data):
"""Prepare input BAM using Picard and GATK cleaning tools.
- ReorderSam to reorder file to reference
- AddOrReplaceReadGroups to add read group information and coordinate sort
- PrintReads to filters to remove problem records:
- filterMBQ to rem... | python | def picard_prep(in_bam, names, ref_file, dirs, data):
"""Prepare input BAM using Picard and GATK cleaning tools.
- ReorderSam to reorder file to reference
- AddOrReplaceReadGroups to add read group information and coordinate sort
- PrintReads to filters to remove problem records:
- filterMBQ to rem... | [
"def",
"picard_prep",
"(",
"in_bam",
",",
"names",
",",
"ref_file",
",",
"dirs",
",",
"data",
")",
":",
"runner",
"=",
"broad",
".",
"runner_from_path",
"(",
"\"picard\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"work_dir",
"=",
"utils",
".",
"safe_mak... | Prepare input BAM using Picard and GATK cleaning tools.
- ReorderSam to reorder file to reference
- AddOrReplaceReadGroups to add read group information and coordinate sort
- PrintReads to filters to remove problem records:
- filterMBQ to remove reads with mismatching bases and base qualities | [
"Prepare",
"input",
"BAM",
"using",
"Picard",
"and",
"GATK",
"cleaning",
"tools",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L122-L139 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/cleanbam.py | _filter_bad_reads | def _filter_bad_reads(in_bam, ref_file, data):
"""Use GATK filter to remove problem reads which choke GATK and Picard.
"""
bam.index(in_bam, data["config"])
out_file = "%s-gatkfilter.bam" % os.path.splitext(in_bam)[0]
if not utils.file_exists(out_file):
with tx_tmpdir(data) as tmp_dir:
... | python | def _filter_bad_reads(in_bam, ref_file, data):
"""Use GATK filter to remove problem reads which choke GATK and Picard.
"""
bam.index(in_bam, data["config"])
out_file = "%s-gatkfilter.bam" % os.path.splitext(in_bam)[0]
if not utils.file_exists(out_file):
with tx_tmpdir(data) as tmp_dir:
... | [
"def",
"_filter_bad_reads",
"(",
"in_bam",
",",
"ref_file",
",",
"data",
")",
":",
"bam",
".",
"index",
"(",
"in_bam",
",",
"data",
"[",
"\"config\"",
"]",
")",
"out_file",
"=",
"\"%s-gatkfilter.bam\"",
"%",
"os",
".",
"path",
".",
"splitext",
"(",
"in_b... | Use GATK filter to remove problem reads which choke GATK and Picard. | [
"Use",
"GATK",
"filter",
"to",
"remove",
"problem",
"reads",
"which",
"choke",
"GATK",
"and",
"Picard",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L141-L161 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | generate_parallel | def generate_parallel(samples, run_parallel):
"""Provide parallel preparation of summary information for alignment and variant calling.
"""
to_analyze, extras = _split_samples_by_qc(samples)
qced = run_parallel("pipeline_summary", to_analyze)
samples = _combine_qc_samples(qced) + extras
qsign_in... | python | def generate_parallel(samples, run_parallel):
"""Provide parallel preparation of summary information for alignment and variant calling.
"""
to_analyze, extras = _split_samples_by_qc(samples)
qced = run_parallel("pipeline_summary", to_analyze)
samples = _combine_qc_samples(qced) + extras
qsign_in... | [
"def",
"generate_parallel",
"(",
"samples",
",",
"run_parallel",
")",
":",
"to_analyze",
",",
"extras",
"=",
"_split_samples_by_qc",
"(",
"samples",
")",
"qced",
"=",
"run_parallel",
"(",
"\"pipeline_summary\"",
",",
"to_analyze",
")",
"samples",
"=",
"_combine_qc... | Provide parallel preparation of summary information for alignment and variant calling. | [
"Provide",
"parallel",
"preparation",
"of",
"summary",
"information",
"for",
"alignment",
"and",
"variant",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L38-L58 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | pipeline_summary | def pipeline_summary(data):
"""Provide summary information on processing sample.
Handles standard and CWL (single QC output) cases.
"""
data = utils.to_single_data(data)
work_bam = dd.get_align_bam(data) or dd.get_work_bam(data)
if not work_bam or not work_bam.endswith(".bam"):
work_bam... | python | def pipeline_summary(data):
"""Provide summary information on processing sample.
Handles standard and CWL (single QC output) cases.
"""
data = utils.to_single_data(data)
work_bam = dd.get_align_bam(data) or dd.get_work_bam(data)
if not work_bam or not work_bam.endswith(".bam"):
work_bam... | [
"def",
"pipeline_summary",
"(",
"data",
")",
":",
"data",
"=",
"utils",
".",
"to_single_data",
"(",
"data",
")",
"work_bam",
"=",
"dd",
".",
"get_align_bam",
"(",
"data",
")",
"or",
"dd",
".",
"get_work_bam",
"(",
"data",
")",
"if",
"not",
"work_bam",
... | Provide summary information on processing sample.
Handles standard and CWL (single QC output) cases. | [
"Provide",
"summary",
"information",
"on",
"processing",
"sample",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L60-L76 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | get_qc_tools | def get_qc_tools(data):
"""Retrieve a list of QC tools to use based on configuration and analysis type.
Uses defaults if previously set.
"""
if dd.get_algorithm_qc(data):
return dd.get_algorithm_qc(data)
analysis = data["analysis"].lower()
to_run = []
if tz.get_in(["config", "algori... | python | def get_qc_tools(data):
"""Retrieve a list of QC tools to use based on configuration and analysis type.
Uses defaults if previously set.
"""
if dd.get_algorithm_qc(data):
return dd.get_algorithm_qc(data)
analysis = data["analysis"].lower()
to_run = []
if tz.get_in(["config", "algori... | [
"def",
"get_qc_tools",
"(",
"data",
")",
":",
"if",
"dd",
".",
"get_algorithm_qc",
"(",
"data",
")",
":",
"return",
"dd",
".",
"get_algorithm_qc",
"(",
"data",
")",
"analysis",
"=",
"data",
"[",
"\"analysis\"",
"]",
".",
"lower",
"(",
")",
"to_run",
"=... | Retrieve a list of QC tools to use based on configuration and analysis type.
Uses defaults if previously set. | [
"Retrieve",
"a",
"list",
"of",
"QC",
"tools",
"to",
"use",
"based",
"on",
"configuration",
"and",
"analysis",
"type",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L78-L123 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _run_qc_tools | def _run_qc_tools(bam_file, data):
"""Run a set of third party quality control tools, returning QC directory and metrics.
:param bam_file: alignments in bam format
:param data: dict with all configuration information
:returns: dict with output of different tools
"""
from bcbio.qc i... | python | def _run_qc_tools(bam_file, data):
"""Run a set of third party quality control tools, returning QC directory and metrics.
:param bam_file: alignments in bam format
:param data: dict with all configuration information
:returns: dict with output of different tools
"""
from bcbio.qc i... | [
"def",
"_run_qc_tools",
"(",
"bam_file",
",",
"data",
")",
":",
"from",
"bcbio",
".",
"qc",
"import",
"(",
"atropos",
",",
"contamination",
",",
"coverage",
",",
"damage",
",",
"fastqc",
",",
"kraken",
",",
"qsignature",
",",
"qualimap",
",",
"samtools",
... | Run a set of third party quality control tools, returning QC directory and metrics.
:param bam_file: alignments in bam format
:param data: dict with all configuration information
:returns: dict with output of different tools | [
"Run",
"a",
"set",
"of",
"third",
"party",
"quality",
"control",
"tools",
"returning",
"QC",
"directory",
"and",
"metrics",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L125-L187 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _organize_qc_files | def _organize_qc_files(program, qc_dir):
"""Organize outputs from quality control runs into a base file and secondary outputs.
Provides compatibility with CWL output. Returns None if no files created during processing.
"""
base_files = {"fastqc": "fastqc_report.html",
"qualimap_rnaseq... | python | def _organize_qc_files(program, qc_dir):
"""Organize outputs from quality control runs into a base file and secondary outputs.
Provides compatibility with CWL output. Returns None if no files created during processing.
"""
base_files = {"fastqc": "fastqc_report.html",
"qualimap_rnaseq... | [
"def",
"_organize_qc_files",
"(",
"program",
",",
"qc_dir",
")",
":",
"base_files",
"=",
"{",
"\"fastqc\"",
":",
"\"fastqc_report.html\"",
",",
"\"qualimap_rnaseq\"",
":",
"\"qualimapReport.html\"",
",",
"\"qualimap\"",
":",
"\"qualimapReport.html\"",
"}",
"if",
"os",... | Organize outputs from quality control runs into a base file and secondary outputs.
Provides compatibility with CWL output. Returns None if no files created during processing. | [
"Organize",
"outputs",
"from",
"quality",
"control",
"runs",
"into",
"a",
"base",
"file",
"and",
"secondary",
"outputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L189-L220 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _split_samples_by_qc | def _split_samples_by_qc(samples):
"""Split data into individual quality control steps for a run.
"""
to_process = []
extras = []
for data in [utils.to_single_data(x) for x in samples]:
qcs = dd.get_algorithm_qc(data)
# kraken doesn't need bam
if qcs and (dd.get_align_bam(dat... | python | def _split_samples_by_qc(samples):
"""Split data into individual quality control steps for a run.
"""
to_process = []
extras = []
for data in [utils.to_single_data(x) for x in samples]:
qcs = dd.get_algorithm_qc(data)
# kraken doesn't need bam
if qcs and (dd.get_align_bam(dat... | [
"def",
"_split_samples_by_qc",
"(",
"samples",
")",
":",
"to_process",
"=",
"[",
"]",
"extras",
"=",
"[",
"]",
"for",
"data",
"in",
"[",
"utils",
".",
"to_single_data",
"(",
"x",
")",
"for",
"x",
"in",
"samples",
"]",
":",
"qcs",
"=",
"dd",
".",
"g... | Split data into individual quality control steps for a run. | [
"Split",
"data",
"into",
"individual",
"quality",
"control",
"steps",
"for",
"a",
"run",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L224-L240 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _combine_qc_samples | def _combine_qc_samples(samples):
"""Combine split QC analyses into single samples based on BAM files.
"""
by_bam = collections.defaultdict(list)
for data in [utils.to_single_data(x) for x in samples]:
batch = dd.get_batch(data) or dd.get_sample_name(data)
if not isinstance(batch, (list,... | python | def _combine_qc_samples(samples):
"""Combine split QC analyses into single samples based on BAM files.
"""
by_bam = collections.defaultdict(list)
for data in [utils.to_single_data(x) for x in samples]:
batch = dd.get_batch(data) or dd.get_sample_name(data)
if not isinstance(batch, (list,... | [
"def",
"_combine_qc_samples",
"(",
"samples",
")",
":",
"by_bam",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"data",
"in",
"[",
"utils",
".",
"to_single_data",
"(",
"x",
")",
"for",
"x",
"in",
"samples",
"]",
":",
"batch",
"=",
"d... | Combine split QC analyses into single samples based on BAM files. | [
"Combine",
"split",
"QC",
"analyses",
"into",
"single",
"samples",
"based",
"on",
"BAM",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L242-L266 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | write_project_summary | def write_project_summary(samples, qsign_info=None):
"""Write project summary information on the provided samples.
write out dirs, genome resources,
"""
work_dir = samples[0][0]["dirs"]["work"]
out_file = os.path.join(work_dir, "project-summary.yaml")
upload_dir = (os.path.join(work_dir, sample... | python | def write_project_summary(samples, qsign_info=None):
"""Write project summary information on the provided samples.
write out dirs, genome resources,
"""
work_dir = samples[0][0]["dirs"]["work"]
out_file = os.path.join(work_dir, "project-summary.yaml")
upload_dir = (os.path.join(work_dir, sample... | [
"def",
"write_project_summary",
"(",
"samples",
",",
"qsign_info",
"=",
"None",
")",
":",
"work_dir",
"=",
"samples",
"[",
"0",
"]",
"[",
"0",
"]",
"[",
"\"dirs\"",
"]",
"[",
"\"work\"",
"]",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"wor... | Write project summary information on the provided samples.
write out dirs, genome resources, | [
"Write",
"project",
"summary",
"information",
"on",
"the",
"provided",
"samples",
".",
"write",
"out",
"dirs",
"genome",
"resources"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L270-L295 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _merge_metadata | def _merge_metadata(samples):
"""Merge all metadata into CSV file"""
samples = list(utils.flatten(samples))
out_dir = dd.get_work_dir(samples[0])
logger.info("summarize metadata")
out_file = os.path.join(out_dir, "metadata.csv")
sample_metrics = collections.defaultdict(dict)
for s in samples... | python | def _merge_metadata(samples):
"""Merge all metadata into CSV file"""
samples = list(utils.flatten(samples))
out_dir = dd.get_work_dir(samples[0])
logger.info("summarize metadata")
out_file = os.path.join(out_dir, "metadata.csv")
sample_metrics = collections.defaultdict(dict)
for s in samples... | [
"def",
"_merge_metadata",
"(",
"samples",
")",
":",
"samples",
"=",
"list",
"(",
"utils",
".",
"flatten",
"(",
"samples",
")",
")",
"out_dir",
"=",
"dd",
".",
"get_work_dir",
"(",
"samples",
"[",
"0",
"]",
")",
"logger",
".",
"info",
"(",
"\"summarize ... | Merge all metadata into CSV file | [
"Merge",
"all",
"metadata",
"into",
"CSV",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L297-L314 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _other_pipeline_samples | def _other_pipeline_samples(summary_file, cur_samples):
"""Retrieve samples produced previously by another pipeline in the summary output.
"""
cur_descriptions = set([s[0]["description"] for s in cur_samples])
out = []
if utils.file_exists(summary_file):
with open(summary_file) as in_handle:... | python | def _other_pipeline_samples(summary_file, cur_samples):
"""Retrieve samples produced previously by another pipeline in the summary output.
"""
cur_descriptions = set([s[0]["description"] for s in cur_samples])
out = []
if utils.file_exists(summary_file):
with open(summary_file) as in_handle:... | [
"def",
"_other_pipeline_samples",
"(",
"summary_file",
",",
"cur_samples",
")",
":",
"cur_descriptions",
"=",
"set",
"(",
"[",
"s",
"[",
"0",
"]",
"[",
"\"description\"",
"]",
"for",
"s",
"in",
"cur_samples",
"]",
")",
"out",
"=",
"[",
"]",
"if",
"utils"... | Retrieve samples produced previously by another pipeline in the summary output. | [
"Retrieve",
"samples",
"produced",
"previously",
"by",
"another",
"pipeline",
"in",
"the",
"summary",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L316-L326 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _add_researcher_summary | def _add_researcher_summary(samples, summary_yaml):
"""Generate summary files per researcher if organized via a LIMS.
"""
by_researcher = collections.defaultdict(list)
for data in (x[0] for x in samples):
researcher = utils.get_in(data, ("upload", "researcher"))
if researcher:
... | python | def _add_researcher_summary(samples, summary_yaml):
"""Generate summary files per researcher if organized via a LIMS.
"""
by_researcher = collections.defaultdict(list)
for data in (x[0] for x in samples):
researcher = utils.get_in(data, ("upload", "researcher"))
if researcher:
... | [
"def",
"_add_researcher_summary",
"(",
"samples",
",",
"summary_yaml",
")",
":",
"by_researcher",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"data",
"in",
"(",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"samples",
")",
":",
"researcher",
... | Generate summary files per researcher if organized via a LIMS. | [
"Generate",
"summary",
"files",
"per",
"researcher",
"if",
"organized",
"via",
"a",
"LIMS",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L338-L356 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | _summary_csv_by_researcher | def _summary_csv_by_researcher(summary_yaml, researcher, descrs, data):
"""Generate a CSV file with summary information for a researcher on this project.
"""
out_file = os.path.join(utils.safe_makedir(os.path.join(data["dirs"]["work"], "researcher")),
"%s-summary.tsv" % run_info.... | python | def _summary_csv_by_researcher(summary_yaml, researcher, descrs, data):
"""Generate a CSV file with summary information for a researcher on this project.
"""
out_file = os.path.join(utils.safe_makedir(os.path.join(data["dirs"]["work"], "researcher")),
"%s-summary.tsv" % run_info.... | [
"def",
"_summary_csv_by_researcher",
"(",
"summary_yaml",
",",
"researcher",
",",
"descrs",
",",
"data",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data",
"[",
... | Generate a CSV file with summary information for a researcher on this project. | [
"Generate",
"a",
"CSV",
"file",
"with",
"summary",
"information",
"for",
"a",
"researcher",
"on",
"this",
"project",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L358-L373 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/qcsummary.py | prep_pdf | def prep_pdf(qc_dir, config):
"""Create PDF from HTML summary outputs in QC directory.
Requires wkhtmltopdf installed: http://www.msweet.org/projects.php?Z1
Thanks to: https://www.biostars.org/p/16991/
Works around issues with CSS conversion on CentOS by adjusting CSS.
"""
html_file = os.path.... | python | def prep_pdf(qc_dir, config):
"""Create PDF from HTML summary outputs in QC directory.
Requires wkhtmltopdf installed: http://www.msweet.org/projects.php?Z1
Thanks to: https://www.biostars.org/p/16991/
Works around issues with CSS conversion on CentOS by adjusting CSS.
"""
html_file = os.path.... | [
"def",
"prep_pdf",
"(",
"qc_dir",
",",
"config",
")",
":",
"html_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"qc_dir",
",",
"\"fastqc\"",
",",
"\"fastqc_report.html\"",
")",
"html_fixed",
"=",
"\"%s-fixed%s\"",
"%",
"os",
".",
"path",
".",
"splitext",... | Create PDF from HTML summary outputs in QC directory.
Requires wkhtmltopdf installed: http://www.msweet.org/projects.php?Z1
Thanks to: https://www.biostars.org/p/16991/
Works around issues with CSS conversion on CentOS by adjusting CSS. | [
"Create",
"PDF",
"from",
"HTML",
"summary",
"outputs",
"in",
"QC",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L377-L399 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _run_purecn_dx | def _run_purecn_dx(out, paired):
"""Extract signatures and mutational burdens from PureCN rds file.
"""
out_base, out, all_files = _get_purecn_dx_files(paired, out)
if not utils.file_uptodate(out["mutation_burden"], out["rds"]):
with file_transaction(paired.tumor_data, out_base) as tx_out_base:
... | python | def _run_purecn_dx(out, paired):
"""Extract signatures and mutational burdens from PureCN rds file.
"""
out_base, out, all_files = _get_purecn_dx_files(paired, out)
if not utils.file_uptodate(out["mutation_burden"], out["rds"]):
with file_transaction(paired.tumor_data, out_base) as tx_out_base:
... | [
"def",
"_run_purecn_dx",
"(",
"out",
",",
"paired",
")",
":",
"out_base",
",",
"out",
",",
"all_files",
"=",
"_get_purecn_dx_files",
"(",
"paired",
",",
"out",
")",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out",
"[",
"\"mutation_burden\"",
"]",
",... | Extract signatures and mutational burdens from PureCN rds file. | [
"Extract",
"signatures",
"and",
"mutational",
"burdens",
"from",
"PureCN",
"rds",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L49-L62 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _get_purecn_dx_files | def _get_purecn_dx_files(paired, out):
"""Retrieve files generated by PureCN_Dx
"""
out_base = "%s-dx" % utils.splitext_plus(out["rds"])[0]
all_files = []
for key, ext in [[("mutation_burden",), "_mutation_burden.csv"],
[("plot", "signatures"), "_signatures.pdf"],
... | python | def _get_purecn_dx_files(paired, out):
"""Retrieve files generated by PureCN_Dx
"""
out_base = "%s-dx" % utils.splitext_plus(out["rds"])[0]
all_files = []
for key, ext in [[("mutation_burden",), "_mutation_burden.csv"],
[("plot", "signatures"), "_signatures.pdf"],
... | [
"def",
"_get_purecn_dx_files",
"(",
"paired",
",",
"out",
")",
":",
"out_base",
"=",
"\"%s-dx\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"out",
"[",
"\"rds\"",
"]",
")",
"[",
"0",
"]",
"all_files",
"=",
"[",
"]",
"for",
"key",
",",
"ext",
"in",
"["... | Retrieve files generated by PureCN_Dx | [
"Retrieve",
"files",
"generated",
"by",
"PureCN_Dx"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L64-L75 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _run_purecn | def _run_purecn(paired, work_dir):
"""Run PureCN.R wrapper with pre-segmented CNVkit or GATK4 inputs.
"""
segfns = {"cnvkit": _segment_normalized_cnvkit, "gatk-cnv": _segment_normalized_gatk}
out_base, out, all_files = _get_purecn_files(paired, work_dir)
failed_file = out_base + "-failed.log"
cn... | python | def _run_purecn(paired, work_dir):
"""Run PureCN.R wrapper with pre-segmented CNVkit or GATK4 inputs.
"""
segfns = {"cnvkit": _segment_normalized_cnvkit, "gatk-cnv": _segment_normalized_gatk}
out_base, out, all_files = _get_purecn_files(paired, work_dir)
failed_file = out_base + "-failed.log"
cn... | [
"def",
"_run_purecn",
"(",
"paired",
",",
"work_dir",
")",
":",
"segfns",
"=",
"{",
"\"cnvkit\"",
":",
"_segment_normalized_cnvkit",
",",
"\"gatk-cnv\"",
":",
"_segment_normalized_gatk",
"}",
"out_base",
",",
"out",
",",
"all_files",
"=",
"_get_purecn_files",
"(",... | Run PureCN.R wrapper with pre-segmented CNVkit or GATK4 inputs. | [
"Run",
"PureCN",
".",
"R",
"wrapper",
"with",
"pre",
"-",
"segmented",
"CNVkit",
"or",
"GATK4",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L77-L118 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _segment_normalized_gatk | def _segment_normalized_gatk(cnr_file, work_dir, paired):
"""Segmentation of normalized inputs using GATK4, converting into standard input formats.
"""
work_dir = utils.safe_makedir(os.path.join(work_dir, "gatk-cnv"))
seg_file = gatkcnv.model_segments(cnr_file, work_dir, paired)["seg"]
std_seg_file ... | python | def _segment_normalized_gatk(cnr_file, work_dir, paired):
"""Segmentation of normalized inputs using GATK4, converting into standard input formats.
"""
work_dir = utils.safe_makedir(os.path.join(work_dir, "gatk-cnv"))
seg_file = gatkcnv.model_segments(cnr_file, work_dir, paired)["seg"]
std_seg_file ... | [
"def",
"_segment_normalized_gatk",
"(",
"cnr_file",
",",
"work_dir",
",",
"paired",
")",
":",
"work_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"gatk-cnv\"",
")",
")",
"seg_file",
"=",
"gatkcnv",
".... | Segmentation of normalized inputs using GATK4, converting into standard input formats. | [
"Segmentation",
"of",
"normalized",
"inputs",
"using",
"GATK4",
"converting",
"into",
"standard",
"input",
"formats",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L126-L151 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _segment_normalized_cnvkit | def _segment_normalized_cnvkit(cnr_file, work_dir, paired):
"""Segmentation of normalized inputs using CNVkit.
"""
cnvkit_base = os.path.join(utils.safe_makedir(os.path.join(work_dir, "cnvkit")),
dd.get_sample_name(paired.tumor_data))
cnr_file = chromhacks.bed_to_standard... | python | def _segment_normalized_cnvkit(cnr_file, work_dir, paired):
"""Segmentation of normalized inputs using CNVkit.
"""
cnvkit_base = os.path.join(utils.safe_makedir(os.path.join(work_dir, "cnvkit")),
dd.get_sample_name(paired.tumor_data))
cnr_file = chromhacks.bed_to_standard... | [
"def",
"_segment_normalized_cnvkit",
"(",
"cnr_file",
",",
"work_dir",
",",
"paired",
")",
":",
"cnvkit_base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"cnvkit\"",
... | Segmentation of normalized inputs using CNVkit. | [
"Segmentation",
"of",
"normalized",
"inputs",
"using",
"CNVkit",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L153-L163 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _remove_overlaps | def _remove_overlaps(in_file, out_dir, data):
"""Remove regions that overlap with next region, these result in issues with PureCN.
"""
out_file = os.path.join(out_dir, "%s-nooverlaps%s" % utils.splitext_plus(os.path.basename(in_file)))
if not utils.file_uptodate(out_file, in_file):
with file_tra... | python | def _remove_overlaps(in_file, out_dir, data):
"""Remove regions that overlap with next region, these result in issues with PureCN.
"""
out_file = os.path.join(out_dir, "%s-nooverlaps%s" % utils.splitext_plus(os.path.basename(in_file)))
if not utils.file_uptodate(out_file, in_file):
with file_tra... | [
"def",
"_remove_overlaps",
"(",
"in_file",
",",
"out_dir",
",",
"data",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"%s-nooverlaps%s\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"os",
".",
"path",
".",
"basename",
"(... | Remove regions that overlap with next region, these result in issues with PureCN. | [
"Remove",
"regions",
"that",
"overlap",
"with",
"next",
"region",
"these",
"result",
"in",
"issues",
"with",
"PureCN",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L165-L185 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _get_purecn_files | def _get_purecn_files(paired, work_dir, require_exist=False):
"""Retrieve organized structure of PureCN output files.
"""
out_base = os.path.join(work_dir, "%s-purecn" % (dd.get_sample_name(paired.tumor_data)))
out = {"plot": {}}
all_files = []
for plot in ["chromosomes", "local_optima", "segmen... | python | def _get_purecn_files(paired, work_dir, require_exist=False):
"""Retrieve organized structure of PureCN output files.
"""
out_base = os.path.join(work_dir, "%s-purecn" % (dd.get_sample_name(paired.tumor_data)))
out = {"plot": {}}
all_files = []
for plot in ["chromosomes", "local_optima", "segmen... | [
"def",
"_get_purecn_files",
"(",
"paired",
",",
"work_dir",
",",
"require_exist",
"=",
"False",
")",
":",
"out_base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-purecn\"",
"%",
"(",
"dd",
".",
"get_sample_name",
"(",
"paired",
".",
... | Retrieve organized structure of PureCN output files. | [
"Retrieve",
"organized",
"structure",
"of",
"PureCN",
"output",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L187-L208 | train |
bcbio/bcbio-nextgen | bcbio/structural/purecn.py | _loh_to_vcf | def _loh_to_vcf(cur):
"""Convert LOH output into standardized VCF.
"""
cn = int(float(cur["C"]))
minor_cn = int(float(cur["M"]))
if cur["type"].find("LOH"):
svtype = "LOH"
elif cn > 2:
svtype = "DUP"
elif cn < 1:
svtype = "DEL"
else:
svtype = None
if s... | python | def _loh_to_vcf(cur):
"""Convert LOH output into standardized VCF.
"""
cn = int(float(cur["C"]))
minor_cn = int(float(cur["M"]))
if cur["type"].find("LOH"):
svtype = "LOH"
elif cn > 2:
svtype = "DUP"
elif cn < 1:
svtype = "DEL"
else:
svtype = None
if s... | [
"def",
"_loh_to_vcf",
"(",
"cur",
")",
":",
"cn",
"=",
"int",
"(",
"float",
"(",
"cur",
"[",
"\"C\"",
"]",
")",
")",
"minor_cn",
"=",
"int",
"(",
"float",
"(",
"cur",
"[",
"\"M\"",
"]",
")",
")",
"if",
"cur",
"[",
"\"type\"",
"]",
".",
"find",
... | Convert LOH output into standardized VCF. | [
"Convert",
"LOH",
"output",
"into",
"standardized",
"VCF",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L219-L237 | train |
bcbio/bcbio-nextgen | scripts/utils/collect_metrics_to_csv.py | _generate_metrics | def _generate_metrics(bam_fname, config_file, ref_file,
bait_file, target_file):
"""Run Picard commands to generate metrics files when missing.
"""
with open(config_file) as in_handle:
config = yaml.safe_load(in_handle)
broad_runner = broad.runner_from_config(config)
ba... | python | def _generate_metrics(bam_fname, config_file, ref_file,
bait_file, target_file):
"""Run Picard commands to generate metrics files when missing.
"""
with open(config_file) as in_handle:
config = yaml.safe_load(in_handle)
broad_runner = broad.runner_from_config(config)
ba... | [
"def",
"_generate_metrics",
"(",
"bam_fname",
",",
"config_file",
",",
"ref_file",
",",
"bait_file",
",",
"target_file",
")",
":",
"with",
"open",
"(",
"config_file",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_handle",
")"... | Run Picard commands to generate metrics files when missing. | [
"Run",
"Picard",
"commands",
"to",
"generate",
"metrics",
"files",
"when",
"missing",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/collect_metrics_to_csv.py#L135-L155 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | run | def run(items, background=None):
"""Detect copy number variations from batched set of samples using GATK4 CNV calling.
TODO: implement germline calling with DetermineGermlineContigPloidy and GermlineCNVCaller
"""
if not background: background = []
paired = vcfutils.get_paired(items + background)
... | python | def run(items, background=None):
"""Detect copy number variations from batched set of samples using GATK4 CNV calling.
TODO: implement germline calling with DetermineGermlineContigPloidy and GermlineCNVCaller
"""
if not background: background = []
paired = vcfutils.get_paired(items + background)
... | [
"def",
"run",
"(",
"items",
",",
"background",
"=",
"None",
")",
":",
"if",
"not",
"background",
":",
"background",
"=",
"[",
"]",
"paired",
"=",
"vcfutils",
".",
"get_paired",
"(",
"items",
"+",
"background",
")",
"if",
"paired",
":",
"out",
"=",
"_... | Detect copy number variations from batched set of samples using GATK4 CNV calling.
TODO: implement germline calling with DetermineGermlineContigPloidy and GermlineCNVCaller | [
"Detect",
"copy",
"number",
"variations",
"from",
"batched",
"set",
"of",
"samples",
"using",
"GATK4",
"CNV",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L19-L32 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | _run_paired | def _run_paired(paired):
"""Run somatic variant calling pipeline.
"""
from bcbio.structural import titancna
work_dir = _sv_workdir(paired.tumor_data)
seg_files = model_segments(tz.get_in(["depth", "bins", "normalized"], paired.tumor_data),
work_dir, paired)
call_fi... | python | def _run_paired(paired):
"""Run somatic variant calling pipeline.
"""
from bcbio.structural import titancna
work_dir = _sv_workdir(paired.tumor_data)
seg_files = model_segments(tz.get_in(["depth", "bins", "normalized"], paired.tumor_data),
work_dir, paired)
call_fi... | [
"def",
"_run_paired",
"(",
"paired",
")",
":",
"from",
"bcbio",
".",
"structural",
"import",
"titancna",
"work_dir",
"=",
"_sv_workdir",
"(",
"paired",
".",
"tumor_data",
")",
"seg_files",
"=",
"model_segments",
"(",
"tz",
".",
"get_in",
"(",
"[",
"\"depth\"... | Run somatic variant calling pipeline. | [
"Run",
"somatic",
"variant",
"calling",
"pipeline",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L34-L54 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | call_copy_numbers | def call_copy_numbers(seg_file, work_dir, data):
"""Call copy numbers from a normalized and segmented input file.
"""
out_file = os.path.join(work_dir, "%s-call.seg" % dd.get_sample_name(data))
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
... | python | def call_copy_numbers(seg_file, work_dir, data):
"""Call copy numbers from a normalized and segmented input file.
"""
out_file = os.path.join(work_dir, "%s-call.seg" % dd.get_sample_name(data))
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
... | [
"def",
"call_copy_numbers",
"(",
"seg_file",
",",
"work_dir",
",",
"data",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-call.seg\"",
"%",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
")",
"if",
"not",
"utils",... | Call copy numbers from a normalized and segmented input file. | [
"Call",
"copy",
"numbers",
"from",
"a",
"normalized",
"and",
"segmented",
"input",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L56-L65 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | plot_model_segments | def plot_model_segments(seg_files, work_dir, data):
"""Diagnostic plots of segmentation and inputs.
"""
from bcbio.heterogeneity import chromhacks
out_file = os.path.join(work_dir, "%s.modeled.png" % dd.get_sample_name(data))
if not utils.file_exists(out_file):
with file_transaction(data, ou... | python | def plot_model_segments(seg_files, work_dir, data):
"""Diagnostic plots of segmentation and inputs.
"""
from bcbio.heterogeneity import chromhacks
out_file = os.path.join(work_dir, "%s.modeled.png" % dd.get_sample_name(data))
if not utils.file_exists(out_file):
with file_transaction(data, ou... | [
"def",
"plot_model_segments",
"(",
"seg_files",
",",
"work_dir",
",",
"data",
")",
":",
"from",
"bcbio",
".",
"heterogeneity",
"import",
"chromhacks",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s.modeled.png\"",
"%",
"dd",
"."... | Diagnostic plots of segmentation and inputs. | [
"Diagnostic",
"plots",
"of",
"segmentation",
"and",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L67-L95 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | model_segments | def model_segments(copy_file, work_dir, paired):
"""Perform segmentation on input copy number log2 ratio file.
"""
out_file = os.path.join(work_dir, "%s.cr.seg" % dd.get_sample_name(paired.tumor_data))
tumor_counts, normal_counts = heterogzygote_counts(paired)
if not utils.file_exists(out_file):
... | python | def model_segments(copy_file, work_dir, paired):
"""Perform segmentation on input copy number log2 ratio file.
"""
out_file = os.path.join(work_dir, "%s.cr.seg" % dd.get_sample_name(paired.tumor_data))
tumor_counts, normal_counts = heterogzygote_counts(paired)
if not utils.file_exists(out_file):
... | [
"def",
"model_segments",
"(",
"copy_file",
",",
"work_dir",
",",
"paired",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s.cr.seg\"",
"%",
"dd",
".",
"get_sample_name",
"(",
"paired",
".",
"tumor_data",
")",
")",
"t... | Perform segmentation on input copy number log2 ratio file. | [
"Perform",
"segmentation",
"on",
"input",
"copy",
"number",
"log2",
"ratio",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L97-L116 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | create_panel_of_normals | def create_panel_of_normals(items, group_id, work_dir):
"""Create a panel of normals from one or more background read counts.
"""
out_file = os.path.join(work_dir, "%s-%s-pon.hdf5" % (dd.get_sample_name(items[0]), group_id))
if not utils.file_exists(out_file):
with file_transaction(items[0], out... | python | def create_panel_of_normals(items, group_id, work_dir):
"""Create a panel of normals from one or more background read counts.
"""
out_file = os.path.join(work_dir, "%s-%s-pon.hdf5" % (dd.get_sample_name(items[0]), group_id))
if not utils.file_exists(out_file):
with file_transaction(items[0], out... | [
"def",
"create_panel_of_normals",
"(",
"items",
",",
"group_id",
",",
"work_dir",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-%s-pon.hdf5\"",
"%",
"(",
"dd",
".",
"get_sample_name",
"(",
"items",
"[",
"0",
"]",
... | Create a panel of normals from one or more background read counts. | [
"Create",
"a",
"panel",
"of",
"normals",
"from",
"one",
"or",
"more",
"background",
"read",
"counts",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L136-L148 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | pon_to_bed | def pon_to_bed(pon_file, out_dir, data):
"""Extract BED intervals from a GATK4 hdf5 panel of normal file.
"""
out_file = os.path.join(out_dir, "%s-intervals.bed" % (utils.splitext_plus(os.path.basename(pon_file))[0]))
if not utils.file_uptodate(out_file, pon_file):
import h5py
with file_... | python | def pon_to_bed(pon_file, out_dir, data):
"""Extract BED intervals from a GATK4 hdf5 panel of normal file.
"""
out_file = os.path.join(out_dir, "%s-intervals.bed" % (utils.splitext_plus(os.path.basename(pon_file))[0]))
if not utils.file_uptodate(out_file, pon_file):
import h5py
with file_... | [
"def",
"pon_to_bed",
"(",
"pon_file",
",",
"out_dir",
",",
"data",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"%s-intervals.bed\"",
"%",
"(",
"utils",
".",
"splitext_plus",
"(",
"os",
".",
"path",
".",
"basename",
... | Extract BED intervals from a GATK4 hdf5 panel of normal file. | [
"Extract",
"BED",
"intervals",
"from",
"a",
"GATK4",
"hdf5",
"panel",
"of",
"normal",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L150-L165 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | prepare_intervals | def prepare_intervals(data, region_file, work_dir):
"""Prepare interval regions for targeted and gene based regions.
"""
target_file = os.path.join(work_dir, "%s-target.interval_list" % dd.get_sample_name(data))
if not utils.file_uptodate(target_file, region_file):
with file_transaction(data, ta... | python | def prepare_intervals(data, region_file, work_dir):
"""Prepare interval regions for targeted and gene based regions.
"""
target_file = os.path.join(work_dir, "%s-target.interval_list" % dd.get_sample_name(data))
if not utils.file_uptodate(target_file, region_file):
with file_transaction(data, ta... | [
"def",
"prepare_intervals",
"(",
"data",
",",
"region_file",
",",
"work_dir",
")",
":",
"target_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-target.interval_list\"",
"%",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
")",
"if",
... | Prepare interval regions for targeted and gene based regions. | [
"Prepare",
"interval",
"regions",
"for",
"targeted",
"and",
"gene",
"based",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L167-L181 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | annotate_intervals | def annotate_intervals(target_file, data):
"""Provide GC annotated intervals for error correction during panels and denoising.
TODO: include mappability and segmentation duplication inputs
"""
out_file = "%s-gcannotated.tsv" % utils.splitext_plus(target_file)[0]
if not utils.file_uptodate(out_file,... | python | def annotate_intervals(target_file, data):
"""Provide GC annotated intervals for error correction during panels and denoising.
TODO: include mappability and segmentation duplication inputs
"""
out_file = "%s-gcannotated.tsv" % utils.splitext_plus(target_file)[0]
if not utils.file_uptodate(out_file,... | [
"def",
"annotate_intervals",
"(",
"target_file",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s-gcannotated.tsv\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"target_file",
")",
"[",
"0",
"]",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"... | Provide GC annotated intervals for error correction during panels and denoising.
TODO: include mappability and segmentation duplication inputs | [
"Provide",
"GC",
"annotated",
"intervals",
"for",
"error",
"correction",
"during",
"panels",
"and",
"denoising",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L183-L196 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | collect_read_counts | def collect_read_counts(data, work_dir):
"""Count reads in defined bins using CollectReadCounts.
"""
out_file = os.path.join(work_dir, "%s-target-coverage.hdf5" % dd.get_sample_name(data))
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
param... | python | def collect_read_counts(data, work_dir):
"""Count reads in defined bins using CollectReadCounts.
"""
out_file = os.path.join(work_dir, "%s-target-coverage.hdf5" % dd.get_sample_name(data))
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
param... | [
"def",
"collect_read_counts",
"(",
"data",
",",
"work_dir",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-target-coverage.hdf5\"",
"%",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
")",
"if",
"not",
"utils",
".",... | Count reads in defined bins using CollectReadCounts. | [
"Count",
"reads",
"in",
"defined",
"bins",
"using",
"CollectReadCounts",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L198-L209 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | _filter_by_normal | def _filter_by_normal(tumor_counts, normal_counts, data):
"""Filter count files based on normal frequency and median depth, avoiding high depth regions.
For frequency, restricts normal positions to those between 0.4 and 0.65
For depth, matches approach used in AMBER to try and avoid problematic genomic re... | python | def _filter_by_normal(tumor_counts, normal_counts, data):
"""Filter count files based on normal frequency and median depth, avoiding high depth regions.
For frequency, restricts normal positions to those between 0.4 and 0.65
For depth, matches approach used in AMBER to try and avoid problematic genomic re... | [
"def",
"_filter_by_normal",
"(",
"tumor_counts",
",",
"normal_counts",
",",
"data",
")",
":",
"from",
"bcbio",
".",
"heterogeneity",
"import",
"bubbletree",
"fparams",
"=",
"bubbletree",
".",
"NORMAL_FILTER_PARAMS",
"tumor_out",
"=",
"\"%s-normfilter%s\"",
"%",
"uti... | Filter count files based on normal frequency and median depth, avoiding high depth regions.
For frequency, restricts normal positions to those between 0.4 and 0.65
For depth, matches approach used in AMBER to try and avoid problematic genomic regions
with high count in the normal:
https://github.com/h... | [
"Filter",
"count",
"files",
"based",
"on",
"normal",
"frequency",
"and",
"median",
"depth",
"avoiding",
"high",
"depth",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L226-L259 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | _run_collect_allelic_counts | def _run_collect_allelic_counts(pos_file, pos_name, work_dir, data):
"""Counts by alleles for a specific sample and set of positions.
"""
out_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "structural", "counts"))
out_file = os.path.join(out_dir, "%s-%s-counts.tsv" % (dd.get_sample_name(da... | python | def _run_collect_allelic_counts(pos_file, pos_name, work_dir, data):
"""Counts by alleles for a specific sample and set of positions.
"""
out_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "structural", "counts"))
out_file = os.path.join(out_dir, "%s-%s-counts.tsv" % (dd.get_sample_name(da... | [
"def",
"_run_collect_allelic_counts",
"(",
"pos_file",
",",
"pos_name",
",",
"work_dir",
",",
"data",
")",
":",
"out_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"s... | Counts by alleles for a specific sample and set of positions. | [
"Counts",
"by",
"alleles",
"for",
"a",
"specific",
"sample",
"and",
"set",
"of",
"positions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L287-L297 | train |
bcbio/bcbio-nextgen | bcbio/structural/gatkcnv.py | _seg_to_vcf | def _seg_to_vcf(vals):
"""Convert GATK CNV calls seg output to a VCF line.
"""
call_to_cn = {"+": 3, "-": 1}
call_to_type = {"+": "DUP", "-": "DEL"}
if vals["CALL"] not in ["0"]:
info = ["FOLD_CHANGE_LOG=%s" % vals["MEAN_LOG2_COPY_RATIO"],
"PROBES=%s" % vals["NUM_POINTS_COPY_... | python | def _seg_to_vcf(vals):
"""Convert GATK CNV calls seg output to a VCF line.
"""
call_to_cn = {"+": 3, "-": 1}
call_to_type = {"+": "DUP", "-": "DEL"}
if vals["CALL"] not in ["0"]:
info = ["FOLD_CHANGE_LOG=%s" % vals["MEAN_LOG2_COPY_RATIO"],
"PROBES=%s" % vals["NUM_POINTS_COPY_... | [
"def",
"_seg_to_vcf",
"(",
"vals",
")",
":",
"call_to_cn",
"=",
"{",
"\"+\"",
":",
"3",
",",
"\"-\"",
":",
"1",
"}",
"call_to_type",
"=",
"{",
"\"+\"",
":",
"\"DUP\"",
",",
"\"-\"",
":",
"\"DEL\"",
"}",
"if",
"vals",
"[",
"\"CALL\"",
"]",
"not",
"i... | Convert GATK CNV calls seg output to a VCF line. | [
"Convert",
"GATK",
"CNV",
"calls",
"seg",
"output",
"to",
"a",
"VCF",
"line",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L313-L326 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/bcbiornaseq.py | make_bcbiornaseq_object | def make_bcbiornaseq_object(data):
"""
load the initial bcb.rda object using bcbioRNASeq
"""
if "bcbiornaseq" not in dd.get_tools_on(data):
return data
upload_dir = tz.get_in(("upload", "dir"), data)
report_dir = os.path.join(upload_dir, "bcbioRNASeq")
safe_makedir(report_dir)
or... | python | def make_bcbiornaseq_object(data):
"""
load the initial bcb.rda object using bcbioRNASeq
"""
if "bcbiornaseq" not in dd.get_tools_on(data):
return data
upload_dir = tz.get_in(("upload", "dir"), data)
report_dir = os.path.join(upload_dir, "bcbioRNASeq")
safe_makedir(report_dir)
or... | [
"def",
"make_bcbiornaseq_object",
"(",
"data",
")",
":",
"if",
"\"bcbiornaseq\"",
"not",
"in",
"dd",
".",
"get_tools_on",
"(",
"data",
")",
":",
"return",
"data",
"upload_dir",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"upload\"",
",",
"\"dir\"",
")",
",",
"... | load the initial bcb.rda object using bcbioRNASeq | [
"load",
"the",
"initial",
"bcb",
".",
"rda",
"object",
"using",
"bcbioRNASeq"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/bcbiornaseq.py#L12-L31 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/bcbiornaseq.py | make_quality_report | def make_quality_report(data):
"""
create and render the bcbioRNASeq quality report
"""
if "bcbiornaseq" not in dd.get_tools_on(data):
return data
upload_dir = tz.get_in(("upload", "dir"), data)
report_dir = os.path.join(upload_dir, "bcbioRNASeq")
safe_makedir(report_dir)
quality... | python | def make_quality_report(data):
"""
create and render the bcbioRNASeq quality report
"""
if "bcbiornaseq" not in dd.get_tools_on(data):
return data
upload_dir = tz.get_in(("upload", "dir"), data)
report_dir = os.path.join(upload_dir, "bcbioRNASeq")
safe_makedir(report_dir)
quality... | [
"def",
"make_quality_report",
"(",
"data",
")",
":",
"if",
"\"bcbiornaseq\"",
"not",
"in",
"dd",
".",
"get_tools_on",
"(",
"data",
")",
":",
"return",
"data",
"upload_dir",
"=",
"tz",
".",
"get_in",
"(",
"(",
"\"upload\"",
",",
"\"dir\"",
")",
",",
"data... | create and render the bcbioRNASeq quality report | [
"create",
"and",
"render",
"the",
"bcbioRNASeq",
"quality",
"report"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/bcbiornaseq.py#L33-L47 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/bcbiornaseq.py | rmarkdown_draft | def rmarkdown_draft(filename, template, package):
"""
create a draft rmarkdown file from an installed template
"""
if file_exists(filename):
return filename
draft_template = Template(
'rmarkdown::draft("$filename", template="$template", package="$package", edit=FALSE)'
)
draf... | python | def rmarkdown_draft(filename, template, package):
"""
create a draft rmarkdown file from an installed template
"""
if file_exists(filename):
return filename
draft_template = Template(
'rmarkdown::draft("$filename", template="$template", package="$package", edit=FALSE)'
)
draf... | [
"def",
"rmarkdown_draft",
"(",
"filename",
",",
"template",
",",
"package",
")",
":",
"if",
"file_exists",
"(",
"filename",
")",
":",
"return",
"filename",
"draft_template",
"=",
"Template",
"(",
"'rmarkdown::draft(\"$filename\", template=\"$template\", package=\"$package... | create a draft rmarkdown file from an installed template | [
"create",
"a",
"draft",
"rmarkdown",
"file",
"from",
"an",
"installed",
"template"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/bcbiornaseq.py#L49-L65 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/bcbiornaseq.py | render_rmarkdown_file | def render_rmarkdown_file(filename):
"""
render a rmarkdown file using the rmarkdown library
"""
render_template = Template(
'rmarkdown::render("$filename")'
)
render_string = render_template.substitute(
filename=filename)
report_dir = os.path.dirname(filename)
rcmd = Rsc... | python | def render_rmarkdown_file(filename):
"""
render a rmarkdown file using the rmarkdown library
"""
render_template = Template(
'rmarkdown::render("$filename")'
)
render_string = render_template.substitute(
filename=filename)
report_dir = os.path.dirname(filename)
rcmd = Rsc... | [
"def",
"render_rmarkdown_file",
"(",
"filename",
")",
":",
"render_template",
"=",
"Template",
"(",
"'rmarkdown::render(\"$filename\")'",
")",
"render_string",
"=",
"render_template",
".",
"substitute",
"(",
"filename",
"=",
"filename",
")",
"report_dir",
"=",
"os",
... | render a rmarkdown file using the rmarkdown library | [
"render",
"a",
"rmarkdown",
"file",
"using",
"the",
"rmarkdown",
"library"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/bcbiornaseq.py#L67-L80 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/bcbiornaseq.py | create_load_string | def create_load_string(upload_dir, groups=None, organism=None):
"""
create the code necessary to load the bcbioRNAseq object
"""
libraryline = 'library(bcbioRNASeq)'
load_template = Template(
('bcb <- bcbioRNASeq(uploadDir="$upload_dir",'
'interestingGroups=$groups,'
'organ... | python | def create_load_string(upload_dir, groups=None, organism=None):
"""
create the code necessary to load the bcbioRNAseq object
"""
libraryline = 'library(bcbioRNASeq)'
load_template = Template(
('bcb <- bcbioRNASeq(uploadDir="$upload_dir",'
'interestingGroups=$groups,'
'organ... | [
"def",
"create_load_string",
"(",
"upload_dir",
",",
"groups",
"=",
"None",
",",
"organism",
"=",
"None",
")",
":",
"libraryline",
"=",
"'library(bcbioRNASeq)'",
"load_template",
"=",
"Template",
"(",
"(",
"'bcb <- bcbioRNASeq(uploadDir=\"$upload_dir\",'",
"'interesting... | create the code necessary to load the bcbioRNAseq object | [
"create",
"the",
"code",
"necessary",
"to",
"load",
"the",
"bcbioRNAseq",
"object"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/bcbiornaseq.py#L82-L107 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/bcbiornaseq.py | _list2Rlist | def _list2Rlist(xs):
""" convert a python list to an R list """
if isinstance(xs, six.string_types):
xs = [xs]
rlist = ",".join([_quotestring(x) for x in xs])
return "c(" + rlist + ")" | python | def _list2Rlist(xs):
""" convert a python list to an R list """
if isinstance(xs, six.string_types):
xs = [xs]
rlist = ",".join([_quotestring(x) for x in xs])
return "c(" + rlist + ")" | [
"def",
"_list2Rlist",
"(",
"xs",
")",
":",
"if",
"isinstance",
"(",
"xs",
",",
"six",
".",
"string_types",
")",
":",
"xs",
"=",
"[",
"xs",
"]",
"rlist",
"=",
"\",\"",
".",
"join",
"(",
"[",
"_quotestring",
"(",
"x",
")",
"for",
"x",
"in",
"xs",
... | convert a python list to an R list | [
"convert",
"a",
"python",
"list",
"to",
"an",
"R",
"list"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/bcbiornaseq.py#L124-L129 | train |
bcbio/bcbio-nextgen | bcbio/variation/qsnp.py | _run_qsnp_paired | def _run_qsnp_paired(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Detect somatic mutations with qSNP.
This is used for paired tumor / normal samples.
"""
config = items[0]["config"]
if out_file is None:
out_file = "%s-paired-variants.vcf" % ... | python | def _run_qsnp_paired(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Detect somatic mutations with qSNP.
This is used for paired tumor / normal samples.
"""
config = items[0]["config"]
if out_file is None:
out_file = "%s-paired-variants.vcf" % ... | [
"def",
"_run_qsnp_paired",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
"if",
"out_file",
"is",
... | Detect somatic mutations with qSNP.
This is used for paired tumor / normal samples. | [
"Detect",
"somatic",
"mutations",
"with",
"qSNP",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/qsnp.py#L55-L82 | train |
bcbio/bcbio-nextgen | bcbio/variation/qsnp.py | _clean_regions | def _clean_regions(items, region):
"""Intersect region with target file if it exists"""
variant_regions = bedutils.population_variant_regions(items, merged=True)
with utils.tmpfile() as tx_out_file:
target = subset_variant_regions(variant_regions, region, tx_out_file, items)
if target:
... | python | def _clean_regions(items, region):
"""Intersect region with target file if it exists"""
variant_regions = bedutils.population_variant_regions(items, merged=True)
with utils.tmpfile() as tx_out_file:
target = subset_variant_regions(variant_regions, region, tx_out_file, items)
if target:
... | [
"def",
"_clean_regions",
"(",
"items",
",",
"region",
")",
":",
"variant_regions",
"=",
"bedutils",
".",
"population_variant_regions",
"(",
"items",
",",
"merged",
"=",
"True",
")",
"with",
"utils",
".",
"tmpfile",
"(",
")",
"as",
"tx_out_file",
":",
"target... | Intersect region with target file if it exists | [
"Intersect",
"region",
"with",
"target",
"file",
"if",
"it",
"exists"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/qsnp.py#L84-L94 | train |
bcbio/bcbio-nextgen | bcbio/variation/qsnp.py | _load_regions | def _load_regions(target):
"""Get list of tupples from bed file"""
regions = []
with open(target) as in_handle:
for line in in_handle:
if not line.startswith("#"):
c, s, e = line.strip().split("\t")
regions.append((c, s, e))
return regions | python | def _load_regions(target):
"""Get list of tupples from bed file"""
regions = []
with open(target) as in_handle:
for line in in_handle:
if not line.startswith("#"):
c, s, e = line.strip().split("\t")
regions.append((c, s, e))
return regions | [
"def",
"_load_regions",
"(",
"target",
")",
":",
"regions",
"=",
"[",
"]",
"with",
"open",
"(",
"target",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"in_handle",
":",
"if",
"not",
"line",
".",
"startswith",
"(",
"\"#\"",
")",
":",
"c",
",",
... | Get list of tupples from bed file | [
"Get",
"list",
"of",
"tupples",
"from",
"bed",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/qsnp.py#L96-L104 | train |
bcbio/bcbio-nextgen | bcbio/variation/qsnp.py | _slice_bam | def _slice_bam(in_bam, region, tmp_dir, config):
"""Use sambamba to slice a bam region"""
name_file = os.path.splitext(os.path.basename(in_bam))[0]
out_file = os.path.join(tmp_dir, os.path.join(tmp_dir, name_file + _to_str(region) + ".bam"))
sambamba = config_utils.get_program("sambamba", config)
re... | python | def _slice_bam(in_bam, region, tmp_dir, config):
"""Use sambamba to slice a bam region"""
name_file = os.path.splitext(os.path.basename(in_bam))[0]
out_file = os.path.join(tmp_dir, os.path.join(tmp_dir, name_file + _to_str(region) + ".bam"))
sambamba = config_utils.get_program("sambamba", config)
re... | [
"def",
"_slice_bam",
"(",
"in_bam",
",",
"region",
",",
"tmp_dir",
",",
"config",
")",
":",
"name_file",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"in_bam",
")",
")",
"[",
"0",
"]",
"out_file",
"=",
"os"... | Use sambamba to slice a bam region | [
"Use",
"sambamba",
"to",
"slice",
"a",
"bam",
"region"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/qsnp.py#L114-L123 | train |
bcbio/bcbio-nextgen | bcbio/variation/qsnp.py | _create_input | def _create_input(paired, out_file, ref_file, snp_file, qsnp_file):
"""Create INI input for qSNP"""
ini_file["[inputFiles]"]["dbSNP"] = snp_file
ini_file["[inputFiles]"]["ref"] = ref_file
ini_file["[inputFiles]"]["normalBam"] = paired.normal_bam
ini_file["[inputFiles]"]["tumourBam"] = paired.tumor_b... | python | def _create_input(paired, out_file, ref_file, snp_file, qsnp_file):
"""Create INI input for qSNP"""
ini_file["[inputFiles]"]["dbSNP"] = snp_file
ini_file["[inputFiles]"]["ref"] = ref_file
ini_file["[inputFiles]"]["normalBam"] = paired.normal_bam
ini_file["[inputFiles]"]["tumourBam"] = paired.tumor_b... | [
"def",
"_create_input",
"(",
"paired",
",",
"out_file",
",",
"ref_file",
",",
"snp_file",
",",
"qsnp_file",
")",
":",
"ini_file",
"[",
"\"[inputFiles]\"",
"]",
"[",
"\"dbSNP\"",
"]",
"=",
"snp_file",
"ini_file",
"[",
"\"[inputFiles]\"",
"]",
"[",
"\"ref\"",
... | Create INI input for qSNP | [
"Create",
"INI",
"input",
"for",
"qSNP"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/qsnp.py#L125-L140 | train |
bcbio/bcbio-nextgen | bcbio/variation/qsnp.py | _filter_vcf | def _filter_vcf(out_file):
"""Fix sample names, FILTER and FORMAT fields. Remove lines with ambiguous reference.
"""
in_file = out_file.replace(".vcf", "-ori.vcf")
FILTER_line = ('##FILTER=<ID=SBIAS,Description="Due to bias">\n'
'##FILTER=<ID=5BP,Description="Due to 5BP">\n'
... | python | def _filter_vcf(out_file):
"""Fix sample names, FILTER and FORMAT fields. Remove lines with ambiguous reference.
"""
in_file = out_file.replace(".vcf", "-ori.vcf")
FILTER_line = ('##FILTER=<ID=SBIAS,Description="Due to bias">\n'
'##FILTER=<ID=5BP,Description="Due to 5BP">\n'
... | [
"def",
"_filter_vcf",
"(",
"out_file",
")",
":",
"in_file",
"=",
"out_file",
".",
"replace",
"(",
"\".vcf\"",
",",
"\"-ori.vcf\"",
")",
"FILTER_line",
"=",
"(",
"'##FILTER=<ID=SBIAS,Description=\"Due to bias\">\\n'",
"'##FILTER=<ID=5BP,Description=\"Due to 5BP\">\\n'",
"'##... | Fix sample names, FILTER and FORMAT fields. Remove lines with ambiguous reference. | [
"Fix",
"sample",
"names",
"FILTER",
"and",
"FORMAT",
"fields",
".",
"Remove",
"lines",
"with",
"ambiguous",
"reference",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/qsnp.py#L147-L185 | train |
bcbio/bcbio-nextgen | bcbio/variation/qsnp.py | _set_reject | def _set_reject(line):
"""Set REJECT in VCF line, or add it if there is something else."""
if line.startswith("#"):
return line
parts = line.split("\t")
if parts[6] == "PASS":
parts[6] = "REJECT"
else:
parts[6] += ";REJECT"
return "\t".join(parts) | python | def _set_reject(line):
"""Set REJECT in VCF line, or add it if there is something else."""
if line.startswith("#"):
return line
parts = line.split("\t")
if parts[6] == "PASS":
parts[6] = "REJECT"
else:
parts[6] += ";REJECT"
return "\t".join(parts) | [
"def",
"_set_reject",
"(",
"line",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#\"",
")",
":",
"return",
"line",
"parts",
"=",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
"if",
"parts",
"[",
"6",
"]",
"==",
"\"PASS\"",
":",
"parts",
"[",
"6",... | Set REJECT in VCF line, or add it if there is something else. | [
"Set",
"REJECT",
"in",
"VCF",
"line",
"or",
"add",
"it",
"if",
"there",
"is",
"something",
"else",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/qsnp.py#L193-L202 | train |
bcbio/bcbio-nextgen | scripts/utils/cg_svevents_to_vcf.py | svevent_reader | def svevent_reader(in_file):
"""Lazy generator of SV events, returned as dictionary of parts.
"""
with open(in_file) as in_handle:
while 1:
line = next(in_handle)
if line.startswith(">"):
break
header = line[1:].rstrip().split("\t")
reader = cs... | python | def svevent_reader(in_file):
"""Lazy generator of SV events, returned as dictionary of parts.
"""
with open(in_file) as in_handle:
while 1:
line = next(in_handle)
if line.startswith(">"):
break
header = line[1:].rstrip().split("\t")
reader = cs... | [
"def",
"svevent_reader",
"(",
"in_file",
")",
":",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",
":",
"while",
"1",
":",
"line",
"=",
"next",
"(",
"in_handle",
")",
"if",
"line",
".",
"startswith",
"(",
"\">\"",
")",
":",
"break",
"header",
... | Lazy generator of SV events, returned as dictionary of parts. | [
"Lazy",
"generator",
"of",
"SV",
"events",
"returned",
"as",
"dictionary",
"of",
"parts",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/cg_svevents_to_vcf.py#L64-L78 | train |
bcbio/bcbio-nextgen | bcbio/cwl/inspect.py | initialize_watcher | def initialize_watcher(samples):
"""
check to see if cwl_reporting is set for any samples,
and if so, initialize a WorldWatcher object from a set of samples,
"""
work_dir = dd.get_in_samples(samples, dd.get_work_dir)
ww = WorldWatcher(work_dir,
is_on=any([dd.get_cwl_reporti... | python | def initialize_watcher(samples):
"""
check to see if cwl_reporting is set for any samples,
and if so, initialize a WorldWatcher object from a set of samples,
"""
work_dir = dd.get_in_samples(samples, dd.get_work_dir)
ww = WorldWatcher(work_dir,
is_on=any([dd.get_cwl_reporti... | [
"def",
"initialize_watcher",
"(",
"samples",
")",
":",
"work_dir",
"=",
"dd",
".",
"get_in_samples",
"(",
"samples",
",",
"dd",
".",
"get_work_dir",
")",
"ww",
"=",
"WorldWatcher",
"(",
"work_dir",
",",
"is_on",
"=",
"any",
"(",
"[",
"dd",
".",
"get_cwl_... | check to see if cwl_reporting is set for any samples,
and if so, initialize a WorldWatcher object from a set of samples, | [
"check",
"to",
"see",
"if",
"cwl_reporting",
"is",
"set",
"for",
"any",
"samples",
"and",
"if",
"so",
"initialize",
"a",
"WorldWatcher",
"object",
"from",
"a",
"set",
"of",
"samples"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/inspect.py#L92-L101 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | guess_infer_extent | def guess_infer_extent(gtf_file):
"""
guess if we need to use the gene extent option when making a gffutils
database by making a tiny database of 1000 lines from the original
GTF and looking for all of the features
"""
_, ext = os.path.splitext(gtf_file)
tmp_out = tempfile.NamedTemporaryFile... | python | def guess_infer_extent(gtf_file):
"""
guess if we need to use the gene extent option when making a gffutils
database by making a tiny database of 1000 lines from the original
GTF and looking for all of the features
"""
_, ext = os.path.splitext(gtf_file)
tmp_out = tempfile.NamedTemporaryFile... | [
"def",
"guess_infer_extent",
"(",
"gtf_file",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"gtf_file",
")",
"tmp_out",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"\".gtf\"",
",",
"delete",
"=",
"False",
")... | guess if we need to use the gene extent option when making a gffutils
database by making a tiny database of 1000 lines from the original
GTF and looking for all of the features | [
"guess",
"if",
"we",
"need",
"to",
"use",
"the",
"gene",
"extent",
"option",
"when",
"making",
"a",
"gffutils",
"database",
"by",
"making",
"a",
"tiny",
"database",
"of",
"1000",
"lines",
"from",
"the",
"original",
"GTF",
"and",
"looking",
"for",
"all",
... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L13-L36 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | get_gtf_db | def get_gtf_db(gtf, in_memory=False):
"""
create a gffutils DB, in memory if we don't have write permissions
"""
db_file = gtf + ".db"
if file_exists(db_file):
return gffutils.FeatureDB(db_file)
if not os.access(os.path.dirname(db_file), os.W_OK | os.X_OK):
in_memory = True
d... | python | def get_gtf_db(gtf, in_memory=False):
"""
create a gffutils DB, in memory if we don't have write permissions
"""
db_file = gtf + ".db"
if file_exists(db_file):
return gffutils.FeatureDB(db_file)
if not os.access(os.path.dirname(db_file), os.W_OK | os.X_OK):
in_memory = True
d... | [
"def",
"get_gtf_db",
"(",
"gtf",
",",
"in_memory",
"=",
"False",
")",
":",
"db_file",
"=",
"gtf",
"+",
"\".db\"",
"if",
"file_exists",
"(",
"db_file",
")",
":",
"return",
"gffutils",
".",
"FeatureDB",
"(",
"db_file",
")",
"if",
"not",
"os",
".",
"acces... | create a gffutils DB, in memory if we don't have write permissions | [
"create",
"a",
"gffutils",
"DB",
"in",
"memory",
"if",
"we",
"don",
"t",
"have",
"write",
"permissions"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L38-L57 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | partition_gtf | def partition_gtf(gtf, coding=False, out_file=False):
"""
return a GTF file of all non-coding or coding transcripts. the GTF must be annotated
with gene_biotype = "protein_coding" or to have the source column set to the
biotype for all coding transcripts. set coding to
True to get only the coding, f... | python | def partition_gtf(gtf, coding=False, out_file=False):
"""
return a GTF file of all non-coding or coding transcripts. the GTF must be annotated
with gene_biotype = "protein_coding" or to have the source column set to the
biotype for all coding transcripts. set coding to
True to get only the coding, f... | [
"def",
"partition_gtf",
"(",
"gtf",
",",
"coding",
"=",
"False",
",",
"out_file",
"=",
"False",
")",
":",
"if",
"out_file",
"and",
"file_exists",
"(",
"out_file",
")",
":",
"return",
"out_file",
"if",
"not",
"out_file",
":",
"out_file",
"=",
"tempfile",
... | return a GTF file of all non-coding or coding transcripts. the GTF must be annotated
with gene_biotype = "protein_coding" or to have the source column set to the
biotype for all coding transcripts. set coding to
True to get only the coding, false to get only the non-coding | [
"return",
"a",
"GTF",
"file",
"of",
"all",
"non",
"-",
"coding",
"or",
"coding",
"transcripts",
".",
"the",
"GTF",
"must",
"be",
"annotated",
"with",
"gene_biotype",
"=",
"protein_coding",
"or",
"to",
"have",
"the",
"source",
"column",
"set",
"to",
"the",
... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L142-L169 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | split_gtf | def split_gtf(gtf, sample_size=None, out_dir=None):
"""
split a GTF file into two equal parts, randomly selecting genes.
sample_size will select up to sample_size genes in total
"""
if out_dir:
part1_fn = os.path.basename(os.path.splitext(gtf)[0]) + ".part1.gtf"
part2_fn = os.path.ba... | python | def split_gtf(gtf, sample_size=None, out_dir=None):
"""
split a GTF file into two equal parts, randomly selecting genes.
sample_size will select up to sample_size genes in total
"""
if out_dir:
part1_fn = os.path.basename(os.path.splitext(gtf)[0]) + ".part1.gtf"
part2_fn = os.path.ba... | [
"def",
"split_gtf",
"(",
"gtf",
",",
"sample_size",
"=",
"None",
",",
"out_dir",
"=",
"None",
")",
":",
"if",
"out_dir",
":",
"part1_fn",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"os",
".",
"path",
".",
"splitext",
"(",
"gtf",
")",
"[",
"0",
... | split a GTF file into two equal parts, randomly selecting genes.
sample_size will select up to sample_size genes in total | [
"split",
"a",
"GTF",
"file",
"into",
"two",
"equal",
"parts",
"randomly",
"selecting",
"genes",
".",
"sample_size",
"will",
"select",
"up",
"to",
"sample_size",
"genes",
"in",
"total"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L171-L202 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | get_coding_noncoding_transcript_ids | def get_coding_noncoding_transcript_ids(gtf):
"""
return a set of coding and non-coding transcript_ids from a GTF
"""
coding_gtf = partition_gtf(gtf, coding=True)
coding_db = get_gtf_db(coding_gtf)
coding_ids = set([x['transcript_id'][0] for x in coding_db.all_features()
if 'tr... | python | def get_coding_noncoding_transcript_ids(gtf):
"""
return a set of coding and non-coding transcript_ids from a GTF
"""
coding_gtf = partition_gtf(gtf, coding=True)
coding_db = get_gtf_db(coding_gtf)
coding_ids = set([x['transcript_id'][0] for x in coding_db.all_features()
if 'tr... | [
"def",
"get_coding_noncoding_transcript_ids",
"(",
"gtf",
")",
":",
"coding_gtf",
"=",
"partition_gtf",
"(",
"gtf",
",",
"coding",
"=",
"True",
")",
"coding_db",
"=",
"get_gtf_db",
"(",
"coding_gtf",
")",
"coding_ids",
"=",
"set",
"(",
"[",
"x",
"[",
"'trans... | return a set of coding and non-coding transcript_ids from a GTF | [
"return",
"a",
"set",
"of",
"coding",
"and",
"non",
"-",
"coding",
"transcript_ids",
"from",
"a",
"GTF"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L204-L216 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | get_gene_source_set | def get_gene_source_set(gtf):
"""
get a dictionary of the set of all sources for a gene
"""
gene_to_source = {}
db = get_gtf_db(gtf)
for feature in complete_features(db):
gene_id = feature['gene_id'][0]
sources = gene_to_source.get(gene_id, set([])).union(set([feature.source]))
... | python | def get_gene_source_set(gtf):
"""
get a dictionary of the set of all sources for a gene
"""
gene_to_source = {}
db = get_gtf_db(gtf)
for feature in complete_features(db):
gene_id = feature['gene_id'][0]
sources = gene_to_source.get(gene_id, set([])).union(set([feature.source]))
... | [
"def",
"get_gene_source_set",
"(",
"gtf",
")",
":",
"gene_to_source",
"=",
"{",
"}",
"db",
"=",
"get_gtf_db",
"(",
"gtf",
")",
"for",
"feature",
"in",
"complete_features",
"(",
"db",
")",
":",
"gene_id",
"=",
"feature",
"[",
"'gene_id'",
"]",
"[",
"0",
... | get a dictionary of the set of all sources for a gene | [
"get",
"a",
"dictionary",
"of",
"the",
"set",
"of",
"all",
"sources",
"for",
"a",
"gene"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L218-L228 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | get_transcript_source_set | def get_transcript_source_set(gtf):
"""
get a dictionary of the set of all sources of the gene for a given
transcript
"""
gene_to_source = get_gene_source_set(gtf)
transcript_to_source = {}
db = get_gtf_db(gtf)
for feature in complete_features(db):
gene_id = feature['gene_id'][0]... | python | def get_transcript_source_set(gtf):
"""
get a dictionary of the set of all sources of the gene for a given
transcript
"""
gene_to_source = get_gene_source_set(gtf)
transcript_to_source = {}
db = get_gtf_db(gtf)
for feature in complete_features(db):
gene_id = feature['gene_id'][0]... | [
"def",
"get_transcript_source_set",
"(",
"gtf",
")",
":",
"gene_to_source",
"=",
"get_gene_source_set",
"(",
"gtf",
")",
"transcript_to_source",
"=",
"{",
"}",
"db",
"=",
"get_gtf_db",
"(",
"gtf",
")",
"for",
"feature",
"in",
"complete_features",
"(",
"db",
")... | get a dictionary of the set of all sources of the gene for a given
transcript | [
"get",
"a",
"dictionary",
"of",
"the",
"set",
"of",
"all",
"sources",
"of",
"the",
"gene",
"for",
"a",
"given",
"transcript"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L230-L241 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | get_rRNA | def get_rRNA(gtf):
"""
extract rRNA genes and transcripts from a gtf file
"""
rRNA_biotypes = ["rRNA", "Mt_rRNA", "tRNA", "MT_tRNA"]
features = set()
with open_gzipsafe(gtf) as in_handle:
for line in in_handle:
if not "gene_id" in line or not "transcript_id" in line:
... | python | def get_rRNA(gtf):
"""
extract rRNA genes and transcripts from a gtf file
"""
rRNA_biotypes = ["rRNA", "Mt_rRNA", "tRNA", "MT_tRNA"]
features = set()
with open_gzipsafe(gtf) as in_handle:
for line in in_handle:
if not "gene_id" in line or not "transcript_id" in line:
... | [
"def",
"get_rRNA",
"(",
"gtf",
")",
":",
"rRNA_biotypes",
"=",
"[",
"\"rRNA\"",
",",
"\"Mt_rRNA\"",
",",
"\"tRNA\"",
",",
"\"MT_tRNA\"",
"]",
"features",
"=",
"set",
"(",
")",
"with",
"open_gzipsafe",
"(",
"gtf",
")",
"as",
"in_handle",
":",
"for",
"line... | extract rRNA genes and transcripts from a gtf file | [
"extract",
"rRNA",
"genes",
"and",
"transcripts",
"from",
"a",
"gtf",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L243-L261 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | _biotype_lookup_fn | def _biotype_lookup_fn(gtf):
"""
return a function that will look up the biotype of a feature
this checks for either gene_biotype or biotype being set or for the source
column to have biotype information
"""
db = get_gtf_db(gtf)
sources = set([feature.source for feature in db.all_features()]... | python | def _biotype_lookup_fn(gtf):
"""
return a function that will look up the biotype of a feature
this checks for either gene_biotype or biotype being set or for the source
column to have biotype information
"""
db = get_gtf_db(gtf)
sources = set([feature.source for feature in db.all_features()]... | [
"def",
"_biotype_lookup_fn",
"(",
"gtf",
")",
":",
"db",
"=",
"get_gtf_db",
"(",
"gtf",
")",
"sources",
"=",
"set",
"(",
"[",
"feature",
".",
"source",
"for",
"feature",
"in",
"db",
".",
"all_features",
"(",
")",
"]",
")",
"gene_biotypes",
"=",
"set",
... | return a function that will look up the biotype of a feature
this checks for either gene_biotype or biotype being set or for the source
column to have biotype information | [
"return",
"a",
"function",
"that",
"will",
"look",
"up",
"the",
"biotype",
"of",
"a",
"feature",
"this",
"checks",
"for",
"either",
"gene_biotype",
"or",
"biotype",
"being",
"set",
"or",
"for",
"the",
"source",
"column",
"to",
"have",
"biotype",
"information... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L263-L282 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | tx2genedict | def tx2genedict(gtf, keep_version=False):
"""
produce a tx2gene dictionary from a GTF file
"""
d = {}
with open_gzipsafe(gtf) as in_handle:
for line in in_handle:
if "gene_id" not in line or "transcript_id" not in line:
continue
geneid = line.split("ge... | python | def tx2genedict(gtf, keep_version=False):
"""
produce a tx2gene dictionary from a GTF file
"""
d = {}
with open_gzipsafe(gtf) as in_handle:
for line in in_handle:
if "gene_id" not in line or "transcript_id" not in line:
continue
geneid = line.split("ge... | [
"def",
"tx2genedict",
"(",
"gtf",
",",
"keep_version",
"=",
"False",
")",
":",
"d",
"=",
"{",
"}",
"with",
"open_gzipsafe",
"(",
"gtf",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"in_handle",
":",
"if",
"\"gene_id\"",
"not",
"in",
"line",
"or",
... | produce a tx2gene dictionary from a GTF file | [
"produce",
"a",
"tx2gene",
"dictionary",
"from",
"a",
"GTF",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L284-L305 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | _strip_feature_version | def _strip_feature_version(featureid):
"""
some feature versions are encoded as featureid.version, this strips those off, if they exist
"""
version_detector = re.compile(r"(?P<featureid>.*)(?P<version>\.\d+)")
match = version_detector.match(featureid)
if match:
return match.groupdict()["... | python | def _strip_feature_version(featureid):
"""
some feature versions are encoded as featureid.version, this strips those off, if they exist
"""
version_detector = re.compile(r"(?P<featureid>.*)(?P<version>\.\d+)")
match = version_detector.match(featureid)
if match:
return match.groupdict()["... | [
"def",
"_strip_feature_version",
"(",
"featureid",
")",
":",
"version_detector",
"=",
"re",
".",
"compile",
"(",
"r\"(?P<featureid>.*)(?P<version>\\.\\d+)\"",
")",
"match",
"=",
"version_detector",
".",
"match",
"(",
"featureid",
")",
"if",
"match",
":",
"return",
... | some feature versions are encoded as featureid.version, this strips those off, if they exist | [
"some",
"feature",
"versions",
"are",
"encoded",
"as",
"featureid",
".",
"version",
"this",
"strips",
"those",
"off",
"if",
"they",
"exist"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L307-L316 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | tx2genefile | def tx2genefile(gtf, out_file=None, data=None, tsv=True, keep_version=False):
"""
write out a file of transcript->gene mappings.
"""
if tsv:
extension = ".tsv"
sep = "\t"
else:
extension = ".csv"
sep = ","
if file_exists(out_file):
return out_file
with... | python | def tx2genefile(gtf, out_file=None, data=None, tsv=True, keep_version=False):
"""
write out a file of transcript->gene mappings.
"""
if tsv:
extension = ".tsv"
sep = "\t"
else:
extension = ".csv"
sep = ","
if file_exists(out_file):
return out_file
with... | [
"def",
"tx2genefile",
"(",
"gtf",
",",
"out_file",
"=",
"None",
",",
"data",
"=",
"None",
",",
"tsv",
"=",
"True",
",",
"keep_version",
"=",
"False",
")",
":",
"if",
"tsv",
":",
"extension",
"=",
"\".tsv\"",
"sep",
"=",
"\"\\t\"",
"else",
":",
"exten... | write out a file of transcript->gene mappings. | [
"write",
"out",
"a",
"file",
"of",
"transcript",
"-",
">",
"gene",
"mappings",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L330-L347 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | is_qualimap_compatible | def is_qualimap_compatible(gtf):
"""
Qualimap needs a very specific GTF format or it fails, so skip it if
the GTF is not in that format
"""
if not gtf:
return False
db = get_gtf_db(gtf)
def qualimap_compatible(feature):
gene_id = feature.attributes.get('gene_id', [None])[0]
... | python | def is_qualimap_compatible(gtf):
"""
Qualimap needs a very specific GTF format or it fails, so skip it if
the GTF is not in that format
"""
if not gtf:
return False
db = get_gtf_db(gtf)
def qualimap_compatible(feature):
gene_id = feature.attributes.get('gene_id', [None])[0]
... | [
"def",
"is_qualimap_compatible",
"(",
"gtf",
")",
":",
"if",
"not",
"gtf",
":",
"return",
"False",
"db",
"=",
"get_gtf_db",
"(",
"gtf",
")",
"def",
"qualimap_compatible",
"(",
"feature",
")",
":",
"gene_id",
"=",
"feature",
".",
"attributes",
".",
"get",
... | Qualimap needs a very specific GTF format or it fails, so skip it if
the GTF is not in that format | [
"Qualimap",
"needs",
"a",
"very",
"specific",
"GTF",
"format",
"or",
"it",
"fails",
"so",
"skip",
"it",
"if",
"the",
"GTF",
"is",
"not",
"in",
"that",
"format"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L349-L365 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/gtf.py | is_cpat_compatible | def is_cpat_compatible(gtf):
"""
CPAT needs some transcripts annotated with protein coding status to work
properly
"""
if not gtf:
return False
db = get_gtf_db(gtf)
pred = lambda biotype: biotype and biotype == "protein_coding"
biotype_lookup = _biotype_lookup_fn(gtf)
if not ... | python | def is_cpat_compatible(gtf):
"""
CPAT needs some transcripts annotated with protein coding status to work
properly
"""
if not gtf:
return False
db = get_gtf_db(gtf)
pred = lambda biotype: biotype and biotype == "protein_coding"
biotype_lookup = _biotype_lookup_fn(gtf)
if not ... | [
"def",
"is_cpat_compatible",
"(",
"gtf",
")",
":",
"if",
"not",
"gtf",
":",
"return",
"False",
"db",
"=",
"get_gtf_db",
"(",
"gtf",
")",
"pred",
"=",
"lambda",
"biotype",
":",
"biotype",
"and",
"biotype",
"==",
"\"protein_coding\"",
"biotype_lookup",
"=",
... | CPAT needs some transcripts annotated with protein coding status to work
properly | [
"CPAT",
"needs",
"some",
"transcripts",
"annotated",
"with",
"protein",
"coding",
"status",
"to",
"work",
"properly"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L403-L420 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | organize | def organize(dirs, config, run_info_yaml, sample_names=None, is_cwl=False,
integrations=None):
"""Organize run information from a passed YAML file or the Galaxy API.
Creates the high level structure used for subsequent processing.
sample_names is a list of samples to include from the overall ... | python | def organize(dirs, config, run_info_yaml, sample_names=None, is_cwl=False,
integrations=None):
"""Organize run information from a passed YAML file or the Galaxy API.
Creates the high level structure used for subsequent processing.
sample_names is a list of samples to include from the overall ... | [
"def",
"organize",
"(",
"dirs",
",",
"config",
",",
"run_info_yaml",
",",
"sample_names",
"=",
"None",
",",
"is_cwl",
"=",
"False",
",",
"integrations",
"=",
"None",
")",
":",
"from",
"bcbio",
".",
"pipeline",
"import",
"qcsummary",
"if",
"integrations",
"... | Organize run information from a passed YAML file or the Galaxy API.
Creates the high level structure used for subsequent processing.
sample_names is a list of samples to include from the overall file, for cases
where we are running multiple pipelines from the same configuration file. | [
"Organize",
"run",
"information",
"from",
"a",
"passed",
"YAML",
"file",
"or",
"the",
"Galaxy",
"API",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L46-L94 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _get_full_paths | def _get_full_paths(fastq_dir, config, config_file):
"""Retrieve full paths for directories in the case of relative locations.
"""
if fastq_dir:
fastq_dir = utils.add_full_path(fastq_dir)
config_dir = utils.add_full_path(os.path.dirname(config_file))
galaxy_config_file = utils.add_full_path(... | python | def _get_full_paths(fastq_dir, config, config_file):
"""Retrieve full paths for directories in the case of relative locations.
"""
if fastq_dir:
fastq_dir = utils.add_full_path(fastq_dir)
config_dir = utils.add_full_path(os.path.dirname(config_file))
galaxy_config_file = utils.add_full_path(... | [
"def",
"_get_full_paths",
"(",
"fastq_dir",
",",
"config",
",",
"config_file",
")",
":",
"if",
"fastq_dir",
":",
"fastq_dir",
"=",
"utils",
".",
"add_full_path",
"(",
"fastq_dir",
")",
"config_dir",
"=",
"utils",
".",
"add_full_path",
"(",
"os",
".",
"path",... | Retrieve full paths for directories in the case of relative locations. | [
"Retrieve",
"full",
"paths",
"for",
"directories",
"in",
"the",
"case",
"of",
"relative",
"locations",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L130-L138 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | add_reference_resources | def add_reference_resources(data, remote_retriever=None):
"""Add genome reference information to the item to process.
"""
aligner = data["config"]["algorithm"].get("aligner", None)
if remote_retriever:
data["reference"] = remote_retriever.get_refs(data["genome_build"],
... | python | def add_reference_resources(data, remote_retriever=None):
"""Add genome reference information to the item to process.
"""
aligner = data["config"]["algorithm"].get("aligner", None)
if remote_retriever:
data["reference"] = remote_retriever.get_refs(data["genome_build"],
... | [
"def",
"add_reference_resources",
"(",
"data",
",",
"remote_retriever",
"=",
"None",
")",
":",
"aligner",
"=",
"data",
"[",
"\"config\"",
"]",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"aligner\"",
",",
"None",
")",
"if",
"remote_retriever",
":",
"data",... | Add genome reference information to the item to process. | [
"Add",
"genome",
"reference",
"information",
"to",
"the",
"item",
"to",
"process",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L166-L204 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _get_data_versions | def _get_data_versions(data):
"""Retrieve CSV file with version information for reference data.
"""
genome_dir = install.get_genome_dir(data["genome_build"], data["dirs"].get("galaxy"), data)
if genome_dir:
version_file = os.path.join(genome_dir, "versions.csv")
if version_file and os.pa... | python | def _get_data_versions(data):
"""Retrieve CSV file with version information for reference data.
"""
genome_dir = install.get_genome_dir(data["genome_build"], data["dirs"].get("galaxy"), data)
if genome_dir:
version_file = os.path.join(genome_dir, "versions.csv")
if version_file and os.pa... | [
"def",
"_get_data_versions",
"(",
"data",
")",
":",
"genome_dir",
"=",
"install",
".",
"get_genome_dir",
"(",
"data",
"[",
"\"genome_build\"",
"]",
",",
"data",
"[",
"\"dirs\"",
"]",
".",
"get",
"(",
"\"galaxy\"",
")",
",",
"data",
")",
"if",
"genome_dir",... | Retrieve CSV file with version information for reference data. | [
"Retrieve",
"CSV",
"file",
"with",
"version",
"information",
"for",
"reference",
"data",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L206-L214 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _fill_validation_targets | def _fill_validation_targets(data):
"""Fill validation targets pointing to globally installed truth sets.
"""
ref_file = dd.get_ref_file(data)
sv_truth = tz.get_in(["config", "algorithm", "svvalidate"], data, {})
sv_targets = (zip(itertools.repeat("svvalidate"), sv_truth.keys()) if isinstance(sv_tru... | python | def _fill_validation_targets(data):
"""Fill validation targets pointing to globally installed truth sets.
"""
ref_file = dd.get_ref_file(data)
sv_truth = tz.get_in(["config", "algorithm", "svvalidate"], data, {})
sv_targets = (zip(itertools.repeat("svvalidate"), sv_truth.keys()) if isinstance(sv_tru... | [
"def",
"_fill_validation_targets",
"(",
"data",
")",
":",
"ref_file",
"=",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
"sv_truth",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"svvalidate\"",
"]",
",",
"data",
",",
"{",
... | Fill validation targets pointing to globally installed truth sets. | [
"Fill",
"validation",
"targets",
"pointing",
"to",
"globally",
"installed",
"truth",
"sets",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L236-L252 | train |
bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _fill_capture_regions | def _fill_capture_regions(data):
"""Fill short-hand specification of BED capture regions.
"""
special_targets = {"sv_regions": ("exons", "transcripts")}
ref_file = dd.get_ref_file(data)
for target in ["variant_regions", "sv_regions", "coverage"]:
val = tz.get_in(["config", "algorithm", targe... | python | def _fill_capture_regions(data):
"""Fill short-hand specification of BED capture regions.
"""
special_targets = {"sv_regions": ("exons", "transcripts")}
ref_file = dd.get_ref_file(data)
for target in ["variant_regions", "sv_regions", "coverage"]:
val = tz.get_in(["config", "algorithm", targe... | [
"def",
"_fill_capture_regions",
"(",
"data",
")",
":",
"special_targets",
"=",
"{",
"\"sv_regions\"",
":",
"(",
"\"exons\"",
",",
"\"transcripts\"",
")",
"}",
"ref_file",
"=",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
"for",
"target",
"in",
"[",
"\"varian... | Fill short-hand specification of BED capture regions. | [
"Fill",
"short",
"-",
"hand",
"specification",
"of",
"BED",
"capture",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L254-L274 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.