repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | _sync | def _sync(original, processed):
"""
Add output to data if run sucessfully.
For now only macs2 is available, so no need
to consider multiple callers.
"""
for original_sample in original:
original_sample[0]["peaks_files"] = {}
for process_sample in processed:
if dd.get_... | python | def _sync(original, processed):
"""
Add output to data if run sucessfully.
For now only macs2 is available, so no need
to consider multiple callers.
"""
for original_sample in original:
original_sample[0]["peaks_files"] = {}
for process_sample in processed:
if dd.get_... | [
"def",
"_sync",
"(",
"original",
",",
"processed",
")",
":",
"for",
"original_sample",
"in",
"original",
":",
"original_sample",
"[",
"0",
"]",
"[",
"\"peaks_files\"",
"]",
"=",
"{",
"}",
"for",
"process_sample",
"in",
"processed",
":",
"if",
"dd",
".",
... | Add output to data if run sucessfully.
For now only macs2 is available, so no need
to consider multiple callers. | [
"Add",
"output",
"to",
"data",
"if",
"run",
"sucessfully",
".",
"For",
"now",
"only",
"macs2",
"is",
"available",
"so",
"no",
"need",
"to",
"consider",
"multiple",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L61-L74 | train |
bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | _check | def _check(sample, data):
"""Get input sample for each chip bam file."""
if dd.get_chip_method(sample).lower() == "atac":
return [sample]
if dd.get_phenotype(sample) == "input":
return None
for origin in data:
if dd.get_batch(sample) in (dd.get_batches(origin[0]) or []) and dd.ge... | python | def _check(sample, data):
"""Get input sample for each chip bam file."""
if dd.get_chip_method(sample).lower() == "atac":
return [sample]
if dd.get_phenotype(sample) == "input":
return None
for origin in data:
if dd.get_batch(sample) in (dd.get_batches(origin[0]) or []) and dd.ge... | [
"def",
"_check",
"(",
"sample",
",",
"data",
")",
":",
"if",
"dd",
".",
"get_chip_method",
"(",
"sample",
")",
".",
"lower",
"(",
")",
"==",
"\"atac\"",
":",
"return",
"[",
"sample",
"]",
"if",
"dd",
".",
"get_phenotype",
"(",
"sample",
")",
"==",
... | Get input sample for each chip bam file. | [
"Get",
"input",
"sample",
"for",
"each",
"chip",
"bam",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L76-L86 | train |
bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | _get_multiplier | def _get_multiplier(samples):
"""Get multiplier to get jobs
only for samples that have input
"""
to_process = 1.0
to_skip = 0
for sample in samples:
if dd.get_phenotype(sample[0]) == "chip":
to_process += 1.0
elif dd.get_chip_method(sample[0]).lower() == "atac":
... | python | def _get_multiplier(samples):
"""Get multiplier to get jobs
only for samples that have input
"""
to_process = 1.0
to_skip = 0
for sample in samples:
if dd.get_phenotype(sample[0]) == "chip":
to_process += 1.0
elif dd.get_chip_method(sample[0]).lower() == "atac":
... | [
"def",
"_get_multiplier",
"(",
"samples",
")",
":",
"to_process",
"=",
"1.0",
"to_skip",
"=",
"0",
"for",
"sample",
"in",
"samples",
":",
"if",
"dd",
".",
"get_phenotype",
"(",
"sample",
"[",
"0",
"]",
")",
"==",
"\"chip\"",
":",
"to_process",
"+=",
"1... | Get multiplier to get jobs
only for samples that have input | [
"Get",
"multiplier",
"to",
"get",
"jobs",
"only",
"for",
"samples",
"that",
"have",
"input"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L88-L104 | train |
bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | greylisting | def greylisting(data):
"""
Run ChIP-seq greylisting
"""
input_bam = data.get("work_bam_input", None)
if not input_bam:
logger.info("No input BAM file detected, skipping greylisting.")
return None
try:
greylister = config_utils.get_program("chipseq-greylist", data)
exc... | python | def greylisting(data):
"""
Run ChIP-seq greylisting
"""
input_bam = data.get("work_bam_input", None)
if not input_bam:
logger.info("No input BAM file detected, skipping greylisting.")
return None
try:
greylister = config_utils.get_program("chipseq-greylist", data)
exc... | [
"def",
"greylisting",
"(",
"data",
")",
":",
"input_bam",
"=",
"data",
".",
"get",
"(",
"\"work_bam_input\"",
",",
"None",
")",
"if",
"not",
"input_bam",
":",
"logger",
".",
"info",
"(",
"\"No input BAM file detected, skipping greylisting.\"",
")",
"return",
"No... | Run ChIP-seq greylisting | [
"Run",
"ChIP",
"-",
"seq",
"greylisting"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L106-L133 | train |
bcbio/bcbio-nextgen | bcbio/distributed/clargs.py | to_parallel | def to_parallel(args, module="bcbio.distributed"):
"""Convert input arguments into a parallel dictionary for passing to processing.
"""
ptype, cores = _get_cores_and_type(args.numcores,
getattr(args, "paralleltype", None),
args.sc... | python | def to_parallel(args, module="bcbio.distributed"):
"""Convert input arguments into a parallel dictionary for passing to processing.
"""
ptype, cores = _get_cores_and_type(args.numcores,
getattr(args, "paralleltype", None),
args.sc... | [
"def",
"to_parallel",
"(",
"args",
",",
"module",
"=",
"\"bcbio.distributed\"",
")",
":",
"ptype",
",",
"cores",
"=",
"_get_cores_and_type",
"(",
"args",
".",
"numcores",
",",
"getattr",
"(",
"args",
",",
"\"paralleltype\"",
",",
"None",
")",
",",
"args",
... | Convert input arguments into a parallel dictionary for passing to processing. | [
"Convert",
"input",
"arguments",
"into",
"a",
"parallel",
"dictionary",
"for",
"passing",
"to",
"processing",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clargs.py#L4-L18 | train |
bcbio/bcbio-nextgen | bcbio/distributed/clargs.py | _get_cores_and_type | def _get_cores_and_type(numcores, paralleltype, scheduler):
"""Return core and parallelization approach from command line providing sane defaults.
"""
if scheduler is not None:
paralleltype = "ipython"
if paralleltype is None:
paralleltype = "local"
if not numcores or int(numcores) <... | python | def _get_cores_and_type(numcores, paralleltype, scheduler):
"""Return core and parallelization approach from command line providing sane defaults.
"""
if scheduler is not None:
paralleltype = "ipython"
if paralleltype is None:
paralleltype = "local"
if not numcores or int(numcores) <... | [
"def",
"_get_cores_and_type",
"(",
"numcores",
",",
"paralleltype",
",",
"scheduler",
")",
":",
"if",
"scheduler",
"is",
"not",
"None",
":",
"paralleltype",
"=",
"\"ipython\"",
"if",
"paralleltype",
"is",
"None",
":",
"paralleltype",
"=",
"\"local\"",
"if",
"n... | Return core and parallelization approach from command line providing sane defaults. | [
"Return",
"core",
"and",
"parallelization",
"approach",
"from",
"command",
"line",
"providing",
"sane",
"defaults",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clargs.py#L20-L29 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | _fix_mates | def _fix_mates(orig_file, out_file, ref_file, config):
"""Fix problematic unmapped mate pairs in TopHat output.
TopHat 2.0.9 appears to have issues with secondary reads:
https://groups.google.com/forum/#!topic/tuxedo-tools-users/puLfDNbN9bo
This cleans the input file to only keep properly mapped pairs,... | python | def _fix_mates(orig_file, out_file, ref_file, config):
"""Fix problematic unmapped mate pairs in TopHat output.
TopHat 2.0.9 appears to have issues with secondary reads:
https://groups.google.com/forum/#!topic/tuxedo-tools-users/puLfDNbN9bo
This cleans the input file to only keep properly mapped pairs,... | [
"def",
"_fix_mates",
"(",
"orig_file",
",",
"out_file",
",",
"ref_file",
",",
"config",
")",
":",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"config",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"samtools",
... | Fix problematic unmapped mate pairs in TopHat output.
TopHat 2.0.9 appears to have issues with secondary reads:
https://groups.google.com/forum/#!topic/tuxedo-tools-users/puLfDNbN9bo
This cleans the input file to only keep properly mapped pairs,
providing a general fix that will handle correctly mapped... | [
"Fix",
"problematic",
"unmapped",
"mate",
"pairs",
"in",
"TopHat",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L173-L187 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | _add_rg | def _add_rg(unmapped_file, config, names):
"""Add the missing RG header."""
picard = broad.runner_from_path("picard", config)
rg_fixed = picard.run_fn("picard_fix_rgs", unmapped_file, names)
return rg_fixed | python | def _add_rg(unmapped_file, config, names):
"""Add the missing RG header."""
picard = broad.runner_from_path("picard", config)
rg_fixed = picard.run_fn("picard_fix_rgs", unmapped_file, names)
return rg_fixed | [
"def",
"_add_rg",
"(",
"unmapped_file",
",",
"config",
",",
"names",
")",
":",
"picard",
"=",
"broad",
".",
"runner_from_path",
"(",
"\"picard\"",
",",
"config",
")",
"rg_fixed",
"=",
"picard",
".",
"run_fn",
"(",
"\"picard_fix_rgs\"",
",",
"unmapped_file",
... | Add the missing RG header. | [
"Add",
"the",
"missing",
"RG",
"header",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L189-L193 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | _estimate_paired_innerdist | def _estimate_paired_innerdist(fastq_file, pair_file, ref_file, out_base,
out_dir, data):
"""Use Bowtie to estimate the inner distance of paired reads.
"""
mean, stdev = _bowtie_for_innerdist("100000", fastq_file, pair_file, ref_file,
ou... | python | def _estimate_paired_innerdist(fastq_file, pair_file, ref_file, out_base,
out_dir, data):
"""Use Bowtie to estimate the inner distance of paired reads.
"""
mean, stdev = _bowtie_for_innerdist("100000", fastq_file, pair_file, ref_file,
ou... | [
"def",
"_estimate_paired_innerdist",
"(",
"fastq_file",
",",
"pair_file",
",",
"ref_file",
",",
"out_base",
",",
"out_dir",
",",
"data",
")",
":",
"mean",
",",
"stdev",
"=",
"_bowtie_for_innerdist",
"(",
"\"100000\"",
",",
"fastq_file",
",",
"pair_file",
",",
... | Use Bowtie to estimate the inner distance of paired reads. | [
"Use",
"Bowtie",
"to",
"estimate",
"the",
"inner",
"distance",
"of",
"paired",
"reads",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L230-L243 | train |
bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | fix_insert_size | def fix_insert_size(in_bam, config):
"""
Tophat sets PI in the RG to be the inner distance size, but the SAM spec
states should be the insert size. This fixes the RG in the alignment
file generated by Tophat header to match the spec
"""
fixed_file = os.path.splitext(in_bam)[0] + ".pi_fixed.bam"
... | python | def fix_insert_size(in_bam, config):
"""
Tophat sets PI in the RG to be the inner distance size, but the SAM spec
states should be the insert size. This fixes the RG in the alignment
file generated by Tophat header to match the spec
"""
fixed_file = os.path.splitext(in_bam)[0] + ".pi_fixed.bam"
... | [
"def",
"fix_insert_size",
"(",
"in_bam",
",",
"config",
")",
":",
"fixed_file",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"in_bam",
")",
"[",
"0",
"]",
"+",
"\".pi_fixed.bam\"",
"if",
"file_exists",
"(",
"fixed_file",
")",
":",
"return",
"fixed_file",
... | Tophat sets PI in the RG to be the inner distance size, but the SAM spec
states should be the insert size. This fixes the RG in the alignment
file generated by Tophat header to match the spec | [
"Tophat",
"sets",
"PI",
"in",
"the",
"RG",
"to",
"be",
"the",
"inner",
"distance",
"size",
"but",
"the",
"SAM",
"spec",
"states",
"should",
"be",
"the",
"insert",
"size",
".",
"This",
"fixes",
"the",
"RG",
"in",
"the",
"alignment",
"file",
"generated",
... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L344-L369 | train |
bcbio/bcbio-nextgen | bcbio/variation/damage.py | _filter_to_info | def _filter_to_info(in_file, data):
"""Move DKFZ filter information into INFO field.
"""
header = ("""##INFO=<ID=DKFZBias,Number=.,Type=String,"""
"""Description="Bias estimation based on unequal read support from DKFZBiasFilterVariant Depth">\n""")
out_file = "%s-ann.vcf" % utils.splitext... | python | def _filter_to_info(in_file, data):
"""Move DKFZ filter information into INFO field.
"""
header = ("""##INFO=<ID=DKFZBias,Number=.,Type=String,"""
"""Description="Bias estimation based on unequal read support from DKFZBiasFilterVariant Depth">\n""")
out_file = "%s-ann.vcf" % utils.splitext... | [
"def",
"_filter_to_info",
"(",
"in_file",
",",
"data",
")",
":",
"header",
"=",
"(",
"\"\"\"##INFO=<ID=DKFZBias,Number=.,Type=String,\"\"\"",
"\"\"\"Description=\"Bias estimation based on unequal read support from DKFZBiasFilterVariant Depth\">\\n\"\"\"",
")",
"out_file",
"=",
"\"%s-... | Move DKFZ filter information into INFO field. | [
"Move",
"DKFZ",
"filter",
"information",
"into",
"INFO",
"field",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/damage.py#L46-L63 | train |
bcbio/bcbio-nextgen | bcbio/variation/damage.py | _rec_filter_to_info | def _rec_filter_to_info(line):
"""Move a DKFZBias filter to the INFO field, for a record.
"""
parts = line.rstrip().split("\t")
move_filters = {"bSeq": "strand", "bPcr": "damage"}
new_filters = []
bias_info = []
for f in parts[6].split(";"):
if f in move_filters:
bias_inf... | python | def _rec_filter_to_info(line):
"""Move a DKFZBias filter to the INFO field, for a record.
"""
parts = line.rstrip().split("\t")
move_filters = {"bSeq": "strand", "bPcr": "damage"}
new_filters = []
bias_info = []
for f in parts[6].split(";"):
if f in move_filters:
bias_inf... | [
"def",
"_rec_filter_to_info",
"(",
"line",
")",
":",
"parts",
"=",
"line",
".",
"rstrip",
"(",
")",
".",
"split",
"(",
"\"\\t\"",
")",
"move_filters",
"=",
"{",
"\"bSeq\"",
":",
"\"strand\"",
",",
"\"bPcr\"",
":",
"\"damage\"",
"}",
"new_filters",
"=",
"... | Move a DKFZBias filter to the INFO field, for a record. | [
"Move",
"a",
"DKFZBias",
"filter",
"to",
"the",
"INFO",
"field",
"for",
"a",
"record",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/damage.py#L65-L80 | train |
bcbio/bcbio-nextgen | bcbio/variation/damage.py | should_filter | def should_filter(items):
"""Check if we should do damage filtering on somatic calling with low frequency events.
"""
return (vcfutils.get_paired(items) is not None and
any("damage_filter" in dd.get_tools_on(d) for d in items)) | python | def should_filter(items):
"""Check if we should do damage filtering on somatic calling with low frequency events.
"""
return (vcfutils.get_paired(items) is not None and
any("damage_filter" in dd.get_tools_on(d) for d in items)) | [
"def",
"should_filter",
"(",
"items",
")",
":",
"return",
"(",
"vcfutils",
".",
"get_paired",
"(",
"items",
")",
"is",
"not",
"None",
"and",
"any",
"(",
"\"damage_filter\"",
"in",
"dd",
".",
"get_tools_on",
"(",
"d",
")",
"for",
"d",
"in",
"items",
")"... | Check if we should do damage filtering on somatic calling with low frequency events. | [
"Check",
"if",
"we",
"should",
"do",
"damage",
"filtering",
"on",
"somatic",
"calling",
"with",
"low",
"frequency",
"events",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/damage.py#L82-L86 | train |
bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | start_cmd | def start_cmd(cmd, descr, data):
"""Retain details about starting a command, returning a command identifier.
"""
if data and "provenance" in data:
entity_id = tz.get_in(["provenance", "entity"], data) | python | def start_cmd(cmd, descr, data):
"""Retain details about starting a command, returning a command identifier.
"""
if data and "provenance" in data:
entity_id = tz.get_in(["provenance", "entity"], data) | [
"def",
"start_cmd",
"(",
"cmd",
",",
"descr",
",",
"data",
")",
":",
"if",
"data",
"and",
"\"provenance\"",
"in",
"data",
":",
"entity_id",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"provenance\"",
",",
"\"entity\"",
"]",
",",
"data",
")"
] | Retain details about starting a command, returning a command identifier. | [
"Retain",
"details",
"about",
"starting",
"a",
"command",
"returning",
"a",
"command",
"identifier",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L23-L27 | train |
bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | initialize | def initialize(dirs):
"""Initialize the biolite database to load provenance information.
"""
if biolite and dirs.get("work"):
base_dir = utils.safe_makedir(os.path.join(dirs["work"], "provenance"))
p_db = os.path.join(base_dir, "biolite.db")
biolite.config.resources["database"] = p_d... | python | def initialize(dirs):
"""Initialize the biolite database to load provenance information.
"""
if biolite and dirs.get("work"):
base_dir = utils.safe_makedir(os.path.join(dirs["work"], "provenance"))
p_db = os.path.join(base_dir, "biolite.db")
biolite.config.resources["database"] = p_d... | [
"def",
"initialize",
"(",
"dirs",
")",
":",
"if",
"biolite",
"and",
"dirs",
".",
"get",
"(",
"\"work\"",
")",
":",
"base_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dirs",
"[",
"\"work\"",
"]",
",",
"\"provenan... | Initialize the biolite database to load provenance information. | [
"Initialize",
"the",
"biolite",
"database",
"to",
"load",
"provenance",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L34-L41 | train |
bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | track_parallel | def track_parallel(items, sub_type):
"""Create entity identifiers to trace the given items in sub-commands.
Helps handle nesting in parallel program execution:
run id => sub-section id => parallel ids
"""
out = []
for i, args in enumerate(items):
item_i, item = _get_provitem_from_args(... | python | def track_parallel(items, sub_type):
"""Create entity identifiers to trace the given items in sub-commands.
Helps handle nesting in parallel program execution:
run id => sub-section id => parallel ids
"""
out = []
for i, args in enumerate(items):
item_i, item = _get_provitem_from_args(... | [
"def",
"track_parallel",
"(",
"items",
",",
"sub_type",
")",
":",
"out",
"=",
"[",
"]",
"for",
"i",
",",
"args",
"in",
"enumerate",
"(",
"items",
")",
":",
"item_i",
",",
"item",
"=",
"_get_provitem_from_args",
"(",
"args",
")",
"if",
"item",
":",
"s... | Create entity identifiers to trace the given items in sub-commands.
Helps handle nesting in parallel program execution:
run id => sub-section id => parallel ids | [
"Create",
"entity",
"identifiers",
"to",
"trace",
"the",
"given",
"items",
"in",
"sub",
"-",
"commands",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L49-L66 | train |
bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | _get_provitem_from_args | def _get_provitem_from_args(xs):
"""Retrieve processed item from list of input arguments.
"""
for i, x in enumerate(xs):
if _has_provenance(x):
return i, x
return -1, None | python | def _get_provitem_from_args(xs):
"""Retrieve processed item from list of input arguments.
"""
for i, x in enumerate(xs):
if _has_provenance(x):
return i, x
return -1, None | [
"def",
"_get_provitem_from_args",
"(",
"xs",
")",
":",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"xs",
")",
":",
"if",
"_has_provenance",
"(",
"x",
")",
":",
"return",
"i",
",",
"x",
"return",
"-",
"1",
",",
"None"
] | Retrieve processed item from list of input arguments. | [
"Retrieve",
"processed",
"item",
"from",
"list",
"of",
"input",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L71-L77 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | handle_vcf_calls | def handle_vcf_calls(vcf_file, data, orig_items):
"""Prioritize VCF calls based on external annotations supplied through GEMINI.
"""
if not _do_prioritize(orig_items):
return vcf_file
else:
ann_vcf = population.run_vcfanno(vcf_file, data)
if ann_vcf:
priority_file = _... | python | def handle_vcf_calls(vcf_file, data, orig_items):
"""Prioritize VCF calls based on external annotations supplied through GEMINI.
"""
if not _do_prioritize(orig_items):
return vcf_file
else:
ann_vcf = population.run_vcfanno(vcf_file, data)
if ann_vcf:
priority_file = _... | [
"def",
"handle_vcf_calls",
"(",
"vcf_file",
",",
"data",
",",
"orig_items",
")",
":",
"if",
"not",
"_do_prioritize",
"(",
"orig_items",
")",
":",
"return",
"vcf_file",
"else",
":",
"ann_vcf",
"=",
"population",
".",
"run_vcfanno",
"(",
"vcf_file",
",",
"data... | Prioritize VCF calls based on external annotations supplied through GEMINI. | [
"Prioritize",
"VCF",
"calls",
"based",
"on",
"external",
"annotations",
"supplied",
"through",
"GEMINI",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L27-L39 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _apply_priority_filter | def _apply_priority_filter(in_file, priority_file, data):
"""Annotate variants with priority information and use to apply filters.
"""
out_file = "%s-priority%s" % utils.splitext_plus(in_file)
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
h... | python | def _apply_priority_filter(in_file, priority_file, data):
"""Annotate variants with priority information and use to apply filters.
"""
out_file = "%s-priority%s" % utils.splitext_plus(in_file)
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
h... | [
"def",
"_apply_priority_filter",
"(",
"in_file",
",",
"priority_file",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s-priority%s\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"in_file",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
... | Annotate variants with priority information and use to apply filters. | [
"Annotate",
"variants",
"with",
"priority",
"information",
"and",
"use",
"to",
"apply",
"filters",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L41-L63 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _prep_priority_filter_vcfanno | def _prep_priority_filter_vcfanno(in_vcf, data):
"""Prepare tabix file with priority filters based on vcfanno annotations.
"""
pops = ['af_adj_exac_afr', 'af_adj_exac_amr', 'af_adj_exac_eas',
'af_adj_exac_fin', 'af_adj_exac_nfe', 'af_adj_exac_oth', 'af_adj_exac_sas',
'af_exac_all', '... | python | def _prep_priority_filter_vcfanno(in_vcf, data):
"""Prepare tabix file with priority filters based on vcfanno annotations.
"""
pops = ['af_adj_exac_afr', 'af_adj_exac_amr', 'af_adj_exac_eas',
'af_adj_exac_fin', 'af_adj_exac_nfe', 'af_adj_exac_oth', 'af_adj_exac_sas',
'af_exac_all', '... | [
"def",
"_prep_priority_filter_vcfanno",
"(",
"in_vcf",
",",
"data",
")",
":",
"pops",
"=",
"[",
"'af_adj_exac_afr'",
",",
"'af_adj_exac_amr'",
",",
"'af_adj_exac_eas'",
",",
"'af_adj_exac_fin'",
",",
"'af_adj_exac_nfe'",
",",
"'af_adj_exac_oth'",
",",
"'af_adj_exac_sas'... | Prepare tabix file with priority filters based on vcfanno annotations. | [
"Prepare",
"tabix",
"file",
"with",
"priority",
"filters",
"based",
"on",
"vcfanno",
"annotations",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L65-L88 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _get_impact_info | def _get_impact_info(vcf_reader):
"""Retrieve impact parsing information from INFO header.
"""
ImpactInfo = collections.namedtuple("ImpactInfo", "header, gclass, id")
KEY_2_CLASS = {
'CSQ': geneimpacts.VEP,
'ANN': geneimpacts.SnpEff,
'BCSQ': geneimpacts.BCFT}
for l in (x.stri... | python | def _get_impact_info(vcf_reader):
"""Retrieve impact parsing information from INFO header.
"""
ImpactInfo = collections.namedtuple("ImpactInfo", "header, gclass, id")
KEY_2_CLASS = {
'CSQ': geneimpacts.VEP,
'ANN': geneimpacts.SnpEff,
'BCSQ': geneimpacts.BCFT}
for l in (x.stri... | [
"def",
"_get_impact_info",
"(",
"vcf_reader",
")",
":",
"ImpactInfo",
"=",
"collections",
".",
"namedtuple",
"(",
"\"ImpactInfo\"",
",",
"\"header, gclass, id\"",
")",
"KEY_2_CLASS",
"=",
"{",
"'CSQ'",
":",
"geneimpacts",
".",
"VEP",
",",
"'ANN'",
":",
"geneimpa... | Retrieve impact parsing information from INFO header. | [
"Retrieve",
"impact",
"parsing",
"information",
"from",
"INFO",
"header",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L90-L104 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _parse_impact_header | def _parse_impact_header(hdr_dict):
"""Parse fields for impact, taken from vcf2db
"""
desc = hdr_dict["Description"]
if hdr_dict["ID"] == "ANN":
parts = [x.strip("\"'") for x in re.split("\s*\|\s*", desc.split(":", 1)[1].strip('" '))]
elif hdr_dict["ID"] == "EFF":
parts = [x.strip(" ... | python | def _parse_impact_header(hdr_dict):
"""Parse fields for impact, taken from vcf2db
"""
desc = hdr_dict["Description"]
if hdr_dict["ID"] == "ANN":
parts = [x.strip("\"'") for x in re.split("\s*\|\s*", desc.split(":", 1)[1].strip('" '))]
elif hdr_dict["ID"] == "EFF":
parts = [x.strip(" ... | [
"def",
"_parse_impact_header",
"(",
"hdr_dict",
")",
":",
"desc",
"=",
"hdr_dict",
"[",
"\"Description\"",
"]",
"if",
"hdr_dict",
"[",
"\"ID\"",
"]",
"==",
"\"ANN\"",
":",
"parts",
"=",
"[",
"x",
".",
"strip",
"(",
"\"\\\"'\"",
")",
"for",
"x",
"in",
"... | Parse fields for impact, taken from vcf2db | [
"Parse",
"fields",
"for",
"impact",
"taken",
"from",
"vcf2db"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L116-L130 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _prepare_vcf_rec | def _prepare_vcf_rec(rec, pops, known, impact_info):
"""Parse a vcfanno output into a dictionary of useful attributes.
"""
out = {}
for k in pops + known:
out[k] = rec.INFO.get(k)
if impact_info:
cur_info = rec.INFO.get(impact_info.id)
if cur_info:
cur_impacts = [... | python | def _prepare_vcf_rec(rec, pops, known, impact_info):
"""Parse a vcfanno output into a dictionary of useful attributes.
"""
out = {}
for k in pops + known:
out[k] = rec.INFO.get(k)
if impact_info:
cur_info = rec.INFO.get(impact_info.id)
if cur_info:
cur_impacts = [... | [
"def",
"_prepare_vcf_rec",
"(",
"rec",
",",
"pops",
",",
"known",
",",
"impact_info",
")",
":",
"out",
"=",
"{",
"}",
"for",
"k",
"in",
"pops",
"+",
"known",
":",
"out",
"[",
"k",
"]",
"=",
"rec",
".",
"INFO",
".",
"get",
"(",
"k",
")",
"if",
... | Parse a vcfanno output into a dictionary of useful attributes. | [
"Parse",
"a",
"vcfanno",
"output",
"into",
"a",
"dictionary",
"of",
"useful",
"attributes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L132-L146 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _calc_priority_filter | def _calc_priority_filter(row, pops):
"""Calculate the priority filter based on external associated data.
- Pass high/medium impact variants not found in population databases
- Pass variants found in COSMIC or Clinvar provided they don't have two
additional reasons to filter (found in multiple extern... | python | def _calc_priority_filter(row, pops):
"""Calculate the priority filter based on external associated data.
- Pass high/medium impact variants not found in population databases
- Pass variants found in COSMIC or Clinvar provided they don't have two
additional reasons to filter (found in multiple extern... | [
"def",
"_calc_priority_filter",
"(",
"row",
",",
"pops",
")",
":",
"filters",
"=",
"[",
"]",
"passes",
"=",
"[",
"]",
"passes",
".",
"extend",
"(",
"_find_known",
"(",
"row",
")",
")",
"filters",
".",
"extend",
"(",
"_known_populations",
"(",
"row",
",... | Calculate the priority filter based on external associated data.
- Pass high/medium impact variants not found in population databases
- Pass variants found in COSMIC or Clinvar provided they don't have two
additional reasons to filter (found in multiple external populations) | [
"Calculate",
"the",
"priority",
"filter",
"based",
"on",
"external",
"associated",
"data",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L148-L161 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _known_populations | def _known_populations(row, pops):
"""Find variants present in substantial frequency in population databases.
"""
cutoff = 0.01
out = set([])
for pop, base in [("esp", "af_esp_all"), ("1000g", "af_1kg_all"),
("exac", "af_exac_all"), ("anypop", "max_aaf_all")]:
for key i... | python | def _known_populations(row, pops):
"""Find variants present in substantial frequency in population databases.
"""
cutoff = 0.01
out = set([])
for pop, base in [("esp", "af_esp_all"), ("1000g", "af_1kg_all"),
("exac", "af_exac_all"), ("anypop", "max_aaf_all")]:
for key i... | [
"def",
"_known_populations",
"(",
"row",
",",
"pops",
")",
":",
"cutoff",
"=",
"0.01",
"out",
"=",
"set",
"(",
"[",
"]",
")",
"for",
"pop",
",",
"base",
"in",
"[",
"(",
"\"esp\"",
",",
"\"af_esp_all\"",
")",
",",
"(",
"\"1000g\"",
",",
"\"af_1kg_all\... | Find variants present in substantial frequency in population databases. | [
"Find",
"variants",
"present",
"in",
"substantial",
"frequency",
"in",
"population",
"databases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L163-L174 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _find_known | def _find_known(row):
"""Find variant present in known pathogenic databases.
"""
out = []
clinvar_no = set(["unknown", "untested", "non-pathogenic", "probable-non-pathogenic",
"uncertain_significance", "uncertain_significance", "not_provided",
"benign", "likel... | python | def _find_known(row):
"""Find variant present in known pathogenic databases.
"""
out = []
clinvar_no = set(["unknown", "untested", "non-pathogenic", "probable-non-pathogenic",
"uncertain_significance", "uncertain_significance", "not_provided",
"benign", "likel... | [
"def",
"_find_known",
"(",
"row",
")",
":",
"out",
"=",
"[",
"]",
"clinvar_no",
"=",
"set",
"(",
"[",
"\"unknown\"",
",",
"\"untested\"",
",",
"\"non-pathogenic\"",
",",
"\"probable-non-pathogenic\"",
",",
"\"uncertain_significance\"",
",",
"\"uncertain_significance... | Find variant present in known pathogenic databases. | [
"Find",
"variant",
"present",
"in",
"known",
"pathogenic",
"databases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L176-L187 | train |
bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _do_prioritize | def _do_prioritize(items):
"""Determine if we should perform prioritization.
Currently done on tumor-only input samples and feeding into PureCN
which needs the germline annotations.
"""
if not any("tumoronly-prioritization" in dd.get_tools_off(d) for d in items):
if vcfutils.get_paired_phen... | python | def _do_prioritize(items):
"""Determine if we should perform prioritization.
Currently done on tumor-only input samples and feeding into PureCN
which needs the germline annotations.
"""
if not any("tumoronly-prioritization" in dd.get_tools_off(d) for d in items):
if vcfutils.get_paired_phen... | [
"def",
"_do_prioritize",
"(",
"items",
")",
":",
"if",
"not",
"any",
"(",
"\"tumoronly-prioritization\"",
"in",
"dd",
".",
"get_tools_off",
"(",
"d",
")",
"for",
"d",
"in",
"items",
")",
":",
"if",
"vcfutils",
".",
"get_paired_phenotype",
"(",
"items",
"["... | Determine if we should perform prioritization.
Currently done on tumor-only input samples and feeding into PureCN
which needs the germline annotations. | [
"Determine",
"if",
"we",
"should",
"perform",
"prioritization",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L189-L204 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | run_cortex | def run_cortex(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Top level entry to regional de-novo based variant calling with cortex_var.
"""
raise NotImplementedError("Cortex currently out of date and needs reworking.")
if len(align_bams) == 1:
align_bam... | python | def run_cortex(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Top level entry to regional de-novo based variant calling with cortex_var.
"""
raise NotImplementedError("Cortex currently out of date and needs reworking.")
if len(align_bams) == 1:
align_bam... | [
"def",
"run_cortex",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Cortex currently out of date and needs reworking.\"",
")",
"if",
... | Top level entry to regional de-novo based variant calling with cortex_var. | [
"Top",
"level",
"entry",
"to",
"regional",
"de",
"-",
"novo",
"based",
"variant",
"calling",
"with",
"cortex_var",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L28-L62 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _passes_cortex_depth | def _passes_cortex_depth(line, min_depth):
"""Do any genotypes in the cortex_var VCF line passes the minimum depth requirement?
"""
parts = line.split("\t")
cov_index = parts[8].split(":").index("COV")
passes_depth = False
for gt in parts[9:]:
cur_cov = gt.split(":")[cov_index]
c... | python | def _passes_cortex_depth(line, min_depth):
"""Do any genotypes in the cortex_var VCF line passes the minimum depth requirement?
"""
parts = line.split("\t")
cov_index = parts[8].split(":").index("COV")
passes_depth = False
for gt in parts[9:]:
cur_cov = gt.split(":")[cov_index]
c... | [
"def",
"_passes_cortex_depth",
"(",
"line",
",",
"min_depth",
")",
":",
"parts",
"=",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
"cov_index",
"=",
"parts",
"[",
"8",
"]",
".",
"split",
"(",
"\":\"",
")",
".",
"index",
"(",
"\"COV\"",
")",
"passes_depth... | Do any genotypes in the cortex_var VCF line passes the minimum depth requirement? | [
"Do",
"any",
"genotypes",
"in",
"the",
"cortex_var",
"VCF",
"line",
"passes",
"the",
"minimum",
"depth",
"requirement?"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L64-L75 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _select_final_variants | def _select_final_variants(base_vcf, out_vcf, config):
"""Filter input file, removing items with low depth of support.
cortex_var calls are tricky to filter by depth. Count information is in
the COV FORMAT field grouped by alleles, so we need to sum up values and
compare.
"""
min_depth = int(co... | python | def _select_final_variants(base_vcf, out_vcf, config):
"""Filter input file, removing items with low depth of support.
cortex_var calls are tricky to filter by depth. Count information is in
the COV FORMAT field grouped by alleles, so we need to sum up values and
compare.
"""
min_depth = int(co... | [
"def",
"_select_final_variants",
"(",
"base_vcf",
",",
"out_vcf",
",",
"config",
")",
":",
"min_depth",
"=",
"int",
"(",
"config",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"min_depth\"",
",",
"4",
")",
")",
"with",
"file_transaction",
"(",
"out_vcf",
... | Filter input file, removing items with low depth of support.
cortex_var calls are tricky to filter by depth. Count information is in
the COV FORMAT field grouped by alleles, so we need to sum up values and
compare. | [
"Filter",
"input",
"file",
"removing",
"items",
"with",
"low",
"depth",
"of",
"support",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L77-L95 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _combine_variants | def _combine_variants(in_vcfs, out_file, ref_file, config):
"""Combine variant files, writing the header from the first non-empty input.
in_vcfs is a list with each item starting with the chromosome regions,
and ending with the input file.
We sort by these regions to ensure the output file is in the ex... | python | def _combine_variants(in_vcfs, out_file, ref_file, config):
"""Combine variant files, writing the header from the first non-empty input.
in_vcfs is a list with each item starting with the chromosome regions,
and ending with the input file.
We sort by these regions to ensure the output file is in the ex... | [
"def",
"_combine_variants",
"(",
"in_vcfs",
",",
"out_file",
",",
"ref_file",
",",
"config",
")",
":",
"in_vcfs",
".",
"sort",
"(",
")",
"wrote_header",
"=",
"False",
"with",
"open",
"(",
"out_file",
",",
"\"w\"",
")",
"as",
"out_handle",
":",
"for",
"in... | Combine variant files, writing the header from the first non-empty input.
in_vcfs is a list with each item starting with the chromosome regions,
and ending with the input file.
We sort by these regions to ensure the output file is in the expected order. | [
"Combine",
"variant",
"files",
"writing",
"the",
"header",
"from",
"the",
"first",
"non",
"-",
"empty",
"input",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L97-L120 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _remap_cortex_out | def _remap_cortex_out(cortex_out, region, out_file):
"""Remap coordinates in local cortex variant calls to the original global region.
"""
def _remap_vcf_line(line, contig, start):
parts = line.split("\t")
if parts[0] == "" or parts[1] == "":
return None
parts[0] = contig... | python | def _remap_cortex_out(cortex_out, region, out_file):
"""Remap coordinates in local cortex variant calls to the original global region.
"""
def _remap_vcf_line(line, contig, start):
parts = line.split("\t")
if parts[0] == "" or parts[1] == "":
return None
parts[0] = contig... | [
"def",
"_remap_cortex_out",
"(",
"cortex_out",
",",
"region",
",",
"out_file",
")",
":",
"def",
"_remap_vcf_line",
"(",
"line",
",",
"contig",
",",
"start",
")",
":",
"parts",
"=",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
"if",
"parts",
"[",
"0",
"]"... | Remap coordinates in local cortex variant calls to the original global region. | [
"Remap",
"coordinates",
"in",
"local",
"cortex",
"variant",
"calls",
"to",
"the",
"original",
"global",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L159-L188 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _run_cortex | def _run_cortex(fastq, indexes, params, out_base, dirs, config):
"""Run cortex_var run_calls.pl, producing a VCF variant file.
"""
print(out_base)
fastaq_index = "{0}.fastaq_index".format(out_base)
se_fastq_index = "{0}.se_fastq".format(out_base)
pe_fastq_index = "{0}.pe_fastq".format(out_base)
... | python | def _run_cortex(fastq, indexes, params, out_base, dirs, config):
"""Run cortex_var run_calls.pl, producing a VCF variant file.
"""
print(out_base)
fastaq_index = "{0}.fastaq_index".format(out_base)
se_fastq_index = "{0}.se_fastq".format(out_base)
pe_fastq_index = "{0}.pe_fastq".format(out_base)
... | [
"def",
"_run_cortex",
"(",
"fastq",
",",
"indexes",
",",
"params",
",",
"out_base",
",",
"dirs",
",",
"config",
")",
":",
"print",
"(",
"out_base",
")",
"fastaq_index",
"=",
"\"{0}.fastaq_index\"",
".",
"format",
"(",
"out_base",
")",
"se_fastq_index",
"=",
... | Run cortex_var run_calls.pl, producing a VCF variant file. | [
"Run",
"cortex_var",
"run_calls",
".",
"pl",
"producing",
"a",
"VCF",
"variant",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L190-L242 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _index_local_ref | def _index_local_ref(fasta_file, cortex_dir, stampy_dir, kmers):
"""Pre-index a generated local reference sequence with cortex_var and stampy.
"""
base_out = os.path.splitext(fasta_file)[0]
cindexes = []
for kmer in kmers:
out_file = "{0}.k{1}.ctx".format(base_out, kmer)
if not file_... | python | def _index_local_ref(fasta_file, cortex_dir, stampy_dir, kmers):
"""Pre-index a generated local reference sequence with cortex_var and stampy.
"""
base_out = os.path.splitext(fasta_file)[0]
cindexes = []
for kmer in kmers:
out_file = "{0}.k{1}.ctx".format(base_out, kmer)
if not file_... | [
"def",
"_index_local_ref",
"(",
"fasta_file",
",",
"cortex_dir",
",",
"stampy_dir",
",",
"kmers",
")",
":",
"base_out",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"fasta_file",
")",
"[",
"0",
"]",
"cindexes",
"=",
"[",
"]",
"for",
"kmer",
"in",
"kme... | Pre-index a generated local reference sequence with cortex_var and stampy. | [
"Pre",
"-",
"index",
"a",
"generated",
"local",
"reference",
"sequence",
"with",
"cortex_var",
"and",
"stampy",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L255-L280 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _get_local_ref | def _get_local_ref(region, ref_file, out_vcf_base):
"""Retrieve a local FASTA file corresponding to the specified region.
"""
out_file = "{0}.fa".format(out_vcf_base)
if not file_exists(out_file):
with pysam.Fastafile(ref_file) as in_pysam:
contig, start, end = region
seq... | python | def _get_local_ref(region, ref_file, out_vcf_base):
"""Retrieve a local FASTA file corresponding to the specified region.
"""
out_file = "{0}.fa".format(out_vcf_base)
if not file_exists(out_file):
with pysam.Fastafile(ref_file) as in_pysam:
contig, start, end = region
seq... | [
"def",
"_get_local_ref",
"(",
"region",
",",
"ref_file",
",",
"out_vcf_base",
")",
":",
"out_file",
"=",
"\"{0}.fa\"",
".",
"format",
"(",
"out_vcf_base",
")",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"pysam",
".",
"Fastafile",
"(",
"... | Retrieve a local FASTA file corresponding to the specified region. | [
"Retrieve",
"a",
"local",
"FASTA",
"file",
"corresponding",
"to",
"the",
"specified",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L282-L296 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _get_fastq_in_region | def _get_fastq_in_region(region, align_bam, out_base):
"""Retrieve fastq files in region as single end.
Paired end is more complicated since pairs can map off the region, so focus
on local only assembly since we've previously used paired information for mapping.
"""
out_file = "{0}.fastq".format(out... | python | def _get_fastq_in_region(region, align_bam, out_base):
"""Retrieve fastq files in region as single end.
Paired end is more complicated since pairs can map off the region, so focus
on local only assembly since we've previously used paired information for mapping.
"""
out_file = "{0}.fastq".format(out... | [
"def",
"_get_fastq_in_region",
"(",
"region",
",",
"align_bam",
",",
"out_base",
")",
":",
"out_file",
"=",
"\"{0}.fastq\"",
".",
"format",
"(",
"out_base",
")",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"pysam",
".",
"Samfile",
"(",
"... | Retrieve fastq files in region as single end.
Paired end is more complicated since pairs can map off the region, so focus
on local only assembly since we've previously used paired information for mapping. | [
"Retrieve",
"fastq",
"files",
"in",
"region",
"as",
"single",
"end",
".",
"Paired",
"end",
"is",
"more",
"complicated",
"since",
"pairs",
"can",
"map",
"off",
"the",
"region",
"so",
"focus",
"on",
"local",
"only",
"assembly",
"since",
"we",
"ve",
"previous... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L298-L317 | train |
bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _count_fastq_reads | def _count_fastq_reads(in_fastq, min_reads):
"""Count the number of fastq reads in a file, stopping after reaching min_reads.
"""
with open(in_fastq) as in_handle:
items = list(itertools.takewhile(lambda i : i <= min_reads,
(i for i, _ in enumerate(FastqGener... | python | def _count_fastq_reads(in_fastq, min_reads):
"""Count the number of fastq reads in a file, stopping after reaching min_reads.
"""
with open(in_fastq) as in_handle:
items = list(itertools.takewhile(lambda i : i <= min_reads,
(i for i, _ in enumerate(FastqGener... | [
"def",
"_count_fastq_reads",
"(",
"in_fastq",
",",
"min_reads",
")",
":",
"with",
"open",
"(",
"in_fastq",
")",
"as",
"in_handle",
":",
"items",
"=",
"list",
"(",
"itertools",
".",
"takewhile",
"(",
"lambda",
"i",
":",
"i",
"<=",
"min_reads",
",",
"(",
... | Count the number of fastq reads in a file, stopping after reaching min_reads. | [
"Count",
"the",
"number",
"of",
"fastq",
"reads",
"in",
"a",
"file",
"stopping",
"after",
"reaching",
"min_reads",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L321-L327 | train |
bcbio/bcbio-nextgen | bcbio/distributed/transaction.py | _move_file_with_sizecheck | def _move_file_with_sizecheck(tx_file, final_file):
"""Move transaction file to final location,
with size checks avoiding failed transfers.
Creates an empty file with '.bcbiotmp' extention in the destination
location, which serves as a flag. If a file like that is present,
it means that... | python | def _move_file_with_sizecheck(tx_file, final_file):
"""Move transaction file to final location,
with size checks avoiding failed transfers.
Creates an empty file with '.bcbiotmp' extention in the destination
location, which serves as a flag. If a file like that is present,
it means that... | [
"def",
"_move_file_with_sizecheck",
"(",
"tx_file",
",",
"final_file",
")",
":",
"#logger.debug(\"Moving %s to %s\" % (tx_file, final_file))",
"tmp_file",
"=",
"final_file",
"+",
"\".bcbiotmp\"",
"open",
"(",
"tmp_file",
",",
"'wb'",
")",
".",
"close",
"(",
")",
"want... | Move transaction file to final location,
with size checks avoiding failed transfers.
Creates an empty file with '.bcbiotmp' extention in the destination
location, which serves as a flag. If a file like that is present,
it means that transaction didn't finish successfully. | [
"Move",
"transaction",
"file",
"to",
"final",
"location",
"with",
"size",
"checks",
"avoiding",
"failed",
"transfers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/transaction.py#L102-L127 | train |
bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _gatk_extract_reads_cl | def _gatk_extract_reads_cl(data, region, prep_params, tmp_dir):
"""Use GATK to extract reads from full BAM file.
"""
args = ["PrintReads",
"-L", region_to_gatk(region),
"-R", dd.get_ref_file(data),
"-I", data["work_bam"]]
# GATK3 back compatibility, need to specify an... | python | def _gatk_extract_reads_cl(data, region, prep_params, tmp_dir):
"""Use GATK to extract reads from full BAM file.
"""
args = ["PrintReads",
"-L", region_to_gatk(region),
"-R", dd.get_ref_file(data),
"-I", data["work_bam"]]
# GATK3 back compatibility, need to specify an... | [
"def",
"_gatk_extract_reads_cl",
"(",
"data",
",",
"region",
",",
"prep_params",
",",
"tmp_dir",
")",
":",
"args",
"=",
"[",
"\"PrintReads\"",
",",
"\"-L\"",
",",
"region_to_gatk",
"(",
"region",
")",
",",
"\"-R\"",
",",
"dd",
".",
"get_ref_file",
"(",
"da... | Use GATK to extract reads from full BAM file. | [
"Use",
"GATK",
"to",
"extract",
"reads",
"from",
"full",
"BAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L23-L34 | train |
bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _piped_input_cl | def _piped_input_cl(data, region, tmp_dir, out_base_file, prep_params):
"""Retrieve the commandline for streaming input into preparation step.
"""
return data["work_bam"], _gatk_extract_reads_cl(data, region, prep_params, tmp_dir) | python | def _piped_input_cl(data, region, tmp_dir, out_base_file, prep_params):
"""Retrieve the commandline for streaming input into preparation step.
"""
return data["work_bam"], _gatk_extract_reads_cl(data, region, prep_params, tmp_dir) | [
"def",
"_piped_input_cl",
"(",
"data",
",",
"region",
",",
"tmp_dir",
",",
"out_base_file",
",",
"prep_params",
")",
":",
"return",
"data",
"[",
"\"work_bam\"",
"]",
",",
"_gatk_extract_reads_cl",
"(",
"data",
",",
"region",
",",
"prep_params",
",",
"tmp_dir",... | Retrieve the commandline for streaming input into preparation step. | [
"Retrieve",
"the",
"commandline",
"for",
"streaming",
"input",
"into",
"preparation",
"step",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L36-L39 | train |
bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _piped_realign_gatk | def _piped_realign_gatk(data, region, cl, out_base_file, tmp_dir, prep_params):
"""Perform realignment with GATK, using input commandline.
GATK requires writing to disk and indexing before realignment.
"""
broad_runner = broad.runner_from_config(data["config"])
pa_bam = "%s-prealign%s" % os.path.spl... | python | def _piped_realign_gatk(data, region, cl, out_base_file, tmp_dir, prep_params):
"""Perform realignment with GATK, using input commandline.
GATK requires writing to disk and indexing before realignment.
"""
broad_runner = broad.runner_from_config(data["config"])
pa_bam = "%s-prealign%s" % os.path.spl... | [
"def",
"_piped_realign_gatk",
"(",
"data",
",",
"region",
",",
"cl",
",",
"out_base_file",
",",
"tmp_dir",
",",
"prep_params",
")",
":",
"broad_runner",
"=",
"broad",
".",
"runner_from_config",
"(",
"data",
"[",
"\"config\"",
"]",
")",
"pa_bam",
"=",
"\"%s-p... | Perform realignment with GATK, using input commandline.
GATK requires writing to disk and indexing before realignment. | [
"Perform",
"realignment",
"with",
"GATK",
"using",
"input",
"commandline",
".",
"GATK",
"requires",
"writing",
"to",
"disk",
"and",
"indexing",
"before",
"realignment",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L41-L58 | train |
bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _get_prep_params | def _get_prep_params(data):
"""Retrieve configuration parameters with defaults for preparing BAM files.
"""
realign_param = dd.get_realign(data)
realign_param = "gatk" if realign_param is True else realign_param
return {"realign": realign_param} | python | def _get_prep_params(data):
"""Retrieve configuration parameters with defaults for preparing BAM files.
"""
realign_param = dd.get_realign(data)
realign_param = "gatk" if realign_param is True else realign_param
return {"realign": realign_param} | [
"def",
"_get_prep_params",
"(",
"data",
")",
":",
"realign_param",
"=",
"dd",
".",
"get_realign",
"(",
"data",
")",
"realign_param",
"=",
"\"gatk\"",
"if",
"realign_param",
"is",
"True",
"else",
"realign_param",
"return",
"{",
"\"realign\"",
":",
"realign_param"... | Retrieve configuration parameters with defaults for preparing BAM files. | [
"Retrieve",
"configuration",
"parameters",
"with",
"defaults",
"for",
"preparing",
"BAM",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L90-L95 | train |
bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _piped_bamprep_region | def _piped_bamprep_region(data, region, out_file, tmp_dir):
"""Do work of preparing BAM input file on the selected region.
"""
if _need_prep(data):
prep_params = _get_prep_params(data)
_piped_bamprep_region_gatk(data, region, prep_params, out_file, tmp_dir)
else:
raise ValueError... | python | def _piped_bamprep_region(data, region, out_file, tmp_dir):
"""Do work of preparing BAM input file on the selected region.
"""
if _need_prep(data):
prep_params = _get_prep_params(data)
_piped_bamprep_region_gatk(data, region, prep_params, out_file, tmp_dir)
else:
raise ValueError... | [
"def",
"_piped_bamprep_region",
"(",
"data",
",",
"region",
",",
"out_file",
",",
"tmp_dir",
")",
":",
"if",
"_need_prep",
"(",
"data",
")",
":",
"prep_params",
"=",
"_get_prep_params",
"(",
"data",
")",
"_piped_bamprep_region_gatk",
"(",
"data",
",",
"region"... | Do work of preparing BAM input file on the selected region. | [
"Do",
"work",
"of",
"preparing",
"BAM",
"input",
"file",
"on",
"the",
"selected",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L101-L108 | train |
bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | piped_bamprep | def piped_bamprep(data, region=None, out_file=None):
"""Perform full BAM preparation using pipes to avoid intermediate disk IO.
Handles realignment of original BAMs.
"""
data["region"] = region
if not _need_prep(data):
return [data]
else:
utils.safe_makedir(os.path.dirname(out_f... | python | def piped_bamprep(data, region=None, out_file=None):
"""Perform full BAM preparation using pipes to avoid intermediate disk IO.
Handles realignment of original BAMs.
"""
data["region"] = region
if not _need_prep(data):
return [data]
else:
utils.safe_makedir(os.path.dirname(out_f... | [
"def",
"piped_bamprep",
"(",
"data",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"data",
"[",
"\"region\"",
"]",
"=",
"region",
"if",
"not",
"_need_prep",
"(",
"data",
")",
":",
"return",
"[",
"data",
"]",
"else",
":",
"utils"... | Perform full BAM preparation using pipes to avoid intermediate disk IO.
Handles realignment of original BAMs. | [
"Perform",
"full",
"BAM",
"preparation",
"using",
"pipes",
"to",
"avoid",
"intermediate",
"disk",
"IO",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L110-L132 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | update_file | def update_file(finfo, sample_info, config):
"""Update file in Galaxy data libraries.
"""
if GalaxyInstance is None:
raise ImportError("Could not import bioblend.galaxy")
if "dir" not in config:
raise ValueError("Galaxy upload requires `dir` parameter in config specifying the "
... | python | def update_file(finfo, sample_info, config):
"""Update file in Galaxy data libraries.
"""
if GalaxyInstance is None:
raise ImportError("Could not import bioblend.galaxy")
if "dir" not in config:
raise ValueError("Galaxy upload requires `dir` parameter in config specifying the "
... | [
"def",
"update_file",
"(",
"finfo",
",",
"sample_info",
",",
"config",
")",
":",
"if",
"GalaxyInstance",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"\"Could not import bioblend.galaxy\"",
")",
"if",
"\"dir\"",
"not",
"in",
"config",
":",
"raise",
"ValueErro... | Update file in Galaxy data libraries. | [
"Update",
"file",
"in",
"Galaxy",
"data",
"libraries",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L28-L39 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _galaxy_tool_copy | def _galaxy_tool_copy(finfo, outputs):
"""Copy information directly to pre-defined outputs from a Galaxy tool.
XXX Needs generalization
"""
tool_map = {"align": "bam", "variants": "vcf.gz"}
for galaxy_key, finfo_type in tool_map.items():
if galaxy_key in outputs and finfo.get("type") == fin... | python | def _galaxy_tool_copy(finfo, outputs):
"""Copy information directly to pre-defined outputs from a Galaxy tool.
XXX Needs generalization
"""
tool_map = {"align": "bam", "variants": "vcf.gz"}
for galaxy_key, finfo_type in tool_map.items():
if galaxy_key in outputs and finfo.get("type") == fin... | [
"def",
"_galaxy_tool_copy",
"(",
"finfo",
",",
"outputs",
")",
":",
"tool_map",
"=",
"{",
"\"align\"",
":",
"\"bam\"",
",",
"\"variants\"",
":",
"\"vcf.gz\"",
"}",
"for",
"galaxy_key",
",",
"finfo_type",
"in",
"tool_map",
".",
"items",
"(",
")",
":",
"if",... | Copy information directly to pre-defined outputs from a Galaxy tool.
XXX Needs generalization | [
"Copy",
"information",
"directly",
"to",
"pre",
"-",
"defined",
"outputs",
"from",
"a",
"Galaxy",
"tool",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L41-L49 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _galaxy_library_upload | def _galaxy_library_upload(finfo, sample_info, config):
"""Upload results to galaxy library.
"""
folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
if finfo.get("type") == "directory":
storage_file = None
... | python | def _galaxy_library_upload(finfo, sample_info, config):
"""Upload results to galaxy library.
"""
folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
if finfo.get("type") == "directory":
storage_file = None
... | [
"def",
"_galaxy_library_upload",
"(",
"finfo",
",",
"sample_info",
",",
"config",
")",
":",
"folder_name",
"=",
"\"%s_%s\"",
"%",
"(",
"config",
"[",
"\"fc_date\"",
"]",
",",
"config",
"[",
"\"fc_name\"",
"]",
")",
"storage_dir",
"=",
"utils",
".",
"safe_mak... | Upload results to galaxy library. | [
"Upload",
"results",
"to",
"galaxy",
"library",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L51-L74 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _to_datalibrary_safe | def _to_datalibrary_safe(fname, gi, folder_name, sample_info, config):
"""Upload with retries for intermittent JSON failures.
"""
num_tries = 0
max_tries = 5
while 1:
try:
_to_datalibrary(fname, gi, folder_name, sample_info, config)
break
except (simplejson.sc... | python | def _to_datalibrary_safe(fname, gi, folder_name, sample_info, config):
"""Upload with retries for intermittent JSON failures.
"""
num_tries = 0
max_tries = 5
while 1:
try:
_to_datalibrary(fname, gi, folder_name, sample_info, config)
break
except (simplejson.sc... | [
"def",
"_to_datalibrary_safe",
"(",
"fname",
",",
"gi",
",",
"folder_name",
",",
"sample_info",
",",
"config",
")",
":",
"num_tries",
"=",
"0",
"max_tries",
"=",
"5",
"while",
"1",
":",
"try",
":",
"_to_datalibrary",
"(",
"fname",
",",
"gi",
",",
"folder... | Upload with retries for intermittent JSON failures. | [
"Upload",
"with",
"retries",
"for",
"intermittent",
"JSON",
"failures",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L76-L90 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _to_datalibrary | def _to_datalibrary(fname, gi, folder_name, sample_info, config):
"""Upload a file to a Galaxy data library in a project specific folder.
"""
library = _get_library(gi, sample_info, config)
libitems = gi.libraries.show_library(library.id, contents=True)
folder = _get_folder(gi, folder_name, library,... | python | def _to_datalibrary(fname, gi, folder_name, sample_info, config):
"""Upload a file to a Galaxy data library in a project specific folder.
"""
library = _get_library(gi, sample_info, config)
libitems = gi.libraries.show_library(library.id, contents=True)
folder = _get_folder(gi, folder_name, library,... | [
"def",
"_to_datalibrary",
"(",
"fname",
",",
"gi",
",",
"folder_name",
",",
"sample_info",
",",
"config",
")",
":",
"library",
"=",
"_get_library",
"(",
"gi",
",",
"sample_info",
",",
"config",
")",
"libitems",
"=",
"gi",
".",
"libraries",
".",
"show_libra... | Upload a file to a Galaxy data library in a project specific folder. | [
"Upload",
"a",
"file",
"to",
"a",
"Galaxy",
"data",
"library",
"in",
"a",
"project",
"specific",
"folder",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L92-L98 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _file_to_folder | def _file_to_folder(gi, fname, sample_info, libitems, library, folder):
"""Check if file exists on Galaxy, if not upload to specified folder.
"""
full_name = os.path.join(folder["name"], os.path.basename(fname))
# Handle VCF: Galaxy reports VCF files without the gzip extension
file_type = "vcf_bgzi... | python | def _file_to_folder(gi, fname, sample_info, libitems, library, folder):
"""Check if file exists on Galaxy, if not upload to specified folder.
"""
full_name = os.path.join(folder["name"], os.path.basename(fname))
# Handle VCF: Galaxy reports VCF files without the gzip extension
file_type = "vcf_bgzi... | [
"def",
"_file_to_folder",
"(",
"gi",
",",
"fname",
",",
"sample_info",
",",
"libitems",
",",
"library",
",",
"folder",
")",
":",
"full_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"folder",
"[",
"\"name\"",
"]",
",",
"os",
".",
"path",
".",
"base... | Check if file exists on Galaxy, if not upload to specified folder. | [
"Check",
"if",
"file",
"exists",
"on",
"Galaxy",
"if",
"not",
"upload",
"to",
"specified",
"folder",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L100-L118 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _get_folder | def _get_folder(gi, folder_name, library, libitems):
"""Retrieve or create a folder inside the library with the specified name.
"""
for item in libitems:
if item["type"] == "folder" and item["name"] == "/%s" % folder_name:
return item
return gi.libraries.create_folder(library.id, fol... | python | def _get_folder(gi, folder_name, library, libitems):
"""Retrieve or create a folder inside the library with the specified name.
"""
for item in libitems:
if item["type"] == "folder" and item["name"] == "/%s" % folder_name:
return item
return gi.libraries.create_folder(library.id, fol... | [
"def",
"_get_folder",
"(",
"gi",
",",
"folder_name",
",",
"library",
",",
"libitems",
")",
":",
"for",
"item",
"in",
"libitems",
":",
"if",
"item",
"[",
"\"type\"",
"]",
"==",
"\"folder\"",
"and",
"item",
"[",
"\"name\"",
"]",
"==",
"\"/%s\"",
"%",
"fo... | Retrieve or create a folder inside the library with the specified name. | [
"Retrieve",
"or",
"create",
"a",
"folder",
"inside",
"the",
"library",
"with",
"the",
"specified",
"name",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L120-L126 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _get_library | def _get_library(gi, sample_info, config):
"""Retrieve the appropriate data library for the current user.
"""
galaxy_lib = sample_info.get("galaxy_library",
config.get("galaxy_library"))
role = sample_info.get("galaxy_role",
config.get("galaxy_... | python | def _get_library(gi, sample_info, config):
"""Retrieve the appropriate data library for the current user.
"""
galaxy_lib = sample_info.get("galaxy_library",
config.get("galaxy_library"))
role = sample_info.get("galaxy_role",
config.get("galaxy_... | [
"def",
"_get_library",
"(",
"gi",
",",
"sample_info",
",",
"config",
")",
":",
"galaxy_lib",
"=",
"sample_info",
".",
"get",
"(",
"\"galaxy_library\"",
",",
"config",
".",
"get",
"(",
"\"galaxy_library\"",
")",
")",
"role",
"=",
"sample_info",
".",
"get",
... | Retrieve the appropriate data library for the current user. | [
"Retrieve",
"the",
"appropriate",
"data",
"library",
"for",
"the",
"current",
"user",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L130-L143 | train |
bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _library_from_nglims | def _library_from_nglims(gi, sample_info, config):
"""Retrieve upload library from nglims specified user libraries.
"""
names = [config.get(x, "").strip() for x in ["lab_association", "researcher"]
if config.get(x)]
for name in names:
for ext in ["sequencing", "lab"]:
ch... | python | def _library_from_nglims(gi, sample_info, config):
"""Retrieve upload library from nglims specified user libraries.
"""
names = [config.get(x, "").strip() for x in ["lab_association", "researcher"]
if config.get(x)]
for name in names:
for ext in ["sequencing", "lab"]:
ch... | [
"def",
"_library_from_nglims",
"(",
"gi",
",",
"sample_info",
",",
"config",
")",
":",
"names",
"=",
"[",
"config",
".",
"get",
"(",
"x",
",",
"\"\"",
")",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"[",
"\"lab_association\"",
",",
"\"researcher\"",
"]"... | Retrieve upload library from nglims specified user libraries. | [
"Retrieve",
"upload",
"library",
"from",
"nglims",
"specified",
"user",
"libraries",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L163-L188 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | prepare_input_data | def prepare_input_data(config):
""" In case of disambiguation, we want to run fusion calling on
the disambiguated reads, which are in the work_bam file.
As EricScript accepts 2 fastq files as input, we need to convert
the .bam to 2 .fq files.
"""
if not dd.get_disambiguate(config):
retu... | python | def prepare_input_data(config):
""" In case of disambiguation, we want to run fusion calling on
the disambiguated reads, which are in the work_bam file.
As EricScript accepts 2 fastq files as input, we need to convert
the .bam to 2 .fq files.
"""
if not dd.get_disambiguate(config):
retu... | [
"def",
"prepare_input_data",
"(",
"config",
")",
":",
"if",
"not",
"dd",
".",
"get_disambiguate",
"(",
"config",
")",
":",
"return",
"dd",
".",
"get_input_sequence_files",
"(",
"config",
")",
"work_bam",
"=",
"dd",
".",
"get_work_bam",
"(",
"config",
")",
... | In case of disambiguation, we want to run fusion calling on
the disambiguated reads, which are in the work_bam file.
As EricScript accepts 2 fastq files as input, we need to convert
the .bam to 2 .fq files. | [
"In",
"case",
"of",
"disambiguation",
"we",
"want",
"to",
"run",
"fusion",
"calling",
"on",
"the",
"disambiguated",
"reads",
"which",
"are",
"in",
"the",
"work_bam",
"file",
".",
"As",
"EricScript",
"accepts",
"2",
"fastq",
"files",
"as",
"input",
"we",
"n... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L32-L47 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | EricScriptConfig.get_run_command | def get_run_command(self, tx_output_dir, input_files):
"""Constructs a command to run EricScript via do.run function.
:param tx_output_dir: A location where all EricScript output will be
written during execution.
:param input_files: an iterable with paths to 2 fastq files
with i... | python | def get_run_command(self, tx_output_dir, input_files):
"""Constructs a command to run EricScript via do.run function.
:param tx_output_dir: A location where all EricScript output will be
written during execution.
:param input_files: an iterable with paths to 2 fastq files
with i... | [
"def",
"get_run_command",
"(",
"self",
",",
"tx_output_dir",
",",
"input_files",
")",
":",
"logger",
".",
"debug",
"(",
"\"Input data: %s\"",
"%",
"', '",
".",
"join",
"(",
"input_files",
")",
")",
"cmd",
"=",
"[",
"self",
".",
"EXECUTABLE",
",",
"'-db'",
... | Constructs a command to run EricScript via do.run function.
:param tx_output_dir: A location where all EricScript output will be
written during execution.
:param input_files: an iterable with paths to 2 fastq files
with input data.
:return: list | [
"Constructs",
"a",
"command",
"to",
"run",
"EricScript",
"via",
"do",
".",
"run",
"function",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L107-L123 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | EricScriptConfig._get_ericscript_path | def _get_ericscript_path(self):
"""Retrieve PATH to the isolated eriscript anaconda environment.
"""
es = utils.which(os.path.join(utils.get_bcbio_bin(), self.EXECUTABLE))
return os.path.dirname(os.path.realpath(es)) | python | def _get_ericscript_path(self):
"""Retrieve PATH to the isolated eriscript anaconda environment.
"""
es = utils.which(os.path.join(utils.get_bcbio_bin(), self.EXECUTABLE))
return os.path.dirname(os.path.realpath(es)) | [
"def",
"_get_ericscript_path",
"(",
"self",
")",
":",
"es",
"=",
"utils",
".",
"which",
"(",
"os",
".",
"path",
".",
"join",
"(",
"utils",
".",
"get_bcbio_bin",
"(",
")",
",",
"self",
".",
"EXECUTABLE",
")",
")",
"return",
"os",
".",
"path",
".",
"... | Retrieve PATH to the isolated eriscript anaconda environment. | [
"Retrieve",
"PATH",
"to",
"the",
"isolated",
"eriscript",
"anaconda",
"environment",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L125-L129 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | EricScriptConfig._get_samtools0_path | def _get_samtools0_path(self):
"""Retrieve PATH to the samtools version specific for eriscript.
"""
samtools_path = os.path.realpath(os.path.join(self._get_ericscript_path(),"..", "..", "bin"))
return samtools_path | python | def _get_samtools0_path(self):
"""Retrieve PATH to the samtools version specific for eriscript.
"""
samtools_path = os.path.realpath(os.path.join(self._get_ericscript_path(),"..", "..", "bin"))
return samtools_path | [
"def",
"_get_samtools0_path",
"(",
"self",
")",
":",
"samtools_path",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_get_ericscript_path",
"(",
")",
",",
"\"..\"",
",",
"\"..\"",
",",
"\"bin\"",
")",
"... | Retrieve PATH to the samtools version specific for eriscript. | [
"Retrieve",
"PATH",
"to",
"the",
"samtools",
"version",
"specific",
"for",
"eriscript",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L130-L134 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | EricScriptConfig.output_dir | def output_dir(self):
"""Absolute path to permanent location in working directory
where EricScript output will be stored.
"""
if self._output_dir is None:
self._output_dir = self._get_output_dir()
return self._output_dir | python | def output_dir(self):
"""Absolute path to permanent location in working directory
where EricScript output will be stored.
"""
if self._output_dir is None:
self._output_dir = self._get_output_dir()
return self._output_dir | [
"def",
"output_dir",
"(",
"self",
")",
":",
"if",
"self",
".",
"_output_dir",
"is",
"None",
":",
"self",
".",
"_output_dir",
"=",
"self",
".",
"_get_output_dir",
"(",
")",
"return",
"self",
".",
"_output_dir"
] | Absolute path to permanent location in working directory
where EricScript output will be stored. | [
"Absolute",
"path",
"to",
"permanent",
"location",
"in",
"working",
"directory",
"where",
"EricScript",
"output",
"will",
"be",
"stored",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L137-L143 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | EricScriptConfig.reference_index | def reference_index(self):
"""Absolute path to the BWA index for EricScript reference data."""
if self._db_location:
ref_indices = glob.glob(os.path.join(self._db_location, "*", self._REF_INDEX))
if ref_indices:
return ref_indices[0] | python | def reference_index(self):
"""Absolute path to the BWA index for EricScript reference data."""
if self._db_location:
ref_indices = glob.glob(os.path.join(self._db_location, "*", self._REF_INDEX))
if ref_indices:
return ref_indices[0] | [
"def",
"reference_index",
"(",
"self",
")",
":",
"if",
"self",
".",
"_db_location",
":",
"ref_indices",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_db_location",
",",
"\"*\"",
",",
"self",
".",
"_REF_INDEX",
")",
... | Absolute path to the BWA index for EricScript reference data. | [
"Absolute",
"path",
"to",
"the",
"BWA",
"index",
"for",
"EricScript",
"reference",
"data",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L158-L163 | train |
bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | EricScriptConfig.reference_fasta | def reference_fasta(self):
"""Absolute path to the fasta file with EricScript reference data."""
if self._db_location:
ref_files = glob.glob(os.path.join(self._db_location, "*", self._REF_FASTA))
if ref_files:
return ref_files[0] | python | def reference_fasta(self):
"""Absolute path to the fasta file with EricScript reference data."""
if self._db_location:
ref_files = glob.glob(os.path.join(self._db_location, "*", self._REF_FASTA))
if ref_files:
return ref_files[0] | [
"def",
"reference_fasta",
"(",
"self",
")",
":",
"if",
"self",
".",
"_db_location",
":",
"ref_files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_db_location",
",",
"\"*\"",
",",
"self",
".",
"_REF_FASTA",
")",
... | Absolute path to the fasta file with EricScript reference data. | [
"Absolute",
"path",
"to",
"the",
"fasta",
"file",
"with",
"EricScript",
"reference",
"data",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L166-L171 | train |
bcbio/bcbio-nextgen | bcbio/qc/contamination.py | _get_input_args | def _get_input_args(bam_file, data, out_base, background):
"""Retrieve input args, depending on genome build.
VerifyBamID2 only handles GRCh37 (1, 2, 3) not hg19, so need to generate
a pileup for hg19 and fix chromosome naming.
"""
if dd.get_genome_build(data) in ["hg19"]:
return ["--Pileup... | python | def _get_input_args(bam_file, data, out_base, background):
"""Retrieve input args, depending on genome build.
VerifyBamID2 only handles GRCh37 (1, 2, 3) not hg19, so need to generate
a pileup for hg19 and fix chromosome naming.
"""
if dd.get_genome_build(data) in ["hg19"]:
return ["--Pileup... | [
"def",
"_get_input_args",
"(",
"bam_file",
",",
"data",
",",
"out_base",
",",
"background",
")",
":",
"if",
"dd",
".",
"get_genome_build",
"(",
"data",
")",
"in",
"[",
"\"hg19\"",
"]",
":",
"return",
"[",
"\"--PileupFile\"",
",",
"_create_pileup",
"(",
"ba... | Retrieve input args, depending on genome build.
VerifyBamID2 only handles GRCh37 (1, 2, 3) not hg19, so need to generate
a pileup for hg19 and fix chromosome naming. | [
"Retrieve",
"input",
"args",
"depending",
"on",
"genome",
"build",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/contamination.py#L78-L87 | train |
bcbio/bcbio-nextgen | bcbio/qc/contamination.py | _create_pileup | def _create_pileup(bam_file, data, out_base, background):
"""Create pileup calls in the regions of interest for hg19 -> GRCh37 chromosome mapping.
"""
out_file = "%s-mpileup.txt" % out_base
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
back... | python | def _create_pileup(bam_file, data, out_base, background):
"""Create pileup calls in the regions of interest for hg19 -> GRCh37 chromosome mapping.
"""
out_file = "%s-mpileup.txt" % out_base
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
back... | [
"def",
"_create_pileup",
"(",
"bam_file",
",",
"data",
",",
"out_base",
",",
"background",
")",
":",
"out_file",
"=",
"\"%s-mpileup.txt\"",
"%",
"out_base",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
... | Create pileup calls in the regions of interest for hg19 -> GRCh37 chromosome mapping. | [
"Create",
"pileup",
"calls",
"in",
"the",
"regions",
"of",
"interest",
"for",
"hg19",
"-",
">",
"GRCh37",
"chromosome",
"mapping",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/contamination.py#L89-L111 | train |
bcbio/bcbio-nextgen | bcbio/structural/convert.py | _cnvbed_to_bed | def _cnvbed_to_bed(in_file, caller, out_file):
"""Convert cn_mops CNV based bed files into flattened BED
"""
with open(out_file, "w") as out_handle:
for feat in pybedtools.BedTool(in_file):
out_handle.write("\t".join([feat.chrom, str(feat.start), str(feat.end),
... | python | def _cnvbed_to_bed(in_file, caller, out_file):
"""Convert cn_mops CNV based bed files into flattened BED
"""
with open(out_file, "w") as out_handle:
for feat in pybedtools.BedTool(in_file):
out_handle.write("\t".join([feat.chrom, str(feat.start), str(feat.end),
... | [
"def",
"_cnvbed_to_bed",
"(",
"in_file",
",",
"caller",
",",
"out_file",
")",
":",
"with",
"open",
"(",
"out_file",
",",
"\"w\"",
")",
"as",
"out_handle",
":",
"for",
"feat",
"in",
"pybedtools",
".",
"BedTool",
"(",
"in_file",
")",
":",
"out_handle",
"."... | Convert cn_mops CNV based bed files into flattened BED | [
"Convert",
"cn_mops",
"CNV",
"based",
"bed",
"files",
"into",
"flattened",
"BED"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/convert.py#L44-L51 | train |
bcbio/bcbio-nextgen | bcbio/structural/convert.py | to_bed | def to_bed(call, sample, work_dir, calls, data):
"""Create a simplified BED file from caller specific input.
"""
out_file = os.path.join(work_dir, "%s-%s-flat.bed" % (sample, call["variantcaller"]))
if call.get("vrn_file") and not utils.file_uptodate(out_file, call["vrn_file"]):
with file_transa... | python | def to_bed(call, sample, work_dir, calls, data):
"""Create a simplified BED file from caller specific input.
"""
out_file = os.path.join(work_dir, "%s-%s-flat.bed" % (sample, call["variantcaller"]))
if call.get("vrn_file") and not utils.file_uptodate(out_file, call["vrn_file"]):
with file_transa... | [
"def",
"to_bed",
"(",
"call",
",",
"sample",
",",
"work_dir",
",",
"calls",
",",
"data",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-%s-flat.bed\"",
"%",
"(",
"sample",
",",
"call",
"[",
"\"variantcaller\"",
"... | Create a simplified BED file from caller specific input. | [
"Create",
"a",
"simplified",
"BED",
"file",
"from",
"caller",
"specific",
"input",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/convert.py#L65-L80 | train |
bcbio/bcbio-nextgen | bcbio/structural/convert.py | _subset_by_support | def _subset_by_support(orig_vcf, cmp_calls, data):
"""Subset orig_vcf to calls also present in any of the comparison callers.
"""
cmp_vcfs = [x["vrn_file"] for x in cmp_calls]
out_file = "%s-inensemble.vcf.gz" % utils.splitext_plus(orig_vcf)[0]
if not utils.file_uptodate(out_file, orig_vcf):
... | python | def _subset_by_support(orig_vcf, cmp_calls, data):
"""Subset orig_vcf to calls also present in any of the comparison callers.
"""
cmp_vcfs = [x["vrn_file"] for x in cmp_calls]
out_file = "%s-inensemble.vcf.gz" % utils.splitext_plus(orig_vcf)[0]
if not utils.file_uptodate(out_file, orig_vcf):
... | [
"def",
"_subset_by_support",
"(",
"orig_vcf",
",",
"cmp_calls",
",",
"data",
")",
":",
"cmp_vcfs",
"=",
"[",
"x",
"[",
"\"vrn_file\"",
"]",
"for",
"x",
"in",
"cmp_calls",
"]",
"out_file",
"=",
"\"%s-inensemble.vcf.gz\"",
"%",
"utils",
".",
"splitext_plus",
"... | Subset orig_vcf to calls also present in any of the comparison callers. | [
"Subset",
"orig_vcf",
"to",
"calls",
"also",
"present",
"in",
"any",
"of",
"the",
"comparison",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/convert.py#L82-L94 | train |
bcbio/bcbio-nextgen | bcbio/qc/coverage.py | run | def run(bam_file, data, out_dir):
"""Run coverage QC analysis
"""
out = dict()
out_dir = utils.safe_makedir(out_dir)
if dd.get_coverage(data) and dd.get_coverage(data) not in ["None"]:
merged_bed_file = bedutils.clean_file(dd.get_coverage_merged(data), data, prefix="cov-", simple=True)
... | python | def run(bam_file, data, out_dir):
"""Run coverage QC analysis
"""
out = dict()
out_dir = utils.safe_makedir(out_dir)
if dd.get_coverage(data) and dd.get_coverage(data) not in ["None"]:
merged_bed_file = bedutils.clean_file(dd.get_coverage_merged(data), data, prefix="cov-", simple=True)
... | [
"def",
"run",
"(",
"bam_file",
",",
"data",
",",
"out_dir",
")",
":",
"out",
"=",
"dict",
"(",
")",
"out_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"out_dir",
")",
"if",
"dd",
".",
"get_coverage",
"(",
"data",
")",
"and",
"dd",
".",
"get_coverage"... | Run coverage QC analysis | [
"Run",
"coverage",
"QC",
"analysis"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/coverage.py#L15-L82 | train |
bcbio/bcbio-nextgen | bcbio/qc/coverage.py | _goleft_indexcov | def _goleft_indexcov(bam_file, data, out_dir):
"""Use goleft indexcov to estimate coverage distributions using BAM index.
Only used for whole genome runs as captures typically don't have enough data
to be useful for index-only summaries.
"""
if not dd.get_coverage_interval(data) == "genome":
... | python | def _goleft_indexcov(bam_file, data, out_dir):
"""Use goleft indexcov to estimate coverage distributions using BAM index.
Only used for whole genome runs as captures typically don't have enough data
to be useful for index-only summaries.
"""
if not dd.get_coverage_interval(data) == "genome":
... | [
"def",
"_goleft_indexcov",
"(",
"bam_file",
",",
"data",
",",
"out_dir",
")",
":",
"if",
"not",
"dd",
".",
"get_coverage_interval",
"(",
"data",
")",
"==",
"\"genome\"",
":",
"return",
"[",
"]",
"out_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".... | Use goleft indexcov to estimate coverage distributions using BAM index.
Only used for whole genome runs as captures typically don't have enough data
to be useful for index-only summaries. | [
"Use",
"goleft",
"indexcov",
"to",
"estimate",
"coverage",
"distributions",
"using",
"BAM",
"index",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/coverage.py#L84-L118 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_sort | def picard_sort(picard, align_bam, sort_order="coordinate",
out_file=None, compression_level=None, pipe=False):
"""Sort a BAM file by coordinates.
"""
base, ext = os.path.splitext(align_bam)
if out_file is None:
out_file = "%s-sort%s" % (base, ext)
if not file_exists(out_file... | python | def picard_sort(picard, align_bam, sort_order="coordinate",
out_file=None, compression_level=None, pipe=False):
"""Sort a BAM file by coordinates.
"""
base, ext = os.path.splitext(align_bam)
if out_file is None:
out_file = "%s-sort%s" % (base, ext)
if not file_exists(out_file... | [
"def",
"picard_sort",
"(",
"picard",
",",
"align_bam",
",",
"sort_order",
"=",
"\"coordinate\"",
",",
"out_file",
"=",
"None",
",",
"compression_level",
"=",
"None",
",",
"pipe",
"=",
"False",
")",
":",
"base",
",",
"ext",
"=",
"os",
".",
"path",
".",
... | Sort a BAM file by coordinates. | [
"Sort",
"a",
"BAM",
"file",
"by",
"coordinates",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L46-L63 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_merge | def picard_merge(picard, in_files, out_file=None,
merge_seq_dicts=False):
"""Merge multiple BAM files together with Picard.
"""
if out_file is None:
out_file = "%smerge.bam" % os.path.commonprefix(in_files)
if not file_exists(out_file):
with tx_tmpdir(picard._config) as ... | python | def picard_merge(picard, in_files, out_file=None,
merge_seq_dicts=False):
"""Merge multiple BAM files together with Picard.
"""
if out_file is None:
out_file = "%smerge.bam" % os.path.commonprefix(in_files)
if not file_exists(out_file):
with tx_tmpdir(picard._config) as ... | [
"def",
"picard_merge",
"(",
"picard",
",",
"in_files",
",",
"out_file",
"=",
"None",
",",
"merge_seq_dicts",
"=",
"False",
")",
":",
"if",
"out_file",
"is",
"None",
":",
"out_file",
"=",
"\"%smerge.bam\"",
"%",
"os",
".",
"path",
".",
"commonprefix",
"(",
... | Merge multiple BAM files together with Picard. | [
"Merge",
"multiple",
"BAM",
"files",
"together",
"with",
"Picard",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L65-L83 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_reorder | def picard_reorder(picard, in_bam, ref_file, out_file):
"""Reorder BAM file to match reference file ordering.
"""
if not file_exists(out_file):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, out_file) as tx_out_file:
opts = [("INPUT", in_... | python | def picard_reorder(picard, in_bam, ref_file, out_file):
"""Reorder BAM file to match reference file ordering.
"""
if not file_exists(out_file):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, out_file) as tx_out_file:
opts = [("INPUT", in_... | [
"def",
"picard_reorder",
"(",
"picard",
",",
"in_bam",
",",
"ref_file",
",",
"out_file",
")",
":",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"tx_tmpdir",
"(",
"picard",
".",
"_config",
")",
"as",
"tmp_dir",
":",
"with",
"file_transacti... | Reorder BAM file to match reference file ordering. | [
"Reorder",
"BAM",
"file",
"to",
"match",
"reference",
"file",
"ordering",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L95-L107 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_fix_rgs | def picard_fix_rgs(picard, in_bam, names):
"""Add read group information to BAM files and coordinate sort.
"""
out_file = "%s-fixrgs.bam" % os.path.splitext(in_bam)[0]
if not file_exists(out_file):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, out_f... | python | def picard_fix_rgs(picard, in_bam, names):
"""Add read group information to BAM files and coordinate sort.
"""
out_file = "%s-fixrgs.bam" % os.path.splitext(in_bam)[0]
if not file_exists(out_file):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, out_f... | [
"def",
"picard_fix_rgs",
"(",
"picard",
",",
"in_bam",
",",
"names",
")",
":",
"out_file",
"=",
"\"%s-fixrgs.bam\"",
"%",
"os",
".",
"path",
".",
"splitext",
"(",
"in_bam",
")",
"[",
"0",
"]",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"wit... | Add read group information to BAM files and coordinate sort. | [
"Add",
"read",
"group",
"information",
"to",
"BAM",
"files",
"and",
"coordinate",
"sort",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L109-L126 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_index_ref | def picard_index_ref(picard, ref_file):
"""Provide a Picard style dict index file for a reference genome.
"""
dict_file = "%s.dict" % os.path.splitext(ref_file)[0]
if not file_exists(dict_file):
with file_transaction(picard._config, dict_file) as tx_dict_file:
opts = [("REFERENCE", r... | python | def picard_index_ref(picard, ref_file):
"""Provide a Picard style dict index file for a reference genome.
"""
dict_file = "%s.dict" % os.path.splitext(ref_file)[0]
if not file_exists(dict_file):
with file_transaction(picard._config, dict_file) as tx_dict_file:
opts = [("REFERENCE", r... | [
"def",
"picard_index_ref",
"(",
"picard",
",",
"ref_file",
")",
":",
"dict_file",
"=",
"\"%s.dict\"",
"%",
"os",
".",
"path",
".",
"splitext",
"(",
"ref_file",
")",
"[",
"0",
"]",
"if",
"not",
"file_exists",
"(",
"dict_file",
")",
":",
"with",
"file_tran... | Provide a Picard style dict index file for a reference genome. | [
"Provide",
"a",
"Picard",
"style",
"dict",
"index",
"file",
"for",
"a",
"reference",
"genome",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L142-L151 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_bam_to_fastq | def picard_bam_to_fastq(picard, in_bam, fastq_one, fastq_two=None):
"""Convert BAM file to fastq.
"""
if not file_exists(fastq_one):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, fastq_one) as tx_out1:
opts = [("INPUT", in_bam),
... | python | def picard_bam_to_fastq(picard, in_bam, fastq_one, fastq_two=None):
"""Convert BAM file to fastq.
"""
if not file_exists(fastq_one):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, fastq_one) as tx_out1:
opts = [("INPUT", in_bam),
... | [
"def",
"picard_bam_to_fastq",
"(",
"picard",
",",
"in_bam",
",",
"fastq_one",
",",
"fastq_two",
"=",
"None",
")",
":",
"if",
"not",
"file_exists",
"(",
"fastq_one",
")",
":",
"with",
"tx_tmpdir",
"(",
"picard",
".",
"_config",
")",
"as",
"tmp_dir",
":",
... | Convert BAM file to fastq. | [
"Convert",
"BAM",
"file",
"to",
"fastq",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L174-L186 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_sam_to_bam | def picard_sam_to_bam(picard, align_sam, fastq_bam, ref_file,
is_paired=False):
"""Convert SAM to BAM, including unmapped reads from fastq BAM file.
"""
to_retain = ["XS", "XG", "XM", "XN", "XO", "YT"]
if align_sam.endswith(".sam"):
out_bam = "%s.bam" % os.path.splitext(ali... | python | def picard_sam_to_bam(picard, align_sam, fastq_bam, ref_file,
is_paired=False):
"""Convert SAM to BAM, including unmapped reads from fastq BAM file.
"""
to_retain = ["XS", "XG", "XM", "XN", "XO", "YT"]
if align_sam.endswith(".sam"):
out_bam = "%s.bam" % os.path.splitext(ali... | [
"def",
"picard_sam_to_bam",
"(",
"picard",
",",
"align_sam",
",",
"fastq_bam",
",",
"ref_file",
",",
"is_paired",
"=",
"False",
")",
":",
"to_retain",
"=",
"[",
"\"XS\"",
",",
"\"XG\"",
",",
"\"XM\"",
",",
"\"XN\"",
",",
"\"XO\"",
",",
"\"YT\"",
"]",
"if... | Convert SAM to BAM, including unmapped reads from fastq BAM file. | [
"Convert",
"SAM",
"to",
"BAM",
"including",
"unmapped",
"reads",
"from",
"fastq",
"BAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L188-L211 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_formatconverter | def picard_formatconverter(picard, align_sam):
"""Convert aligned SAM file to BAM format.
"""
out_bam = "%s.bam" % os.path.splitext(align_sam)[0]
if not file_exists(out_bam):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, out_bam) as tx_out_bam:
... | python | def picard_formatconverter(picard, align_sam):
"""Convert aligned SAM file to BAM format.
"""
out_bam = "%s.bam" % os.path.splitext(align_sam)[0]
if not file_exists(out_bam):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transaction(picard._config, out_bam) as tx_out_bam:
... | [
"def",
"picard_formatconverter",
"(",
"picard",
",",
"align_sam",
")",
":",
"out_bam",
"=",
"\"%s.bam\"",
"%",
"os",
".",
"path",
".",
"splitext",
"(",
"align_sam",
")",
"[",
"0",
"]",
"if",
"not",
"file_exists",
"(",
"out_bam",
")",
":",
"with",
"tx_tmp... | Convert aligned SAM file to BAM format. | [
"Convert",
"aligned",
"SAM",
"file",
"to",
"BAM",
"format",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L213-L224 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_fixmate | def picard_fixmate(picard, align_bam):
"""Run Picard's FixMateInformation generating an aligned output file.
"""
base, ext = os.path.splitext(align_bam)
out_file = "%s-sort%s" % (base, ext)
if not file_exists(out_file):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transac... | python | def picard_fixmate(picard, align_bam):
"""Run Picard's FixMateInformation generating an aligned output file.
"""
base, ext = os.path.splitext(align_bam)
out_file = "%s-sort%s" % (base, ext)
if not file_exists(out_file):
with tx_tmpdir(picard._config) as tmp_dir:
with file_transac... | [
"def",
"picard_fixmate",
"(",
"picard",
",",
"align_bam",
")",
":",
"base",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"align_bam",
")",
"out_file",
"=",
"\"%s-sort%s\"",
"%",
"(",
"base",
",",
"ext",
")",
"if",
"not",
"file_exists",
"("... | Run Picard's FixMateInformation generating an aligned output file. | [
"Run",
"Picard",
"s",
"FixMateInformation",
"generating",
"an",
"aligned",
"output",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L244-L257 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_idxstats | def picard_idxstats(picard, align_bam):
"""Retrieve alignment stats from picard using BamIndexStats.
"""
opts = [("INPUT", align_bam)]
stdout = picard.run("BamIndexStats", opts, get_stdout=True)
out = []
AlignInfo = collections.namedtuple("AlignInfo", ["contig", "length", "aligned", "unaligned"]... | python | def picard_idxstats(picard, align_bam):
"""Retrieve alignment stats from picard using BamIndexStats.
"""
opts = [("INPUT", align_bam)]
stdout = picard.run("BamIndexStats", opts, get_stdout=True)
out = []
AlignInfo = collections.namedtuple("AlignInfo", ["contig", "length", "aligned", "unaligned"]... | [
"def",
"picard_idxstats",
"(",
"picard",
",",
"align_bam",
")",
":",
"opts",
"=",
"[",
"(",
"\"INPUT\"",
",",
"align_bam",
")",
"]",
"stdout",
"=",
"picard",
".",
"run",
"(",
"\"BamIndexStats\"",
",",
"opts",
",",
"get_stdout",
"=",
"True",
")",
"out",
... | Retrieve alignment stats from picard using BamIndexStats. | [
"Retrieve",
"alignment",
"stats",
"from",
"picard",
"using",
"BamIndexStats",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L259-L277 | train |
bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | bed2interval | def bed2interval(align_file, bed, out_file=None):
"""Converts a bed file to an interval file for use with some of the
Picard tools by grabbing the header from the alignment file, reording
the bed file columns and gluing them together.
align_file can be in BAM or SAM format.
bed needs to be in bed12... | python | def bed2interval(align_file, bed, out_file=None):
"""Converts a bed file to an interval file for use with some of the
Picard tools by grabbing the header from the alignment file, reording
the bed file columns and gluing them together.
align_file can be in BAM or SAM format.
bed needs to be in bed12... | [
"def",
"bed2interval",
"(",
"align_file",
",",
"bed",
",",
"out_file",
"=",
"None",
")",
":",
"import",
"pysam",
"base",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"align_file",
")",
"if",
"out_file",
"is",
"None",
":",
"out_file",
"=",
... | Converts a bed file to an interval file for use with some of the
Picard tools by grabbing the header from the alignment file, reording
the bed file columns and gluing them together.
align_file can be in BAM or SAM format.
bed needs to be in bed12 format:
http://genome.ucsc.edu/FAQ/FAQformat.html#fo... | [
"Converts",
"a",
"bed",
"file",
"to",
"an",
"interval",
"file",
"for",
"use",
"with",
"some",
"of",
"the",
"Picard",
"tools",
"by",
"grabbing",
"the",
"header",
"from",
"the",
"alignment",
"file",
"reording",
"the",
"bed",
"file",
"columns",
"and",
"gluing... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L279-L309 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | _enforce_max_region_size | def _enforce_max_region_size(in_file, data):
"""Ensure we don't have any chunks in the region greater than 20kb.
VarDict memory usage depends on size of individual windows in the input
file. This breaks regions into 20kb chunks with 250bp overlaps. 20kb gives
~1Gb/core memory usage and the overlaps avo... | python | def _enforce_max_region_size(in_file, data):
"""Ensure we don't have any chunks in the region greater than 20kb.
VarDict memory usage depends on size of individual windows in the input
file. This breaks regions into 20kb chunks with 250bp overlaps. 20kb gives
~1Gb/core memory usage and the overlaps avo... | [
"def",
"_enforce_max_region_size",
"(",
"in_file",
",",
"data",
")",
":",
"max_size",
"=",
"20000",
"overlap_size",
"=",
"250",
"def",
"_has_larger_regions",
"(",
"f",
")",
":",
"return",
"any",
"(",
"r",
".",
"stop",
"-",
"r",
".",
"start",
">",
"max_si... | Ensure we don't have any chunks in the region greater than 20kb.
VarDict memory usage depends on size of individual windows in the input
file. This breaks regions into 20kb chunks with 250bp overlaps. 20kb gives
~1Gb/core memory usage and the overlaps avoid missing indels spanning a
gap. Downstream Var... | [
"Ensure",
"we",
"don",
"t",
"have",
"any",
"chunks",
"in",
"the",
"region",
"greater",
"than",
"20kb",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L90-L113 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | run_vardict | def run_vardict(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Run VarDict variant calling.
"""
items = shared.add_highdepth_genome_exclusion(items)
if vcfutils.is_paired_analysis(align_bams, items):
call_file = _run_vardict_paired(align_bams, items, re... | python | def run_vardict(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Run VarDict variant calling.
"""
items = shared.add_highdepth_genome_exclusion(items)
if vcfutils.is_paired_analysis(align_bams, items):
call_file = _run_vardict_paired(align_bams, items, re... | [
"def",
"run_vardict",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"items",
"=",
"shared",
".",
"add_highdepth_genome_exclusion",
"(",
"items",
")",
"if",
"vcfutils"... | Run VarDict variant calling. | [
"Run",
"VarDict",
"variant",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L115-L127 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | _get_jvm_opts | def _get_jvm_opts(data, out_file):
"""Retrieve JVM options when running the Java version of VarDict.
"""
if get_vardict_command(data) == "vardict-java":
resources = config_utils.get_resources("vardict", data["config"])
jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx4g"])
jvm_... | python | def _get_jvm_opts(data, out_file):
"""Retrieve JVM options when running the Java version of VarDict.
"""
if get_vardict_command(data) == "vardict-java":
resources = config_utils.get_resources("vardict", data["config"])
jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx4g"])
jvm_... | [
"def",
"_get_jvm_opts",
"(",
"data",
",",
"out_file",
")",
":",
"if",
"get_vardict_command",
"(",
"data",
")",
"==",
"\"vardict-java\"",
":",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"vardict\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
... | Retrieve JVM options when running the Java version of VarDict. | [
"Retrieve",
"JVM",
"options",
"when",
"running",
"the",
"Java",
"version",
"of",
"VarDict",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L129-L138 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | _run_vardict_caller | def _run_vardict_caller(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Detect SNPs and indels with VarDict.
var2vcf_valid uses -A flag which reports all alleles and improves sensitivity:
https://github.com/AstraZeneca-NGS/VarDict/issues/35#issuecomment-2... | python | def _run_vardict_caller(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Detect SNPs and indels with VarDict.
var2vcf_valid uses -A flag which reports all alleles and improves sensitivity:
https://github.com/AstraZeneca-NGS/VarDict/issues/35#issuecomment-2... | [
"def",
"_run_vardict_caller",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
"if",
"out_file",
"is",... | Detect SNPs and indels with VarDict.
var2vcf_valid uses -A flag which reports all alleles and improves sensitivity:
https://github.com/AstraZeneca-NGS/VarDict/issues/35#issuecomment-276738191 | [
"Detect",
"SNPs",
"and",
"indels",
"with",
"VarDict",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L140-L201 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | _lowfreq_linear_filter | def _lowfreq_linear_filter(tumor_index, is_paired):
"""Linear classifier for removing low frequency false positives.
Uses a logistic classifier based on 0.5% tumor only variants from the smcounter2 paper:
https://github.com/bcbio/bcbio_validations/tree/master/somatic-lowfreq
The classifier uses stran... | python | def _lowfreq_linear_filter(tumor_index, is_paired):
"""Linear classifier for removing low frequency false positives.
Uses a logistic classifier based on 0.5% tumor only variants from the smcounter2 paper:
https://github.com/bcbio/bcbio_validations/tree/master/somatic-lowfreq
The classifier uses stran... | [
"def",
"_lowfreq_linear_filter",
"(",
"tumor_index",
",",
"is_paired",
")",
":",
"if",
"is_paired",
":",
"sbf",
"=",
"\"FORMAT/SBF[%s]\"",
"%",
"tumor_index",
"nm",
"=",
"\"FORMAT/NM[%s]\"",
"%",
"tumor_index",
"else",
":",
"sbf",
"=",
"\"INFO/SBF\"",
"nm",
"=",... | Linear classifier for removing low frequency false positives.
Uses a logistic classifier based on 0.5% tumor only variants from the smcounter2 paper:
https://github.com/bcbio/bcbio_validations/tree/master/somatic-lowfreq
The classifier uses strand bias (SBF) and read mismatches (NM) and
applies only ... | [
"Linear",
"classifier",
"for",
"removing",
"low",
"frequency",
"false",
"positives",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L203-L222 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | add_db_germline_flag | def add_db_germline_flag(line):
"""Adds a DB flag for Germline filters, allowing downstream compatibility with PureCN.
"""
if line.startswith("#CHROM"):
headers = ['##INFO=<ID=DB,Number=0,Type=Flag,Description="Likely germline variant">']
return "\n".join(headers) + "\n" + line
elif line... | python | def add_db_germline_flag(line):
"""Adds a DB flag for Germline filters, allowing downstream compatibility with PureCN.
"""
if line.startswith("#CHROM"):
headers = ['##INFO=<ID=DB,Number=0,Type=Flag,Description="Likely germline variant">']
return "\n".join(headers) + "\n" + line
elif line... | [
"def",
"add_db_germline_flag",
"(",
"line",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#CHROM\"",
")",
":",
"headers",
"=",
"[",
"'##INFO=<ID=DB,Number=0,Type=Flag,Description=\"Likely germline variant\">'",
"]",
"return",
"\"\\n\"",
".",
"join",
"(",
"headers... | Adds a DB flag for Germline filters, allowing downstream compatibility with PureCN. | [
"Adds",
"a",
"DB",
"flag",
"for",
"Germline",
"filters",
"allowing",
"downstream",
"compatibility",
"with",
"PureCN",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L224-L236 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | depth_freq_filter | def depth_freq_filter(line, tumor_index, aligner):
"""Command line to filter VarDict calls based on depth, frequency and quality.
Looks at regions with low depth for allele frequency (AF * DP < 6, the equivalent
of < 13bp for heterogygote calls, but generalized. Within these calls filters if a
calls ha... | python | def depth_freq_filter(line, tumor_index, aligner):
"""Command line to filter VarDict calls based on depth, frequency and quality.
Looks at regions with low depth for allele frequency (AF * DP < 6, the equivalent
of < 13bp for heterogygote calls, but generalized. Within these calls filters if a
calls ha... | [
"def",
"depth_freq_filter",
"(",
"line",
",",
"tumor_index",
",",
"aligner",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#CHROM\"",
")",
":",
"headers",
"=",
"[",
"(",
"'##FILTER=<ID=LowAlleleDepth,Description=\"Low depth per allele frequency '",
"'along with poo... | Command line to filter VarDict calls based on depth, frequency and quality.
Looks at regions with low depth for allele frequency (AF * DP < 6, the equivalent
of < 13bp for heterogygote calls, but generalized. Within these calls filters if a
calls has:
- Low mapping quality and multiple mismatches in a... | [
"Command",
"line",
"to",
"filter",
"VarDict",
"calls",
"based",
"on",
"depth",
"frequency",
"and",
"quality",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L238-L293 | train |
bcbio/bcbio-nextgen | bcbio/variation/vardict.py | get_vardict_command | def get_vardict_command(data):
"""
convert variantcaller specification to proper vardict command, handling
string or list specification
"""
vcaller = dd.get_variantcaller(data)
if isinstance(vcaller, list):
vardict = [x for x in vcaller if "vardict" in x]
if not vardict:
... | python | def get_vardict_command(data):
"""
convert variantcaller specification to proper vardict command, handling
string or list specification
"""
vcaller = dd.get_variantcaller(data)
if isinstance(vcaller, list):
vardict = [x for x in vcaller if "vardict" in x]
if not vardict:
... | [
"def",
"get_vardict_command",
"(",
"data",
")",
":",
"vcaller",
"=",
"dd",
".",
"get_variantcaller",
"(",
"data",
")",
"if",
"isinstance",
"(",
"vcaller",
",",
"list",
")",
":",
"vardict",
"=",
"[",
"x",
"for",
"x",
"in",
"vcaller",
"if",
"\"vardict\"",
... | convert variantcaller specification to proper vardict command, handling
string or list specification | [
"convert",
"variantcaller",
"specification",
"to",
"proper",
"vardict",
"command",
"handling",
"string",
"or",
"list",
"specification"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vardict.py#L362-L378 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | run | def run(vrn_info, calls_by_name, somatic_info, do_plots=True, handle_failures=True):
"""Run BubbleTree given variant calls, CNVs and somatic
"""
if "seq2c" in calls_by_name:
cnv_info = calls_by_name["seq2c"]
elif "cnvkit" in calls_by_name:
cnv_info = calls_by_name["cnvkit"]
else:
... | python | def run(vrn_info, calls_by_name, somatic_info, do_plots=True, handle_failures=True):
"""Run BubbleTree given variant calls, CNVs and somatic
"""
if "seq2c" in calls_by_name:
cnv_info = calls_by_name["seq2c"]
elif "cnvkit" in calls_by_name:
cnv_info = calls_by_name["cnvkit"]
else:
... | [
"def",
"run",
"(",
"vrn_info",
",",
"calls_by_name",
",",
"somatic_info",
",",
"do_plots",
"=",
"True",
",",
"handle_failures",
"=",
"True",
")",
":",
"if",
"\"seq2c\"",
"in",
"calls_by_name",
":",
"cnv_info",
"=",
"calls_by_name",
"[",
"\"seq2c\"",
"]",
"el... | Run BubbleTree given variant calls, CNVs and somatic | [
"Run",
"BubbleTree",
"given",
"variant",
"calls",
"CNVs",
"and",
"somatic"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L34-L57 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _run_bubbletree | def _run_bubbletree(vcf_csv, cnv_csv, data, wide_lrr=False, do_plots=True,
handle_failures=True):
"""Create R script and run on input data
BubbleTree has some internal hardcoded paramters that assume a smaller
distribution of log2 scores. This is not true for tumor-only calls, so if
... | python | def _run_bubbletree(vcf_csv, cnv_csv, data, wide_lrr=False, do_plots=True,
handle_failures=True):
"""Create R script and run on input data
BubbleTree has some internal hardcoded paramters that assume a smaller
distribution of log2 scores. This is not true for tumor-only calls, so if
... | [
"def",
"_run_bubbletree",
"(",
"vcf_csv",
",",
"cnv_csv",
",",
"data",
",",
"wide_lrr",
"=",
"False",
",",
"do_plots",
"=",
"True",
",",
"handle_failures",
"=",
"True",
")",
":",
"lrr_scale",
"=",
"10.0",
"if",
"wide_lrr",
"else",
"1.0",
"local_sitelib",
"... | Create R script and run on input data
BubbleTree has some internal hardcoded paramters that assume a smaller
distribution of log2 scores. This is not true for tumor-only calls, so if
we specify wide_lrr we scale the calculations to actually get calls. Need a
better long term solution with flexible para... | [
"Create",
"R",
"script",
"and",
"run",
"on",
"input",
"data"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L59-L93 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _prep_cnv_file | def _prep_cnv_file(cns_file, svcaller, work_dir, data):
"""Create a CSV file of CNV calls with log2 and number of marks.
"""
in_file = cns_file
out_file = os.path.join(work_dir, "%s-%s-prep.csv" % (utils.splitext_plus(os.path.basename(in_file))[0],
... | python | def _prep_cnv_file(cns_file, svcaller, work_dir, data):
"""Create a CSV file of CNV calls with log2 and number of marks.
"""
in_file = cns_file
out_file = os.path.join(work_dir, "%s-%s-prep.csv" % (utils.splitext_plus(os.path.basename(in_file))[0],
... | [
"def",
"_prep_cnv_file",
"(",
"cns_file",
",",
"svcaller",
",",
"work_dir",
",",
"data",
")",
":",
"in_file",
"=",
"cns_file",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-%s-prep.csv\"",
"%",
"(",
"utils",
".",
"splitext_pl... | Create a CSV file of CNV calls with log2 and number of marks. | [
"Create",
"a",
"CSV",
"file",
"of",
"CNV",
"calls",
"with",
"log2",
"and",
"number",
"of",
"marks",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L104-L123 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | prep_vrn_file | def prep_vrn_file(in_file, vcaller, work_dir, somatic_info, writer_class, seg_file=None, params=None):
"""Select heterozygous variants in the normal sample with sufficient depth.
writer_class implements write_header and write_row to write VCF outputs
from a record and extracted tumor/normal statistics.
... | python | def prep_vrn_file(in_file, vcaller, work_dir, somatic_info, writer_class, seg_file=None, params=None):
"""Select heterozygous variants in the normal sample with sufficient depth.
writer_class implements write_header and write_row to write VCF outputs
from a record and extracted tumor/normal statistics.
... | [
"def",
"prep_vrn_file",
"(",
"in_file",
",",
"vcaller",
",",
"work_dir",
",",
"somatic_info",
",",
"writer_class",
",",
"seg_file",
"=",
"None",
",",
"params",
"=",
"None",
")",
":",
"data",
"=",
"somatic_info",
".",
"tumor_data",
"if",
"not",
"params",
":... | Select heterozygous variants in the normal sample with sufficient depth.
writer_class implements write_header and write_row to write VCF outputs
from a record and extracted tumor/normal statistics. | [
"Select",
"heterozygous",
"variants",
"in",
"the",
"normal",
"sample",
"with",
"sufficient",
"depth",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L125-L153 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | max_normal_germline_depth | def max_normal_germline_depth(in_file, params, somatic_info):
"""Calculate threshold for excluding potential heterozygotes based on normal depth.
"""
bcf_in = pysam.VariantFile(in_file)
depths = []
for rec in bcf_in:
stats = _is_possible_loh(rec, bcf_in, params, somatic_info)
if tz.g... | python | def max_normal_germline_depth(in_file, params, somatic_info):
"""Calculate threshold for excluding potential heterozygotes based on normal depth.
"""
bcf_in = pysam.VariantFile(in_file)
depths = []
for rec in bcf_in:
stats = _is_possible_loh(rec, bcf_in, params, somatic_info)
if tz.g... | [
"def",
"max_normal_germline_depth",
"(",
"in_file",
",",
"params",
",",
"somatic_info",
")",
":",
"bcf_in",
"=",
"pysam",
".",
"VariantFile",
"(",
"in_file",
")",
"depths",
"=",
"[",
"]",
"for",
"rec",
"in",
"bcf_in",
":",
"stats",
"=",
"_is_possible_loh",
... | Calculate threshold for excluding potential heterozygotes based on normal depth. | [
"Calculate",
"threshold",
"for",
"excluding",
"potential",
"heterozygotes",
"based",
"on",
"normal",
"depth",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L162-L172 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _identify_heterogeneity_blocks_hmm | def _identify_heterogeneity_blocks_hmm(in_file, params, work_dir, somatic_info):
"""Use a HMM to identify blocks of heterogeneity to use for calculating allele frequencies.
The goal is to subset the genome to a more reasonable section that contains potential
loss of heterogeneity or other allele frequency ... | python | def _identify_heterogeneity_blocks_hmm(in_file, params, work_dir, somatic_info):
"""Use a HMM to identify blocks of heterogeneity to use for calculating allele frequencies.
The goal is to subset the genome to a more reasonable section that contains potential
loss of heterogeneity or other allele frequency ... | [
"def",
"_identify_heterogeneity_blocks_hmm",
"(",
"in_file",
",",
"params",
",",
"work_dir",
",",
"somatic_info",
")",
":",
"def",
"_segment_by_hmm",
"(",
"chrom",
",",
"freqs",
",",
"coords",
")",
":",
"cur_coords",
"=",
"[",
"]",
"for",
"j",
",",
"state",
... | Use a HMM to identify blocks of heterogeneity to use for calculating allele frequencies.
The goal is to subset the genome to a more reasonable section that contains potential
loss of heterogeneity or other allele frequency adjustment based on selection. | [
"Use",
"a",
"HMM",
"to",
"identify",
"blocks",
"of",
"heterogeneity",
"to",
"use",
"for",
"calculating",
"allele",
"frequencies",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L195-L216 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _predict_states | def _predict_states(freqs):
"""Use frequencies to predict states across a chromosome.
Normalize so heterozygote blocks are assigned state 0 and homozygous
are assigned state 1.
"""
from hmmlearn import hmm
freqs = np.column_stack([np.array(freqs)])
model = hmm.GaussianHMM(2, covariance_type... | python | def _predict_states(freqs):
"""Use frequencies to predict states across a chromosome.
Normalize so heterozygote blocks are assigned state 0 and homozygous
are assigned state 1.
"""
from hmmlearn import hmm
freqs = np.column_stack([np.array(freqs)])
model = hmm.GaussianHMM(2, covariance_type... | [
"def",
"_predict_states",
"(",
"freqs",
")",
":",
"from",
"hmmlearn",
"import",
"hmm",
"freqs",
"=",
"np",
".",
"column_stack",
"(",
"[",
"np",
".",
"array",
"(",
"freqs",
")",
"]",
")",
"model",
"=",
"hmm",
".",
"GaussianHMM",
"(",
"2",
",",
"covari... | Use frequencies to predict states across a chromosome.
Normalize so heterozygote blocks are assigned state 0 and homozygous
are assigned state 1. | [
"Use",
"frequencies",
"to",
"predict",
"states",
"across",
"a",
"chromosome",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L230-L246 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _freqs_by_chromosome | def _freqs_by_chromosome(in_file, params, somatic_info):
"""Retrieve frequencies across each chromosome as inputs to HMM.
"""
freqs = []
coords = []
cur_chrom = None
with pysam.VariantFile(in_file) as bcf_in:
for rec in bcf_in:
if _is_biallelic_snp(rec) and _passes_plus_germl... | python | def _freqs_by_chromosome(in_file, params, somatic_info):
"""Retrieve frequencies across each chromosome as inputs to HMM.
"""
freqs = []
coords = []
cur_chrom = None
with pysam.VariantFile(in_file) as bcf_in:
for rec in bcf_in:
if _is_biallelic_snp(rec) and _passes_plus_germl... | [
"def",
"_freqs_by_chromosome",
"(",
"in_file",
",",
"params",
",",
"somatic_info",
")",
":",
"freqs",
"=",
"[",
"]",
"coords",
"=",
"[",
"]",
"cur_chrom",
"=",
"None",
"with",
"pysam",
".",
"VariantFile",
"(",
"in_file",
")",
"as",
"bcf_in",
":",
"for",
... | Retrieve frequencies across each chromosome as inputs to HMM. | [
"Retrieve",
"frequencies",
"across",
"each",
"chromosome",
"as",
"inputs",
"to",
"HMM",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L248-L270 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _create_subset_file | def _create_subset_file(in_file, het_region_bed, work_dir, data):
"""Subset the VCF to a set of pre-calculated smaller regions.
"""
cnv_regions = shared.get_base_cnv_regions(data, work_dir)
region_bed = bedutils.intersect_two(het_region_bed, cnv_regions, work_dir, data)
out_file = os.path.join(work_... | python | def _create_subset_file(in_file, het_region_bed, work_dir, data):
"""Subset the VCF to a set of pre-calculated smaller regions.
"""
cnv_regions = shared.get_base_cnv_regions(data, work_dir)
region_bed = bedutils.intersect_two(het_region_bed, cnv_regions, work_dir, data)
out_file = os.path.join(work_... | [
"def",
"_create_subset_file",
"(",
"in_file",
",",
"het_region_bed",
",",
"work_dir",
",",
"data",
")",
":",
"cnv_regions",
"=",
"shared",
".",
"get_base_cnv_regions",
"(",
"data",
",",
"work_dir",
")",
"region_bed",
"=",
"bedutils",
".",
"intersect_two",
"(",
... | Subset the VCF to a set of pre-calculated smaller regions. | [
"Subset",
"the",
"VCF",
"to",
"a",
"set",
"of",
"pre",
"-",
"calculated",
"smaller",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L272-L283 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | is_info_germline | def is_info_germline(rec):
"""Check if a variant record is germline based on INFO attributes.
Works with VarDict's annotation of STATUS.
"""
if hasattr(rec, "INFO"):
status = rec.INFO.get("STATUS", "").lower()
else:
status = rec.info.get("STATUS", "").lower()
return status == "g... | python | def is_info_germline(rec):
"""Check if a variant record is germline based on INFO attributes.
Works with VarDict's annotation of STATUS.
"""
if hasattr(rec, "INFO"):
status = rec.INFO.get("STATUS", "").lower()
else:
status = rec.info.get("STATUS", "").lower()
return status == "g... | [
"def",
"is_info_germline",
"(",
"rec",
")",
":",
"if",
"hasattr",
"(",
"rec",
",",
"\"INFO\"",
")",
":",
"status",
"=",
"rec",
".",
"INFO",
".",
"get",
"(",
"\"STATUS\"",
",",
"\"\"",
")",
".",
"lower",
"(",
")",
"else",
":",
"status",
"=",
"rec",
... | Check if a variant record is germline based on INFO attributes.
Works with VarDict's annotation of STATUS. | [
"Check",
"if",
"a",
"variant",
"record",
"is",
"germline",
"based",
"on",
"INFO",
"attributes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L290-L299 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _tumor_normal_stats | def _tumor_normal_stats(rec, somatic_info, vcf_rec):
"""Retrieve depth and frequency of tumor and normal samples.
"""
out = {"normal": {"alt": None, "depth": None, "freq": None},
"tumor": {"alt": 0, "depth": 0, "freq": None}}
if hasattr(vcf_rec, "samples"):
samples = [(s, {}) for s in... | python | def _tumor_normal_stats(rec, somatic_info, vcf_rec):
"""Retrieve depth and frequency of tumor and normal samples.
"""
out = {"normal": {"alt": None, "depth": None, "freq": None},
"tumor": {"alt": 0, "depth": 0, "freq": None}}
if hasattr(vcf_rec, "samples"):
samples = [(s, {}) for s in... | [
"def",
"_tumor_normal_stats",
"(",
"rec",
",",
"somatic_info",
",",
"vcf_rec",
")",
":",
"out",
"=",
"{",
"\"normal\"",
":",
"{",
"\"alt\"",
":",
"None",
",",
"\"depth\"",
":",
"None",
",",
"\"freq\"",
":",
"None",
"}",
",",
"\"tumor\"",
":",
"{",
"\"a... | Retrieve depth and frequency of tumor and normal samples. | [
"Retrieve",
"depth",
"and",
"frequency",
"of",
"tumor",
"and",
"normal",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L328-L356 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _is_possible_loh | def _is_possible_loh(rec, vcf_rec, params, somatic_info, use_status=False, max_normal_depth=None):
"""Check if the VCF record is a het in the normal with sufficient support.
Only returns SNPs, since indels tend to have less precise frequency measurements.
"""
if _is_biallelic_snp(rec) and _passes_plus_... | python | def _is_possible_loh(rec, vcf_rec, params, somatic_info, use_status=False, max_normal_depth=None):
"""Check if the VCF record is a het in the normal with sufficient support.
Only returns SNPs, since indels tend to have less precise frequency measurements.
"""
if _is_biallelic_snp(rec) and _passes_plus_... | [
"def",
"_is_possible_loh",
"(",
"rec",
",",
"vcf_rec",
",",
"params",
",",
"somatic_info",
",",
"use_status",
"=",
"False",
",",
"max_normal_depth",
"=",
"None",
")",
":",
"if",
"_is_biallelic_snp",
"(",
"rec",
")",
"and",
"_passes_plus_germline",
"(",
"rec",
... | Check if the VCF record is a het in the normal with sufficient support.
Only returns SNPs, since indels tend to have less precise frequency measurements. | [
"Check",
"if",
"the",
"VCF",
"record",
"is",
"a",
"het",
"in",
"the",
"normal",
"with",
"sufficient",
"support",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L358-L378 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | _has_population_germline | def _has_population_germline(rec):
"""Check if header defines population annotated germline samples for tumor only.
"""
for k in population_keys:
if k in rec.header.info:
return True
return False | python | def _has_population_germline(rec):
"""Check if header defines population annotated germline samples for tumor only.
"""
for k in population_keys:
if k in rec.header.info:
return True
return False | [
"def",
"_has_population_germline",
"(",
"rec",
")",
":",
"for",
"k",
"in",
"population_keys",
":",
"if",
"k",
"in",
"rec",
".",
"header",
".",
"info",
":",
"return",
"True",
"return",
"False"
] | Check if header defines population annotated germline samples for tumor only. | [
"Check",
"if",
"header",
"defines",
"population",
"annotated",
"germline",
"samples",
"for",
"tumor",
"only",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L380-L386 | train |
bcbio/bcbio-nextgen | bcbio/heterogeneity/bubbletree.py | is_population_germline | def is_population_germline(rec):
"""Identify a germline calls based on annoations with ExAC or other population databases.
"""
min_count = 50
for k in population_keys:
if k in rec.info:
val = rec.info.get(k)
if "," in val:
val = val.split(",")[0]
... | python | def is_population_germline(rec):
"""Identify a germline calls based on annoations with ExAC or other population databases.
"""
min_count = 50
for k in population_keys:
if k in rec.info:
val = rec.info.get(k)
if "," in val:
val = val.split(",")[0]
... | [
"def",
"is_population_germline",
"(",
"rec",
")",
":",
"min_count",
"=",
"50",
"for",
"k",
"in",
"population_keys",
":",
"if",
"k",
"in",
"rec",
".",
"info",
":",
"val",
"=",
"rec",
".",
"info",
".",
"get",
"(",
"k",
")",
"if",
"\",\"",
"in",
"val"... | Identify a germline calls based on annoations with ExAC or other population databases. | [
"Identify",
"a",
"germline",
"calls",
"based",
"on",
"annoations",
"with",
"ExAC",
"or",
"other",
"population",
"databases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L388-L401 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.