id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
224,300 | 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 |
224,301 | 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 |
224,302 | 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 |
224,303 | 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 |
224,304 | 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 |
224,305 | 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 |
224,306 | 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 |
224,307 | 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 |
224,308 | 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 |
224,309 | 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 |
224,310 | 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 |
224,311 | 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 |
224,312 | 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 |
224,313 | 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 |
224,314 | 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 |
224,315 | 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 |
224,316 | 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 |
224,317 | 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 |
224,318 | 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 |
224,319 | 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 |
224,320 | 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 |
224,321 | 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 |
224,322 | 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 |
224,323 | 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 |
224,324 | 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 |
224,325 | 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 |
224,326 | 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 |
224,327 | 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 |
224,328 | 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 |
224,329 | 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 |
224,330 | 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 |
224,331 | 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 |
224,332 | 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 |
224,333 | 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 |
224,334 | 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 |
224,335 | 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 |
224,336 | 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 |
224,337 | 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 |
224,338 | 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 |
224,339 | 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 |
224,340 | 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 |
224,341 | 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 |
224,342 | 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 |
224,343 | 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 |
224,344 | 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 |
224,345 | 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 |
224,346 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _fill_prioritization_targets | def _fill_prioritization_targets(data):
"""Fill in globally installed files for prioritization.
"""
ref_file = dd.get_ref_file(data)
for target in ["svprioritize", "coverage"]:
val = tz.get_in(["config", "algorithm", target], data)
if val and not os.path.exists(val) and not objectstore.i... | python | def _fill_prioritization_targets(data):
"""Fill in globally installed files for prioritization.
"""
ref_file = dd.get_ref_file(data)
for target in ["svprioritize", "coverage"]:
val = tz.get_in(["config", "algorithm", target], data)
if val and not os.path.exists(val) and not objectstore.i... | [
"def",
"_fill_prioritization_targets",
"(",
"data",
")",
":",
"ref_file",
"=",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
"for",
"target",
"in",
"[",
"\"svprioritize\"",
",",
"\"coverage\"",
"]",
":",
"val",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"config\... | Fill in globally installed files for prioritization. | [
"Fill",
"in",
"globally",
"installed",
"files",
"for",
"prioritization",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L276-L315 |
224,347 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _clean_algorithm | def _clean_algorithm(data):
"""Clean algorithm keys, handling items that can be specified as lists or single items.
"""
# convert single items to lists
for key in ["variantcaller", "jointcaller", "svcaller"]:
val = tz.get_in(["algorithm", key], data)
if val:
if not isinstance... | python | def _clean_algorithm(data):
"""Clean algorithm keys, handling items that can be specified as lists or single items.
"""
# convert single items to lists
for key in ["variantcaller", "jointcaller", "svcaller"]:
val = tz.get_in(["algorithm", key], data)
if val:
if not isinstance... | [
"def",
"_clean_algorithm",
"(",
"data",
")",
":",
"# convert single items to lists",
"for",
"key",
"in",
"[",
"\"variantcaller\"",
",",
"\"jointcaller\"",
",",
"\"svcaller\"",
"]",
":",
"val",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"algorithm\"",
",",
"key",
"]... | Clean algorithm keys, handling items that can be specified as lists or single items. | [
"Clean",
"algorithm",
"keys",
"handling",
"items",
"that",
"can",
"be",
"specified",
"as",
"lists",
"or",
"single",
"items",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L336-L351 |
224,348 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _organize_tools_on | def _organize_tools_on(data, is_cwl):
"""Ensure tools_on inputs match items specified elsewhere.
"""
# want tools_on: [gvcf] if joint calling specified in CWL
if is_cwl:
if tz.get_in(["algorithm", "jointcaller"], data):
val = tz.get_in(["algorithm", "tools_on"], data)
if ... | python | def _organize_tools_on(data, is_cwl):
"""Ensure tools_on inputs match items specified elsewhere.
"""
# want tools_on: [gvcf] if joint calling specified in CWL
if is_cwl:
if tz.get_in(["algorithm", "jointcaller"], data):
val = tz.get_in(["algorithm", "tools_on"], data)
if ... | [
"def",
"_organize_tools_on",
"(",
"data",
",",
"is_cwl",
")",
":",
"# want tools_on: [gvcf] if joint calling specified in CWL",
"if",
"is_cwl",
":",
"if",
"tz",
".",
"get_in",
"(",
"[",
"\"algorithm\"",
",",
"\"jointcaller\"",
"]",
",",
"data",
")",
":",
"val",
... | Ensure tools_on inputs match items specified elsewhere. | [
"Ensure",
"tools_on",
"inputs",
"match",
"items",
"specified",
"elsewhere",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L353-L367 |
224,349 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _clean_background | def _clean_background(data):
"""Clean up background specification, remaining back compatible.
"""
allowed_keys = set(["variant", "cnv_reference"])
val = tz.get_in(["algorithm", "background"], data)
errors = []
if val:
out = {}
# old style specification, single string for variant
... | python | def _clean_background(data):
"""Clean up background specification, remaining back compatible.
"""
allowed_keys = set(["variant", "cnv_reference"])
val = tz.get_in(["algorithm", "background"], data)
errors = []
if val:
out = {}
# old style specification, single string for variant
... | [
"def",
"_clean_background",
"(",
"data",
")",
":",
"allowed_keys",
"=",
"set",
"(",
"[",
"\"variant\"",
",",
"\"cnv_reference\"",
"]",
")",
"val",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"algorithm\"",
",",
"\"background\"",
"]",
",",
"data",
")",
"errors",
... | Clean up background specification, remaining back compatible. | [
"Clean",
"up",
"background",
"specification",
"remaining",
"back",
"compatible",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L369-L400 |
224,350 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _clean_characters | def _clean_characters(x):
"""Clean problem characters in sample lane or descriptions.
"""
if not isinstance(x, six.string_types):
x = str(x)
else:
if not all(ord(char) < 128 for char in x):
msg = "Found unicode character in input YAML (%s)" % (x)
raise ValueError(... | python | def _clean_characters(x):
"""Clean problem characters in sample lane or descriptions.
"""
if not isinstance(x, six.string_types):
x = str(x)
else:
if not all(ord(char) < 128 for char in x):
msg = "Found unicode character in input YAML (%s)" % (x)
raise ValueError(... | [
"def",
"_clean_characters",
"(",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"six",
".",
"string_types",
")",
":",
"x",
"=",
"str",
"(",
"x",
")",
"else",
":",
"if",
"not",
"all",
"(",
"ord",
"(",
"char",
")",
"<",
"128",
"for",
"c... | Clean problem characters in sample lane or descriptions. | [
"Clean",
"problem",
"characters",
"in",
"sample",
"lane",
"or",
"descriptions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L402-L413 |
224,351 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | prep_rg_names | def prep_rg_names(item, config, fc_name, fc_date):
"""Generate read group names from item inputs.
"""
if fc_name and fc_date:
lane_name = "%s_%s_%s" % (item["lane"], fc_date, fc_name)
else:
lane_name = item["description"]
return {"rg": item["description"],
"sample": item[... | python | def prep_rg_names(item, config, fc_name, fc_date):
"""Generate read group names from item inputs.
"""
if fc_name and fc_date:
lane_name = "%s_%s_%s" % (item["lane"], fc_date, fc_name)
else:
lane_name = item["description"]
return {"rg": item["description"],
"sample": item[... | [
"def",
"prep_rg_names",
"(",
"item",
",",
"config",
",",
"fc_name",
",",
"fc_date",
")",
":",
"if",
"fc_name",
"and",
"fc_date",
":",
"lane_name",
"=",
"\"%s_%s_%s\"",
"%",
"(",
"item",
"[",
"\"lane\"",
"]",
",",
"fc_date",
",",
"fc_name",
")",
"else",
... | Generate read group names from item inputs. | [
"Generate",
"read",
"group",
"names",
"from",
"item",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L415-L428 |
224,352 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_for_duplicates | def _check_for_duplicates(xs, attr, check_fn=None):
"""Identify and raise errors on duplicate items.
"""
dups = []
for key, vals in itertools.groupby(x[attr] for x in xs):
if len(list(vals)) > 1:
dups.append(key)
if len(dups) > 0:
psamples = []
for x in xs:
... | python | def _check_for_duplicates(xs, attr, check_fn=None):
"""Identify and raise errors on duplicate items.
"""
dups = []
for key, vals in itertools.groupby(x[attr] for x in xs):
if len(list(vals)) > 1:
dups.append(key)
if len(dups) > 0:
psamples = []
for x in xs:
... | [
"def",
"_check_for_duplicates",
"(",
"xs",
",",
"attr",
",",
"check_fn",
"=",
"None",
")",
":",
"dups",
"=",
"[",
"]",
"for",
"key",
",",
"vals",
"in",
"itertools",
".",
"groupby",
"(",
"x",
"[",
"attr",
"]",
"for",
"x",
"in",
"xs",
")",
":",
"if... | Identify and raise errors on duplicate items. | [
"Identify",
"and",
"raise",
"errors",
"on",
"duplicate",
"items",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L432-L450 |
224,353 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_for_batch_clashes | def _check_for_batch_clashes(xs):
"""Check that batch names do not overlap with sample names.
"""
names = set([x["description"] for x in xs])
dups = set([])
for x in xs:
batches = tz.get_in(("metadata", "batch"), x)
if batches:
if not isinstance(batches, (list, tuple)):
... | python | def _check_for_batch_clashes(xs):
"""Check that batch names do not overlap with sample names.
"""
names = set([x["description"] for x in xs])
dups = set([])
for x in xs:
batches = tz.get_in(("metadata", "batch"), x)
if batches:
if not isinstance(batches, (list, tuple)):
... | [
"def",
"_check_for_batch_clashes",
"(",
"xs",
")",
":",
"names",
"=",
"set",
"(",
"[",
"x",
"[",
"\"description\"",
"]",
"for",
"x",
"in",
"xs",
"]",
")",
"dups",
"=",
"set",
"(",
"[",
"]",
")",
"for",
"x",
"in",
"xs",
":",
"batches",
"=",
"tz",
... | Check that batch names do not overlap with sample names. | [
"Check",
"that",
"batch",
"names",
"do",
"not",
"overlap",
"with",
"sample",
"names",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L452-L467 |
224,354 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_for_problem_somatic_batches | def _check_for_problem_somatic_batches(items, config):
"""Identify problem batch setups for somatic calling.
We do not support multiple tumors in a single batch and VarDict(Java) does not
handle pooled calling, only tumor/normal.
"""
to_check = []
for data in items:
data = copy.deepcopy... | python | def _check_for_problem_somatic_batches(items, config):
"""Identify problem batch setups for somatic calling.
We do not support multiple tumors in a single batch and VarDict(Java) does not
handle pooled calling, only tumor/normal.
"""
to_check = []
for data in items:
data = copy.deepcopy... | [
"def",
"_check_for_problem_somatic_batches",
"(",
"items",
",",
"config",
")",
":",
"to_check",
"=",
"[",
"]",
"for",
"data",
"in",
"items",
":",
"data",
"=",
"copy",
".",
"deepcopy",
"(",
"data",
")",
"data",
"[",
"\"config\"",
"]",
"=",
"config_utils",
... | Identify problem batch setups for somatic calling.
We do not support multiple tumors in a single batch and VarDict(Java) does not
handle pooled calling, only tumor/normal. | [
"Identify",
"problem",
"batch",
"setups",
"for",
"somatic",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L469-L497 |
224,355 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_for_misplaced | def _check_for_misplaced(xs, subkey, other_keys):
"""Ensure configuration keys are not incorrectly nested under other keys.
"""
problems = []
for x in xs:
check_dict = x.get(subkey, {})
for to_check in other_keys:
if to_check in check_dict:
problems.append((x[... | python | def _check_for_misplaced(xs, subkey, other_keys):
"""Ensure configuration keys are not incorrectly nested under other keys.
"""
problems = []
for x in xs:
check_dict = x.get(subkey, {})
for to_check in other_keys:
if to_check in check_dict:
problems.append((x[... | [
"def",
"_check_for_misplaced",
"(",
"xs",
",",
"subkey",
",",
"other_keys",
")",
":",
"problems",
"=",
"[",
"]",
"for",
"x",
"in",
"xs",
":",
"check_dict",
"=",
"x",
".",
"get",
"(",
"subkey",
",",
"{",
"}",
")",
"for",
"to_check",
"in",
"other_keys"... | Ensure configuration keys are not incorrectly nested under other keys. | [
"Ensure",
"configuration",
"keys",
"are",
"not",
"incorrectly",
"nested",
"under",
"other",
"keys",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L499-L512 |
224,356 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_for_degenerate_interesting_groups | def _check_for_degenerate_interesting_groups(items):
""" Make sure interesting_groups specify existing metadata and that
the interesting_group is not all of the same for all of the samples
"""
igkey = ("algorithm", "bcbiornaseq", "interesting_groups")
interesting_groups = tz.get_in(igkey, items[0], ... | python | def _check_for_degenerate_interesting_groups(items):
""" Make sure interesting_groups specify existing metadata and that
the interesting_group is not all of the same for all of the samples
"""
igkey = ("algorithm", "bcbiornaseq", "interesting_groups")
interesting_groups = tz.get_in(igkey, items[0], ... | [
"def",
"_check_for_degenerate_interesting_groups",
"(",
"items",
")",
":",
"igkey",
"=",
"(",
"\"algorithm\"",
",",
"\"bcbiornaseq\"",
",",
"\"interesting_groups\"",
")",
"interesting_groups",
"=",
"tz",
".",
"get_in",
"(",
"igkey",
",",
"items",
"[",
"0",
"]",
... | Make sure interesting_groups specify existing metadata and that
the interesting_group is not all of the same for all of the samples | [
"Make",
"sure",
"interesting_groups",
"specify",
"existing",
"metadata",
"and",
"that",
"the",
"interesting_group",
"is",
"not",
"all",
"of",
"the",
"same",
"for",
"all",
"of",
"the",
"samples"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L514-L529 |
224,357 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_algorithm_keys | def _check_algorithm_keys(item):
"""Check for unexpected keys in the algorithm section.
Needs to be manually updated when introducing new keys, but avoids silent bugs
with typos in key names.
"""
problem_keys = [k for k in item["algorithm"].keys() if k not in ALGORITHM_KEYS]
if len(problem_keys... | python | def _check_algorithm_keys(item):
"""Check for unexpected keys in the algorithm section.
Needs to be manually updated when introducing new keys, but avoids silent bugs
with typos in key names.
"""
problem_keys = [k for k in item["algorithm"].keys() if k not in ALGORITHM_KEYS]
if len(problem_keys... | [
"def",
"_check_algorithm_keys",
"(",
"item",
")",
":",
"problem_keys",
"=",
"[",
"k",
"for",
"k",
"in",
"item",
"[",
"\"algorithm\"",
"]",
".",
"keys",
"(",
")",
"if",
"k",
"not",
"in",
"ALGORITHM_KEYS",
"]",
"if",
"len",
"(",
"problem_keys",
")",
">",... | Check for unexpected keys in the algorithm section.
Needs to be manually updated when introducing new keys, but avoids silent bugs
with typos in key names. | [
"Check",
"for",
"unexpected",
"keys",
"in",
"the",
"algorithm",
"section",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L575-L585 |
224,358 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_algorithm_values | def _check_algorithm_values(item):
"""Check for misplaced inputs in the algorithms.
- Identify incorrect boolean values where a choice is required.
"""
problems = []
for k, v in item.get("algorithm", {}).items():
if v is True and k not in ALG_ALLOW_BOOLEANS:
problems.append("%s ... | python | def _check_algorithm_values(item):
"""Check for misplaced inputs in the algorithms.
- Identify incorrect boolean values where a choice is required.
"""
problems = []
for k, v in item.get("algorithm", {}).items():
if v is True and k not in ALG_ALLOW_BOOLEANS:
problems.append("%s ... | [
"def",
"_check_algorithm_values",
"(",
"item",
")",
":",
"problems",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"item",
".",
"get",
"(",
"\"algorithm\"",
",",
"{",
"}",
")",
".",
"items",
"(",
")",
":",
"if",
"v",
"is",
"True",
"and",
"k",
"not",... | Check for misplaced inputs in the algorithms.
- Identify incorrect boolean values where a choice is required. | [
"Check",
"for",
"misplaced",
"inputs",
"in",
"the",
"algorithms",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L587-L601 |
224,359 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_toplevel_misplaced | def _check_toplevel_misplaced(item):
"""Check for algorithm keys accidentally placed at the top level.
"""
problem_keys = [k for k in item.keys() if k in ALGORITHM_KEYS]
if len(problem_keys) > 0:
raise ValueError("Unexpected configuration keywords found in top level of %s: %s\n"
... | python | def _check_toplevel_misplaced(item):
"""Check for algorithm keys accidentally placed at the top level.
"""
problem_keys = [k for k in item.keys() if k in ALGORITHM_KEYS]
if len(problem_keys) > 0:
raise ValueError("Unexpected configuration keywords found in top level of %s: %s\n"
... | [
"def",
"_check_toplevel_misplaced",
"(",
"item",
")",
":",
"problem_keys",
"=",
"[",
"k",
"for",
"k",
"in",
"item",
".",
"keys",
"(",
")",
"if",
"k",
"in",
"ALGORITHM_KEYS",
"]",
"if",
"len",
"(",
"problem_keys",
")",
">",
"0",
":",
"raise",
"ValueErro... | Check for algorithm keys accidentally placed at the top level. | [
"Check",
"for",
"algorithm",
"keys",
"accidentally",
"placed",
"at",
"the",
"top",
"level",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L604-L615 |
224,360 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_quality_format | def _check_quality_format(items):
"""
Check if quality_format="standard" and fastq_format is not sanger
"""
SAMPLE_FORMAT = {"illumina_1.3+": "illumina",
"illumina_1.5+": "illumina",
"illumina_1.8+": "standard",
"solexa": "solexa",
... | python | def _check_quality_format(items):
"""
Check if quality_format="standard" and fastq_format is not sanger
"""
SAMPLE_FORMAT = {"illumina_1.3+": "illumina",
"illumina_1.5+": "illumina",
"illumina_1.8+": "standard",
"solexa": "solexa",
... | [
"def",
"_check_quality_format",
"(",
"items",
")",
":",
"SAMPLE_FORMAT",
"=",
"{",
"\"illumina_1.3+\"",
":",
"\"illumina\"",
",",
"\"illumina_1.5+\"",
":",
"\"illumina\"",
",",
"\"illumina_1.8+\"",
":",
"\"standard\"",
",",
"\"solexa\"",
":",
"\"solexa\"",
",",
"\"s... | Check if quality_format="standard" and fastq_format is not sanger | [
"Check",
"if",
"quality_format",
"=",
"standard",
"and",
"fastq_format",
"is",
"not",
"sanger"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L648-L677 |
224,361 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_aligner | def _check_aligner(item):
"""Ensure specified aligner is valid choice.
"""
allowed = set(list(alignment.TOOLS.keys()) + [None, False])
if item["algorithm"].get("aligner") not in allowed:
raise ValueError("Unexpected algorithm 'aligner' parameter: %s\n"
"Supported options... | python | def _check_aligner(item):
"""Ensure specified aligner is valid choice.
"""
allowed = set(list(alignment.TOOLS.keys()) + [None, False])
if item["algorithm"].get("aligner") not in allowed:
raise ValueError("Unexpected algorithm 'aligner' parameter: %s\n"
"Supported options... | [
"def",
"_check_aligner",
"(",
"item",
")",
":",
"allowed",
"=",
"set",
"(",
"list",
"(",
"alignment",
".",
"TOOLS",
".",
"keys",
"(",
")",
")",
"+",
"[",
"None",
",",
"False",
"]",
")",
"if",
"item",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\... | Ensure specified aligner is valid choice. | [
"Ensure",
"specified",
"aligner",
"is",
"valid",
"choice",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L680-L687 |
224,362 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_variantcaller | def _check_variantcaller(item):
"""Ensure specified variantcaller is a valid choice.
"""
allowed = set(list(genotype.get_variantcallers().keys()) + [None, False])
vcs = item["algorithm"].get("variantcaller")
if not isinstance(vcs, dict):
vcs = {"variantcaller": vcs}
for vc_set in vcs.val... | python | def _check_variantcaller(item):
"""Ensure specified variantcaller is a valid choice.
"""
allowed = set(list(genotype.get_variantcallers().keys()) + [None, False])
vcs = item["algorithm"].get("variantcaller")
if not isinstance(vcs, dict):
vcs = {"variantcaller": vcs}
for vc_set in vcs.val... | [
"def",
"_check_variantcaller",
"(",
"item",
")",
":",
"allowed",
"=",
"set",
"(",
"list",
"(",
"genotype",
".",
"get_variantcallers",
"(",
")",
".",
"keys",
"(",
")",
")",
"+",
"[",
"None",
",",
"False",
"]",
")",
"vcs",
"=",
"item",
"[",
"\"algorith... | Ensure specified variantcaller is a valid choice. | [
"Ensure",
"specified",
"variantcaller",
"is",
"a",
"valid",
"choice",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L689-L708 |
224,363 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_svcaller | def _check_svcaller(item):
"""Ensure the provide structural variant caller is valid.
"""
allowed = set(reduce(operator.add, [list(d.keys()) for d in structural._CALLERS.values()]) + [None, False])
svs = item["algorithm"].get("svcaller")
if not isinstance(svs, (list, tuple)):
svs = [svs]
... | python | def _check_svcaller(item):
"""Ensure the provide structural variant caller is valid.
"""
allowed = set(reduce(operator.add, [list(d.keys()) for d in structural._CALLERS.values()]) + [None, False])
svs = item["algorithm"].get("svcaller")
if not isinstance(svs, (list, tuple)):
svs = [svs]
... | [
"def",
"_check_svcaller",
"(",
"item",
")",
":",
"allowed",
"=",
"set",
"(",
"reduce",
"(",
"operator",
".",
"add",
",",
"[",
"list",
"(",
"d",
".",
"keys",
"(",
")",
")",
"for",
"d",
"in",
"structural",
".",
"_CALLERS",
".",
"values",
"(",
")",
... | Ensure the provide structural variant caller is valid. | [
"Ensure",
"the",
"provide",
"structural",
"variant",
"caller",
"is",
"valid",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L710-L721 |
224,364 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_hetcaller | def _check_hetcaller(item):
"""Ensure upstream SV callers requires to heterogeneity analysis are available.
"""
svs = _get_as_list(item, "svcaller")
hets = _get_as_list(item, "hetcaller")
if hets or any([x in svs for x in ["titancna", "purecn"]]):
if not any([x in svs for x in ["cnvkit", "ga... | python | def _check_hetcaller(item):
"""Ensure upstream SV callers requires to heterogeneity analysis are available.
"""
svs = _get_as_list(item, "svcaller")
hets = _get_as_list(item, "hetcaller")
if hets or any([x in svs for x in ["titancna", "purecn"]]):
if not any([x in svs for x in ["cnvkit", "ga... | [
"def",
"_check_hetcaller",
"(",
"item",
")",
":",
"svs",
"=",
"_get_as_list",
"(",
"item",
",",
"\"svcaller\"",
")",
"hets",
"=",
"_get_as_list",
"(",
"item",
",",
"\"hetcaller\"",
")",
"if",
"hets",
"or",
"any",
"(",
"[",
"x",
"in",
"svs",
"for",
"x",... | Ensure upstream SV callers requires to heterogeneity analysis are available. | [
"Ensure",
"upstream",
"SV",
"callers",
"requires",
"to",
"heterogeneity",
"analysis",
"are",
"available",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L731-L739 |
224,365 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_jointcaller | def _check_jointcaller(data):
"""Ensure specified jointcaller is valid.
"""
allowed = set(joint.get_callers() + [None, False])
cs = data["algorithm"].get("jointcaller", [])
if not isinstance(cs, (tuple, list)):
cs = [cs]
problem = [x for x in cs if x not in allowed]
if len(problem) >... | python | def _check_jointcaller(data):
"""Ensure specified jointcaller is valid.
"""
allowed = set(joint.get_callers() + [None, False])
cs = data["algorithm"].get("jointcaller", [])
if not isinstance(cs, (tuple, list)):
cs = [cs]
problem = [x for x in cs if x not in allowed]
if len(problem) >... | [
"def",
"_check_jointcaller",
"(",
"data",
")",
":",
"allowed",
"=",
"set",
"(",
"joint",
".",
"get_callers",
"(",
")",
"+",
"[",
"None",
",",
"False",
"]",
")",
"cs",
"=",
"data",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"jointcaller\"",
",",
"[... | Ensure specified jointcaller is valid. | [
"Ensure",
"specified",
"jointcaller",
"is",
"valid",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L741-L751 |
224,366 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_realign | def _check_realign(data):
"""Check for realignment, which is not supported in GATK4
"""
if "gatk4" not in data["algorithm"].get("tools_off", []) and not "gatk4" == data["algorithm"].get("tools_off"):
if data["algorithm"].get("realign"):
raise ValueError("In sample %s, realign specified b... | python | def _check_realign(data):
"""Check for realignment, which is not supported in GATK4
"""
if "gatk4" not in data["algorithm"].get("tools_off", []) and not "gatk4" == data["algorithm"].get("tools_off"):
if data["algorithm"].get("realign"):
raise ValueError("In sample %s, realign specified b... | [
"def",
"_check_realign",
"(",
"data",
")",
":",
"if",
"\"gatk4\"",
"not",
"in",
"data",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"tools_off\"",
",",
"[",
"]",
")",
"and",
"not",
"\"gatk4\"",
"==",
"data",
"[",
"\"algorithm\"",
"]",
".",
"get",
"("... | Check for realignment, which is not supported in GATK4 | [
"Check",
"for",
"realignment",
"which",
"is",
"not",
"supported",
"in",
"GATK4"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L767-L774 |
224,367 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_trim | def _check_trim(data):
"""Check for valid values for trim_reads.
"""
trim = data["algorithm"].get("trim_reads")
if trim:
if trim == "fastp" and data["algorithm"].get("align_split_size") is not False:
raise ValueError("In sample %s, `trim_reads: fastp` currently requires `align_split_... | python | def _check_trim(data):
"""Check for valid values for trim_reads.
"""
trim = data["algorithm"].get("trim_reads")
if trim:
if trim == "fastp" and data["algorithm"].get("align_split_size") is not False:
raise ValueError("In sample %s, `trim_reads: fastp` currently requires `align_split_... | [
"def",
"_check_trim",
"(",
"data",
")",
":",
"trim",
"=",
"data",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"trim_reads\"",
")",
"if",
"trim",
":",
"if",
"trim",
"==",
"\"fastp\"",
"and",
"data",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"align... | Check for valid values for trim_reads. | [
"Check",
"for",
"valid",
"values",
"for",
"trim_reads",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L776-L783 |
224,368 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _check_sample_config | def _check_sample_config(items, in_file, config):
"""Identify common problems in input sample configuration files.
"""
logger.info("Checking sample YAML configuration: %s" % in_file)
_check_quality_format(items)
_check_for_duplicates(items, "lane")
_check_for_duplicates(items, "description")
... | python | def _check_sample_config(items, in_file, config):
"""Identify common problems in input sample configuration files.
"""
logger.info("Checking sample YAML configuration: %s" % in_file)
_check_quality_format(items)
_check_for_duplicates(items, "lane")
_check_for_duplicates(items, "description")
... | [
"def",
"_check_sample_config",
"(",
"items",
",",
"in_file",
",",
"config",
")",
":",
"logger",
".",
"info",
"(",
"\"Checking sample YAML configuration: %s\"",
"%",
"in_file",
")",
"_check_quality_format",
"(",
"items",
")",
"_check_for_duplicates",
"(",
"items",
",... | Identify common problems in input sample configuration files. | [
"Identify",
"common",
"problems",
"in",
"input",
"sample",
"configuration",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L786-L811 |
224,369 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _file_to_abs | def _file_to_abs(x, dnames, makedir=False):
"""Make a file absolute using the supplied base directory choices.
"""
if x is None or os.path.isabs(x):
return x
elif isinstance(x, six.string_types) and objectstore.is_remote(x):
return x
elif isinstance(x, six.string_types) and x.lower()... | python | def _file_to_abs(x, dnames, makedir=False):
"""Make a file absolute using the supplied base directory choices.
"""
if x is None or os.path.isabs(x):
return x
elif isinstance(x, six.string_types) and objectstore.is_remote(x):
return x
elif isinstance(x, six.string_types) and x.lower()... | [
"def",
"_file_to_abs",
"(",
"x",
",",
"dnames",
",",
"makedir",
"=",
"False",
")",
":",
"if",
"x",
"is",
"None",
"or",
"os",
".",
"path",
".",
"isabs",
"(",
"x",
")",
":",
"return",
"x",
"elif",
"isinstance",
"(",
"x",
",",
"six",
".",
"string_ty... | Make a file absolute using the supplied base directory choices. | [
"Make",
"a",
"file",
"absolute",
"using",
"the",
"supplied",
"base",
"directory",
"choices",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L815-L833 |
224,370 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _normalize_files | def _normalize_files(item, fc_dir=None):
"""Ensure the files argument is a list of absolute file names.
Handles BAM, single and paired end fastq, as well as split inputs.
"""
files = item.get("files")
if files:
if isinstance(files, six.string_types):
files = [files]
fastq... | python | def _normalize_files(item, fc_dir=None):
"""Ensure the files argument is a list of absolute file names.
Handles BAM, single and paired end fastq, as well as split inputs.
"""
files = item.get("files")
if files:
if isinstance(files, six.string_types):
files = [files]
fastq... | [
"def",
"_normalize_files",
"(",
"item",
",",
"fc_dir",
"=",
"None",
")",
":",
"files",
"=",
"item",
".",
"get",
"(",
"\"files\"",
")",
"if",
"files",
":",
"if",
"isinstance",
"(",
"files",
",",
"six",
".",
"string_types",
")",
":",
"files",
"=",
"[",... | Ensure the files argument is a list of absolute file names.
Handles BAM, single and paired end fastq, as well as split inputs. | [
"Ensure",
"the",
"files",
"argument",
"is",
"a",
"list",
"of",
"absolute",
"file",
"names",
".",
"Handles",
"BAM",
"single",
"and",
"paired",
"end",
"fastq",
"as",
"well",
"as",
"split",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L835-L848 |
224,371 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _sanity_check_files | def _sanity_check_files(item, files):
"""Ensure input files correspond with supported approaches.
Handles BAM, fastqs, plus split fastqs.
"""
msg = None
file_types = set([("bam" if x.endswith(".bam") else "fastq") for x in files if x])
if len(file_types) > 1:
msg = "Found multiple file ... | python | def _sanity_check_files(item, files):
"""Ensure input files correspond with supported approaches.
Handles BAM, fastqs, plus split fastqs.
"""
msg = None
file_types = set([("bam" if x.endswith(".bam") else "fastq") for x in files if x])
if len(file_types) > 1:
msg = "Found multiple file ... | [
"def",
"_sanity_check_files",
"(",
"item",
",",
"files",
")",
":",
"msg",
"=",
"None",
"file_types",
"=",
"set",
"(",
"[",
"(",
"\"bam\"",
"if",
"x",
".",
"endswith",
"(",
"\".bam\"",
")",
"else",
"\"fastq\"",
")",
"for",
"x",
"in",
"files",
"if",
"x... | Ensure input files correspond with supported approaches.
Handles BAM, fastqs, plus split fastqs. | [
"Ensure",
"input",
"files",
"correspond",
"with",
"supported",
"approaches",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L850-L871 |
224,372 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | add_metadata_defaults | def add_metadata_defaults(md):
"""Central location for defaults for algorithm inputs.
"""
defaults = {"batch": None,
"phenotype": ""}
for k, v in defaults.items():
if k not in md:
md[k] = v
return md | python | def add_metadata_defaults(md):
"""Central location for defaults for algorithm inputs.
"""
defaults = {"batch": None,
"phenotype": ""}
for k, v in defaults.items():
if k not in md:
md[k] = v
return md | [
"def",
"add_metadata_defaults",
"(",
"md",
")",
":",
"defaults",
"=",
"{",
"\"batch\"",
":",
"None",
",",
"\"phenotype\"",
":",
"\"\"",
"}",
"for",
"k",
",",
"v",
"in",
"defaults",
".",
"items",
"(",
")",
":",
"if",
"k",
"not",
"in",
"md",
":",
"md... | Central location for defaults for algorithm inputs. | [
"Central",
"location",
"for",
"defaults",
"for",
"algorithm",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L1031-L1039 |
224,373 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _add_algorithm_defaults | def _add_algorithm_defaults(algorithm, analysis, is_cwl):
"""Central location specifying defaults for algorithm inputs.
Converts allowed multiple inputs into lists if specified as a single item.
Converts required single items into string if specified as a list
"""
if not algorithm:
algorith... | python | def _add_algorithm_defaults(algorithm, analysis, is_cwl):
"""Central location specifying defaults for algorithm inputs.
Converts allowed multiple inputs into lists if specified as a single item.
Converts required single items into string if specified as a list
"""
if not algorithm:
algorith... | [
"def",
"_add_algorithm_defaults",
"(",
"algorithm",
",",
"analysis",
",",
"is_cwl",
")",
":",
"if",
"not",
"algorithm",
":",
"algorithm",
"=",
"{",
"}",
"defaults",
"=",
"{",
"\"archive\"",
":",
"None",
",",
"\"tools_off\"",
":",
"[",
"]",
",",
"\"tools_on... | Central location specifying defaults for algorithm inputs.
Converts allowed multiple inputs into lists if specified as a single item.
Converts required single items into string if specified as a list | [
"Central",
"location",
"specifying",
"defaults",
"for",
"algorithm",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L1055-L1116 |
224,374 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | _replace_global_vars | def _replace_global_vars(xs, global_vars):
"""Replace globally shared names from input header with value.
The value of the `algorithm` item may be a pointer to a real
file specified in the `global` section. If found, replace with
the full value.
"""
if isinstance(xs, (list, tuple)):
ret... | python | def _replace_global_vars(xs, global_vars):
"""Replace globally shared names from input header with value.
The value of the `algorithm` item may be a pointer to a real
file specified in the `global` section. If found, replace with
the full value.
"""
if isinstance(xs, (list, tuple)):
ret... | [
"def",
"_replace_global_vars",
"(",
"xs",
",",
"global_vars",
")",
":",
"if",
"isinstance",
"(",
"xs",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"_replace_global_vars",
"(",
"x",
")",
"for",
"x",
"in",
"xs",
"]",
"elif",
"isinstance... | Replace globally shared names from input header with value.
The value of the `algorithm` item may be a pointer to a real
file specified in the `global` section. If found, replace with
the full value. | [
"Replace",
"globally",
"shared",
"names",
"from",
"input",
"header",
"with",
"value",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L1118-L1135 |
224,375 | bcbio/bcbio-nextgen | bcbio/pipeline/run_info.py | prep_system | def prep_system(run_info_yaml, bcbio_system=None):
"""Prepare system configuration information from an input configuration file.
This does the work of parsing the system input file and setting up directories
for use in 'organize'.
"""
work_dir = os.getcwd()
config, config_file = config_utils.lo... | python | def prep_system(run_info_yaml, bcbio_system=None):
"""Prepare system configuration information from an input configuration file.
This does the work of parsing the system input file and setting up directories
for use in 'organize'.
"""
work_dir = os.getcwd()
config, config_file = config_utils.lo... | [
"def",
"prep_system",
"(",
"run_info_yaml",
",",
"bcbio_system",
"=",
"None",
")",
":",
"work_dir",
"=",
"os",
".",
"getcwd",
"(",
")",
"config",
",",
"config_file",
"=",
"config_utils",
".",
"load_system_config",
"(",
"bcbio_system",
",",
"work_dir",
")",
"... | Prepare system configuration information from an input configuration file.
This does the work of parsing the system input file and setting up directories
for use in 'organize'. | [
"Prepare",
"system",
"configuration",
"information",
"from",
"an",
"input",
"configuration",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/run_info.py#L1150-L1160 |
224,376 | bcbio/bcbio-nextgen | bcbio/variation/platypus.py | run | def run(align_bams, items, ref_file, assoc_files, region, out_file):
"""Run platypus variant calling, germline whole genome or exome.
"""
assert out_file.endswith(".vcf.gz")
if not utils.file_exists(out_file):
with file_transaction(items[0], out_file) as tx_out_file:
for align_bam in... | python | def run(align_bams, items, ref_file, assoc_files, region, out_file):
"""Run platypus variant calling, germline whole genome or exome.
"""
assert out_file.endswith(".vcf.gz")
if not utils.file_exists(out_file):
with file_transaction(items[0], out_file) as tx_out_file:
for align_bam in... | [
"def",
"run",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
",",
"out_file",
")",
":",
"assert",
"out_file",
".",
"endswith",
"(",
"\".vcf.gz\"",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
... | Run platypus variant calling, germline whole genome or exome. | [
"Run",
"platypus",
"variant",
"calling",
"germline",
"whole",
"genome",
"or",
"exome",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/platypus.py#L19-L62 |
224,377 | bcbio/bcbio-nextgen | bcbio/qc/srna.py | run | def run(bam_file, data, out_dir):
"""Create several log files"""
m = {"base": None, "secondary": []}
m.update(_mirbase_stats(data, out_dir))
m["secondary"].append(_seqcluster_stats(data, out_dir)) | python | def run(bam_file, data, out_dir):
"""Create several log files"""
m = {"base": None, "secondary": []}
m.update(_mirbase_stats(data, out_dir))
m["secondary"].append(_seqcluster_stats(data, out_dir)) | [
"def",
"run",
"(",
"bam_file",
",",
"data",
",",
"out_dir",
")",
":",
"m",
"=",
"{",
"\"base\"",
":",
"None",
",",
"\"secondary\"",
":",
"[",
"]",
"}",
"m",
".",
"update",
"(",
"_mirbase_stats",
"(",
"data",
",",
"out_dir",
")",
")",
"m",
"[",
"\... | Create several log files | [
"Create",
"several",
"log",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/srna.py#L14-L18 |
224,378 | bcbio/bcbio-nextgen | bcbio/qc/srna.py | _mirbase_stats | def _mirbase_stats(data, out_dir):
"""Create stats from miraligner"""
utils.safe_makedir(out_dir)
out_file = os.path.join(out_dir, "%s_bcbio_mirbase.txt" % dd.get_sample_name(data))
out_file_novel = os.path.join(out_dir, "%s_bcbio_mirdeeep2.txt" % dd.get_sample_name(data))
mirbase_fn = data.get("seq... | python | def _mirbase_stats(data, out_dir):
"""Create stats from miraligner"""
utils.safe_makedir(out_dir)
out_file = os.path.join(out_dir, "%s_bcbio_mirbase.txt" % dd.get_sample_name(data))
out_file_novel = os.path.join(out_dir, "%s_bcbio_mirdeeep2.txt" % dd.get_sample_name(data))
mirbase_fn = data.get("seq... | [
"def",
"_mirbase_stats",
"(",
"data",
",",
"out_dir",
")",
":",
"utils",
".",
"safe_makedir",
"(",
"out_dir",
")",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"%s_bcbio_mirbase.txt\"",
"%",
"dd",
".",
"get_sample_name",
"(",
"da... | Create stats from miraligner | [
"Create",
"stats",
"from",
"miraligner"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/srna.py#L20-L31 |
224,379 | bcbio/bcbio-nextgen | bcbio/qc/srna.py | _seqcluster_stats | def _seqcluster_stats(data, out_dir):
"""Parse seqcluster output"""
name = dd.get_sample_name(data)
fn = data.get("seqcluster", {}).get("stat_file", None)
if not fn:
return None
out_file = os.path.join(out_dir, "%s.txt" % name)
df = pd.read_csv(fn, sep="\t", names = ["reads", "sample", "... | python | def _seqcluster_stats(data, out_dir):
"""Parse seqcluster output"""
name = dd.get_sample_name(data)
fn = data.get("seqcluster", {}).get("stat_file", None)
if not fn:
return None
out_file = os.path.join(out_dir, "%s.txt" % name)
df = pd.read_csv(fn, sep="\t", names = ["reads", "sample", "... | [
"def",
"_seqcluster_stats",
"(",
"data",
",",
"out_dir",
")",
":",
"name",
"=",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
"fn",
"=",
"data",
".",
"get",
"(",
"\"seqcluster\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"stat_file\"",
",",
"None",
"... | Parse seqcluster output | [
"Parse",
"seqcluster",
"output"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/srna.py#L61-L71 |
224,380 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | from_flowcell | def from_flowcell(run_folder, lane_details, out_dir=None):
"""Convert a flowcell into a samplesheet for demultiplexing.
"""
fcid = os.path.basename(run_folder)
if out_dir is None:
out_dir = run_folder
out_file = os.path.join(out_dir, "%s.csv" % fcid)
with open(out_file, "w") as out_handl... | python | def from_flowcell(run_folder, lane_details, out_dir=None):
"""Convert a flowcell into a samplesheet for demultiplexing.
"""
fcid = os.path.basename(run_folder)
if out_dir is None:
out_dir = run_folder
out_file = os.path.join(out_dir, "%s.csv" % fcid)
with open(out_file, "w") as out_handl... | [
"def",
"from_flowcell",
"(",
"run_folder",
",",
"lane_details",
",",
"out_dir",
"=",
"None",
")",
":",
"fcid",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"run_folder",
")",
"if",
"out_dir",
"is",
"None",
":",
"out_dir",
"=",
"run_folder",
"out_file",
... | Convert a flowcell into a samplesheet for demultiplexing. | [
"Convert",
"a",
"flowcell",
"into",
"a",
"samplesheet",
"for",
"demultiplexing",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L20-L33 |
224,381 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | _lane_detail_to_ss | def _lane_detail_to_ss(fcid, ldetail):
"""Convert information about a lane into Illumina samplesheet output.
"""
return [fcid, ldetail["lane"], ldetail["name"], ldetail["genome_build"],
ldetail["bc_index"], ldetail["description"].encode("ascii", "ignore"), "N", "", "",
ldetail["proje... | python | def _lane_detail_to_ss(fcid, ldetail):
"""Convert information about a lane into Illumina samplesheet output.
"""
return [fcid, ldetail["lane"], ldetail["name"], ldetail["genome_build"],
ldetail["bc_index"], ldetail["description"].encode("ascii", "ignore"), "N", "", "",
ldetail["proje... | [
"def",
"_lane_detail_to_ss",
"(",
"fcid",
",",
"ldetail",
")",
":",
"return",
"[",
"fcid",
",",
"ldetail",
"[",
"\"lane\"",
"]",
",",
"ldetail",
"[",
"\"name\"",
"]",
",",
"ldetail",
"[",
"\"genome_build\"",
"]",
",",
"ldetail",
"[",
"\"bc_index\"",
"]",
... | Convert information about a lane into Illumina samplesheet output. | [
"Convert",
"information",
"about",
"a",
"lane",
"into",
"Illumina",
"samplesheet",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L35-L40 |
224,382 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | _organize_lanes | def _organize_lanes(info_iter, barcode_ids):
"""Organize flat lane information into nested YAML structure.
"""
all_lanes = []
for (fcid, lane, sampleref), info in itertools.groupby(info_iter, lambda x: (x[0], x[1], x[1])):
info = list(info)
cur_lane = dict(flowcell_id=fcid, lane=lane, ge... | python | def _organize_lanes(info_iter, barcode_ids):
"""Organize flat lane information into nested YAML structure.
"""
all_lanes = []
for (fcid, lane, sampleref), info in itertools.groupby(info_iter, lambda x: (x[0], x[1], x[1])):
info = list(info)
cur_lane = dict(flowcell_id=fcid, lane=lane, ge... | [
"def",
"_organize_lanes",
"(",
"info_iter",
",",
"barcode_ids",
")",
":",
"all_lanes",
"=",
"[",
"]",
"for",
"(",
"fcid",
",",
"lane",
",",
"sampleref",
")",
",",
"info",
"in",
"itertools",
".",
"groupby",
"(",
"info_iter",
",",
"lambda",
"x",
":",
"("... | Organize flat lane information into nested YAML structure. | [
"Organize",
"flat",
"lane",
"information",
"into",
"nested",
"YAML",
"structure",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L44-L64 |
224,383 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | _generate_barcode_ids | def _generate_barcode_ids(info_iter):
"""Create unique barcode IDs assigned to sequences
"""
bc_type = "SampleSheet"
barcodes = list(set([x[-1] for x in info_iter]))
barcodes.sort()
barcode_ids = {}
for i, bc in enumerate(barcodes):
barcode_ids[bc] = (bc_type, i+1)
return barcode... | python | def _generate_barcode_ids(info_iter):
"""Create unique barcode IDs assigned to sequences
"""
bc_type = "SampleSheet"
barcodes = list(set([x[-1] for x in info_iter]))
barcodes.sort()
barcode_ids = {}
for i, bc in enumerate(barcodes):
barcode_ids[bc] = (bc_type, i+1)
return barcode... | [
"def",
"_generate_barcode_ids",
"(",
"info_iter",
")",
":",
"bc_type",
"=",
"\"SampleSheet\"",
"barcodes",
"=",
"list",
"(",
"set",
"(",
"[",
"x",
"[",
"-",
"1",
"]",
"for",
"x",
"in",
"info_iter",
"]",
")",
")",
"barcodes",
".",
"sort",
"(",
")",
"b... | Create unique barcode IDs assigned to sequences | [
"Create",
"unique",
"barcode",
"IDs",
"assigned",
"to",
"sequences"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L70-L79 |
224,384 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | _read_input_csv | def _read_input_csv(in_file):
"""Parse useful details from SampleSheet CSV file.
"""
with io.open(in_file, newline=None) as in_handle:
reader = csv.reader(in_handle)
next(reader) # header
for line in reader:
if line: # empty lines
(fc_id, lane, sample_id, ... | python | def _read_input_csv(in_file):
"""Parse useful details from SampleSheet CSV file.
"""
with io.open(in_file, newline=None) as in_handle:
reader = csv.reader(in_handle)
next(reader) # header
for line in reader:
if line: # empty lines
(fc_id, lane, sample_id, ... | [
"def",
"_read_input_csv",
"(",
"in_file",
")",
":",
"with",
"io",
".",
"open",
"(",
"in_file",
",",
"newline",
"=",
"None",
")",
"as",
"in_handle",
":",
"reader",
"=",
"csv",
".",
"reader",
"(",
"in_handle",
")",
"next",
"(",
"reader",
")",
"# header",... | Parse useful details from SampleSheet CSV file. | [
"Parse",
"useful",
"details",
"from",
"SampleSheet",
"CSV",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L81-L90 |
224,385 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | _get_flowcell_id | def _get_flowcell_id(in_file, require_single=True):
"""Retrieve the unique flowcell id represented in the SampleSheet.
"""
fc_ids = set([x[0] for x in _read_input_csv(in_file)])
if require_single and len(fc_ids) > 1:
raise ValueError("There are several FCIDs in the same samplesheet file: %s" % i... | python | def _get_flowcell_id(in_file, require_single=True):
"""Retrieve the unique flowcell id represented in the SampleSheet.
"""
fc_ids = set([x[0] for x in _read_input_csv(in_file)])
if require_single and len(fc_ids) > 1:
raise ValueError("There are several FCIDs in the same samplesheet file: %s" % i... | [
"def",
"_get_flowcell_id",
"(",
"in_file",
",",
"require_single",
"=",
"True",
")",
":",
"fc_ids",
"=",
"set",
"(",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"_read_input_csv",
"(",
"in_file",
")",
"]",
")",
"if",
"require_single",
"and",
"len",
"(",
... | Retrieve the unique flowcell id represented in the SampleSheet. | [
"Retrieve",
"the",
"unique",
"flowcell",
"id",
"represented",
"in",
"the",
"SampleSheet",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L92-L99 |
224,386 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | csv2yaml | def csv2yaml(in_file, out_file=None):
"""Convert a CSV SampleSheet to YAML run_info format.
"""
if out_file is None:
out_file = "%s.yaml" % os.path.splitext(in_file)[0]
barcode_ids = _generate_barcode_ids(_read_input_csv(in_file))
lanes = _organize_lanes(_read_input_csv(in_file), barcode_ids... | python | def csv2yaml(in_file, out_file=None):
"""Convert a CSV SampleSheet to YAML run_info format.
"""
if out_file is None:
out_file = "%s.yaml" % os.path.splitext(in_file)[0]
barcode_ids = _generate_barcode_ids(_read_input_csv(in_file))
lanes = _organize_lanes(_read_input_csv(in_file), barcode_ids... | [
"def",
"csv2yaml",
"(",
"in_file",
",",
"out_file",
"=",
"None",
")",
":",
"if",
"out_file",
"is",
"None",
":",
"out_file",
"=",
"\"%s.yaml\"",
"%",
"os",
".",
"path",
".",
"splitext",
"(",
"in_file",
")",
"[",
"0",
"]",
"barcode_ids",
"=",
"_generate_... | Convert a CSV SampleSheet to YAML run_info format. | [
"Convert",
"a",
"CSV",
"SampleSheet",
"to",
"YAML",
"run_info",
"format",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L101-L110 |
224,387 | bcbio/bcbio-nextgen | bcbio/illumina/samplesheet.py | run_has_samplesheet | def run_has_samplesheet(fc_dir, config, require_single=True):
"""Checks if there's a suitable SampleSheet.csv present for the run
"""
fc_name, _ = flowcell.parse_dirname(fc_dir)
sheet_dirs = config.get("samplesheet_directories", [])
fcid_sheet = {}
for ss_dir in (s for s in sheet_dirs if os.path... | python | def run_has_samplesheet(fc_dir, config, require_single=True):
"""Checks if there's a suitable SampleSheet.csv present for the run
"""
fc_name, _ = flowcell.parse_dirname(fc_dir)
sheet_dirs = config.get("samplesheet_directories", [])
fcid_sheet = {}
for ss_dir in (s for s in sheet_dirs if os.path... | [
"def",
"run_has_samplesheet",
"(",
"fc_dir",
",",
"config",
",",
"require_single",
"=",
"True",
")",
":",
"fc_name",
",",
"_",
"=",
"flowcell",
".",
"parse_dirname",
"(",
"fc_dir",
")",
"sheet_dirs",
"=",
"config",
".",
"get",
"(",
"\"samplesheet_directories\"... | Checks if there's a suitable SampleSheet.csv present for the run | [
"Checks",
"if",
"there",
"s",
"a",
"suitable",
"SampleSheet",
".",
"csv",
"present",
"for",
"the",
"run"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L112-L133 |
224,388 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | combine_bam | def combine_bam(in_files, out_file, config):
"""Parallel target to combine multiple BAM files.
"""
runner = broad.runner_from_path("picard", config)
runner.run_fn("picard_merge", in_files, out_file)
for in_file in in_files:
save_diskspace(in_file, "Merged into {0}".format(out_file), config)
... | python | def combine_bam(in_files, out_file, config):
"""Parallel target to combine multiple BAM files.
"""
runner = broad.runner_from_path("picard", config)
runner.run_fn("picard_merge", in_files, out_file)
for in_file in in_files:
save_diskspace(in_file, "Merged into {0}".format(out_file), config)
... | [
"def",
"combine_bam",
"(",
"in_files",
",",
"out_file",
",",
"config",
")",
":",
"runner",
"=",
"broad",
".",
"runner_from_path",
"(",
"\"picard\"",
",",
"config",
")",
"runner",
".",
"run_fn",
"(",
"\"picard_merge\"",
",",
"in_files",
",",
"out_file",
")",
... | Parallel target to combine multiple BAM files. | [
"Parallel",
"target",
"to",
"combine",
"multiple",
"BAM",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L25-L33 |
224,389 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | write_nochr_reads | def write_nochr_reads(in_file, out_file, config):
"""Write a BAM file of reads that are not mapped on a reference chromosome.
This is useful for maintaining non-mapped reads in parallel processes
that split processing by chromosome.
"""
if not file_exists(out_file):
with file_transaction(co... | python | def write_nochr_reads(in_file, out_file, config):
"""Write a BAM file of reads that are not mapped on a reference chromosome.
This is useful for maintaining non-mapped reads in parallel processes
that split processing by chromosome.
"""
if not file_exists(out_file):
with file_transaction(co... | [
"def",
"write_nochr_reads",
"(",
"in_file",
",",
"out_file",
",",
"config",
")",
":",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"config",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"samtools",
"=",
"config_u... | Write a BAM file of reads that are not mapped on a reference chromosome.
This is useful for maintaining non-mapped reads in parallel processes
that split processing by chromosome. | [
"Write",
"a",
"BAM",
"file",
"of",
"reads",
"that",
"are",
"not",
"mapped",
"on",
"a",
"reference",
"chromosome",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L57-L68 |
224,390 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | write_noanalysis_reads | def write_noanalysis_reads(in_file, region_file, out_file, config):
"""Write a BAM file of reads in the specified region file that are not analyzed.
We want to get only reads not in analysis regions but also make use of
the BAM index to perform well on large files. The tricky part is avoiding
command l... | python | def write_noanalysis_reads(in_file, region_file, out_file, config):
"""Write a BAM file of reads in the specified region file that are not analyzed.
We want to get only reads not in analysis regions but also make use of
the BAM index to perform well on large files. The tricky part is avoiding
command l... | [
"def",
"write_noanalysis_reads",
"(",
"in_file",
",",
"region_file",
",",
"out_file",
",",
"config",
")",
":",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"config",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"... | Write a BAM file of reads in the specified region file that are not analyzed.
We want to get only reads not in analysis regions but also make use of
the BAM index to perform well on large files. The tricky part is avoiding
command line limits. There is a nice discussion on SeqAnswers:
http://seqanswers... | [
"Write",
"a",
"BAM",
"file",
"of",
"reads",
"in",
"the",
"specified",
"region",
"file",
"that",
"are",
"not",
"analyzed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L70-L88 |
224,391 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | subset_bam_by_region | def subset_bam_by_region(in_file, region, config, out_file_base=None):
"""Subset BAM files based on specified chromosome region.
"""
if out_file_base is not None:
base, ext = os.path.splitext(out_file_base)
else:
base, ext = os.path.splitext(in_file)
out_file = "%s-subset%s%s" % (bas... | python | def subset_bam_by_region(in_file, region, config, out_file_base=None):
"""Subset BAM files based on specified chromosome region.
"""
if out_file_base is not None:
base, ext = os.path.splitext(out_file_base)
else:
base, ext = os.path.splitext(in_file)
out_file = "%s-subset%s%s" % (bas... | [
"def",
"subset_bam_by_region",
"(",
"in_file",
",",
"region",
",",
"config",
",",
"out_file_base",
"=",
"None",
")",
":",
"if",
"out_file_base",
"is",
"not",
"None",
":",
"base",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"out_file_base",
... | Subset BAM files based on specified chromosome region. | [
"Subset",
"BAM",
"files",
"based",
"on",
"specified",
"chromosome",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L90-L109 |
224,392 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | subset_bed_by_chrom | def subset_bed_by_chrom(in_file, chrom, data, out_dir=None):
"""Subset a BED file to only have items from the specified chromosome.
"""
if out_dir is None:
out_dir = os.path.dirname(in_file)
base, ext = os.path.splitext(os.path.basename(in_file))
out_file = os.path.join(out_dir, "%s-%s%s" % ... | python | def subset_bed_by_chrom(in_file, chrom, data, out_dir=None):
"""Subset a BED file to only have items from the specified chromosome.
"""
if out_dir is None:
out_dir = os.path.dirname(in_file)
base, ext = os.path.splitext(os.path.basename(in_file))
out_file = os.path.join(out_dir, "%s-%s%s" % ... | [
"def",
"subset_bed_by_chrom",
"(",
"in_file",
",",
"chrom",
",",
"data",
",",
"out_dir",
"=",
"None",
")",
":",
"if",
"out_dir",
"is",
"None",
":",
"out_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"in_file",
")",
"base",
",",
"ext",
"=",
"os",... | Subset a BED file to only have items from the specified chromosome. | [
"Subset",
"a",
"BED",
"file",
"to",
"only",
"have",
"items",
"from",
"the",
"specified",
"chromosome",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L111-L121 |
224,393 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | remove_lcr_regions | def remove_lcr_regions(orig_bed, items):
"""If configured and available, update a BED file to remove low complexity regions.
"""
lcr_bed = tz.get_in(["genome_resources", "variation", "lcr"], items[0])
if lcr_bed and os.path.exists(lcr_bed) and "lcr" in get_exclude_regions(items):
return _remove_... | python | def remove_lcr_regions(orig_bed, items):
"""If configured and available, update a BED file to remove low complexity regions.
"""
lcr_bed = tz.get_in(["genome_resources", "variation", "lcr"], items[0])
if lcr_bed and os.path.exists(lcr_bed) and "lcr" in get_exclude_regions(items):
return _remove_... | [
"def",
"remove_lcr_regions",
"(",
"orig_bed",
",",
"items",
")",
":",
"lcr_bed",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"genome_resources\"",
",",
"\"variation\"",
",",
"\"lcr\"",
"]",
",",
"items",
"[",
"0",
"]",
")",
"if",
"lcr_bed",
"and",
"os",
".",
... | If configured and available, update a BED file to remove low complexity regions. | [
"If",
"configured",
"and",
"available",
"update",
"a",
"BED",
"file",
"to",
"remove",
"low",
"complexity",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L143-L150 |
224,394 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | remove_polyx_regions | def remove_polyx_regions(in_file, items):
"""Remove polyX stretches, contributing to long variant runtimes.
"""
ex_bed = tz.get_in(["genome_resources", "variation", "polyx"], items[0])
if ex_bed and os.path.exists(ex_bed):
return _remove_regions(in_file, [ex_bed], "nopolyx", items[0])
else:
... | python | def remove_polyx_regions(in_file, items):
"""Remove polyX stretches, contributing to long variant runtimes.
"""
ex_bed = tz.get_in(["genome_resources", "variation", "polyx"], items[0])
if ex_bed and os.path.exists(ex_bed):
return _remove_regions(in_file, [ex_bed], "nopolyx", items[0])
else:
... | [
"def",
"remove_polyx_regions",
"(",
"in_file",
",",
"items",
")",
":",
"ex_bed",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"genome_resources\"",
",",
"\"variation\"",
",",
"\"polyx\"",
"]",
",",
"items",
"[",
"0",
"]",
")",
"if",
"ex_bed",
"and",
"os",
".",
... | Remove polyX stretches, contributing to long variant runtimes. | [
"Remove",
"polyX",
"stretches",
"contributing",
"to",
"long",
"variant",
"runtimes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L152-L159 |
224,395 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | add_highdepth_genome_exclusion | def add_highdepth_genome_exclusion(items):
"""Add exclusions to input items to avoid slow runtimes on whole genomes.
"""
out = []
for d in items:
d = utils.deepish_copy(d)
if dd.get_coverage_interval(d) == "genome":
e = dd.get_exclude_regions(d)
if "highdepth" not... | python | def add_highdepth_genome_exclusion(items):
"""Add exclusions to input items to avoid slow runtimes on whole genomes.
"""
out = []
for d in items:
d = utils.deepish_copy(d)
if dd.get_coverage_interval(d) == "genome":
e = dd.get_exclude_regions(d)
if "highdepth" not... | [
"def",
"add_highdepth_genome_exclusion",
"(",
"items",
")",
":",
"out",
"=",
"[",
"]",
"for",
"d",
"in",
"items",
":",
"d",
"=",
"utils",
".",
"deepish_copy",
"(",
"d",
")",
"if",
"dd",
".",
"get_coverage_interval",
"(",
"d",
")",
"==",
"\"genome\"",
"... | Add exclusions to input items to avoid slow runtimes on whole genomes. | [
"Add",
"exclusions",
"to",
"input",
"items",
"to",
"avoid",
"slow",
"runtimes",
"on",
"whole",
"genomes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L161-L173 |
224,396 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | remove_highdepth_regions | def remove_highdepth_regions(in_file, items):
"""Remove high depth regions from a BED file for analyzing a set of calls.
Tries to avoid spurious errors and slow run times in collapsed repeat regions.
Also adds ENCODE blacklist regions which capture additional collapsed repeats
around centromeres.
... | python | def remove_highdepth_regions(in_file, items):
"""Remove high depth regions from a BED file for analyzing a set of calls.
Tries to avoid spurious errors and slow run times in collapsed repeat regions.
Also adds ENCODE blacklist regions which capture additional collapsed repeats
around centromeres.
... | [
"def",
"remove_highdepth_regions",
"(",
"in_file",
",",
"items",
")",
":",
"encode_bed",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"genome_resources\"",
",",
"\"variation\"",
",",
"\"encode_blacklist\"",
"]",
",",
"items",
"[",
"0",
"]",
")",
"if",
"encode_bed",
... | Remove high depth regions from a BED file for analyzing a set of calls.
Tries to avoid spurious errors and slow run times in collapsed repeat regions.
Also adds ENCODE blacklist regions which capture additional collapsed repeats
around centromeres. | [
"Remove",
"high",
"depth",
"regions",
"from",
"a",
"BED",
"file",
"for",
"analyzing",
"a",
"set",
"of",
"calls",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L175-L187 |
224,397 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | _remove_regions | def _remove_regions(in_file, remove_beds, ext, data):
"""Subtract a list of BED files from an input BED.
General approach handling none, one and more remove_beds.
"""
from bcbio.variation import bedutils
out_file = "%s-%s.bed" % (utils.splitext_plus(in_file)[0], ext)
if not utils.file_uptodate(... | python | def _remove_regions(in_file, remove_beds, ext, data):
"""Subtract a list of BED files from an input BED.
General approach handling none, one and more remove_beds.
"""
from bcbio.variation import bedutils
out_file = "%s-%s.bed" % (utils.splitext_plus(in_file)[0], ext)
if not utils.file_uptodate(... | [
"def",
"_remove_regions",
"(",
"in_file",
",",
"remove_beds",
",",
"ext",
",",
"data",
")",
":",
"from",
"bcbio",
".",
"variation",
"import",
"bedutils",
"out_file",
"=",
"\"%s-%s.bed\"",
"%",
"(",
"utils",
".",
"splitext_plus",
"(",
"in_file",
")",
"[",
"... | Subtract a list of BED files from an input BED.
General approach handling none, one and more remove_beds. | [
"Subtract",
"a",
"list",
"of",
"BED",
"files",
"from",
"an",
"input",
"BED",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L189-L218 |
224,398 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | get_exclude_regions | def get_exclude_regions(items):
"""Retrieve regions to exclude from a set of items.
Includes back compatibility for older custom ways of specifying different
exclusions.
"""
def _get_sample_excludes(d):
excludes = dd.get_exclude_regions(d)
# back compatible
if tz.get_in(("co... | python | def get_exclude_regions(items):
"""Retrieve regions to exclude from a set of items.
Includes back compatibility for older custom ways of specifying different
exclusions.
"""
def _get_sample_excludes(d):
excludes = dd.get_exclude_regions(d)
# back compatible
if tz.get_in(("co... | [
"def",
"get_exclude_regions",
"(",
"items",
")",
":",
"def",
"_get_sample_excludes",
"(",
"d",
")",
":",
"excludes",
"=",
"dd",
".",
"get_exclude_regions",
"(",
"d",
")",
"# back compatible",
"if",
"tz",
".",
"get_in",
"(",
"(",
"\"config\"",
",",
"\"algorit... | Retrieve regions to exclude from a set of items.
Includes back compatibility for older custom ways of specifying different
exclusions. | [
"Retrieve",
"regions",
"to",
"exclude",
"from",
"a",
"set",
"of",
"items",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L231-L244 |
224,399 | bcbio/bcbio-nextgen | bcbio/pipeline/shared.py | to_multiregion | def to_multiregion(region):
"""Convert a single region or multiple region specification into multiregion list.
If a single region (chrom, start, end), returns [(chrom, start, end)]
otherwise returns multiregion.
"""
assert isinstance(region, (list, tuple)), region
if isinstance(region[0], (list... | python | def to_multiregion(region):
"""Convert a single region or multiple region specification into multiregion list.
If a single region (chrom, start, end), returns [(chrom, start, end)]
otherwise returns multiregion.
"""
assert isinstance(region, (list, tuple)), region
if isinstance(region[0], (list... | [
"def",
"to_multiregion",
"(",
"region",
")",
":",
"assert",
"isinstance",
"(",
"region",
",",
"(",
"list",
",",
"tuple",
")",
")",
",",
"region",
"if",
"isinstance",
"(",
"region",
"[",
"0",
"]",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"retu... | Convert a single region or multiple region specification into multiregion list.
If a single region (chrom, start, end), returns [(chrom, start, end)]
otherwise returns multiregion. | [
"Convert",
"a",
"single",
"region",
"or",
"multiple",
"region",
"specification",
"into",
"multiregion",
"list",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L261-L272 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.