id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
224,000 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _samplejson_to_inputs | def _samplejson_to_inputs(svals):
"""Convert sample output into inputs for CWL configuration files, with types.
"""
out = []
for key, val in svals.items():
out.append(_add_suppl_info({"id": "%s" % key}, val))
return out | python | def _samplejson_to_inputs(svals):
"""Convert sample output into inputs for CWL configuration files, with types.
"""
out = []
for key, val in svals.items():
out.append(_add_suppl_info({"id": "%s" % key}, val))
return out | [
"def",
"_samplejson_to_inputs",
"(",
"svals",
")",
":",
"out",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"svals",
".",
"items",
"(",
")",
":",
"out",
".",
"append",
"(",
"_add_suppl_info",
"(",
"{",
"\"id\"",
":",
"\"%s\"",
"%",
"key",
"}",
",... | Convert sample output into inputs for CWL configuration files, with types. | [
"Convert",
"sample",
"output",
"into",
"inputs",
"for",
"CWL",
"configuration",
"files",
"with",
"types",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L655-L661 |
224,001 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _to_cwldata | def _to_cwldata(key, val, get_retriever):
"""Convert nested dictionary into CWL data, flatening and marking up files.
Moves file objects to the top level, enabling insertion in CWL inputs/outputs.
"""
out = []
if isinstance(val, dict):
if len(val) == 2 and "base" in val and "indexes" in val... | python | def _to_cwldata(key, val, get_retriever):
"""Convert nested dictionary into CWL data, flatening and marking up files.
Moves file objects to the top level, enabling insertion in CWL inputs/outputs.
"""
out = []
if isinstance(val, dict):
if len(val) == 2 and "base" in val and "indexes" in val... | [
"def",
"_to_cwldata",
"(",
"key",
",",
"val",
",",
"get_retriever",
")",
":",
"out",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"if",
"len",
"(",
"val",
")",
"==",
"2",
"and",
"\"base\"",
"in",
"val",
"and",
"\"indexes\""... | Convert nested dictionary into CWL data, flatening and marking up files.
Moves file objects to the top level, enabling insertion in CWL inputs/outputs. | [
"Convert",
"nested",
"dictionary",
"into",
"CWL",
"data",
"flatening",
"and",
"marking",
"up",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L663-L701 |
224,002 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _to_cwlfile_with_indexes | def _to_cwlfile_with_indexes(val, get_retriever):
"""Convert reads with ready to go indexes into the right CWL object.
Identifies the top level directory and creates a tarball, avoiding
trying to handle complex secondary setups which are not cross platform.
Skips doing this for reference files and sta... | python | def _to_cwlfile_with_indexes(val, get_retriever):
"""Convert reads with ready to go indexes into the right CWL object.
Identifies the top level directory and creates a tarball, avoiding
trying to handle complex secondary setups which are not cross platform.
Skips doing this for reference files and sta... | [
"def",
"_to_cwlfile_with_indexes",
"(",
"val",
",",
"get_retriever",
")",
":",
"val",
"[",
"\"indexes\"",
"]",
"=",
"_index_blacklist",
"(",
"val",
"[",
"\"indexes\"",
"]",
")",
"tval",
"=",
"{",
"\"base\"",
":",
"_remove_remote_prefix",
"(",
"val",
"[",
"\"... | Convert reads with ready to go indexes into the right CWL object.
Identifies the top level directory and creates a tarball, avoiding
trying to handle complex secondary setups which are not cross platform.
Skips doing this for reference files and standard setups like bwa, which
take up too much time an... | [
"Convert",
"reads",
"with",
"ready",
"to",
"go",
"indexes",
"into",
"the",
"right",
"CWL",
"object",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L712-L734 |
224,003 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _add_secondary_if_exists | def _add_secondary_if_exists(secondary, out, get_retriever):
"""Add secondary files only if present locally or remotely.
"""
secondary = [_file_local_or_remote(y, get_retriever) for y in secondary]
secondary = [z for z in secondary if z]
if secondary:
out["secondaryFiles"] = [{"class": "File... | python | def _add_secondary_if_exists(secondary, out, get_retriever):
"""Add secondary files only if present locally or remotely.
"""
secondary = [_file_local_or_remote(y, get_retriever) for y in secondary]
secondary = [z for z in secondary if z]
if secondary:
out["secondaryFiles"] = [{"class": "File... | [
"def",
"_add_secondary_if_exists",
"(",
"secondary",
",",
"out",
",",
"get_retriever",
")",
":",
"secondary",
"=",
"[",
"_file_local_or_remote",
"(",
"y",
",",
"get_retriever",
")",
"for",
"y",
"in",
"secondary",
"]",
"secondary",
"=",
"[",
"z",
"for",
"z",
... | Add secondary files only if present locally or remotely. | [
"Add",
"secondary",
"files",
"only",
"if",
"present",
"locally",
"or",
"remotely",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L736-L743 |
224,004 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _item_to_cwldata | def _item_to_cwldata(x, get_retriever, indexes=None):
""""Markup an item with CWL specific metadata.
"""
if isinstance(x, (list, tuple)):
return [_item_to_cwldata(subx, get_retriever) for subx in x]
elif (x and isinstance(x, six.string_types) and
(((os.path.isfile(x) or os.path.isdir(x... | python | def _item_to_cwldata(x, get_retriever, indexes=None):
""""Markup an item with CWL specific metadata.
"""
if isinstance(x, (list, tuple)):
return [_item_to_cwldata(subx, get_retriever) for subx in x]
elif (x and isinstance(x, six.string_types) and
(((os.path.isfile(x) or os.path.isdir(x... | [
"def",
"_item_to_cwldata",
"(",
"x",
",",
"get_retriever",
",",
"indexes",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"_item_to_cwldata",
"(",
"subx",
",",
"get_retriever",
")",
"f... | Markup an item with CWL specific metadata. | [
"Markup",
"an",
"item",
"with",
"CWL",
"specific",
"metadata",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L745-L778 |
224,005 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _file_local_or_remote | def _file_local_or_remote(f, get_retriever):
"""Check for presence of a local or remote file.
"""
if os.path.exists(f):
return f
integration, config = get_retriever.integration_and_config(f)
if integration:
return integration.file_exists(f, config) | python | def _file_local_or_remote(f, get_retriever):
"""Check for presence of a local or remote file.
"""
if os.path.exists(f):
return f
integration, config = get_retriever.integration_and_config(f)
if integration:
return integration.file_exists(f, config) | [
"def",
"_file_local_or_remote",
"(",
"f",
",",
"get_retriever",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"f",
")",
":",
"return",
"f",
"integration",
",",
"config",
"=",
"get_retriever",
".",
"integration_and_config",
"(",
"f",
")",
"if",
"... | Check for presence of a local or remote file. | [
"Check",
"for",
"presence",
"of",
"a",
"local",
"or",
"remote",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L780-L787 |
224,006 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | directory_tarball | def directory_tarball(dirname):
"""Create a tarball of a complex directory, avoiding complex secondaryFiles.
Complex secondary files do not work on multiple platforms and are not portable
to WDL, so for now we create a tarball that workers will unpack.
"""
assert os.path.isdir(dirname), dirname
... | python | def directory_tarball(dirname):
"""Create a tarball of a complex directory, avoiding complex secondaryFiles.
Complex secondary files do not work on multiple platforms and are not portable
to WDL, so for now we create a tarball that workers will unpack.
"""
assert os.path.isdir(dirname), dirname
... | [
"def",
"directory_tarball",
"(",
"dirname",
")",
":",
"assert",
"os",
".",
"path",
".",
"isdir",
"(",
"dirname",
")",
",",
"dirname",
"base_dir",
",",
"tarball_dir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"dirname",
")",
"while",
"not",
"os",
".",
... | Create a tarball of a complex directory, avoiding complex secondaryFiles.
Complex secondary files do not work on multiple platforms and are not portable
to WDL, so for now we create a tarball that workers will unpack. | [
"Create",
"a",
"tarball",
"of",
"a",
"complex",
"directory",
"avoiding",
"complex",
"secondaryFiles",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L789-L809 |
224,007 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _calc_input_estimates | def _calc_input_estimates(keyvals, get_retriever):
"""Calculate estimations of input file sizes for disk usage approximation.
These are current dominated by fastq/BAM sizes, so estimate based on that.
"""
out = {}
for key, val in keyvals.items():
size = _calc_file_size(val, 0, get_retriever... | python | def _calc_input_estimates(keyvals, get_retriever):
"""Calculate estimations of input file sizes for disk usage approximation.
These are current dominated by fastq/BAM sizes, so estimate based on that.
"""
out = {}
for key, val in keyvals.items():
size = _calc_file_size(val, 0, get_retriever... | [
"def",
"_calc_input_estimates",
"(",
"keyvals",
",",
"get_retriever",
")",
":",
"out",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"keyvals",
".",
"items",
"(",
")",
":",
"size",
"=",
"_calc_file_size",
"(",
"val",
",",
"0",
",",
"get_retriever",
")... | Calculate estimations of input file sizes for disk usage approximation.
These are current dominated by fastq/BAM sizes, so estimate based on that. | [
"Calculate",
"estimations",
"of",
"input",
"file",
"sizes",
"for",
"disk",
"usage",
"approximation",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L853-L863 |
224,008 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | _get_file_size | def _get_file_size(path, get_retriever):
"""Return file size in megabytes, including querying remote integrations
"""
integration, config = get_retriever.integration_and_config(path)
if integration:
return integration.file_size(path, config)
elif os.path.exists(path):
return os.path.... | python | def _get_file_size(path, get_retriever):
"""Return file size in megabytes, including querying remote integrations
"""
integration, config = get_retriever.integration_and_config(path)
if integration:
return integration.file_size(path, config)
elif os.path.exists(path):
return os.path.... | [
"def",
"_get_file_size",
"(",
"path",
",",
"get_retriever",
")",
":",
"integration",
",",
"config",
"=",
"get_retriever",
".",
"integration_and_config",
"(",
"path",
")",
"if",
"integration",
":",
"return",
"integration",
".",
"file_size",
"(",
"path",
",",
"c... | Return file size in megabytes, including querying remote integrations | [
"Return",
"file",
"size",
"in",
"megabytes",
"including",
"querying",
"remote",
"integrations"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L896-L903 |
224,009 | bcbio/bcbio-nextgen | bcbio/cwl/create.py | GetRetriever.integration_and_config | def integration_and_config(self, path):
"""Get a retriever and configuration for the given file path.
"""
if path.startswith(tuple(INTEGRATION_MAP.keys())):
key = INTEGRATION_MAP[path.split(":")[0] + ":"]
integration = self._integrations.get(key)
config = {}
... | python | def integration_and_config(self, path):
"""Get a retriever and configuration for the given file path.
"""
if path.startswith(tuple(INTEGRATION_MAP.keys())):
key = INTEGRATION_MAP[path.split(":")[0] + ":"]
integration = self._integrations.get(key)
config = {}
... | [
"def",
"integration_and_config",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
".",
"startswith",
"(",
"tuple",
"(",
"INTEGRATION_MAP",
".",
"keys",
"(",
")",
")",
")",
":",
"key",
"=",
"INTEGRATION_MAP",
"[",
"path",
".",
"split",
"(",
"\":\"",
")... | Get a retriever and configuration for the given file path. | [
"Get",
"a",
"retriever",
"and",
"configuration",
"for",
"the",
"given",
"file",
"path",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L881-L894 |
224,010 | bcbio/bcbio-nextgen | bcbio/rnaseq/singlecellexperiment.py | make_scrnaseq_object | def make_scrnaseq_object(samples):
"""
load the initial se.rda object using sinclecell-experiment
"""
local_sitelib = R_sitelib()
counts_dir = os.path.dirname(dd.get_in_samples(samples, dd.get_combined_counts))
gtf_file = dd.get_in_samples(samples, dd.get_transcriptome_gtf)
if not gtf_file:
... | python | def make_scrnaseq_object(samples):
"""
load the initial se.rda object using sinclecell-experiment
"""
local_sitelib = R_sitelib()
counts_dir = os.path.dirname(dd.get_in_samples(samples, dd.get_combined_counts))
gtf_file = dd.get_in_samples(samples, dd.get_transcriptome_gtf)
if not gtf_file:
... | [
"def",
"make_scrnaseq_object",
"(",
"samples",
")",
":",
"local_sitelib",
"=",
"R_sitelib",
"(",
")",
"counts_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"dd",
".",
"get_in_samples",
"(",
"samples",
",",
"dd",
".",
"get_combined_counts",
")",
")",
"... | load the initial se.rda object using sinclecell-experiment | [
"load",
"the",
"initial",
"se",
".",
"rda",
"object",
"using",
"sinclecell",
"-",
"experiment"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/singlecellexperiment.py#L13-L37 |
224,011 | bcbio/bcbio-nextgen | bcbio/distributed/multi.py | runner | def runner(parallel, config):
"""Run functions, provided by string name, on multiple cores on the current machine.
"""
def run_parallel(fn_name, items):
items = [x for x in items if x is not None]
if len(items) == 0:
return []
items = diagnostics.track_parallel(items, fn_... | python | def runner(parallel, config):
"""Run functions, provided by string name, on multiple cores on the current machine.
"""
def run_parallel(fn_name, items):
items = [x for x in items if x is not None]
if len(items) == 0:
return []
items = diagnostics.track_parallel(items, fn_... | [
"def",
"runner",
"(",
"parallel",
",",
"config",
")",
":",
"def",
"run_parallel",
"(",
"fn_name",
",",
"items",
")",
":",
"items",
"=",
"[",
"x",
"for",
"x",
"in",
"items",
"if",
"x",
"is",
"not",
"None",
"]",
"if",
"len",
"(",
"items",
")",
"=="... | Run functions, provided by string name, on multiple cores on the current machine. | [
"Run",
"functions",
"provided",
"by",
"string",
"name",
"on",
"multiple",
"cores",
"on",
"the",
"current",
"machine",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/multi.py#L15-L29 |
224,012 | bcbio/bcbio-nextgen | bcbio/distributed/multi.py | zeromq_aware_logging | def zeromq_aware_logging(f):
"""Ensure multiprocessing logging uses ZeroMQ queues.
ZeroMQ and local stdout/stderr do not behave nicely when intertwined. This
ensures the local logging uses existing ZeroMQ logging queues.
"""
@functools.wraps(f)
def wrapper(*args, **kwargs):
config = Non... | python | def zeromq_aware_logging(f):
"""Ensure multiprocessing logging uses ZeroMQ queues.
ZeroMQ and local stdout/stderr do not behave nicely when intertwined. This
ensures the local logging uses existing ZeroMQ logging queues.
"""
@functools.wraps(f)
def wrapper(*args, **kwargs):
config = Non... | [
"def",
"zeromq_aware_logging",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"None",
"for",
"arg",
"in",
"args",
":",
"if",
"config_utils",
"... | Ensure multiprocessing logging uses ZeroMQ queues.
ZeroMQ and local stdout/stderr do not behave nicely when intertwined. This
ensures the local logging uses existing ZeroMQ logging queues. | [
"Ensure",
"multiprocessing",
"logging",
"uses",
"ZeroMQ",
"queues",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/multi.py#L39-L68 |
224,013 | bcbio/bcbio-nextgen | bcbio/distributed/multi.py | run_multicore | def run_multicore(fn, items, config, parallel=None):
"""Run the function using multiple cores on the given items to process.
"""
if len(items) == 0:
return []
if parallel is None or "num_jobs" not in parallel:
if parallel is None:
parallel = {"type": "local", "cores": config[... | python | def run_multicore(fn, items, config, parallel=None):
"""Run the function using multiple cores on the given items to process.
"""
if len(items) == 0:
return []
if parallel is None or "num_jobs" not in parallel:
if parallel is None:
parallel = {"type": "local", "cores": config[... | [
"def",
"run_multicore",
"(",
"fn",
",",
"items",
",",
"config",
",",
"parallel",
"=",
"None",
")",
":",
"if",
"len",
"(",
"items",
")",
"==",
"0",
":",
"return",
"[",
"]",
"if",
"parallel",
"is",
"None",
"or",
"\"num_jobs\"",
"not",
"in",
"parallel",... | Run the function using multiple cores on the given items to process. | [
"Run",
"the",
"function",
"using",
"multiple",
"cores",
"on",
"the",
"given",
"items",
"to",
"process",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/multi.py#L70-L89 |
224,014 | bcbio/bcbio-nextgen | scripts/bcbio_fastq_umi_prep.py | _add_umis_with_fastp | def _add_umis_with_fastp(read_fq, umi_fq, out_fq, cores):
"""Add UMIs to reads from separate UMI file using fastp.
"""
with utils.open_gzipsafe(umi_fq) as in_handle:
in_handle.readline() # name
umi_size = len(in_handle.readline().strip())
cmd = ("fastp -Q -A -L -G -w 1 --in1 {read_fq} -... | python | def _add_umis_with_fastp(read_fq, umi_fq, out_fq, cores):
"""Add UMIs to reads from separate UMI file using fastp.
"""
with utils.open_gzipsafe(umi_fq) as in_handle:
in_handle.readline() # name
umi_size = len(in_handle.readline().strip())
cmd = ("fastp -Q -A -L -G -w 1 --in1 {read_fq} -... | [
"def",
"_add_umis_with_fastp",
"(",
"read_fq",
",",
"umi_fq",
",",
"out_fq",
",",
"cores",
")",
":",
"with",
"utils",
".",
"open_gzipsafe",
"(",
"umi_fq",
")",
"as",
"in_handle",
":",
"in_handle",
".",
"readline",
"(",
")",
"# name",
"umi_size",
"=",
"len"... | Add UMIs to reads from separate UMI file using fastp. | [
"Add",
"UMIs",
"to",
"reads",
"from",
"separate",
"UMI",
"file",
"using",
"fastp",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_fastq_umi_prep.py#L117-L127 |
224,015 | bcbio/bcbio-nextgen | scripts/bcbio_fastq_umi_prep.py | _find_umi | def _find_umi(files):
"""Find UMI file using different naming schemes.
R1/R2/R3 => R1/R3 with R2 UMI
R1/R2/I1 => R1/R2 with I1 UMI
"""
base = os.path.basename(_commonprefix(files))
def _file_ext(f):
exts = utils.splitext_plus(os.path.basename(f).replace(base, ""))[0].split("_")
... | python | def _find_umi(files):
"""Find UMI file using different naming schemes.
R1/R2/R3 => R1/R3 with R2 UMI
R1/R2/I1 => R1/R2 with I1 UMI
"""
base = os.path.basename(_commonprefix(files))
def _file_ext(f):
exts = utils.splitext_plus(os.path.basename(f).replace(base, ""))[0].split("_")
... | [
"def",
"_find_umi",
"(",
"files",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"_commonprefix",
"(",
"files",
")",
")",
"def",
"_file_ext",
"(",
"f",
")",
":",
"exts",
"=",
"utils",
".",
"splitext_plus",
"(",
"os",
".",
"path",
"... | Find UMI file using different naming schemes.
R1/R2/R3 => R1/R3 with R2 UMI
R1/R2/I1 => R1/R2 with I1 UMI | [
"Find",
"UMI",
"file",
"using",
"different",
"naming",
"schemes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_fastq_umi_prep.py#L176-L194 |
224,016 | bcbio/bcbio-nextgen | scripts/bcbio_fastq_umi_prep.py | _commonprefix | def _commonprefix(files):
"""Retrieve a common prefix for files without extra _R1 _I1 extensions.
Allows alternative naming schemes (R1/R2/R3) (R1/R2/I1).
"""
out = os.path.commonprefix(files)
out = out.rstrip("_R")
out = out.rstrip("_I")
out = out.rstrip("_")
return out | python | def _commonprefix(files):
"""Retrieve a common prefix for files without extra _R1 _I1 extensions.
Allows alternative naming schemes (R1/R2/R3) (R1/R2/I1).
"""
out = os.path.commonprefix(files)
out = out.rstrip("_R")
out = out.rstrip("_I")
out = out.rstrip("_")
return out | [
"def",
"_commonprefix",
"(",
"files",
")",
":",
"out",
"=",
"os",
".",
"path",
".",
"commonprefix",
"(",
"files",
")",
"out",
"=",
"out",
".",
"rstrip",
"(",
"\"_R\"",
")",
"out",
"=",
"out",
".",
"rstrip",
"(",
"\"_I\"",
")",
"out",
"=",
"out",
... | Retrieve a common prefix for files without extra _R1 _I1 extensions.
Allows alternative naming schemes (R1/R2/R3) (R1/R2/I1). | [
"Retrieve",
"a",
"common",
"prefix",
"for",
"files",
"without",
"extra",
"_R1",
"_I1",
"extensions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_fastq_umi_prep.py#L196-L205 |
224,017 | bcbio/bcbio-nextgen | bcbio/variation/vfilter.py | cutoff_w_expression | def cutoff_w_expression(vcf_file, expression, data, name="+", filterext="",
extra_cmd="", limit_regions="variant_regions"):
"""Perform cutoff-based soft filtering using bcftools expressions like %QUAL < 20 || DP < 4.
"""
base, ext = utils.splitext_plus(vcf_file)
out_file = "{base}-... | python | def cutoff_w_expression(vcf_file, expression, data, name="+", filterext="",
extra_cmd="", limit_regions="variant_regions"):
"""Perform cutoff-based soft filtering using bcftools expressions like %QUAL < 20 || DP < 4.
"""
base, ext = utils.splitext_plus(vcf_file)
out_file = "{base}-... | [
"def",
"cutoff_w_expression",
"(",
"vcf_file",
",",
"expression",
",",
"data",
",",
"name",
"=",
"\"+\"",
",",
"filterext",
"=",
"\"\"",
",",
"extra_cmd",
"=",
"\"\"",
",",
"limit_regions",
"=",
"\"variant_regions\"",
")",
":",
"base",
",",
"ext",
"=",
"ut... | Perform cutoff-based soft filtering using bcftools expressions like %QUAL < 20 || DP < 4. | [
"Perform",
"cutoff",
"-",
"based",
"soft",
"filtering",
"using",
"bcftools",
"expressions",
"like",
"%QUAL",
"<",
"20",
"||",
"DP",
"<",
"4",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L21-L45 |
224,018 | bcbio/bcbio-nextgen | bcbio/variation/vfilter.py | _freebayes_custom | def _freebayes_custom(in_file, ref_file, data):
"""Custom FreeBayes filtering using bcbio.variation, tuned to human NA12878 results.
Experimental: for testing new methods.
"""
if vcfutils.get_paired_phenotype(data):
return None
config = data["config"]
bv_ver = programs.get_version("bcbi... | python | def _freebayes_custom(in_file, ref_file, data):
"""Custom FreeBayes filtering using bcbio.variation, tuned to human NA12878 results.
Experimental: for testing new methods.
"""
if vcfutils.get_paired_phenotype(data):
return None
config = data["config"]
bv_ver = programs.get_version("bcbi... | [
"def",
"_freebayes_custom",
"(",
"in_file",
",",
"ref_file",
",",
"data",
")",
":",
"if",
"vcfutils",
".",
"get_paired_phenotype",
"(",
"data",
")",
":",
"return",
"None",
"config",
"=",
"data",
"[",
"\"config\"",
"]",
"bv_ver",
"=",
"programs",
".",
"get_... | Custom FreeBayes filtering using bcbio.variation, tuned to human NA12878 results.
Experimental: for testing new methods. | [
"Custom",
"FreeBayes",
"filtering",
"using",
"bcbio",
".",
"variation",
"tuned",
"to",
"human",
"NA12878",
"results",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L56-L76 |
224,019 | bcbio/bcbio-nextgen | bcbio/variation/vfilter.py | _freebayes_cutoff | def _freebayes_cutoff(in_file, data):
"""Perform filtering of FreeBayes results, flagging low confidence calls.
Filters using cutoffs on low depth based on Meynert et al's work modeling sensitivity
of homozygote and heterozygote calling on depth:
http://www.ncbi.nlm.nih.gov/pubmed/23773188
and hi... | python | def _freebayes_cutoff(in_file, data):
"""Perform filtering of FreeBayes results, flagging low confidence calls.
Filters using cutoffs on low depth based on Meynert et al's work modeling sensitivity
of homozygote and heterozygote calling on depth:
http://www.ncbi.nlm.nih.gov/pubmed/23773188
and hi... | [
"def",
"_freebayes_cutoff",
"(",
"in_file",
",",
"data",
")",
":",
"if",
"not",
"vcfutils",
".",
"vcf_has_variants",
"(",
"in_file",
")",
":",
"base",
",",
"ext",
"=",
"utils",
".",
"splitext_plus",
"(",
"in_file",
")",
"out_file",
"=",
"\"{base}-filter{ext}... | Perform filtering of FreeBayes results, flagging low confidence calls.
Filters using cutoffs on low depth based on Meynert et al's work modeling sensitivity
of homozygote and heterozygote calling on depth:
http://www.ncbi.nlm.nih.gov/pubmed/23773188
and high depth heterozygote SNP filtering based on ... | [
"Perform",
"filtering",
"of",
"FreeBayes",
"results",
"flagging",
"low",
"confidence",
"calls",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L78-L112 |
224,020 | bcbio/bcbio-nextgen | bcbio/variation/vfilter.py | _calc_vcf_stats | def _calc_vcf_stats(in_file):
"""Calculate statistics on VCF for filtering, saving to a file for quick re-runs.
"""
out_file = "%s-stats.yaml" % utils.splitext_plus(in_file)[0]
if not utils.file_exists(out_file):
stats = {"avg_depth": _average_called_depth(in_file)}
with open(out_file, "... | python | def _calc_vcf_stats(in_file):
"""Calculate statistics on VCF for filtering, saving to a file for quick re-runs.
"""
out_file = "%s-stats.yaml" % utils.splitext_plus(in_file)[0]
if not utils.file_exists(out_file):
stats = {"avg_depth": _average_called_depth(in_file)}
with open(out_file, "... | [
"def",
"_calc_vcf_stats",
"(",
"in_file",
")",
":",
"out_file",
"=",
"\"%s-stats.yaml\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"in_file",
")",
"[",
"0",
"]",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"stats",
"=",
"{",
"\"a... | Calculate statistics on VCF for filtering, saving to a file for quick re-runs. | [
"Calculate",
"statistics",
"on",
"VCF",
"for",
"filtering",
"saving",
"to",
"a",
"file",
"for",
"quick",
"re",
"-",
"runs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L121-L133 |
224,021 | bcbio/bcbio-nextgen | bcbio/variation/vfilter.py | _average_called_depth | def _average_called_depth(in_file):
"""Retrieve the average depth of called reads in the provided VCF.
"""
import cyvcf2
depths = []
for rec in cyvcf2.VCF(str(in_file)):
d = rec.INFO.get("DP")
if d is not None:
depths.append(int(d))
if len(depths) > 0:
return ... | python | def _average_called_depth(in_file):
"""Retrieve the average depth of called reads in the provided VCF.
"""
import cyvcf2
depths = []
for rec in cyvcf2.VCF(str(in_file)):
d = rec.INFO.get("DP")
if d is not None:
depths.append(int(d))
if len(depths) > 0:
return ... | [
"def",
"_average_called_depth",
"(",
"in_file",
")",
":",
"import",
"cyvcf2",
"depths",
"=",
"[",
"]",
"for",
"rec",
"in",
"cyvcf2",
".",
"VCF",
"(",
"str",
"(",
"in_file",
")",
")",
":",
"d",
"=",
"rec",
".",
"INFO",
".",
"get",
"(",
"\"DP\"",
")"... | Retrieve the average depth of called reads in the provided VCF. | [
"Retrieve",
"the",
"average",
"depth",
"of",
"called",
"reads",
"in",
"the",
"provided",
"VCF",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L135-L147 |
224,022 | bcbio/bcbio-nextgen | bcbio/variation/vfilter.py | platypus | def platypus(in_file, data):
"""Filter Platypus calls, removing Q20 filter and replacing with depth and quality based filter.
Platypus uses its own VCF nomenclature: TC == DP, FR == AF
Platypus gVCF output appears to have an 0/1 index problem so the reference block
regions are 1 base outside regions o... | python | def platypus(in_file, data):
"""Filter Platypus calls, removing Q20 filter and replacing with depth and quality based filter.
Platypus uses its own VCF nomenclature: TC == DP, FR == AF
Platypus gVCF output appears to have an 0/1 index problem so the reference block
regions are 1 base outside regions o... | [
"def",
"platypus",
"(",
"in_file",
",",
"data",
")",
":",
"filters",
"=",
"(",
"'(FR[0] <= 0.5 && TC < 4 && %QUAL < 20) || '",
"'(TC < 13 && %QUAL < 10) || '",
"'(FR[0] > 0.5 && TC < 4 && %QUAL < 50)'",
")",
"limit_regions",
"=",
"\"variant_regions\"",
"if",
"not",
"vcfutils"... | Filter Platypus calls, removing Q20 filter and replacing with depth and quality based filter.
Platypus uses its own VCF nomenclature: TC == DP, FR == AF
Platypus gVCF output appears to have an 0/1 index problem so the reference block
regions are 1 base outside regions of interest. We avoid limiting region... | [
"Filter",
"Platypus",
"calls",
"removing",
"Q20",
"filter",
"and",
"replacing",
"with",
"depth",
"and",
"quality",
"based",
"filter",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L149-L163 |
224,023 | bcbio/bcbio-nextgen | bcbio/variation/vfilter.py | gatk_snp_cutoff | def gatk_snp_cutoff(in_file, data):
"""Perform cutoff-based soft filtering on GATK SNPs using best-practice recommendations.
We have a more lenient mapping quality (MQ) filter compared to GATK defaults.
The recommended filter (MQ < 40) is too stringent, so we adjust to 30:
http://imgur.com/a/oHRVB
... | python | def gatk_snp_cutoff(in_file, data):
"""Perform cutoff-based soft filtering on GATK SNPs using best-practice recommendations.
We have a more lenient mapping quality (MQ) filter compared to GATK defaults.
The recommended filter (MQ < 40) is too stringent, so we adjust to 30:
http://imgur.com/a/oHRVB
... | [
"def",
"gatk_snp_cutoff",
"(",
"in_file",
",",
"data",
")",
":",
"filters",
"=",
"[",
"\"MQRankSum < -12.5\"",
",",
"\"ReadPosRankSum < -8.0\"",
"]",
"# GATK Haplotype caller (v2.2) appears to have much larger HaplotypeScores",
"# resulting in excessive filtering, so avoid this metri... | Perform cutoff-based soft filtering on GATK SNPs using best-practice recommendations.
We have a more lenient mapping quality (MQ) filter compared to GATK defaults.
The recommended filter (MQ < 40) is too stringent, so we adjust to 30:
http://imgur.com/a/oHRVB
QD and FS are not calculated when generati... | [
"Perform",
"cutoff",
"-",
"based",
"soft",
"filtering",
"on",
"GATK",
"SNPs",
"using",
"best",
"-",
"practice",
"recommendations",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L183-L214 |
224,024 | bcbio/bcbio-nextgen | bcbio/bam/counts.py | random_regions | def random_regions(base, n, size):
"""Generate n random regions of 'size' in the provided base spread.
"""
spread = size // 2
base_info = collections.defaultdict(list)
for space, start, end in base:
base_info[space].append(start + spread)
base_info[space].append(end - spread)
reg... | python | def random_regions(base, n, size):
"""Generate n random regions of 'size' in the provided base spread.
"""
spread = size // 2
base_info = collections.defaultdict(list)
for space, start, end in base:
base_info[space].append(start + spread)
base_info[space].append(end - spread)
reg... | [
"def",
"random_regions",
"(",
"base",
",",
"n",
",",
"size",
")",
":",
"spread",
"=",
"size",
"//",
"2",
"base_info",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"space",
",",
"start",
",",
"end",
"in",
"base",
":",
"base_info",
... | Generate n random regions of 'size' in the provided base spread. | [
"Generate",
"n",
"random",
"regions",
"of",
"size",
"in",
"the",
"provided",
"base",
"spread",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/counts.py#L52-L65 |
224,025 | bcbio/bcbio-nextgen | bcbio/bam/counts.py | NormalizedBam.all_regions | def all_regions(self):
"""Get a tuple of all chromosome, start and end regions.
"""
regions = []
for sq in self._bam.header["SQ"]:
regions.append((sq["SN"], 1, int(sq["LN"])))
return regions | python | def all_regions(self):
"""Get a tuple of all chromosome, start and end regions.
"""
regions = []
for sq in self._bam.header["SQ"]:
regions.append((sq["SN"], 1, int(sq["LN"])))
return regions | [
"def",
"all_regions",
"(",
"self",
")",
":",
"regions",
"=",
"[",
"]",
"for",
"sq",
"in",
"self",
".",
"_bam",
".",
"header",
"[",
"\"SQ\"",
"]",
":",
"regions",
".",
"append",
"(",
"(",
"sq",
"[",
"\"SN\"",
"]",
",",
"1",
",",
"int",
"(",
"sq"... | Get a tuple of all chromosome, start and end regions. | [
"Get",
"a",
"tuple",
"of",
"all",
"chromosome",
"start",
"and",
"end",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/counts.py#L25-L31 |
224,026 | bcbio/bcbio-nextgen | bcbio/bam/counts.py | NormalizedBam.read_count | def read_count(self, space, start, end):
"""Retrieve the normalized read count in the provided region.
"""
read_counts = 0
for read in self._bam.fetch(space, start, end):
read_counts += 1
return self._normalize(read_counts, self._total) | python | def read_count(self, space, start, end):
"""Retrieve the normalized read count in the provided region.
"""
read_counts = 0
for read in self._bam.fetch(space, start, end):
read_counts += 1
return self._normalize(read_counts, self._total) | [
"def",
"read_count",
"(",
"self",
",",
"space",
",",
"start",
",",
"end",
")",
":",
"read_counts",
"=",
"0",
"for",
"read",
"in",
"self",
".",
"_bam",
".",
"fetch",
"(",
"space",
",",
"start",
",",
"end",
")",
":",
"read_counts",
"+=",
"1",
"return... | Retrieve the normalized read count in the provided region. | [
"Retrieve",
"the",
"normalized",
"read",
"count",
"in",
"the",
"provided",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/counts.py#L33-L39 |
224,027 | bcbio/bcbio-nextgen | bcbio/bam/counts.py | NormalizedBam.coverage_pileup | def coverage_pileup(self, space, start, end):
"""Retrieve pileup coverage across a specified region.
"""
return ((col.pos, self._normalize(col.n, self._total))
for col in self._bam.pileup(space, start, end)) | python | def coverage_pileup(self, space, start, end):
"""Retrieve pileup coverage across a specified region.
"""
return ((col.pos, self._normalize(col.n, self._total))
for col in self._bam.pileup(space, start, end)) | [
"def",
"coverage_pileup",
"(",
"self",
",",
"space",
",",
"start",
",",
"end",
")",
":",
"return",
"(",
"(",
"col",
".",
"pos",
",",
"self",
".",
"_normalize",
"(",
"col",
".",
"n",
",",
"self",
".",
"_total",
")",
")",
"for",
"col",
"in",
"self"... | Retrieve pileup coverage across a specified region. | [
"Retrieve",
"pileup",
"coverage",
"across",
"a",
"specified",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/counts.py#L41-L45 |
224,028 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _prepare_summary | def _prepare_summary(evolve_file, ssm_file, cnv_file, work_dir, somatic_info):
"""Prepare a summary with gene-labelled heterogeneity from PhyloWGS predictions.
"""
out_file = os.path.join(work_dir, "%s-phylowgs.txt" % somatic_info.tumor_name)
if not utils.file_uptodate(out_file, evolve_file):
wi... | python | def _prepare_summary(evolve_file, ssm_file, cnv_file, work_dir, somatic_info):
"""Prepare a summary with gene-labelled heterogeneity from PhyloWGS predictions.
"""
out_file = os.path.join(work_dir, "%s-phylowgs.txt" % somatic_info.tumor_name)
if not utils.file_uptodate(out_file, evolve_file):
wi... | [
"def",
"_prepare_summary",
"(",
"evolve_file",
",",
"ssm_file",
",",
"cnv_file",
",",
"work_dir",
",",
"somatic_info",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-phylowgs.txt\"",
"%",
"somatic_info",
".",
"tumor_name... | Prepare a summary with gene-labelled heterogeneity from PhyloWGS predictions. | [
"Prepare",
"a",
"summary",
"with",
"gene",
"-",
"labelled",
"heterogeneity",
"from",
"PhyloWGS",
"predictions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L39-L55 |
224,029 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _gids_to_genes | def _gids_to_genes(gids, ssm_locs, cnv_ssms, data):
"""Convert support ids for SNPs and SSMs into associated genes.
"""
locs = collections.defaultdict(set)
for gid in gids:
cur_locs = []
try:
cur_locs.append(ssm_locs[gid])
except KeyError:
for ssm_loc in c... | python | def _gids_to_genes(gids, ssm_locs, cnv_ssms, data):
"""Convert support ids for SNPs and SSMs into associated genes.
"""
locs = collections.defaultdict(set)
for gid in gids:
cur_locs = []
try:
cur_locs.append(ssm_locs[gid])
except KeyError:
for ssm_loc in c... | [
"def",
"_gids_to_genes",
"(",
"gids",
",",
"ssm_locs",
",",
"cnv_ssms",
",",
"data",
")",
":",
"locs",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"for",
"gid",
"in",
"gids",
":",
"cur_locs",
"=",
"[",
"]",
"try",
":",
"cur_locs",
".",
"... | Convert support ids for SNPs and SSMs into associated genes. | [
"Convert",
"support",
"ids",
"for",
"SNPs",
"and",
"SSMs",
"into",
"associated",
"genes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L57-L83 |
224,030 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _evolve_reader | def _evolve_reader(in_file):
"""Generate a list of region IDs and trees from a top_k_trees evolve.py file.
"""
cur_id_list = None
cur_tree = None
with open(in_file) as in_handle:
for line in in_handle:
if line.startswith("id,"):
if cur_id_list:
... | python | def _evolve_reader(in_file):
"""Generate a list of region IDs and trees from a top_k_trees evolve.py file.
"""
cur_id_list = None
cur_tree = None
with open(in_file) as in_handle:
for line in in_handle:
if line.startswith("id,"):
if cur_id_list:
... | [
"def",
"_evolve_reader",
"(",
"in_file",
")",
":",
"cur_id_list",
"=",
"None",
"cur_tree",
"=",
"None",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"in_handle",
":",
"if",
"line",
".",
"startswith",
"(",
"\"id,\"",
"... | Generate a list of region IDs and trees from a top_k_trees evolve.py file. | [
"Generate",
"a",
"list",
"of",
"region",
"IDs",
"and",
"trees",
"from",
"a",
"top_k_trees",
"evolve",
".",
"py",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L85-L112 |
224,031 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _read_cnv_ssms | def _read_cnv_ssms(in_file):
"""Map CNVs to associated SSMs
"""
out = {}
with open(in_file) as in_handle:
in_handle.readline() # header
for line in in_handle:
parts = line.strip().split()
if len(parts) > 3:
cnvid, _, _, ssms = parts
... | python | def _read_cnv_ssms(in_file):
"""Map CNVs to associated SSMs
"""
out = {}
with open(in_file) as in_handle:
in_handle.readline() # header
for line in in_handle:
parts = line.strip().split()
if len(parts) > 3:
cnvid, _, _, ssms = parts
... | [
"def",
"_read_cnv_ssms",
"(",
"in_file",
")",
":",
"out",
"=",
"{",
"}",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",
":",
"in_handle",
".",
"readline",
"(",
")",
"# header",
"for",
"line",
"in",
"in_handle",
":",
"parts",
"=",
"line",
".",
... | Map CNVs to associated SSMs | [
"Map",
"CNVs",
"to",
"associated",
"SSMs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L114-L125 |
224,032 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _read_ssm_locs | def _read_ssm_locs(in_file):
"""Map SSMs to chromosomal locations.
"""
out = {}
with open(in_file) as in_handle:
in_handle.readline() # header
for line in in_handle:
sid, loc = line.split()[:2]
chrom, pos = loc.split("_")
out[sid] = (chrom, int(pos))
... | python | def _read_ssm_locs(in_file):
"""Map SSMs to chromosomal locations.
"""
out = {}
with open(in_file) as in_handle:
in_handle.readline() # header
for line in in_handle:
sid, loc = line.split()[:2]
chrom, pos = loc.split("_")
out[sid] = (chrom, int(pos))
... | [
"def",
"_read_ssm_locs",
"(",
"in_file",
")",
":",
"out",
"=",
"{",
"}",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",
":",
"in_handle",
".",
"readline",
"(",
")",
"# header",
"for",
"line",
"in",
"in_handle",
":",
"sid",
",",
"loc",
"=",
"... | Map SSMs to chromosomal locations. | [
"Map",
"SSMs",
"to",
"chromosomal",
"locations",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L127-L137 |
224,033 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _run_evolve | def _run_evolve(ssm_file, cnv_file, work_dir, data):
"""Run evolve.py to infer subclonal composition.
"""
exe = os.path.join(os.path.dirname(sys.executable), "evolve.py")
assert os.path.exists(exe), "Could not find evolve script for PhyloWGS runs."
out_dir = os.path.join(work_dir, "evolve")
out_... | python | def _run_evolve(ssm_file, cnv_file, work_dir, data):
"""Run evolve.py to infer subclonal composition.
"""
exe = os.path.join(os.path.dirname(sys.executable), "evolve.py")
assert os.path.exists(exe), "Could not find evolve script for PhyloWGS runs."
out_dir = os.path.join(work_dir, "evolve")
out_... | [
"def",
"_run_evolve",
"(",
"ssm_file",
",",
"cnv_file",
",",
"work_dir",
",",
"data",
")",
":",
"exe",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"sys",
".",
"executable",
")",
",",
"\"evolve.py\"",
")",
"assert... | Run evolve.py to infer subclonal composition. | [
"Run",
"evolve",
".",
"py",
"to",
"infer",
"subclonal",
"composition",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L139-L151 |
224,034 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _prep_inputs | def _prep_inputs(vrn_info, cnv_info, somatic_info, work_dir, config):
"""Prepare inputs for running PhyloWGS from variant and CNV calls.
"""
exe = os.path.join(os.path.dirname(sys.executable), "create_phylowgs_inputs.py")
assert os.path.exists(exe), "Could not find input prep script for PhyloWGS runs."
... | python | def _prep_inputs(vrn_info, cnv_info, somatic_info, work_dir, config):
"""Prepare inputs for running PhyloWGS from variant and CNV calls.
"""
exe = os.path.join(os.path.dirname(sys.executable), "create_phylowgs_inputs.py")
assert os.path.exists(exe), "Could not find input prep script for PhyloWGS runs."
... | [
"def",
"_prep_inputs",
"(",
"vrn_info",
",",
"cnv_info",
",",
"somatic_info",
",",
"work_dir",
",",
"config",
")",
":",
"exe",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"sys",
".",
"executable",
")",
",",
"\"cr... | Prepare inputs for running PhyloWGS from variant and CNV calls. | [
"Prepare",
"inputs",
"for",
"running",
"PhyloWGS",
"from",
"variant",
"and",
"CNV",
"calls",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L153-L171 |
224,035 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _prep_cnv_file | def _prep_cnv_file(in_file, work_dir, somatic_info):
"""Prepare Battenberg CNV file for ingest by PhyloWGS.
The PhyloWGS preparation script does not handle 'chr' prefixed chromosomes (hg19 style)
correctly. This converts them over to GRCh37 (no 'chr') style to match preparation
work in _prep_vrn_file.
... | python | def _prep_cnv_file(in_file, work_dir, somatic_info):
"""Prepare Battenberg CNV file for ingest by PhyloWGS.
The PhyloWGS preparation script does not handle 'chr' prefixed chromosomes (hg19 style)
correctly. This converts them over to GRCh37 (no 'chr') style to match preparation
work in _prep_vrn_file.
... | [
"def",
"_prep_cnv_file",
"(",
"in_file",
",",
"work_dir",
",",
"somatic_info",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"%s-prep%s\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"os",
".",
"path",
".",
"basename",
... | Prepare Battenberg CNV file for ingest by PhyloWGS.
The PhyloWGS preparation script does not handle 'chr' prefixed chromosomes (hg19 style)
correctly. This converts them over to GRCh37 (no 'chr') style to match preparation
work in _prep_vrn_file. | [
"Prepare",
"Battenberg",
"CNV",
"file",
"for",
"ingest",
"by",
"PhyloWGS",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L173-L190 |
224,036 | bcbio/bcbio-nextgen | bcbio/heterogeneity/phylowgs.py | _prep_vrn_file | def _prep_vrn_file(in_file, vcaller, work_dir, somatic_info, ignore_file, config):
"""Create a variant file to feed into the PhyloWGS prep script, limiting records.
Sorts by depth, adding top covered samples up to the sample_size supported
by PhyloWGS. The logic is that the higher depth samples will have b... | python | def _prep_vrn_file(in_file, vcaller, work_dir, somatic_info, ignore_file, config):
"""Create a variant file to feed into the PhyloWGS prep script, limiting records.
Sorts by depth, adding top covered samples up to the sample_size supported
by PhyloWGS. The logic is that the higher depth samples will have b... | [
"def",
"_prep_vrn_file",
"(",
"in_file",
",",
"vcaller",
",",
"work_dir",
",",
"somatic_info",
",",
"ignore_file",
",",
"config",
")",
":",
"if",
"vcaller",
".",
"startswith",
"(",
"\"vardict\"",
")",
":",
"variant_type",
"=",
"\"vardict\"",
"elif",
"vcaller",... | Create a variant file to feed into the PhyloWGS prep script, limiting records.
Sorts by depth, adding top covered samples up to the sample_size supported
by PhyloWGS. The logic is that the higher depth samples will have better
resolution for frequency differences. More complex implementations could try
... | [
"Create",
"a",
"variant",
"file",
"to",
"feed",
"into",
"the",
"PhyloWGS",
"prep",
"script",
"limiting",
"records",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L197-L243 |
224,037 | bcbio/bcbio-nextgen | bcbio/srna/group.py | run_prepare | def run_prepare(*data):
"""
Run seqcluster prepare to merge all samples in one file
"""
out_dir = os.path.join(dd.get_work_dir(data[0][0]), "seqcluster", "prepare")
out_dir = os.path.abspath(safe_makedir(out_dir))
prepare_dir = os.path.join(out_dir, "prepare")
tools = dd.get_expression_calle... | python | def run_prepare(*data):
"""
Run seqcluster prepare to merge all samples in one file
"""
out_dir = os.path.join(dd.get_work_dir(data[0][0]), "seqcluster", "prepare")
out_dir = os.path.abspath(safe_makedir(out_dir))
prepare_dir = os.path.join(out_dir, "prepare")
tools = dd.get_expression_calle... | [
"def",
"run_prepare",
"(",
"*",
"data",
")",
":",
"out_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
")",
",",
"\"seqcluster\"",
",",
"\"prepare\"",
")",
"out_dir",
"=",
"os",
... | Run seqcluster prepare to merge all samples in one file | [
"Run",
"seqcluster",
"prepare",
"to",
"merge",
"all",
"samples",
"in",
"one",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L24-L56 |
224,038 | bcbio/bcbio-nextgen | bcbio/srna/group.py | run_align | def run_align(*data):
"""
Prepare data to run alignment step, only once for each project
"""
work_dir = dd.get_work_dir(data[0][0])
out_dir = op.join(work_dir, "seqcluster", "prepare")
seq_out = op.join(out_dir, "seqs.fastq")
bam_dir = op.join(work_dir, "align")
new_bam_file = op.join(ba... | python | def run_align(*data):
"""
Prepare data to run alignment step, only once for each project
"""
work_dir = dd.get_work_dir(data[0][0])
out_dir = op.join(work_dir, "seqcluster", "prepare")
seq_out = op.join(out_dir, "seqs.fastq")
bam_dir = op.join(work_dir, "align")
new_bam_file = op.join(ba... | [
"def",
"run_align",
"(",
"*",
"data",
")",
":",
"work_dir",
"=",
"dd",
".",
"get_work_dir",
"(",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"out_dir",
"=",
"op",
".",
"join",
"(",
"work_dir",
",",
"\"seqcluster\"",
",",
"\"prepare\"",
")",
"seq_out",... | Prepare data to run alignment step, only once for each project | [
"Prepare",
"data",
"to",
"run",
"alignment",
"step",
"only",
"once",
"for",
"each",
"project"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L58-L80 |
224,039 | bcbio/bcbio-nextgen | bcbio/srna/group.py | run_cluster | def run_cluster(*data):
"""
Run seqcluster cluster to detect smallRNA clusters
"""
sample = data[0][0]
tools = dd.get_expression_caller(data[0][0])
work_dir = dd.get_work_dir(sample)
out_dir = op.join(work_dir, "seqcluster", "cluster")
out_dir = op.abspath(safe_makedir(out_dir))
prep... | python | def run_cluster(*data):
"""
Run seqcluster cluster to detect smallRNA clusters
"""
sample = data[0][0]
tools = dd.get_expression_caller(data[0][0])
work_dir = dd.get_work_dir(sample)
out_dir = op.join(work_dir, "seqcluster", "cluster")
out_dir = op.abspath(safe_makedir(out_dir))
prep... | [
"def",
"run_cluster",
"(",
"*",
"data",
")",
":",
"sample",
"=",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
"tools",
"=",
"dd",
".",
"get_expression_caller",
"(",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"work_dir",
"=",
"dd",
".",
"get_work_dir",
"... | Run seqcluster cluster to detect smallRNA clusters | [
"Run",
"seqcluster",
"cluster",
"to",
"detect",
"smallRNA",
"clusters"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L82-L114 |
224,040 | bcbio/bcbio-nextgen | bcbio/srna/group.py | _cluster | def _cluster(bam_file, ma_file, out_dir, reference, annotation_file=None):
"""
Connect to seqcluster to run cluster with python directly
"""
seqcluster = op.join(get_bcbio_bin(), "seqcluster")
# cl = ["cluster", "-o", out_dir, "-m", ma_file, "-a", bam_file, "-r", reference]
if annotation_file:
... | python | def _cluster(bam_file, ma_file, out_dir, reference, annotation_file=None):
"""
Connect to seqcluster to run cluster with python directly
"""
seqcluster = op.join(get_bcbio_bin(), "seqcluster")
# cl = ["cluster", "-o", out_dir, "-m", ma_file, "-a", bam_file, "-r", reference]
if annotation_file:
... | [
"def",
"_cluster",
"(",
"bam_file",
",",
"ma_file",
",",
"out_dir",
",",
"reference",
",",
"annotation_file",
"=",
"None",
")",
":",
"seqcluster",
"=",
"op",
".",
"join",
"(",
"get_bcbio_bin",
"(",
")",
",",
"\"seqcluster\"",
")",
"# cl = [\"cluster\", \"-o\",... | Connect to seqcluster to run cluster with python directly | [
"Connect",
"to",
"seqcluster",
"to",
"run",
"cluster",
"with",
"python",
"directly"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L116-L133 |
224,041 | bcbio/bcbio-nextgen | bcbio/srna/group.py | _report | def _report(data, reference):
"""
Run report of seqcluster to get browser options for results
"""
seqcluster = op.join(get_bcbio_bin(), "seqcluster")
work_dir = dd.get_work_dir(data)
out_dir = safe_makedir(os.path.join(work_dir, "seqcluster", "report"))
out_file = op.join(out_dir, "seqcluste... | python | def _report(data, reference):
"""
Run report of seqcluster to get browser options for results
"""
seqcluster = op.join(get_bcbio_bin(), "seqcluster")
work_dir = dd.get_work_dir(data)
out_dir = safe_makedir(os.path.join(work_dir, "seqcluster", "report"))
out_file = op.join(out_dir, "seqcluste... | [
"def",
"_report",
"(",
"data",
",",
"reference",
")",
":",
"seqcluster",
"=",
"op",
".",
"join",
"(",
"get_bcbio_bin",
"(",
")",
",",
"\"seqcluster\"",
")",
"work_dir",
"=",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
"out_dir",
"=",
"safe_makedir",
"("... | Run report of seqcluster to get browser options for results | [
"Run",
"report",
"of",
"seqcluster",
"to",
"get",
"browser",
"options",
"for",
"results"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L135-L147 |
224,042 | bcbio/bcbio-nextgen | bcbio/srna/group.py | report | def report(data):
"""Create a Rmd report for small RNAseq analysis"""
work_dir = dd.get_work_dir(data[0][0])
out_dir = op.join(work_dir, "report")
safe_makedir(out_dir)
summary_file = op.join(out_dir, "summary.csv")
with file_transaction(summary_file) as out_tx:
with open(out_tx, 'w') as... | python | def report(data):
"""Create a Rmd report for small RNAseq analysis"""
work_dir = dd.get_work_dir(data[0][0])
out_dir = op.join(work_dir, "report")
safe_makedir(out_dir)
summary_file = op.join(out_dir, "summary.csv")
with file_transaction(summary_file) as out_tx:
with open(out_tx, 'w') as... | [
"def",
"report",
"(",
"data",
")",
":",
"work_dir",
"=",
"dd",
".",
"get_work_dir",
"(",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"out_dir",
"=",
"op",
".",
"join",
"(",
"work_dir",
",",
"\"report\"",
")",
"safe_makedir",
"(",
"out_dir",
")",
"su... | Create a Rmd report for small RNAseq analysis | [
"Create",
"a",
"Rmd",
"report",
"for",
"small",
"RNAseq",
"analysis"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L149-L165 |
224,043 | bcbio/bcbio-nextgen | bcbio/srna/group.py | _modify_report | def _modify_report(summary_path, out_dir):
"""Read Rmd template and dump with project path."""
summary_path = op.abspath(summary_path)
template = op.normpath(op.join(op.dirname(op.realpath(template_seqcluster.__file__)), "report.rmd"))
content = open(template).read()
out_content = string.Template(co... | python | def _modify_report(summary_path, out_dir):
"""Read Rmd template and dump with project path."""
summary_path = op.abspath(summary_path)
template = op.normpath(op.join(op.dirname(op.realpath(template_seqcluster.__file__)), "report.rmd"))
content = open(template).read()
out_content = string.Template(co... | [
"def",
"_modify_report",
"(",
"summary_path",
",",
"out_dir",
")",
":",
"summary_path",
"=",
"op",
".",
"abspath",
"(",
"summary_path",
")",
"template",
"=",
"op",
".",
"normpath",
"(",
"op",
".",
"join",
"(",
"op",
".",
"dirname",
"(",
"op",
".",
"rea... | Read Rmd template and dump with project path. | [
"Read",
"Rmd",
"template",
"and",
"dump",
"with",
"project",
"path",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L183-L192 |
224,044 | bcbio/bcbio-nextgen | bcbio/srna/group.py | _make_isomir_counts | def _make_isomir_counts(data, srna_type="seqbuster", out_dir=None, stem=""):
"""
Parse miraligner files to create count matrix.
"""
work_dir = dd.get_work_dir(data[0][0])
if not out_dir:
out_dir = op.join(work_dir, "mirbase")
out_novel_isomir = append_stem(op.join(out_dir, "counts.tsv"),... | python | def _make_isomir_counts(data, srna_type="seqbuster", out_dir=None, stem=""):
"""
Parse miraligner files to create count matrix.
"""
work_dir = dd.get_work_dir(data[0][0])
if not out_dir:
out_dir = op.join(work_dir, "mirbase")
out_novel_isomir = append_stem(op.join(out_dir, "counts.tsv"),... | [
"def",
"_make_isomir_counts",
"(",
"data",
",",
"srna_type",
"=",
"\"seqbuster\"",
",",
"out_dir",
"=",
"None",
",",
"stem",
"=",
"\"\"",
")",
":",
"work_dir",
"=",
"dd",
".",
"get_work_dir",
"(",
"data",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"if",
"not... | Parse miraligner files to create count matrix. | [
"Parse",
"miraligner",
"files",
"to",
"create",
"count",
"matrix",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/group.py#L194-L221 |
224,045 | bcbio/bcbio-nextgen | bcbio/bam/coverage.py | _split_regions | def _split_regions(chrom, start, end):
"""Split regions longer than 100kb into smaller sections.
"""
window_size = 1e5
if end - start < window_size * 5:
return [(chrom, start, end)]
else:
out = []
for r in pybedtools.BedTool().window_maker(w=window_size,
... | python | def _split_regions(chrom, start, end):
"""Split regions longer than 100kb into smaller sections.
"""
window_size = 1e5
if end - start < window_size * 5:
return [(chrom, start, end)]
else:
out = []
for r in pybedtools.BedTool().window_maker(w=window_size,
... | [
"def",
"_split_regions",
"(",
"chrom",
",",
"start",
",",
"end",
")",
":",
"window_size",
"=",
"1e5",
"if",
"end",
"-",
"start",
"<",
"window_size",
"*",
"5",
":",
"return",
"[",
"(",
"chrom",
",",
"start",
",",
"end",
")",
"]",
"else",
":",
"out",... | Split regions longer than 100kb into smaller sections. | [
"Split",
"regions",
"longer",
"than",
"100kb",
"into",
"smaller",
"sections",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/coverage.py#L96-L108 |
224,046 | bcbio/bcbio-nextgen | bcbio/bam/coverage.py | plot_multiple_regions_coverage | def plot_multiple_regions_coverage(samples, out_file, data, region_bed=None, stem_bed=None):
"""
given a list of bcbio samples and a bed file or BedTool of regions,
makes a plot of the coverage in the regions for the set of samples
if given a bed file or BedTool of locations in stem_bed with a label,
... | python | def plot_multiple_regions_coverage(samples, out_file, data, region_bed=None, stem_bed=None):
"""
given a list of bcbio samples and a bed file or BedTool of regions,
makes a plot of the coverage in the regions for the set of samples
if given a bed file or BedTool of locations in stem_bed with a label,
... | [
"def",
"plot_multiple_regions_coverage",
"(",
"samples",
",",
"out_file",
",",
"data",
",",
"region_bed",
"=",
"None",
",",
"stem_bed",
"=",
"None",
")",
":",
"mpl",
".",
"use",
"(",
"'Agg'",
",",
"force",
"=",
"True",
")",
"PAD",
"=",
"100",
"if",
"fi... | given a list of bcbio samples and a bed file or BedTool of regions,
makes a plot of the coverage in the regions for the set of samples
if given a bed file or BedTool of locations in stem_bed with a label,
plots lollipops at those locations | [
"given",
"a",
"list",
"of",
"bcbio",
"samples",
"and",
"a",
"bed",
"file",
"or",
"BedTool",
"of",
"regions",
"makes",
"a",
"plot",
"of",
"the",
"coverage",
"in",
"the",
"regions",
"for",
"the",
"set",
"of",
"samples"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/coverage.py#L110-L148 |
224,047 | bcbio/bcbio-nextgen | bcbio/variation/mutect.py | _config_params | def _config_params(base_config, assoc_files, region, out_file, items):
"""Add parameters based on configuration variables, associated files and genomic regions.
"""
params = []
dbsnp = assoc_files.get("dbsnp")
if dbsnp:
params += ["--dbsnp", dbsnp]
cosmic = assoc_files.get("cosmic")
... | python | def _config_params(base_config, assoc_files, region, out_file, items):
"""Add parameters based on configuration variables, associated files and genomic regions.
"""
params = []
dbsnp = assoc_files.get("dbsnp")
if dbsnp:
params += ["--dbsnp", dbsnp]
cosmic = assoc_files.get("cosmic")
... | [
"def",
"_config_params",
"(",
"base_config",
",",
"assoc_files",
",",
"region",
",",
"out_file",
",",
"items",
")",
":",
"params",
"=",
"[",
"]",
"dbsnp",
"=",
"assoc_files",
".",
"get",
"(",
"\"dbsnp\"",
")",
"if",
"dbsnp",
":",
"params",
"+=",
"[",
"... | Add parameters based on configuration variables, associated files and genomic regions. | [
"Add",
"parameters",
"based",
"on",
"configuration",
"variables",
"associated",
"files",
"and",
"genomic",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L46-L75 |
224,048 | bcbio/bcbio-nextgen | bcbio/variation/mutect.py | _mutect_call_prep | def _mutect_call_prep(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Preparation work for MuTect.
"""
base_config = items[0]["config"]
broad_runner = broad.runner_from_path("picard", base_config)
broad_runner.run_fn("picard_index_ref", ref_file)
... | python | def _mutect_call_prep(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Preparation work for MuTect.
"""
base_config = items[0]["config"]
broad_runner = broad.runner_from_path("picard", base_config)
broad_runner.run_fn("picard_index_ref", ref_file)
... | [
"def",
"_mutect_call_prep",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"base_config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
"broad_runner",
"=",
... | Preparation work for MuTect. | [
"Preparation",
"work",
"for",
"MuTect",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L77-L106 |
224,049 | bcbio/bcbio-nextgen | bcbio/variation/mutect.py | _SID_call_prep | def _SID_call_prep(align_bams, items, ref_file, assoc_files, region=None, out_file=None):
"""Preparation work for SomaticIndelDetector.
"""
base_config = items[0]["config"]
for x in align_bams:
bam.index(x, base_config)
params = ["-R", ref_file, "-T", "SomaticIndelDetector", "-U", "ALLOW_N_... | python | def _SID_call_prep(align_bams, items, ref_file, assoc_files, region=None, out_file=None):
"""Preparation work for SomaticIndelDetector.
"""
base_config = items[0]["config"]
for x in align_bams:
bam.index(x, base_config)
params = ["-R", ref_file, "-T", "SomaticIndelDetector", "-U", "ALLOW_N_... | [
"def",
"_SID_call_prep",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"base_config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
"for",
"x",
"in",
"al... | Preparation work for SomaticIndelDetector. | [
"Preparation",
"work",
"for",
"SomaticIndelDetector",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L191-L217 |
224,050 | bcbio/bcbio-nextgen | bcbio/variation/mutect.py | _fix_mutect_output | def _fix_mutect_output(orig_file, config, out_file, is_paired):
"""Adjust MuTect output to match other callers.
- Rename allelic fraction field in mutect output from FA to FREQ to standarize with other tools
- Remove extra 'none' samples introduced when calling tumor-only samples
"""
out_file_noc =... | python | def _fix_mutect_output(orig_file, config, out_file, is_paired):
"""Adjust MuTect output to match other callers.
- Rename allelic fraction field in mutect output from FA to FREQ to standarize with other tools
- Remove extra 'none' samples introduced when calling tumor-only samples
"""
out_file_noc =... | [
"def",
"_fix_mutect_output",
"(",
"orig_file",
",",
"config",
",",
"out_file",
",",
"is_paired",
")",
":",
"out_file_noc",
"=",
"out_file",
".",
"replace",
"(",
"\".vcf.gz\"",
",",
"\".vcf\"",
")",
"none_index",
"=",
"-",
"1",
"with",
"file_transaction",
"(",
... | Adjust MuTect output to match other callers.
- Rename allelic fraction field in mutect output from FA to FREQ to standarize with other tools
- Remove extra 'none' samples introduced when calling tumor-only samples | [
"Adjust",
"MuTect",
"output",
"to",
"match",
"other",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L219-L245 |
224,051 | bcbio/bcbio-nextgen | bcbio/variation/population.py | prep_gemini_db | def prep_gemini_db(fnames, call_info, samples, extras):
"""Prepare a gemini database from VCF inputs prepared with snpEff.
"""
data = samples[0]
name, caller, is_batch = call_info
build_type = _get_build_type(fnames, samples, caller)
out_dir = utils.safe_makedir(os.path.join(data["dirs"]["work"]... | python | def prep_gemini_db(fnames, call_info, samples, extras):
"""Prepare a gemini database from VCF inputs prepared with snpEff.
"""
data = samples[0]
name, caller, is_batch = call_info
build_type = _get_build_type(fnames, samples, caller)
out_dir = utils.safe_makedir(os.path.join(data["dirs"]["work"]... | [
"def",
"prep_gemini_db",
"(",
"fnames",
",",
"call_info",
",",
"samples",
",",
"extras",
")",
":",
"data",
"=",
"samples",
"[",
"0",
"]",
"name",
",",
"caller",
",",
"is_batch",
"=",
"call_info",
"build_type",
"=",
"_get_build_type",
"(",
"fnames",
",",
... | Prepare a gemini database from VCF inputs prepared with snpEff. | [
"Prepare",
"a",
"gemini",
"database",
"from",
"VCF",
"inputs",
"prepared",
"with",
"snpEff",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L25-L54 |
224,052 | bcbio/bcbio-nextgen | bcbio/variation/population.py | _back_compatible_gemini | def _back_compatible_gemini(conf_files, data):
"""Provide old install directory for configuration with GEMINI supplied tidy VCFs.
Handles new style (bcbio installed) and old style (GEMINI installed)
configuration and data locations.
"""
if vcfanno.is_human(data, builds=["37"]):
for f in con... | python | def _back_compatible_gemini(conf_files, data):
"""Provide old install directory for configuration with GEMINI supplied tidy VCFs.
Handles new style (bcbio installed) and old style (GEMINI installed)
configuration and data locations.
"""
if vcfanno.is_human(data, builds=["37"]):
for f in con... | [
"def",
"_back_compatible_gemini",
"(",
"conf_files",
",",
"data",
")",
":",
"if",
"vcfanno",
".",
"is_human",
"(",
"data",
",",
"builds",
"=",
"[",
"\"37\"",
"]",
")",
":",
"for",
"f",
"in",
"conf_files",
":",
"if",
"f",
"and",
"os",
".",
"path",
"."... | Provide old install directory for configuration with GEMINI supplied tidy VCFs.
Handles new style (bcbio installed) and old style (GEMINI installed)
configuration and data locations. | [
"Provide",
"old",
"install",
"directory",
"for",
"configuration",
"with",
"GEMINI",
"supplied",
"tidy",
"VCFs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L56-L71 |
224,053 | bcbio/bcbio-nextgen | bcbio/variation/population.py | run_vcfanno | def run_vcfanno(vcf_file, data, decomposed=False):
"""Run vcfanno, providing annotations from external databases if needed.
Puts together lua and conf files from multiple inputs by file names.
"""
conf_files = dd.get_vcfanno(data)
if conf_files:
with_basepaths = collections.defaultdict(list... | python | def run_vcfanno(vcf_file, data, decomposed=False):
"""Run vcfanno, providing annotations from external databases if needed.
Puts together lua and conf files from multiple inputs by file names.
"""
conf_files = dd.get_vcfanno(data)
if conf_files:
with_basepaths = collections.defaultdict(list... | [
"def",
"run_vcfanno",
"(",
"vcf_file",
",",
"data",
",",
"decomposed",
"=",
"False",
")",
":",
"conf_files",
"=",
"dd",
".",
"get_vcfanno",
"(",
"data",
")",
"if",
"conf_files",
":",
"with_basepaths",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")... | Run vcfanno, providing annotations from external databases if needed.
Puts together lua and conf files from multiple inputs by file names. | [
"Run",
"vcfanno",
"providing",
"annotations",
"from",
"external",
"databases",
"if",
"needed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L73-L123 |
224,054 | bcbio/bcbio-nextgen | bcbio/variation/population.py | get_ped_info | def get_ped_info(data, samples):
"""Retrieve all PED info from metadata
"""
family_id = tz.get_in(["metadata", "family_id"], data, None)
if not family_id:
family_id = _find_shared_batch(samples)
return {
"gender": {"male": 1, "female": 2, "unknown": 0}.get(get_gender(data)),
... | python | def get_ped_info(data, samples):
"""Retrieve all PED info from metadata
"""
family_id = tz.get_in(["metadata", "family_id"], data, None)
if not family_id:
family_id = _find_shared_batch(samples)
return {
"gender": {"male": 1, "female": 2, "unknown": 0}.get(get_gender(data)),
... | [
"def",
"get_ped_info",
"(",
"data",
",",
"samples",
")",
":",
"family_id",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"metadata\"",
",",
"\"family_id\"",
"]",
",",
"data",
",",
"None",
")",
"if",
"not",
"family_id",
":",
"family_id",
"=",
"_find_shared_batch",
... | Retrieve all PED info from metadata | [
"Retrieve",
"all",
"PED",
"info",
"from",
"metadata"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L224-L238 |
224,055 | bcbio/bcbio-nextgen | bcbio/variation/population.py | create_ped_file | def create_ped_file(samples, base_vcf, out_dir=None):
"""Create a GEMINI-compatible PED file, including gender, family and phenotype information.
Checks for a specified `ped` file in metadata, and will use sample information from this file
before reconstituting from metadata information.
"""
out_fi... | python | def create_ped_file(samples, base_vcf, out_dir=None):
"""Create a GEMINI-compatible PED file, including gender, family and phenotype information.
Checks for a specified `ped` file in metadata, and will use sample information from this file
before reconstituting from metadata information.
"""
out_fi... | [
"def",
"create_ped_file",
"(",
"samples",
",",
"base_vcf",
",",
"out_dir",
"=",
"None",
")",
":",
"out_file",
"=",
"\"%s.ped\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"base_vcf",
")",
"[",
"0",
"]",
"if",
"out_dir",
":",
"out_file",
"=",
"os",
".",
... | Create a GEMINI-compatible PED file, including gender, family and phenotype information.
Checks for a specified `ped` file in metadata, and will use sample information from this file
before reconstituting from metadata information. | [
"Create",
"a",
"GEMINI",
"-",
"compatible",
"PED",
"file",
"including",
"gender",
"family",
"and",
"phenotype",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L240-L278 |
224,056 | bcbio/bcbio-nextgen | bcbio/variation/population.py | _is_small_vcf | def _is_small_vcf(vcf_file):
"""Check for small VCFs which we want to analyze quicker.
"""
count = 0
small_thresh = 250
with utils.open_gzipsafe(vcf_file) as in_handle:
for line in in_handle:
if not line.startswith("#"):
count += 1
if count > small_thr... | python | def _is_small_vcf(vcf_file):
"""Check for small VCFs which we want to analyze quicker.
"""
count = 0
small_thresh = 250
with utils.open_gzipsafe(vcf_file) as in_handle:
for line in in_handle:
if not line.startswith("#"):
count += 1
if count > small_thr... | [
"def",
"_is_small_vcf",
"(",
"vcf_file",
")",
":",
"count",
"=",
"0",
"small_thresh",
"=",
"250",
"with",
"utils",
".",
"open_gzipsafe",
"(",
"vcf_file",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"in_handle",
":",
"if",
"not",
"line",
".",
"start... | Check for small VCFs which we want to analyze quicker. | [
"Check",
"for",
"small",
"VCFs",
"which",
"we",
"want",
"to",
"analyze",
"quicker",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L286-L297 |
224,057 | bcbio/bcbio-nextgen | bcbio/variation/population.py | get_multisample_vcf | def get_multisample_vcf(fnames, name, caller, data):
"""Retrieve a multiple sample VCF file in a standard location.
Handles inputs with multiple repeated input files from batches.
"""
unique_fnames = []
for f in fnames:
if f not in unique_fnames:
unique_fnames.append(f)
out_... | python | def get_multisample_vcf(fnames, name, caller, data):
"""Retrieve a multiple sample VCF file in a standard location.
Handles inputs with multiple repeated input files from batches.
"""
unique_fnames = []
for f in fnames:
if f not in unique_fnames:
unique_fnames.append(f)
out_... | [
"def",
"get_multisample_vcf",
"(",
"fnames",
",",
"name",
",",
"caller",
",",
"data",
")",
":",
"unique_fnames",
"=",
"[",
"]",
"for",
"f",
"in",
"fnames",
":",
"if",
"f",
"not",
"in",
"unique_fnames",
":",
"unique_fnames",
".",
"append",
"(",
"f",
")"... | Retrieve a multiple sample VCF file in a standard location.
Handles inputs with multiple repeated input files from batches. | [
"Retrieve",
"a",
"multiple",
"sample",
"VCF",
"file",
"in",
"a",
"standard",
"location",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L299-L324 |
224,058 | bcbio/bcbio-nextgen | bcbio/variation/population.py | get_gemini_files | def get_gemini_files(data):
"""Enumerate available gemini data files in a standard installation.
"""
try:
from gemini import annotations, config
except ImportError:
return {}
return {"base": config.read_gemini_config()["annotation_dir"],
"files": annotations.get_anno_file... | python | def get_gemini_files(data):
"""Enumerate available gemini data files in a standard installation.
"""
try:
from gemini import annotations, config
except ImportError:
return {}
return {"base": config.read_gemini_config()["annotation_dir"],
"files": annotations.get_anno_file... | [
"def",
"get_gemini_files",
"(",
"data",
")",
":",
"try",
":",
"from",
"gemini",
"import",
"annotations",
",",
"config",
"except",
"ImportError",
":",
"return",
"{",
"}",
"return",
"{",
"\"base\"",
":",
"config",
".",
"read_gemini_config",
"(",
")",
"[",
"\... | Enumerate available gemini data files in a standard installation. | [
"Enumerate",
"available",
"gemini",
"data",
"files",
"in",
"a",
"standard",
"installation",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L348-L356 |
224,059 | bcbio/bcbio-nextgen | bcbio/variation/population.py | _group_by_batches | def _group_by_batches(samples, check_fn):
"""Group data items into batches, providing details to retrieve results.
"""
batch_groups = collections.defaultdict(list)
singles = []
out_retrieve = []
extras = []
for data in [x[0] for x in samples]:
if check_fn(data):
batch = t... | python | def _group_by_batches(samples, check_fn):
"""Group data items into batches, providing details to retrieve results.
"""
batch_groups = collections.defaultdict(list)
singles = []
out_retrieve = []
extras = []
for data in [x[0] for x in samples]:
if check_fn(data):
batch = t... | [
"def",
"_group_by_batches",
"(",
"samples",
",",
"check_fn",
")",
":",
"batch_groups",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"singles",
"=",
"[",
"]",
"out_retrieve",
"=",
"[",
"]",
"extras",
"=",
"[",
"]",
"for",
"data",
"in",
"[",
... | Group data items into batches, providing details to retrieve results. | [
"Group",
"data",
"items",
"into",
"batches",
"providing",
"details",
"to",
"retrieve",
"results",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L358-L381 |
224,060 | bcbio/bcbio-nextgen | bcbio/variation/population.py | prep_db_parallel | def prep_db_parallel(samples, parallel_fn):
"""Prepares gemini databases in parallel, handling jointly called populations.
"""
batch_groups, singles, out_retrieve, extras = _group_by_batches(samples, _has_variant_calls)
to_process = []
has_batches = False
for (name, caller), info in batch_groups... | python | def prep_db_parallel(samples, parallel_fn):
"""Prepares gemini databases in parallel, handling jointly called populations.
"""
batch_groups, singles, out_retrieve, extras = _group_by_batches(samples, _has_variant_calls)
to_process = []
has_batches = False
for (name, caller), info in batch_groups... | [
"def",
"prep_db_parallel",
"(",
"samples",
",",
"parallel_fn",
")",
":",
"batch_groups",
",",
"singles",
",",
"out_retrieve",
",",
"extras",
"=",
"_group_by_batches",
"(",
"samples",
",",
"_has_variant_calls",
")",
"to_process",
"=",
"[",
"]",
"has_batches",
"="... | Prepares gemini databases in parallel, handling jointly called populations. | [
"Prepares",
"gemini",
"databases",
"in",
"parallel",
"handling",
"jointly",
"called",
"populations",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L389-L417 |
224,061 | bcbio/bcbio-nextgen | bcbio/workflow/stormseq.py | _get_s3_files | def _get_s3_files(local_dir, file_info, params):
"""Retrieve s3 files to local directory, handling STORMSeq inputs.
"""
assert len(file_info) == 1
files = file_info.values()[0]
fnames = []
for k in ["1", "2"]:
if files[k] not in fnames:
fnames.append(files[k])
out = []
... | python | def _get_s3_files(local_dir, file_info, params):
"""Retrieve s3 files to local directory, handling STORMSeq inputs.
"""
assert len(file_info) == 1
files = file_info.values()[0]
fnames = []
for k in ["1", "2"]:
if files[k] not in fnames:
fnames.append(files[k])
out = []
... | [
"def",
"_get_s3_files",
"(",
"local_dir",
",",
"file_info",
",",
"params",
")",
":",
"assert",
"len",
"(",
"file_info",
")",
"==",
"1",
"files",
"=",
"file_info",
".",
"values",
"(",
")",
"[",
"0",
"]",
"fnames",
"=",
"[",
"]",
"for",
"k",
"in",
"[... | Retrieve s3 files to local directory, handling STORMSeq inputs. | [
"Retrieve",
"s3",
"files",
"to",
"local",
"directory",
"handling",
"STORMSeq",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/stormseq.py#L22-L38 |
224,062 | bcbio/bcbio-nextgen | bcbio/pipeline/fastq.py | _gzip_fastq | def _gzip_fastq(in_file, out_dir=None):
"""
gzip a fastq file if it is not already gzipped, handling conversion
from bzip to gzipped files
"""
if fastq.is_fastq(in_file) and not objectstore.is_remote(in_file):
if utils.is_bzipped(in_file):
return _bzip_gzip(in_file, out_dir)
... | python | def _gzip_fastq(in_file, out_dir=None):
"""
gzip a fastq file if it is not already gzipped, handling conversion
from bzip to gzipped files
"""
if fastq.is_fastq(in_file) and not objectstore.is_remote(in_file):
if utils.is_bzipped(in_file):
return _bzip_gzip(in_file, out_dir)
... | [
"def",
"_gzip_fastq",
"(",
"in_file",
",",
"out_dir",
"=",
"None",
")",
":",
"if",
"fastq",
".",
"is_fastq",
"(",
"in_file",
")",
"and",
"not",
"objectstore",
".",
"is_remote",
"(",
"in_file",
")",
":",
"if",
"utils",
".",
"is_bzipped",
"(",
"in_file",
... | gzip a fastq file if it is not already gzipped, handling conversion
from bzip to gzipped files | [
"gzip",
"a",
"fastq",
"file",
"if",
"it",
"is",
"not",
"already",
"gzipped",
"handling",
"conversion",
"from",
"bzip",
"to",
"gzipped",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L51-L72 |
224,063 | bcbio/bcbio-nextgen | bcbio/pipeline/fastq.py | _pipeline_needs_fastq | def _pipeline_needs_fastq(config, data):
"""Determine if the pipeline can proceed with a BAM file, or needs fastq conversion.
"""
aligner = config["algorithm"].get("aligner")
support_bam = aligner in alignment.metadata.get("support_bam", [])
return aligner and not support_bam | python | def _pipeline_needs_fastq(config, data):
"""Determine if the pipeline can proceed with a BAM file, or needs fastq conversion.
"""
aligner = config["algorithm"].get("aligner")
support_bam = aligner in alignment.metadata.get("support_bam", [])
return aligner and not support_bam | [
"def",
"_pipeline_needs_fastq",
"(",
"config",
",",
"data",
")",
":",
"aligner",
"=",
"config",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"aligner\"",
")",
"support_bam",
"=",
"aligner",
"in",
"alignment",
".",
"metadata",
".",
"get",
"(",
"\"support_bam... | Determine if the pipeline can proceed with a BAM file, or needs fastq conversion. | [
"Determine",
"if",
"the",
"pipeline",
"can",
"proceed",
"with",
"a",
"BAM",
"file",
"or",
"needs",
"fastq",
"conversion",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L95-L100 |
224,064 | bcbio/bcbio-nextgen | bcbio/pipeline/fastq.py | convert_bam_to_fastq | def convert_bam_to_fastq(in_file, work_dir, data, dirs, config):
"""Convert BAM input file into FASTQ files.
"""
return alignprep.prep_fastq_inputs([in_file], data) | python | def convert_bam_to_fastq(in_file, work_dir, data, dirs, config):
"""Convert BAM input file into FASTQ files.
"""
return alignprep.prep_fastq_inputs([in_file], data) | [
"def",
"convert_bam_to_fastq",
"(",
"in_file",
",",
"work_dir",
",",
"data",
",",
"dirs",
",",
"config",
")",
":",
"return",
"alignprep",
".",
"prep_fastq_inputs",
"(",
"[",
"in_file",
"]",
",",
"data",
")"
] | Convert BAM input file into FASTQ files. | [
"Convert",
"BAM",
"input",
"file",
"into",
"FASTQ",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L103-L106 |
224,065 | bcbio/bcbio-nextgen | bcbio/pipeline/fastq.py | merge | def merge(files, out_file, config):
"""merge smartly fastq files. It recognizes paired fastq files."""
pair1 = [fastq_file[0] for fastq_file in files]
if len(files[0]) > 1:
path = splitext_plus(out_file)
pair1_out_file = path[0] + "_R1" + path[1]
pair2 = [fastq_file[1] for fastq_file... | python | def merge(files, out_file, config):
"""merge smartly fastq files. It recognizes paired fastq files."""
pair1 = [fastq_file[0] for fastq_file in files]
if len(files[0]) > 1:
path = splitext_plus(out_file)
pair1_out_file = path[0] + "_R1" + path[1]
pair2 = [fastq_file[1] for fastq_file... | [
"def",
"merge",
"(",
"files",
",",
"out_file",
",",
"config",
")",
":",
"pair1",
"=",
"[",
"fastq_file",
"[",
"0",
"]",
"for",
"fastq_file",
"in",
"files",
"]",
"if",
"len",
"(",
"files",
"[",
"0",
"]",
")",
">",
"1",
":",
"path",
"=",
"splitext_... | merge smartly fastq files. It recognizes paired fastq files. | [
"merge",
"smartly",
"fastq",
"files",
".",
"It",
"recognizes",
"paired",
"fastq",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L108-L120 |
224,066 | bcbio/bcbio-nextgen | bcbio/pipeline/fastq.py | _merge_list_fastqs | def _merge_list_fastqs(files, out_file, config):
"""merge list of fastq files into one"""
if not all(map(fastq.is_fastq, files)):
raise ValueError("Not all of the files to merge are fastq files: %s " % (files))
assert all(map(utils.file_exists, files)), ("Not all of the files to merge "
... | python | def _merge_list_fastqs(files, out_file, config):
"""merge list of fastq files into one"""
if not all(map(fastq.is_fastq, files)):
raise ValueError("Not all of the files to merge are fastq files: %s " % (files))
assert all(map(utils.file_exists, files)), ("Not all of the files to merge "
... | [
"def",
"_merge_list_fastqs",
"(",
"files",
",",
"out_file",
",",
"config",
")",
":",
"if",
"not",
"all",
"(",
"map",
"(",
"fastq",
".",
"is_fastq",
",",
"files",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"Not all of the files to merge are fastq files: %s \"",... | merge list of fastq files into one | [
"merge",
"list",
"of",
"fastq",
"files",
"into",
"one"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L122-L140 |
224,067 | bcbio/bcbio-nextgen | bcbio/bed/__init__.py | decomment | def decomment(bed_file, out_file):
"""
clean a BED file
"""
if file_exists(out_file):
return out_file
with utils.open_gzipsafe(bed_file) as in_handle, open(out_file, "w") as out_handle:
for line in in_handle:
if line.startswith("#") or line.startswith("browser") or line.... | python | def decomment(bed_file, out_file):
"""
clean a BED file
"""
if file_exists(out_file):
return out_file
with utils.open_gzipsafe(bed_file) as in_handle, open(out_file, "w") as out_handle:
for line in in_handle:
if line.startswith("#") or line.startswith("browser") or line.... | [
"def",
"decomment",
"(",
"bed_file",
",",
"out_file",
")",
":",
"if",
"file_exists",
"(",
"out_file",
")",
":",
"return",
"out_file",
"with",
"utils",
".",
"open_gzipsafe",
"(",
"bed_file",
")",
"as",
"in_handle",
",",
"open",
"(",
"out_file",
",",
"\"w\""... | clean a BED file | [
"clean",
"a",
"BED",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bed/__init__.py#L5-L18 |
224,068 | bcbio/bcbio-nextgen | bcbio/bed/__init__.py | concat | def concat(bed_files, catted=None):
"""
recursively concat a set of BED files, returning a
sorted bedtools object of the result
"""
bed_files = [x for x in bed_files if x]
if len(bed_files) == 0:
if catted:
# move to a .bed extension for downstream tools if not already
... | python | def concat(bed_files, catted=None):
"""
recursively concat a set of BED files, returning a
sorted bedtools object of the result
"""
bed_files = [x for x in bed_files if x]
if len(bed_files) == 0:
if catted:
# move to a .bed extension for downstream tools if not already
... | [
"def",
"concat",
"(",
"bed_files",
",",
"catted",
"=",
"None",
")",
":",
"bed_files",
"=",
"[",
"x",
"for",
"x",
"in",
"bed_files",
"if",
"x",
"]",
"if",
"len",
"(",
"bed_files",
")",
"==",
"0",
":",
"if",
"catted",
":",
"# move to a .bed extension for... | recursively concat a set of BED files, returning a
sorted bedtools object of the result | [
"recursively",
"concat",
"a",
"set",
"of",
"BED",
"files",
"returning",
"a",
"sorted",
"bedtools",
"object",
"of",
"the",
"result"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bed/__init__.py#L20-L44 |
224,069 | bcbio/bcbio-nextgen | bcbio/bed/__init__.py | merge | def merge(bedfiles):
"""
given a BED file or list of BED files merge them an return a bedtools object
"""
if isinstance(bedfiles, list):
catted = concat(bedfiles)
else:
catted = concat([bedfiles])
if catted:
return concat(bedfiles).sort().merge()
else:
return ... | python | def merge(bedfiles):
"""
given a BED file or list of BED files merge them an return a bedtools object
"""
if isinstance(bedfiles, list):
catted = concat(bedfiles)
else:
catted = concat([bedfiles])
if catted:
return concat(bedfiles).sort().merge()
else:
return ... | [
"def",
"merge",
"(",
"bedfiles",
")",
":",
"if",
"isinstance",
"(",
"bedfiles",
",",
"list",
")",
":",
"catted",
"=",
"concat",
"(",
"bedfiles",
")",
"else",
":",
"catted",
"=",
"concat",
"(",
"[",
"bedfiles",
"]",
")",
"if",
"catted",
":",
"return",... | given a BED file or list of BED files merge them an return a bedtools object | [
"given",
"a",
"BED",
"file",
"or",
"list",
"of",
"BED",
"files",
"merge",
"them",
"an",
"return",
"a",
"bedtools",
"object"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bed/__init__.py#L46-L57 |
224,070 | bcbio/bcbio-nextgen | bcbio/structural/hydra.py | select_unaligned_read_pairs | def select_unaligned_read_pairs(in_bam, extra, out_dir, config):
"""Retrieve unaligned read pairs from input alignment BAM, as two fastq files.
"""
runner = broad.runner_from_config(config)
base, ext = os.path.splitext(os.path.basename(in_bam))
nomap_bam = os.path.join(out_dir, "{}-{}{}".format(base... | python | def select_unaligned_read_pairs(in_bam, extra, out_dir, config):
"""Retrieve unaligned read pairs from input alignment BAM, as two fastq files.
"""
runner = broad.runner_from_config(config)
base, ext = os.path.splitext(os.path.basename(in_bam))
nomap_bam = os.path.join(out_dir, "{}-{}{}".format(base... | [
"def",
"select_unaligned_read_pairs",
"(",
"in_bam",
",",
"extra",
",",
"out_dir",
",",
"config",
")",
":",
"runner",
"=",
"broad",
".",
"runner_from_config",
"(",
"config",
")",
"base",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
"."... | Retrieve unaligned read pairs from input alignment BAM, as two fastq files. | [
"Retrieve",
"unaligned",
"read",
"pairs",
"from",
"input",
"alignment",
"BAM",
"as",
"two",
"fastq",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L22-L46 |
224,071 | bcbio/bcbio-nextgen | bcbio/structural/hydra.py | remove_nopairs | def remove_nopairs(in_bam, out_dir, config):
"""Remove any reads without both pairs present in the file.
"""
runner = broad.runner_from_config(config)
out_bam = os.path.join(out_dir, "{}-safepair{}".format(*os.path.splitext(os.path.basename(in_bam))))
if not utils.file_exists(out_bam):
read_... | python | def remove_nopairs(in_bam, out_dir, config):
"""Remove any reads without both pairs present in the file.
"""
runner = broad.runner_from_config(config)
out_bam = os.path.join(out_dir, "{}-safepair{}".format(*os.path.splitext(os.path.basename(in_bam))))
if not utils.file_exists(out_bam):
read_... | [
"def",
"remove_nopairs",
"(",
"in_bam",
",",
"out_dir",
",",
"config",
")",
":",
"runner",
"=",
"broad",
".",
"runner_from_config",
"(",
"config",
")",
"out_bam",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"{}-safepair{}\"",
".",
"format",... | Remove any reads without both pairs present in the file. | [
"Remove",
"any",
"reads",
"without",
"both",
"pairs",
"present",
"in",
"the",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L48-L65 |
224,072 | bcbio/bcbio-nextgen | bcbio/structural/hydra.py | tiered_alignment | def tiered_alignment(in_bam, tier_num, multi_mappers, extra_args,
genome_build, pair_stats,
work_dir, dirs, config):
"""Perform the alignment of non-mapped reads from previous tier.
"""
nomap_fq1, nomap_fq2 = select_unaligned_read_pairs(in_bam, "tier{}".format(tier_... | python | def tiered_alignment(in_bam, tier_num, multi_mappers, extra_args,
genome_build, pair_stats,
work_dir, dirs, config):
"""Perform the alignment of non-mapped reads from previous tier.
"""
nomap_fq1, nomap_fq2 = select_unaligned_read_pairs(in_bam, "tier{}".format(tier_... | [
"def",
"tiered_alignment",
"(",
"in_bam",
",",
"tier_num",
",",
"multi_mappers",
",",
"extra_args",
",",
"genome_build",
",",
"pair_stats",
",",
"work_dir",
",",
"dirs",
",",
"config",
")",
":",
"nomap_fq1",
",",
"nomap_fq2",
"=",
"select_unaligned_read_pairs",
... | Perform the alignment of non-mapped reads from previous tier. | [
"Perform",
"the",
"alignment",
"of",
"non",
"-",
"mapped",
"reads",
"from",
"previous",
"tier",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L68-L91 |
224,073 | bcbio/bcbio-nextgen | bcbio/structural/hydra.py | convert_bam_to_bed | def convert_bam_to_bed(in_bam, out_file):
"""Convert BAM to bed file using BEDTools.
"""
with file_transaction(out_file) as tx_out_file:
with open(tx_out_file, "w") as out_handle:
subprocess.check_call(["bamToBed", "-i", in_bam, "-tag", "NM"],
stdout=out... | python | def convert_bam_to_bed(in_bam, out_file):
"""Convert BAM to bed file using BEDTools.
"""
with file_transaction(out_file) as tx_out_file:
with open(tx_out_file, "w") as out_handle:
subprocess.check_call(["bamToBed", "-i", in_bam, "-tag", "NM"],
stdout=out... | [
"def",
"convert_bam_to_bed",
"(",
"in_bam",
",",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"out_file",
")",
"as",
"tx_out_file",
":",
"with",
"open",
"(",
"tx_out_file",
",",
"\"w\"",
")",
"as",
"out_handle",
":",
"subprocess",
".",
"check_call",
... | Convert BAM to bed file using BEDTools. | [
"Convert",
"BAM",
"to",
"bed",
"file",
"using",
"BEDTools",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L96-L103 |
224,074 | bcbio/bcbio-nextgen | bcbio/structural/hydra.py | hydra_breakpoints | def hydra_breakpoints(in_bam, pair_stats):
"""Detect structural variation breakpoints with hydra.
"""
in_bed = convert_bam_to_bed(in_bam)
if os.path.getsize(in_bed) > 0:
pair_bed = pair_discordants(in_bed, pair_stats)
dedup_bed = dedup_discordants(pair_bed)
return run_hydra(dedup... | python | def hydra_breakpoints(in_bam, pair_stats):
"""Detect structural variation breakpoints with hydra.
"""
in_bed = convert_bam_to_bed(in_bam)
if os.path.getsize(in_bed) > 0:
pair_bed = pair_discordants(in_bed, pair_stats)
dedup_bed = dedup_discordants(pair_bed)
return run_hydra(dedup... | [
"def",
"hydra_breakpoints",
"(",
"in_bam",
",",
"pair_stats",
")",
":",
"in_bed",
"=",
"convert_bam_to_bed",
"(",
"in_bam",
")",
"if",
"os",
".",
"path",
".",
"getsize",
"(",
"in_bed",
")",
">",
"0",
":",
"pair_bed",
"=",
"pair_discordants",
"(",
"in_bed",... | Detect structural variation breakpoints with hydra. | [
"Detect",
"structural",
"variation",
"breakpoints",
"with",
"hydra",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L135-L144 |
224,075 | bcbio/bcbio-nextgen | bcbio/structural/hydra.py | detect_sv | def detect_sv(align_bam, genome_build, dirs, config):
"""Detect structural variation from discordant aligned pairs.
"""
work_dir = utils.safe_makedir(os.path.join(dirs["work"], "structural"))
pair_stats = shared.calc_paired_insert_stats(align_bam)
fix_bam = remove_nopairs(align_bam, work_dir, config... | python | def detect_sv(align_bam, genome_build, dirs, config):
"""Detect structural variation from discordant aligned pairs.
"""
work_dir = utils.safe_makedir(os.path.join(dirs["work"], "structural"))
pair_stats = shared.calc_paired_insert_stats(align_bam)
fix_bam = remove_nopairs(align_bam, work_dir, config... | [
"def",
"detect_sv",
"(",
"align_bam",
",",
"genome_build",
",",
"dirs",
",",
"config",
")",
":",
"work_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dirs",
"[",
"\"work\"",
"]",
",",
"\"structural\"",
")",
")",
"pa... | Detect structural variation from discordant aligned pairs. | [
"Detect",
"structural",
"variation",
"from",
"discordant",
"aligned",
"pairs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L148-L162 |
224,076 | bcbio/bcbio-nextgen | bcbio/log/logbook_zmqpush.py | inject | def inject(**params):
"""
A Logbook processor to inject arbitrary information into log records.
Simply pass in keyword arguments and use as a context manager:
>>> with inject(identifier=str(uuid.uuid4())).applicationbound():
... logger.debug('Something happened')
"""
def call... | python | def inject(**params):
"""
A Logbook processor to inject arbitrary information into log records.
Simply pass in keyword arguments and use as a context manager:
>>> with inject(identifier=str(uuid.uuid4())).applicationbound():
... logger.debug('Something happened')
"""
def call... | [
"def",
"inject",
"(",
"*",
"*",
"params",
")",
":",
"def",
"callback",
"(",
"log_record",
")",
":",
"log_record",
".",
"extra",
".",
"update",
"(",
"params",
")",
"return",
"logbook",
".",
"Processor",
"(",
"callback",
")"
] | A Logbook processor to inject arbitrary information into log records.
Simply pass in keyword arguments and use as a context manager:
>>> with inject(identifier=str(uuid.uuid4())).applicationbound():
... logger.debug('Something happened') | [
"A",
"Logbook",
"processor",
"to",
"inject",
"arbitrary",
"information",
"into",
"log",
"records",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/log/logbook_zmqpush.py#L121-L134 |
224,077 | bcbio/bcbio-nextgen | bcbio/log/logbook_zmqpush.py | ZeroMQPullSubscriber.recv | def recv(self, timeout=None):
"""Overwrite standard recv for timeout calls to catch interrupt errors.
"""
if timeout:
try:
testsock = self._zmq.select([self.socket], [], [], timeout)[0]
except zmq.ZMQError as e:
if e.errno == errno.EINTR:
... | python | def recv(self, timeout=None):
"""Overwrite standard recv for timeout calls to catch interrupt errors.
"""
if timeout:
try:
testsock = self._zmq.select([self.socket], [], [], timeout)[0]
except zmq.ZMQError as e:
if e.errno == errno.EINTR:
... | [
"def",
"recv",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"timeout",
":",
"try",
":",
"testsock",
"=",
"self",
".",
"_zmq",
".",
"select",
"(",
"[",
"self",
".",
"socket",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"timeout",
")",
... | Overwrite standard recv for timeout calls to catch interrupt errors. | [
"Overwrite",
"standard",
"recv",
"for",
"timeout",
"calls",
"to",
"catch",
"interrupt",
"errors",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/log/logbook_zmqpush.py#L98-L114 |
224,078 | bcbio/bcbio-nextgen | bcbio/variation/pisces.py | run | def run(align_bams, items, ref_file, assoc_files, region=None, out_file=None):
"""Run tumor only pisces calling
Handles bgzipping output file and fixing VCF sample naming to match BAM sample.
"""
paired = vcfutils.get_paired_bams(align_bams, items)
assert paired and not paired.normal_bam, ("Pisces ... | python | def run(align_bams, items, ref_file, assoc_files, region=None, out_file=None):
"""Run tumor only pisces calling
Handles bgzipping output file and fixing VCF sample naming to match BAM sample.
"""
paired = vcfutils.get_paired_bams(align_bams, items)
assert paired and not paired.normal_bam, ("Pisces ... | [
"def",
"run",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"paired",
"=",
"vcfutils",
".",
"get_paired_bams",
"(",
"align_bams",
",",
"items",
")",
"assert",
"pa... | Run tumor only pisces calling
Handles bgzipping output file and fixing VCF sample naming to match BAM sample. | [
"Run",
"tumor",
"only",
"pisces",
"calling"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/pisces.py#L17-L54 |
224,079 | bcbio/bcbio-nextgen | bcbio/variation/pisces.py | _prep_genome | def _prep_genome(out_dir, data):
"""Create prepped reference directory for pisces.
Requires a custom GenomeSize.xml file present.
"""
genome_name = utils.splitext_plus(os.path.basename(dd.get_ref_file(data)))[0]
out_dir = utils.safe_makedir(os.path.join(out_dir, genome_name))
ref_file = dd.get_... | python | def _prep_genome(out_dir, data):
"""Create prepped reference directory for pisces.
Requires a custom GenomeSize.xml file present.
"""
genome_name = utils.splitext_plus(os.path.basename(dd.get_ref_file(data)))[0]
out_dir = utils.safe_makedir(os.path.join(out_dir, genome_name))
ref_file = dd.get_... | [
"def",
"_prep_genome",
"(",
"out_dir",
",",
"data",
")",
":",
"genome_name",
"=",
"utils",
".",
"splitext_plus",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
")",
")",
"[",
"0",
"]",
"out_dir",
"=",
"util... | Create prepped reference directory for pisces.
Requires a custom GenomeSize.xml file present. | [
"Create",
"prepped",
"reference",
"directory",
"for",
"pisces",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/pisces.py#L56-L73 |
224,080 | bcbio/bcbio-nextgen | bcbio/variation/deepvariant.py | run | def run(align_bams, items, ref_file, assoc_files, region, out_file):
"""Return DeepVariant calling on germline samples.
region can be a single region or list of multiple regions for multicore calling.
"""
assert not vcfutils.is_paired_analysis(align_bams, items), \
("DeepVariant currently only ... | python | def run(align_bams, items, ref_file, assoc_files, region, out_file):
"""Return DeepVariant calling on germline samples.
region can be a single region or list of multiple regions for multicore calling.
"""
assert not vcfutils.is_paired_analysis(align_bams, items), \
("DeepVariant currently only ... | [
"def",
"run",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
",",
"out_file",
")",
":",
"assert",
"not",
"vcfutils",
".",
"is_paired_analysis",
"(",
"align_bams",
",",
"items",
")",
",",
"(",
"\"DeepVariant currently only ... | Return DeepVariant calling on germline samples.
region can be a single region or list of multiple regions for multicore calling. | [
"Return",
"DeepVariant",
"calling",
"on",
"germline",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L12-L25 |
224,081 | bcbio/bcbio-nextgen | bcbio/variation/deepvariant.py | _run_germline | def _run_germline(bam_file, data, ref_file, region, out_file):
"""Single sample germline variant calling.
"""
work_dir = utils.safe_makedir("%s-work" % utils.splitext_plus(out_file)[0])
region_bed = strelka2.get_region_bed(region, [data], out_file, want_gzip=False)
example_dir = _make_examples(bam_f... | python | def _run_germline(bam_file, data, ref_file, region, out_file):
"""Single sample germline variant calling.
"""
work_dir = utils.safe_makedir("%s-work" % utils.splitext_plus(out_file)[0])
region_bed = strelka2.get_region_bed(region, [data], out_file, want_gzip=False)
example_dir = _make_examples(bam_f... | [
"def",
"_run_germline",
"(",
"bam_file",
",",
"data",
",",
"ref_file",
",",
"region",
",",
"out_file",
")",
":",
"work_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"\"%s-work\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"out_file",
")",
"[",
"0",
"]",
"... | Single sample germline variant calling. | [
"Single",
"sample",
"germline",
"variant",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L27-L37 |
224,082 | bcbio/bcbio-nextgen | bcbio/variation/deepvariant.py | _make_examples | def _make_examples(bam_file, data, ref_file, region_bed, out_file, work_dir):
"""Create example pileup images to feed into variant calling.
"""
log_dir = utils.safe_makedir(os.path.join(work_dir, "log"))
example_dir = utils.safe_makedir(os.path.join(work_dir, "examples"))
if len(glob.glob(os.path.jo... | python | def _make_examples(bam_file, data, ref_file, region_bed, out_file, work_dir):
"""Create example pileup images to feed into variant calling.
"""
log_dir = utils.safe_makedir(os.path.join(work_dir, "log"))
example_dir = utils.safe_makedir(os.path.join(work_dir, "examples"))
if len(glob.glob(os.path.jo... | [
"def",
"_make_examples",
"(",
"bam_file",
",",
"data",
",",
"ref_file",
",",
"region_bed",
",",
"out_file",
",",
"work_dir",
")",
":",
"log_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"log\"",
")"... | Create example pileup images to feed into variant calling. | [
"Create",
"example",
"pileup",
"images",
"to",
"feed",
"into",
"variant",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L42-L55 |
224,083 | bcbio/bcbio-nextgen | bcbio/variation/deepvariant.py | _call_variants | def _call_variants(example_dir, region_bed, data, out_file):
"""Call variants from prepared pileup examples, creating tensorflow record file.
"""
tf_out_file = "%s-tfrecord.gz" % utils.splitext_plus(out_file)[0]
if not utils.file_exists(tf_out_file):
with file_transaction(data, tf_out_file) as t... | python | def _call_variants(example_dir, region_bed, data, out_file):
"""Call variants from prepared pileup examples, creating tensorflow record file.
"""
tf_out_file = "%s-tfrecord.gz" % utils.splitext_plus(out_file)[0]
if not utils.file_exists(tf_out_file):
with file_transaction(data, tf_out_file) as t... | [
"def",
"_call_variants",
"(",
"example_dir",
",",
"region_bed",
",",
"data",
",",
"out_file",
")",
":",
"tf_out_file",
"=",
"\"%s-tfrecord.gz\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"out_file",
")",
"[",
"0",
"]",
"if",
"not",
"utils",
".",
"file_exists... | Call variants from prepared pileup examples, creating tensorflow record file. | [
"Call",
"variants",
"from",
"prepared",
"pileup",
"examples",
"creating",
"tensorflow",
"record",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L57-L68 |
224,084 | bcbio/bcbio-nextgen | bcbio/variation/deepvariant.py | _postprocess_variants | def _postprocess_variants(record_file, data, ref_file, out_file):
"""Post-process variants, converting into standard VCF file.
"""
if not utils.file_uptodate(out_file, record_file):
with file_transaction(data, out_file) as tx_out_file:
cmd = ["dv_postprocess_variants.py", "--ref", ref_fi... | python | def _postprocess_variants(record_file, data, ref_file, out_file):
"""Post-process variants, converting into standard VCF file.
"""
if not utils.file_uptodate(out_file, record_file):
with file_transaction(data, out_file) as tx_out_file:
cmd = ["dv_postprocess_variants.py", "--ref", ref_fi... | [
"def",
"_postprocess_variants",
"(",
"record_file",
",",
"data",
",",
"ref_file",
",",
"out_file",
")",
":",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"record_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
... | Post-process variants, converting into standard VCF file. | [
"Post",
"-",
"process",
"variants",
"converting",
"into",
"standard",
"VCF",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L70-L78 |
224,085 | bcbio/bcbio-nextgen | bcbio/qc/qsignature.py | run | def run(bam_file, data, out_dir):
""" Run SignatureGenerator to create normalize vcf that later will be input of qsignature_summary
:param bam_file: (str) path of the bam_file
:param data: (list) list containing the all the dictionary
for this sample
:param out_dir: (str) path of t... | python | def run(bam_file, data, out_dir):
""" Run SignatureGenerator to create normalize vcf that later will be input of qsignature_summary
:param bam_file: (str) path of the bam_file
:param data: (list) list containing the all the dictionary
for this sample
:param out_dir: (str) path of t... | [
"def",
"run",
"(",
"bam_file",
",",
"data",
",",
"out_dir",
")",
":",
"qsig",
"=",
"config_utils",
".",
"get_program",
"(",
"\"qsignature\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"res_qsig",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"qsignature\... | Run SignatureGenerator to create normalize vcf that later will be input of qsignature_summary
:param bam_file: (str) path of the bam_file
:param data: (list) list containing the all the dictionary
for this sample
:param out_dir: (str) path of the output
:returns: (string) output n... | [
"Run",
"SignatureGenerator",
"to",
"create",
"normalize",
"vcf",
"that",
"later",
"will",
"be",
"input",
"of",
"qsignature_summary"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L20-L69 |
224,086 | bcbio/bcbio-nextgen | bcbio/qc/qsignature.py | summary | def summary(*samples):
"""Run SignatureCompareRelatedSimple module from qsignature tool.
Creates a matrix of pairwise comparison among samples. The
function will not run if the output exists
:param samples: list with only one element containing all samples information
:returns: (dict) with the pat... | python | def summary(*samples):
"""Run SignatureCompareRelatedSimple module from qsignature tool.
Creates a matrix of pairwise comparison among samples. The
function will not run if the output exists
:param samples: list with only one element containing all samples information
:returns: (dict) with the pat... | [
"def",
"summary",
"(",
"*",
"samples",
")",
":",
"warnings",
",",
"similar",
"=",
"[",
"]",
",",
"[",
"]",
"qsig",
"=",
"config_utils",
".",
"get_program",
"(",
"\"qsignature\"",
",",
"samples",
"[",
"0",
"]",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
... | Run SignatureCompareRelatedSimple module from qsignature tool.
Creates a matrix of pairwise comparison among samples. The
function will not run if the output exists
:param samples: list with only one element containing all samples information
:returns: (dict) with the path of the output to be joined t... | [
"Run",
"SignatureCompareRelatedSimple",
"module",
"from",
"qsignature",
"tool",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L71-L118 |
224,087 | bcbio/bcbio-nextgen | bcbio/qc/qsignature.py | _parse_qsignature_output | def _parse_qsignature_output(in_file, out_file, warning_file, data):
""" Parse xml file produced by qsignature
:param in_file: (str) with the path to the xml file
:param out_file: (str) with the path to output file
:param warning_file: (str) with the path to warning file
:returns: (list) with samp... | python | def _parse_qsignature_output(in_file, out_file, warning_file, data):
""" Parse xml file produced by qsignature
:param in_file: (str) with the path to the xml file
:param out_file: (str) with the path to output file
:param warning_file: (str) with the path to warning file
:returns: (list) with samp... | [
"def",
"_parse_qsignature_output",
"(",
"in_file",
",",
"out_file",
",",
"warning_file",
",",
"data",
")",
":",
"name",
"=",
"{",
"}",
"error",
",",
"warnings",
",",
"similar",
"=",
"set",
"(",
")",
",",
"set",
"(",
")",
",",
"set",
"(",
")",
"same",... | Parse xml file produced by qsignature
:param in_file: (str) with the path to the xml file
:param out_file: (str) with the path to output file
:param warning_file: (str) with the path to warning file
:returns: (list) with samples that could be duplicated | [
"Parse",
"xml",
"file",
"produced",
"by",
"qsignature"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L125-L166 |
224,088 | bcbio/bcbio-nextgen | bcbio/qc/qsignature.py | _slice_bam_chr21 | def _slice_bam_chr21(in_bam, data):
"""
return only one BAM file with only chromosome 21
"""
sambamba = config_utils.get_program("sambamba", data["config"])
out_file = "%s-chr%s" % os.path.splitext(in_bam)
if not utils.file_exists(out_file):
bam.index(in_bam, data['config'])
with... | python | def _slice_bam_chr21(in_bam, data):
"""
return only one BAM file with only chromosome 21
"""
sambamba = config_utils.get_program("sambamba", data["config"])
out_file = "%s-chr%s" % os.path.splitext(in_bam)
if not utils.file_exists(out_file):
bam.index(in_bam, data['config'])
with... | [
"def",
"_slice_bam_chr21",
"(",
"in_bam",
",",
"data",
")",
":",
"sambamba",
"=",
"config_utils",
".",
"get_program",
"(",
"\"sambamba\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"out_file",
"=",
"\"%s-chr%s\"",
"%",
"os",
".",
"path",
".",
"splitext",
"... | return only one BAM file with only chromosome 21 | [
"return",
"only",
"one",
"BAM",
"file",
"with",
"only",
"chromosome",
"21"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L168-L184 |
224,089 | bcbio/bcbio-nextgen | bcbio/qc/qsignature.py | _slice_vcf_chr21 | def _slice_vcf_chr21(vcf_file, out_dir):
"""
Slice chr21 of qsignature SNPs to reduce computation time
"""
tmp_file = os.path.join(out_dir, "chr21_qsignature.vcf")
if not utils.file_exists(tmp_file):
cmd = ("grep chr21 {vcf_file} > {tmp_file}").format(**locals())
out = subprocess.che... | python | def _slice_vcf_chr21(vcf_file, out_dir):
"""
Slice chr21 of qsignature SNPs to reduce computation time
"""
tmp_file = os.path.join(out_dir, "chr21_qsignature.vcf")
if not utils.file_exists(tmp_file):
cmd = ("grep chr21 {vcf_file} > {tmp_file}").format(**locals())
out = subprocess.che... | [
"def",
"_slice_vcf_chr21",
"(",
"vcf_file",
",",
"out_dir",
")",
":",
"tmp_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"chr21_qsignature.vcf\"",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"tmp_file",
")",
":",
"cmd",
"=",
... | Slice chr21 of qsignature SNPs to reduce computation time | [
"Slice",
"chr21",
"of",
"qsignature",
"SNPs",
"to",
"reduce",
"computation",
"time"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L186-L194 |
224,090 | bcbio/bcbio-nextgen | bcbio/variation/vcfanno.py | _combine_files | def _combine_files(orig_files, base_out_file, data, fill_paths=True):
"""Combine multiple input files, fixing file paths if needed.
We fill in full paths from files in the data dictionary if we're
not using basepath (old style GEMINI).
"""
orig_files = [x for x in orig_files if x and utils.file_exi... | python | def _combine_files(orig_files, base_out_file, data, fill_paths=True):
"""Combine multiple input files, fixing file paths if needed.
We fill in full paths from files in the data dictionary if we're
not using basepath (old style GEMINI).
"""
orig_files = [x for x in orig_files if x and utils.file_exi... | [
"def",
"_combine_files",
"(",
"orig_files",
",",
"base_out_file",
",",
"data",
",",
"fill_paths",
"=",
"True",
")",
":",
"orig_files",
"=",
"[",
"x",
"for",
"x",
"in",
"orig_files",
"if",
"x",
"and",
"utils",
".",
"file_exists",
"(",
"x",
")",
"]",
"if... | Combine multiple input files, fixing file paths if needed.
We fill in full paths from files in the data dictionary if we're
not using basepath (old style GEMINI). | [
"Combine",
"multiple",
"input",
"files",
"fixing",
"file",
"paths",
"if",
"needed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L47-L66 |
224,091 | bcbio/bcbio-nextgen | bcbio/variation/vcfanno.py | _fill_file_path | def _fill_file_path(line, data):
"""Fill in a full file path in the configuration file from data dictionary.
"""
def _find_file(xs, target):
if isinstance(xs, dict):
for v in xs.values():
f = _find_file(v, target)
if f:
return f
... | python | def _fill_file_path(line, data):
"""Fill in a full file path in the configuration file from data dictionary.
"""
def _find_file(xs, target):
if isinstance(xs, dict):
for v in xs.values():
f = _find_file(v, target)
if f:
return f
... | [
"def",
"_fill_file_path",
"(",
"line",
",",
"data",
")",
":",
"def",
"_find_file",
"(",
"xs",
",",
"target",
")",
":",
"if",
"isinstance",
"(",
"xs",
",",
"dict",
")",
":",
"for",
"v",
"in",
"xs",
".",
"values",
"(",
")",
":",
"f",
"=",
"_find_fi... | Fill in a full file path in the configuration file from data dictionary. | [
"Fill",
"in",
"a",
"full",
"file",
"path",
"in",
"the",
"configuration",
"file",
"from",
"data",
"dictionary",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L68-L89 |
224,092 | bcbio/bcbio-nextgen | bcbio/variation/vcfanno.py | find_annotations | def find_annotations(data, retriever=None):
"""Find annotation configuration files for vcfanno, using pre-installed inputs.
Creates absolute paths for user specified inputs and finds locally
installed defaults.
Default annotations:
- gemini for variant pipelines
- somatic for variant tumor... | python | def find_annotations(data, retriever=None):
"""Find annotation configuration files for vcfanno, using pre-installed inputs.
Creates absolute paths for user specified inputs and finds locally
installed defaults.
Default annotations:
- gemini for variant pipelines
- somatic for variant tumor... | [
"def",
"find_annotations",
"(",
"data",
",",
"retriever",
"=",
"None",
")",
":",
"conf_files",
"=",
"dd",
".",
"get_vcfanno",
"(",
"data",
")",
"if",
"not",
"isinstance",
"(",
"conf_files",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"conf_files",
"... | Find annotation configuration files for vcfanno, using pre-installed inputs.
Creates absolute paths for user specified inputs and finds locally
installed defaults.
Default annotations:
- gemini for variant pipelines
- somatic for variant tumor pipelines
- rnaedit for RNA-seq variant call... | [
"Find",
"annotation",
"configuration",
"files",
"for",
"vcfanno",
"using",
"pre",
"-",
"installed",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L91-L137 |
224,093 | bcbio/bcbio-nextgen | bcbio/variation/vcfanno.py | annotate_gemini | def annotate_gemini(data, retriever=None):
"""Annotate with population calls if have data installed.
"""
r = dd.get_variation_resources(data)
return all([r.get(k) and objectstore.file_exists_or_remote(r[k]) for k in ["exac", "gnomad_exome"]]) | python | def annotate_gemini(data, retriever=None):
"""Annotate with population calls if have data installed.
"""
r = dd.get_variation_resources(data)
return all([r.get(k) and objectstore.file_exists_or_remote(r[k]) for k in ["exac", "gnomad_exome"]]) | [
"def",
"annotate_gemini",
"(",
"data",
",",
"retriever",
"=",
"None",
")",
":",
"r",
"=",
"dd",
".",
"get_variation_resources",
"(",
"data",
")",
"return",
"all",
"(",
"[",
"r",
".",
"get",
"(",
"k",
")",
"and",
"objectstore",
".",
"file_exists_or_remote... | Annotate with population calls if have data installed. | [
"Annotate",
"with",
"population",
"calls",
"if",
"have",
"data",
"installed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L150-L154 |
224,094 | bcbio/bcbio-nextgen | bcbio/variation/vcfanno.py | _annotate_somatic | def _annotate_somatic(data, retriever=None):
"""Annotate somatic calls if we have cosmic data installed.
"""
if is_human(data):
paired = vcfutils.get_paired([data])
if paired:
r = dd.get_variation_resources(data)
if r.get("cosmic") and objectstore.file_exists_or_remot... | python | def _annotate_somatic(data, retriever=None):
"""Annotate somatic calls if we have cosmic data installed.
"""
if is_human(data):
paired = vcfutils.get_paired([data])
if paired:
r = dd.get_variation_resources(data)
if r.get("cosmic") and objectstore.file_exists_or_remot... | [
"def",
"_annotate_somatic",
"(",
"data",
",",
"retriever",
"=",
"None",
")",
":",
"if",
"is_human",
"(",
"data",
")",
":",
"paired",
"=",
"vcfutils",
".",
"get_paired",
"(",
"[",
"data",
"]",
")",
"if",
"paired",
":",
"r",
"=",
"dd",
".",
"get_variat... | Annotate somatic calls if we have cosmic data installed. | [
"Annotate",
"somatic",
"calls",
"if",
"we",
"have",
"cosmic",
"data",
"installed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L156-L165 |
224,095 | bcbio/bcbio-nextgen | bcbio/variation/vcfanno.py | is_human | def is_human(data, builds=None):
"""Check if human, optionally with build number, search by name or extra GL contigs.
"""
def has_build37_contigs(data):
for contig in ref.file_contigs(dd.get_ref_file(data)):
if contig.name.startswith("GL") or contig.name.find("_gl") >= 0:
... | python | def is_human(data, builds=None):
"""Check if human, optionally with build number, search by name or extra GL contigs.
"""
def has_build37_contigs(data):
for contig in ref.file_contigs(dd.get_ref_file(data)):
if contig.name.startswith("GL") or contig.name.find("_gl") >= 0:
... | [
"def",
"is_human",
"(",
"data",
",",
"builds",
"=",
"None",
")",
":",
"def",
"has_build37_contigs",
"(",
"data",
")",
":",
"for",
"contig",
"in",
"ref",
".",
"file_contigs",
"(",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
")",
":",
"if",
"contig",
... | Check if human, optionally with build number, search by name or extra GL contigs. | [
"Check",
"if",
"human",
"optionally",
"with",
"build",
"number",
"search",
"by",
"name",
"or",
"extra",
"GL",
"contigs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L167-L188 |
224,096 | bcbio/bcbio-nextgen | bcbio/distributed/resources.py | _get_resource_programs | def _get_resource_programs(progs, algs):
"""Retrieve programs used in analysis based on algorithm configurations.
Handles special cases like aligners and variant callers.
"""
checks = {"gatk-vqsr": config_utils.use_vqsr,
"snpeff": config_utils.use_snpeff,
"bcbio-variation-rec... | python | def _get_resource_programs(progs, algs):
"""Retrieve programs used in analysis based on algorithm configurations.
Handles special cases like aligners and variant callers.
"""
checks = {"gatk-vqsr": config_utils.use_vqsr,
"snpeff": config_utils.use_snpeff,
"bcbio-variation-rec... | [
"def",
"_get_resource_programs",
"(",
"progs",
",",
"algs",
")",
":",
"checks",
"=",
"{",
"\"gatk-vqsr\"",
":",
"config_utils",
".",
"use_vqsr",
",",
"\"snpeff\"",
":",
"config_utils",
".",
"use_snpeff",
",",
"\"bcbio-variation-recall\"",
":",
"config_utils",
".",... | Retrieve programs used in analysis based on algorithm configurations.
Handles special cases like aligners and variant callers. | [
"Retrieve",
"programs",
"used",
"in",
"analysis",
"based",
"on",
"algorithm",
"configurations",
".",
"Handles",
"special",
"cases",
"like",
"aligners",
"and",
"variant",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L14-L49 |
224,097 | bcbio/bcbio-nextgen | bcbio/distributed/resources.py | _parent_prefix | def _parent_prefix(prefix):
"""Identify a parent prefix we should add to resources if present in a caller name.
"""
def run(algs):
for alg in algs:
vcs = alg.get("variantcaller")
if vcs:
if isinstance(vcs, dict):
vcs = reduce(operator.add, ... | python | def _parent_prefix(prefix):
"""Identify a parent prefix we should add to resources if present in a caller name.
"""
def run(algs):
for alg in algs:
vcs = alg.get("variantcaller")
if vcs:
if isinstance(vcs, dict):
vcs = reduce(operator.add, ... | [
"def",
"_parent_prefix",
"(",
"prefix",
")",
":",
"def",
"run",
"(",
"algs",
")",
":",
"for",
"alg",
"in",
"algs",
":",
"vcs",
"=",
"alg",
".",
"get",
"(",
"\"variantcaller\"",
")",
"if",
"vcs",
":",
"if",
"isinstance",
"(",
"vcs",
",",
"dict",
")"... | Identify a parent prefix we should add to resources if present in a caller name. | [
"Identify",
"a",
"parent",
"prefix",
"we",
"should",
"add",
"to",
"resources",
"if",
"present",
"in",
"a",
"caller",
"name",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L51-L63 |
224,098 | bcbio/bcbio-nextgen | bcbio/distributed/resources.py | _ensure_min_resources | def _ensure_min_resources(progs, cores, memory, min_memory):
"""Ensure setting match minimum resources required for used programs.
"""
for p in progs:
if p in min_memory:
if not memory or cores * memory < min_memory[p]:
memory = float(min_memory[p]) / cores
return cor... | python | def _ensure_min_resources(progs, cores, memory, min_memory):
"""Ensure setting match minimum resources required for used programs.
"""
for p in progs:
if p in min_memory:
if not memory or cores * memory < min_memory[p]:
memory = float(min_memory[p]) / cores
return cor... | [
"def",
"_ensure_min_resources",
"(",
"progs",
",",
"cores",
",",
"memory",
",",
"min_memory",
")",
":",
"for",
"p",
"in",
"progs",
":",
"if",
"p",
"in",
"min_memory",
":",
"if",
"not",
"memory",
"or",
"cores",
"*",
"memory",
"<",
"min_memory",
"[",
"p"... | Ensure setting match minimum resources required for used programs. | [
"Ensure",
"setting",
"match",
"minimum",
"resources",
"required",
"for",
"used",
"programs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L65-L72 |
224,099 | bcbio/bcbio-nextgen | bcbio/distributed/resources.py | _get_prog_memory | def _get_prog_memory(resources, cores_per_job):
"""Get expected memory usage, in Gb per core, for a program from resource specification.
"""
out = None
for jvm_opt in resources.get("jvm_opts", []):
if jvm_opt.startswith("-Xmx"):
out = _str_memory_to_gb(jvm_opt[4:])
memory = resou... | python | def _get_prog_memory(resources, cores_per_job):
"""Get expected memory usage, in Gb per core, for a program from resource specification.
"""
out = None
for jvm_opt in resources.get("jvm_opts", []):
if jvm_opt.startswith("-Xmx"):
out = _str_memory_to_gb(jvm_opt[4:])
memory = resou... | [
"def",
"_get_prog_memory",
"(",
"resources",
",",
"cores_per_job",
")",
":",
"out",
"=",
"None",
"for",
"jvm_opt",
"in",
"resources",
".",
"get",
"(",
"\"jvm_opts\"",
",",
"[",
"]",
")",
":",
"if",
"jvm_opt",
".",
"startswith",
"(",
"\"-Xmx\"",
")",
":",... | Get expected memory usage, in Gb per core, for a program from resource specification. | [
"Get",
"expected",
"memory",
"usage",
"in",
"Gb",
"per",
"core",
"for",
"a",
"program",
"from",
"resource",
"specification",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L83-L98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.