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
223,100
bcbio/bcbio-nextgen
bcbio/variation/effects.py
get_db
def get_db(data): """Retrieve a snpEff database name and location relative to reference file. """ snpeff_db = utils.get_in(data, ("genome_resources", "aliases", "snpeff")) snpeff_base_dir = None if snpeff_db: snpeff_base_dir = utils.get_in(data, ("reference", "snpeff")) if not (isins...
python
def get_db(data): """Retrieve a snpEff database name and location relative to reference file. """ snpeff_db = utils.get_in(data, ("genome_resources", "aliases", "snpeff")) snpeff_base_dir = None if snpeff_db: snpeff_base_dir = utils.get_in(data, ("reference", "snpeff")) if not (isins...
[ "def", "get_db", "(", "data", ")", ":", "snpeff_db", "=", "utils", ".", "get_in", "(", "data", ",", "(", "\"genome_resources\"", ",", "\"aliases\"", ",", "\"snpeff\"", ")", ")", "snpeff_base_dir", "=", "None", "if", "snpeff_db", ":", "snpeff_base_dir", "=", ...
Retrieve a snpEff database name and location relative to reference file.
[ "Retrieve", "a", "snpEff", "database", "name", "and", "location", "relative", "to", "reference", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L290-L320
223,101
bcbio/bcbio-nextgen
bcbio/variation/effects.py
_get_snpeff_cmd
def _get_snpeff_cmd(cmd_name, datadir, data, out_file): """Retrieve snpEff base command line. """ resources = config_utils.get_resources("snpeff", data["config"]) jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx3g"]) # scale by cores, defaulting to 2x base usage to ensure we have enough memor...
python
def _get_snpeff_cmd(cmd_name, datadir, data, out_file): """Retrieve snpEff base command line. """ resources = config_utils.get_resources("snpeff", data["config"]) jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx3g"]) # scale by cores, defaulting to 2x base usage to ensure we have enough memor...
[ "def", "_get_snpeff_cmd", "(", "cmd_name", ",", "datadir", ",", "data", ",", "out_file", ")", ":", "resources", "=", "config_utils", ".", "get_resources", "(", "\"snpeff\"", ",", "data", "[", "\"config\"", "]", ")", "jvm_opts", "=", "resources", ".", "get", ...
Retrieve snpEff base command line.
[ "Retrieve", "snpEff", "base", "command", "line", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L339-L358
223,102
bcbio/bcbio-nextgen
bcbio/variation/effects.py
_run_snpeff
def _run_snpeff(snp_in, out_format, data): """Run effects prediction with snpEff, skipping if snpEff database not present. """ snpeff_db, datadir = get_db(data) if not snpeff_db: return None, None assert os.path.exists(os.path.join(datadir, snpeff_db)), \ "Did not find %s snpEff gen...
python
def _run_snpeff(snp_in, out_format, data): """Run effects prediction with snpEff, skipping if snpEff database not present. """ snpeff_db, datadir = get_db(data) if not snpeff_db: return None, None assert os.path.exists(os.path.join(datadir, snpeff_db)), \ "Did not find %s snpEff gen...
[ "def", "_run_snpeff", "(", "snp_in", ",", "out_format", ",", "data", ")", ":", "snpeff_db", ",", "datadir", "=", "get_db", "(", "data", ")", "if", "not", "snpeff_db", ":", "return", "None", ",", "None", "assert", "os", ".", "path", ".", "exists", "(", ...
Run effects prediction with snpEff, skipping if snpEff database not present.
[ "Run", "effects", "prediction", "with", "snpEff", "skipping", "if", "snpEff", "database", "not", "present", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L360-L386
223,103
bcbio/bcbio-nextgen
bcbio/variation/effects.py
_installed_snpeff_genome
def _installed_snpeff_genome(base_name, config): """Find the most recent installed genome for snpEff with the given name. """ snpeff_config_file = os.path.join(config_utils.get_program("snpeff", config, "dir"), "snpEff.config") if os.path.exists(snpeff_config_file):...
python
def _installed_snpeff_genome(base_name, config): """Find the most recent installed genome for snpEff with the given name. """ snpeff_config_file = os.path.join(config_utils.get_program("snpeff", config, "dir"), "snpEff.config") if os.path.exists(snpeff_config_file):...
[ "def", "_installed_snpeff_genome", "(", "base_name", ",", "config", ")", ":", "snpeff_config_file", "=", "os", ".", "path", ".", "join", "(", "config_utils", ".", "get_program", "(", "\"snpeff\"", ",", "config", ",", "\"dir\"", ")", ",", "\"snpEff.config\"", "...
Find the most recent installed genome for snpEff with the given name.
[ "Find", "the", "most", "recent", "installed", "genome", "for", "snpEff", "with", "the", "given", "name", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L400-L415
223,104
bcbio/bcbio-nextgen
bcbio/ngsalign/minimap2.py
remap_index_fn
def remap_index_fn(ref_file): """minimap2 can build indexes on the fly but will also store commons ones. """ index_dir = os.path.join(os.path.dirname(ref_file), os.pardir, "minimap2") if os.path.exists(index_dir) and os.path.isdir(index_dir): return index_dir else: return os.path.dir...
python
def remap_index_fn(ref_file): """minimap2 can build indexes on the fly but will also store commons ones. """ index_dir = os.path.join(os.path.dirname(ref_file), os.pardir, "minimap2") if os.path.exists(index_dir) and os.path.isdir(index_dir): return index_dir else: return os.path.dir...
[ "def", "remap_index_fn", "(", "ref_file", ")", ":", "index_dir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "ref_file", ")", ",", "os", ".", "pardir", ",", "\"minimap2\"", ")", "if", "os", ".", "path", ".", "e...
minimap2 can build indexes on the fly but will also store commons ones.
[ "minimap2", "can", "build", "indexes", "on", "the", "fly", "but", "will", "also", "store", "commons", "ones", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/minimap2.py#L44-L51
223,105
bcbio/bcbio-nextgen
scripts/bcbio_prepare_samples.py
create_new_csv
def create_new_csv(samples, args): """create csv file that can be use with bcbio -w template""" out_fn = os.path.splitext(args.csv)[0] + "-merged.csv" logger.info("Preparing new csv: %s" % out_fn) with file_transaction(out_fn) as tx_out: with open(tx_out, 'w') as handle: handle.write...
python
def create_new_csv(samples, args): """create csv file that can be use with bcbio -w template""" out_fn = os.path.splitext(args.csv)[0] + "-merged.csv" logger.info("Preparing new csv: %s" % out_fn) with file_transaction(out_fn) as tx_out: with open(tx_out, 'w') as handle: handle.write...
[ "def", "create_new_csv", "(", "samples", ",", "args", ")", ":", "out_fn", "=", "os", ".", "path", ".", "splitext", "(", "args", ".", "csv", ")", "[", "0", "]", "+", "\"-merged.csv\"", "logger", ".", "info", "(", "\"Preparing new csv: %s\"", "%", "out_fn"...
create csv file that can be use with bcbio -w template
[ "create", "csv", "file", "that", "can", "be", "use", "with", "bcbio", "-", "w", "template" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_prepare_samples.py#L23-L32
223,106
bcbio/bcbio-nextgen
scripts/bcbio_prepare_samples.py
_get_samples_to_process
def _get_samples_to_process(fn, out_dir, config, force_single, separators): """parse csv file with one line per file. It will merge all files that have the same description name""" out_dir = os.path.abspath(out_dir) samples = defaultdict(list) with open(fn) as handle: for l in handle: ...
python
def _get_samples_to_process(fn, out_dir, config, force_single, separators): """parse csv file with one line per file. It will merge all files that have the same description name""" out_dir = os.path.abspath(out_dir) samples = defaultdict(list) with open(fn) as handle: for l in handle: ...
[ "def", "_get_samples_to_process", "(", "fn", ",", "out_dir", ",", "config", ",", "force_single", ",", "separators", ")", ":", "out_dir", "=", "os", ".", "path", ".", "abspath", "(", "out_dir", ")", "samples", "=", "defaultdict", "(", "list", ")", "with", ...
parse csv file with one line per file. It will merge all files that have the same description name
[ "parse", "csv", "file", "with", "one", "line", "per", "file", ".", "It", "will", "merge", "all", "files", "that", "have", "the", "same", "description", "name" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_prepare_samples.py#L41-L83
223,107
bcbio/bcbio-nextgen
scripts/bcbio_prepare_samples.py
_check_stems
def _check_stems(files): """check if stem names are the same and use full path then""" used = set() for fn in files: if os.path.basename(fn) in used: logger.warning("%s stem is multiple times in your file list, " "so we don't know " "how ...
python
def _check_stems(files): """check if stem names are the same and use full path then""" used = set() for fn in files: if os.path.basename(fn) in used: logger.warning("%s stem is multiple times in your file list, " "so we don't know " "how ...
[ "def", "_check_stems", "(", "files", ")", ":", "used", "=", "set", "(", ")", "for", "fn", "in", "files", ":", "if", "os", ".", "path", ".", "basename", "(", "fn", ")", "in", "used", ":", "logger", ".", "warning", "(", "\"%s stem is multiple times in yo...
check if stem names are the same and use full path then
[ "check", "if", "stem", "names", "are", "the", "same", "and", "use", "full", "path", "then" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_prepare_samples.py#L86-L101
223,108
bcbio/bcbio-nextgen
scripts/bcbio_prepare_samples.py
get_cluster_view
def get_cluster_view(p): """get ipython running""" from cluster_helper import cluster as ipc return ipc.cluster_view(p['scheduler'], p['queue'], p['num_jobs'], p['cores_per_job'], start_wait=p['timeout'], extra_params={"resources": p['resources'], "mem": p['mem'], "tag": p['tag'], "run_local": False})
python
def get_cluster_view(p): """get ipython running""" from cluster_helper import cluster as ipc return ipc.cluster_view(p['scheduler'], p['queue'], p['num_jobs'], p['cores_per_job'], start_wait=p['timeout'], extra_params={"resources": p['resources'], "mem": p['mem'], "tag": p['tag'], "run_local": False})
[ "def", "get_cluster_view", "(", "p", ")", ":", "from", "cluster_helper", "import", "cluster", "as", "ipc", "return", "ipc", ".", "cluster_view", "(", "p", "[", "'scheduler'", "]", ",", "p", "[", "'queue'", "]", ",", "p", "[", "'num_jobs'", "]", ",", "p...
get ipython running
[ "get", "ipython", "running" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_prepare_samples.py#L114-L117
223,109
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
from_sample
def from_sample(sample): """Upload results of processing from an analysis pipeline sample. """ upload_config = sample.get("upload") if upload_config: approach = _approaches[upload_config.get("method", "filesystem")] for finfo in _get_files(sample): approach.update_file(finfo,...
python
def from_sample(sample): """Upload results of processing from an analysis pipeline sample. """ upload_config = sample.get("upload") if upload_config: approach = _approaches[upload_config.get("method", "filesystem")] for finfo in _get_files(sample): approach.update_file(finfo,...
[ "def", "from_sample", "(", "sample", ")", ":", "upload_config", "=", "sample", ".", "get", "(", "\"upload\"", ")", "if", "upload_config", ":", "approach", "=", "_approaches", "[", "upload_config", ".", "get", "(", "\"method\"", ",", "\"filesystem\"", ")", "]...
Upload results of processing from an analysis pipeline sample.
[ "Upload", "results", "of", "processing", "from", "an", "analysis", "pipeline", "sample", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L29-L37
223,110
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_get_files
def _get_files(sample): """Retrieve files for the sample, dispatching by analysis type. Each file is a dictionary containing the path plus associated metadata about the file and pipeline versions. """ analysis = sample.get("analysis") if analysis.lower() in ["variant", "snp calling", "variant2"...
python
def _get_files(sample): """Retrieve files for the sample, dispatching by analysis type. Each file is a dictionary containing the path plus associated metadata about the file and pipeline versions. """ analysis = sample.get("analysis") if analysis.lower() in ["variant", "snp calling", "variant2"...
[ "def", "_get_files", "(", "sample", ")", ":", "analysis", "=", "sample", ".", "get", "(", "\"analysis\"", ")", "if", "analysis", ".", "lower", "(", ")", "in", "[", "\"variant\"", ",", "\"snp calling\"", ",", "\"variant2\"", ",", "\"standard\"", "]", ":", ...
Retrieve files for the sample, dispatching by analysis type. Each file is a dictionary containing the path plus associated metadata about the file and pipeline versions.
[ "Retrieve", "files", "for", "the", "sample", "dispatching", "by", "analysis", "type", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L56-L74
223,111
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_add_meta
def _add_meta(xs, sample=None, config=None): """Add top level information about the sample or flowcell to output. Sorts outputs into sample names (sample input) and project (config input). """ out = [] for x in xs: if not isinstance(x["path"], six.string_types) or not os.path.exists(x["path...
python
def _add_meta(xs, sample=None, config=None): """Add top level information about the sample or flowcell to output. Sorts outputs into sample names (sample input) and project (config input). """ out = [] for x in xs: if not isinstance(x["path"], six.string_types) or not os.path.exists(x["path...
[ "def", "_add_meta", "(", "xs", ",", "sample", "=", "None", ",", "config", "=", "None", ")", ":", "out", "=", "[", "]", "for", "x", "in", "xs", ":", "if", "not", "isinstance", "(", "x", "[", "\"path\"", "]", ",", "six", ".", "string_types", ")", ...
Add top level information about the sample or flowcell to output. Sorts outputs into sample names (sample input) and project (config input).
[ "Add", "top", "level", "information", "about", "the", "sample", "or", "flowcell", "to", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L123-L144
223,112
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_get_files_variantcall
def _get_files_variantcall(sample): """Return output files for the variant calling pipeline. """ out = [] algorithm = sample["config"]["algorithm"] out = _maybe_add_summary(algorithm, sample, out) out = _maybe_add_alignment(algorithm, sample, out) out = _maybe_add_callable(sample, out) o...
python
def _get_files_variantcall(sample): """Return output files for the variant calling pipeline. """ out = [] algorithm = sample["config"]["algorithm"] out = _maybe_add_summary(algorithm, sample, out) out = _maybe_add_alignment(algorithm, sample, out) out = _maybe_add_callable(sample, out) o...
[ "def", "_get_files_variantcall", "(", "sample", ")", ":", "out", "=", "[", "]", "algorithm", "=", "sample", "[", "\"config\"", "]", "[", "\"algorithm\"", "]", "out", "=", "_maybe_add_summary", "(", "algorithm", ",", "sample", ",", "out", ")", "out", "=", ...
Return output files for the variant calling pipeline.
[ "Return", "output", "files", "for", "the", "variant", "calling", "pipeline", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L146-L161
223,113
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_maybe_add_callable
def _maybe_add_callable(data, out): """Add callable and depth regions to output folder. """ callable_bed = dd.get_sample_callable(data) if callable_bed: out.append({"path": callable_bed, "type": "bed", "ext": "callable"}) perbase_bed = tz.get_in(["depth", "variant_regions", "per_base"], data...
python
def _maybe_add_callable(data, out): """Add callable and depth regions to output folder. """ callable_bed = dd.get_sample_callable(data) if callable_bed: out.append({"path": callable_bed, "type": "bed", "ext": "callable"}) perbase_bed = tz.get_in(["depth", "variant_regions", "per_base"], data...
[ "def", "_maybe_add_callable", "(", "data", ",", "out", ")", ":", "callable_bed", "=", "dd", ".", "get_sample_callable", "(", "data", ")", "if", "callable_bed", ":", "out", ".", "append", "(", "{", "\"path\"", ":", "callable_bed", ",", "\"type\"", ":", "\"b...
Add callable and depth regions to output folder.
[ "Add", "callable", "and", "depth", "regions", "to", "output", "folder", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L183-L192
223,114
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_get_batch_name
def _get_batch_name(sample): """Retrieve batch name for use in SV calling outputs. Handles multiple batches split via SV calling. """ batch = dd.get_batch(sample) or dd.get_sample_name(sample) if isinstance(batch, (list, tuple)) and len(batch) > 1: batch = dd.get_sample_name(sample) ret...
python
def _get_batch_name(sample): """Retrieve batch name for use in SV calling outputs. Handles multiple batches split via SV calling. """ batch = dd.get_batch(sample) or dd.get_sample_name(sample) if isinstance(batch, (list, tuple)) and len(batch) > 1: batch = dd.get_sample_name(sample) ret...
[ "def", "_get_batch_name", "(", "sample", ")", ":", "batch", "=", "dd", ".", "get_batch", "(", "sample", ")", "or", "dd", ".", "get_sample_name", "(", "sample", ")", "if", "isinstance", "(", "batch", ",", "(", "list", ",", "tuple", ")", ")", "and", "l...
Retrieve batch name for use in SV calling outputs. Handles multiple batches split via SV calling.
[ "Retrieve", "batch", "name", "for", "use", "in", "SV", "calling", "outputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L236-L244
223,115
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_sample_variant_file_in_population
def _sample_variant_file_in_population(x): """Check if a sample file is the same as the population file. This is true for batches where we don't extract into samples and do not run decomposition for gemini. '""" if "population" in x: a = _get_project_vcf(x) b = _get_variant_file(x, ...
python
def _sample_variant_file_in_population(x): """Check if a sample file is the same as the population file. This is true for batches where we don't extract into samples and do not run decomposition for gemini. '""" if "population" in x: a = _get_project_vcf(x) b = _get_variant_file(x, ...
[ "def", "_sample_variant_file_in_population", "(", "x", ")", ":", "if", "\"population\"", "in", "x", ":", "a", "=", "_get_project_vcf", "(", "x", ")", "b", "=", "_get_variant_file", "(", "x", ",", "(", "\"vrn_file\"", ",", ")", ")", "decomposed", "=", "tz",...
Check if a sample file is the same as the population file. This is true for batches where we don't extract into samples and do not run decomposition for gemini.
[ "Check", "if", "a", "sample", "file", "is", "the", "same", "as", "the", "population", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L316-L329
223,116
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_get_variant_file
def _get_variant_file(x, key, suffix="", sample=None, ignore_do_upload=False): """Retrieve VCF file with the given key if it exists, handling bgzipped. """ out = [] fname = utils.get_in(x, key) upload_key = list(key) upload_key[-1] = "do_upload" do_upload = tz.get_in(tuple(upload_key), x, Tr...
python
def _get_variant_file(x, key, suffix="", sample=None, ignore_do_upload=False): """Retrieve VCF file with the given key if it exists, handling bgzipped. """ out = [] fname = utils.get_in(x, key) upload_key = list(key) upload_key[-1] = "do_upload" do_upload = tz.get_in(tuple(upload_key), x, Tr...
[ "def", "_get_variant_file", "(", "x", ",", "key", ",", "suffix", "=", "\"\"", ",", "sample", "=", "None", ",", "ignore_do_upload", "=", "False", ")", ":", "out", "=", "[", "]", "fname", "=", "utils", ".", "get_in", "(", "x", ",", "key", ")", "uploa...
Retrieve VCF file with the given key if it exists, handling bgzipped.
[ "Retrieve", "VCF", "file", "with", "the", "given", "key", "if", "it", "exists", "handling", "bgzipped", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L331-L368
223,117
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_add_batch
def _add_batch(x, sample): """Potentially add batch name to an upload file. """ added = False for batch in sorted(dd.get_batches(sample) or [], key=len, reverse=True): if batch and os.path.basename(x["path"]).startswith(("%s-" % batch, "%s.vcf" % batch)): x["batch"] = batch ...
python
def _add_batch(x, sample): """Potentially add batch name to an upload file. """ added = False for batch in sorted(dd.get_batches(sample) or [], key=len, reverse=True): if batch and os.path.basename(x["path"]).startswith(("%s-" % batch, "%s.vcf" % batch)): x["batch"] = batch ...
[ "def", "_add_batch", "(", "x", ",", "sample", ")", ":", "added", "=", "False", "for", "batch", "in", "sorted", "(", "dd", ".", "get_batches", "(", "sample", ")", "or", "[", "]", ",", "key", "=", "len", ",", "reverse", "=", "True", ")", ":", "if",...
Potentially add batch name to an upload file.
[ "Potentially", "add", "batch", "name", "to", "an", "upload", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L638-L649
223,118
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
_get_project_vcf
def _get_project_vcf(x, suffix=""): """Get our project VCF, either from the population or the variant batch file. """ vcfs = _get_variant_file(x, ("population", "vcf"), suffix=suffix) if not vcfs: vcfs = _get_variant_file(x, ("vrn_file_batch", ), suffix=suffix, ignore_do_upload=True) if ...
python
def _get_project_vcf(x, suffix=""): """Get our project VCF, either from the population or the variant batch file. """ vcfs = _get_variant_file(x, ("population", "vcf"), suffix=suffix) if not vcfs: vcfs = _get_variant_file(x, ("vrn_file_batch", ), suffix=suffix, ignore_do_upload=True) if ...
[ "def", "_get_project_vcf", "(", "x", ",", "suffix", "=", "\"\"", ")", ":", "vcfs", "=", "_get_variant_file", "(", "x", ",", "(", "\"population\"", ",", "\"vcf\"", ")", ",", "suffix", "=", "suffix", ")", "if", "not", "vcfs", ":", "vcfs", "=", "_get_vari...
Get our project VCF, either from the population or the variant batch file.
[ "Get", "our", "project", "VCF", "either", "from", "the", "population", "or", "the", "variant", "batch", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L651-L659
223,119
bcbio/bcbio-nextgen
scripts/utils/resort_bam_karyotype.py
_id_remapper
def _id_remapper(orig, new): """Provide a dictionary remapping original read indexes to new indexes. When re-ordering the header, the individual read identifiers need to be updated as well. """ new_chrom_to_index = {} for i_n, (chr_n, _) in enumerate(new): new_chrom_to_index[chr_n] = i_...
python
def _id_remapper(orig, new): """Provide a dictionary remapping original read indexes to new indexes. When re-ordering the header, the individual read identifiers need to be updated as well. """ new_chrom_to_index = {} for i_n, (chr_n, _) in enumerate(new): new_chrom_to_index[chr_n] = i_...
[ "def", "_id_remapper", "(", "orig", ",", "new", ")", ":", "new_chrom_to_index", "=", "{", "}", "for", "i_n", ",", "(", "chr_n", ",", "_", ")", "in", "enumerate", "(", "new", ")", ":", "new_chrom_to_index", "[", "chr_n", "]", "=", "i_n", "remap_indexes"...
Provide a dictionary remapping original read indexes to new indexes. When re-ordering the header, the individual read identifiers need to be updated as well.
[ "Provide", "a", "dictionary", "remapping", "original", "read", "indexes", "to", "new", "indexes", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/resort_bam_karyotype.py#L67-L81
223,120
bcbio/bcbio-nextgen
scripts/bcbio_setup_genome.py
_clean_rec_name
def _clean_rec_name(rec): """Clean illegal characters in input fasta file which cause problems downstream. """ out_id = [] for char in list(rec.id): if char in ALLOWED_CONTIG_NAME_CHARS: out_id.append(char) else: out_id.append("_") rec.id = "".join(out_id) ...
python
def _clean_rec_name(rec): """Clean illegal characters in input fasta file which cause problems downstream. """ out_id = [] for char in list(rec.id): if char in ALLOWED_CONTIG_NAME_CHARS: out_id.append(char) else: out_id.append("_") rec.id = "".join(out_id) ...
[ "def", "_clean_rec_name", "(", "rec", ")", ":", "out_id", "=", "[", "]", "for", "char", "in", "list", "(", "rec", ".", "id", ")", ":", "if", "char", "in", "ALLOWED_CONTIG_NAME_CHARS", ":", "out_id", ".", "append", "(", "char", ")", "else", ":", "out_...
Clean illegal characters in input fasta file which cause problems downstream.
[ "Clean", "illegal", "characters", "in", "input", "fasta", "file", "which", "cause", "problems", "downstream", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_setup_genome.py#L151-L162
223,121
bcbio/bcbio-nextgen
bcbio/qc/kraken.py
run
def run(_, data, out_dir): """Run kraken, generating report in specified directory and parsing metrics. Using only first paired reads. """ # logger.info("Number of aligned reads < than 0.60 in %s: %s" % (dd.get_sample_name(data), ratio)) logger.info("Running kraken to determine contaminant: %s" %...
python
def run(_, data, out_dir): """Run kraken, generating report in specified directory and parsing metrics. Using only first paired reads. """ # logger.info("Number of aligned reads < than 0.60 in %s: %s" % (dd.get_sample_name(data), ratio)) logger.info("Running kraken to determine contaminant: %s" %...
[ "def", "run", "(", "_", ",", "data", ",", "out_dir", ")", ":", "# logger.info(\"Number of aligned reads < than 0.60 in %s: %s\" % (dd.get_sample_name(data), ratio))", "logger", ".", "info", "(", "\"Running kraken to determine contaminant: %s\"", "%", "dd", ".", "get_sample_name...
Run kraken, generating report in specified directory and parsing metrics. Using only first paired reads.
[ "Run", "kraken", "generating", "report", "in", "specified", "directory", "and", "parsing", "metrics", ".", "Using", "only", "first", "paired", "reads", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/kraken.py#L16-L57
223,122
bcbio/bcbio-nextgen
bcbio/qc/kraken.py
_parse_kraken_output
def _parse_kraken_output(out_dir, db, data): """Parse kraken stat info comming from stderr, generating report with kraken-report """ in_file = os.path.join(out_dir, "kraken_out") stat_file = os.path.join(out_dir, "kraken_stats") out_file = os.path.join(out_dir, "kraken_summary") kraken_cm...
python
def _parse_kraken_output(out_dir, db, data): """Parse kraken stat info comming from stderr, generating report with kraken-report """ in_file = os.path.join(out_dir, "kraken_out") stat_file = os.path.join(out_dir, "kraken_stats") out_file = os.path.join(out_dir, "kraken_summary") kraken_cm...
[ "def", "_parse_kraken_output", "(", "out_dir", ",", "db", ",", "data", ")", ":", "in_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"kraken_out\"", ")", "stat_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"krake...
Parse kraken stat info comming from stderr, generating report with kraken-report
[ "Parse", "kraken", "stat", "info", "comming", "from", "stderr", "generating", "report", "with", "kraken", "-", "report" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/kraken.py#L59-L81
223,123
bcbio/bcbio-nextgen
bcbio/qc/kraken.py
_summarize_kraken
def _summarize_kraken(fn): """get the value at species level""" kraken = {} list_sp, list_value = [], [] with open(fn) as handle: for line in handle: cols = line.strip().split("\t") sp = cols[5].strip() if len(sp.split(" ")) > 1 and not sp.startswith("cellular...
python
def _summarize_kraken(fn): """get the value at species level""" kraken = {} list_sp, list_value = [], [] with open(fn) as handle: for line in handle: cols = line.strip().split("\t") sp = cols[5].strip() if len(sp.split(" ")) > 1 and not sp.startswith("cellular...
[ "def", "_summarize_kraken", "(", "fn", ")", ":", "kraken", "=", "{", "}", "list_sp", ",", "list_value", "=", "[", "]", ",", "[", "]", "with", "open", "(", "fn", ")", "as", "handle", ":", "for", "line", "in", "handle", ":", "cols", "=", "line", "....
get the value at species level
[ "get", "the", "value", "at", "species", "level" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/kraken.py#L83-L95
223,124
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_get_main_and_json
def _get_main_and_json(directory): """Retrieve the main CWL and sample JSON files from a bcbio generated directory. """ directory = os.path.normpath(os.path.abspath(directory)) checker_main = os.path.normpath(os.path.join(directory, os.path.pardir, "checker-workflow-wrapping-tool.cwl")) if checker_m...
python
def _get_main_and_json(directory): """Retrieve the main CWL and sample JSON files from a bcbio generated directory. """ directory = os.path.normpath(os.path.abspath(directory)) checker_main = os.path.normpath(os.path.join(directory, os.path.pardir, "checker-workflow-wrapping-tool.cwl")) if checker_m...
[ "def", "_get_main_and_json", "(", "directory", ")", ":", "directory", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "directory", ")", ")", "checker_main", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", ...
Retrieve the main CWL and sample JSON files from a bcbio generated directory.
[ "Retrieve", "the", "main", "CWL", "and", "sample", "JSON", "files", "from", "a", "bcbio", "generated", "directory", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L18-L32
223,125
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_tool
def _run_tool(cmd, use_container=True, work_dir=None, log_file=None): """Run with injection of bcbio path. Place at end for runs without containers to avoid overriding other bcbio installations. """ if isinstance(cmd, (list, tuple)): cmd = " ".join([str(x) for x in cmd]) cmd = utils.loc...
python
def _run_tool(cmd, use_container=True, work_dir=None, log_file=None): """Run with injection of bcbio path. Place at end for runs without containers to avoid overriding other bcbio installations. """ if isinstance(cmd, (list, tuple)): cmd = " ".join([str(x) for x in cmd]) cmd = utils.loc...
[ "def", "_run_tool", "(", "cmd", ",", "use_container", "=", "True", ",", "work_dir", "=", "None", ",", "log_file", "=", "None", ")", ":", "if", "isinstance", "(", "cmd", ",", "(", "list", ",", "tuple", ")", ")", ":", "cmd", "=", "\" \"", ".", "join"...
Run with injection of bcbio path. Place at end for runs without containers to avoid overriding other bcbio installations.
[ "Run", "with", "injection", "of", "bcbio", "path", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L34-L50
223,126
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_pack_cwl
def _pack_cwl(unpacked_cwl): """Pack CWL into a single document for submission. """ out_file = "%s-pack%s" % os.path.splitext(unpacked_cwl) cmd = "cwltool --pack {unpacked_cwl} > {out_file}" _run_tool(cmd.format(**locals())) return out_file
python
def _pack_cwl(unpacked_cwl): """Pack CWL into a single document for submission. """ out_file = "%s-pack%s" % os.path.splitext(unpacked_cwl) cmd = "cwltool --pack {unpacked_cwl} > {out_file}" _run_tool(cmd.format(**locals())) return out_file
[ "def", "_pack_cwl", "(", "unpacked_cwl", ")", ":", "out_file", "=", "\"%s-pack%s\"", "%", "os", ".", "path", ".", "splitext", "(", "unpacked_cwl", ")", "cmd", "=", "\"cwltool --pack {unpacked_cwl} > {out_file}\"", "_run_tool", "(", "cmd", ".", "format", "(", "*"...
Pack CWL into a single document for submission.
[ "Pack", "CWL", "into", "a", "single", "document", "for", "submission", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L52-L58
223,127
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_remove_bcbiovm_path
def _remove_bcbiovm_path(): """Avoid referencing minimal bcbio_nextgen in bcbio_vm installation. """ cur_path = os.path.dirname(os.path.realpath(sys.executable)) paths = os.environ["PATH"].split(":") if cur_path in paths: paths.remove(cur_path) os.environ["PATH"] = ":".join(paths)
python
def _remove_bcbiovm_path(): """Avoid referencing minimal bcbio_nextgen in bcbio_vm installation. """ cur_path = os.path.dirname(os.path.realpath(sys.executable)) paths = os.environ["PATH"].split(":") if cur_path in paths: paths.remove(cur_path) os.environ["PATH"] = ":".join(paths)
[ "def", "_remove_bcbiovm_path", "(", ")", ":", "cur_path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "sys", ".", "executable", ")", ")", "paths", "=", "os", ".", "environ", "[", "\"PATH\"", "]", ".", "split"...
Avoid referencing minimal bcbio_nextgen in bcbio_vm installation.
[ "Avoid", "referencing", "minimal", "bcbio_nextgen", "in", "bcbio_vm", "installation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L74-L81
223,128
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_arvados
def _run_arvados(args): """Run CWL on Arvados. """ assert not args.no_container, "Arvados runs require containers" assert "ARVADOS_API_TOKEN" in os.environ and "ARVADOS_API_HOST" in os.environ, \ "Need to set ARVADOS_API_TOKEN and ARVADOS_API_HOST in environment to run" main_file, json_file,...
python
def _run_arvados(args): """Run CWL on Arvados. """ assert not args.no_container, "Arvados runs require containers" assert "ARVADOS_API_TOKEN" in os.environ and "ARVADOS_API_HOST" in os.environ, \ "Need to set ARVADOS_API_TOKEN and ARVADOS_API_HOST in environment to run" main_file, json_file,...
[ "def", "_run_arvados", "(", "args", ")", ":", "assert", "not", "args", ".", "no_container", ",", "\"Arvados runs require containers\"", "assert", "\"ARVADOS_API_TOKEN\"", "in", "os", ".", "environ", "and", "\"ARVADOS_API_HOST\"", "in", "os", ".", "environ", ",", "...
Run CWL on Arvados.
[ "Run", "CWL", "on", "Arvados", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L99-L108
223,129
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_toil
def _run_toil(args): """Run CWL with Toil. """ main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "toil_work")) tmp_dir = utils.safe_makedir(os.path.join(work_dir, "tmpdir")) os.environ["TMPDIR"] = tmp_dir log_file ...
python
def _run_toil(args): """Run CWL with Toil. """ main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "toil_work")) tmp_dir = utils.safe_makedir(os.path.join(work_dir, "tmpdir")) os.environ["TMPDIR"] = tmp_dir log_file ...
[ "def", "_run_toil", "(", "args", ")", ":", "main_file", ",", "json_file", ",", "project_name", "=", "_get_main_and_json", "(", "args", ".", "directory", ")", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "os", "...
Run CWL with Toil.
[ "Run", "CWL", "with", "Toil", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L110-L135
223,130
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_bunny
def _run_bunny(args): """Run CWL with rabix bunny. """ main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "bunny_work")) flags = ["-b", work_dir] log_file = os.path.join(work_dir, "%s-bunny.log" % project_name) if o...
python
def _run_bunny(args): """Run CWL with rabix bunny. """ main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "bunny_work")) flags = ["-b", work_dir] log_file = os.path.join(work_dir, "%s-bunny.log" % project_name) if o...
[ "def", "_run_bunny", "(", "args", ")", ":", "main_file", ",", "json_file", ",", "project_name", "=", "_get_main_and_json", "(", "args", ".", "directory", ")", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "os", ...
Run CWL with rabix bunny.
[ "Run", "CWL", "with", "rabix", "bunny", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L137-L154
223,131
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_wes_stratus
def _run_wes_stratus(args, main_file, json_file): """Run WES on Illumina stratus endpoint server, which wes-client doesn't support. https://stratus-docs.readme.io/docs/quick-start-4 """ import requests base_url = args.host if not base_url.startswith("http"): base_url = "https://%s" % ba...
python
def _run_wes_stratus(args, main_file, json_file): """Run WES on Illumina stratus endpoint server, which wes-client doesn't support. https://stratus-docs.readme.io/docs/quick-start-4 """ import requests base_url = args.host if not base_url.startswith("http"): base_url = "https://%s" % ba...
[ "def", "_run_wes_stratus", "(", "args", ",", "main_file", ",", "json_file", ")", ":", "import", "requests", "base_url", "=", "args", ".", "host", "if", "not", "base_url", ".", "startswith", "(", "\"http\"", ")", ":", "base_url", "=", "\"https://%s\"", "%", ...
Run WES on Illumina stratus endpoint server, which wes-client doesn't support. https://stratus-docs.readme.io/docs/quick-start-4
[ "Run", "WES", "on", "Illumina", "stratus", "endpoint", "server", "which", "wes", "-", "client", "doesn", "t", "support", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L172-L187
223,132
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_estimate_runner_memory
def _estimate_runner_memory(json_file): """Estimate Java memory requirements based on number of samples. A rough approach to selecting correct allocated memory for Cromwell. """ with open(json_file) as in_handle: sinfo = json.load(in_handle) num_parallel = 1 for key in ["config__algorit...
python
def _estimate_runner_memory(json_file): """Estimate Java memory requirements based on number of samples. A rough approach to selecting correct allocated memory for Cromwell. """ with open(json_file) as in_handle: sinfo = json.load(in_handle) num_parallel = 1 for key in ["config__algorit...
[ "def", "_estimate_runner_memory", "(", "json_file", ")", ":", "with", "open", "(", "json_file", ")", "as", "in_handle", ":", "sinfo", "=", "json", ".", "load", "(", "in_handle", ")", "num_parallel", "=", "1", "for", "key", "in", "[", "\"config__algorithm__va...
Estimate Java memory requirements based on number of samples. A rough approach to selecting correct allocated memory for Cromwell.
[ "Estimate", "Java", "memory", "requirements", "based", "on", "number", "of", "samples", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L189-L218
223,133
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_cromwell
def _run_cromwell(args): """Run CWL with Cromwell. """ main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "cromwell_work")) final_dir = utils.safe_makedir(os.path.join(work_dir, "final")) if args.no_container: _...
python
def _run_cromwell(args): """Run CWL with Cromwell. """ main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "cromwell_work")) final_dir = utils.safe_makedir(os.path.join(work_dir, "final")) if args.no_container: _...
[ "def", "_run_cromwell", "(", "args", ")", ":", "main_file", ",", "json_file", ",", "project_name", "=", "_get_main_and_json", "(", "args", ".", "directory", ")", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "os",...
Run CWL with Cromwell.
[ "Run", "CWL", "with", "Cromwell", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L220-L251
223,134
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_cromwell_debug
def _cromwell_debug(metadata): """Format Cromwell failures to make debugging easier. """ def get_failed_calls(cur, key=None): if key is None: key = [] out = [] if isinstance(cur, dict) and "failures" in cur and "callRoot" in cur: out.append((key, cur)) elif isinst...
python
def _cromwell_debug(metadata): """Format Cromwell failures to make debugging easier. """ def get_failed_calls(cur, key=None): if key is None: key = [] out = [] if isinstance(cur, dict) and "failures" in cur and "callRoot" in cur: out.append((key, cur)) elif isinst...
[ "def", "_cromwell_debug", "(", "metadata", ")", ":", "def", "get_failed_calls", "(", "cur", ",", "key", "=", "None", ")", ":", "if", "key", "is", "None", ":", "key", "=", "[", "]", "out", "=", "[", "]", "if", "isinstance", "(", "cur", ",", "dict", ...
Format Cromwell failures to make debugging easier.
[ "Format", "Cromwell", "failures", "to", "make", "debugging", "easier", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L253-L277
223,135
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_cromwell_move_outputs
def _cromwell_move_outputs(metadata, final_dir): """Move Cromwell outputs to the final upload directory. """ sample_key = [k for k in metadata["outputs"].keys() if k.endswith(("rgnames__sample", "rgnames__sample_out"))][0] project_dir = utils.safe_makedir(os.path.join(final_dir, "project")) samples ...
python
def _cromwell_move_outputs(metadata, final_dir): """Move Cromwell outputs to the final upload directory. """ sample_key = [k for k in metadata["outputs"].keys() if k.endswith(("rgnames__sample", "rgnames__sample_out"))][0] project_dir = utils.safe_makedir(os.path.join(final_dir, "project")) samples ...
[ "def", "_cromwell_move_outputs", "(", "metadata", ",", "final_dir", ")", ":", "sample_key", "=", "[", "k", "for", "k", "in", "metadata", "[", "\"outputs\"", "]", ".", "keys", "(", ")", "if", "k", ".", "endswith", "(", "(", "\"rgnames__sample\"", ",", "\"...
Move Cromwell outputs to the final upload directory.
[ "Move", "Cromwell", "outputs", "to", "the", "final", "upload", "directory", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L279-L311
223,136
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_sbgenomics
def _run_sbgenomics(args): """Run CWL on SevenBridges platform and Cancer Genomics Cloud. """ assert not args.no_container, "Seven Bridges runs require containers" main_file, json_file, project_name = _get_main_and_json(args.directory) flags = [] cmd = ["sbg-cwl-runner"] + flags + args.toolargs ...
python
def _run_sbgenomics(args): """Run CWL on SevenBridges platform and Cancer Genomics Cloud. """ assert not args.no_container, "Seven Bridges runs require containers" main_file, json_file, project_name = _get_main_and_json(args.directory) flags = [] cmd = ["sbg-cwl-runner"] + flags + args.toolargs ...
[ "def", "_run_sbgenomics", "(", "args", ")", ":", "assert", "not", "args", ".", "no_container", ",", "\"Seven Bridges runs require containers\"", "main_file", ",", "json_file", ",", "project_name", "=", "_get_main_and_json", "(", "args", ".", "directory", ")", "flags...
Run CWL on SevenBridges platform and Cancer Genomics Cloud.
[ "Run", "CWL", "on", "SevenBridges", "platform", "and", "Cancer", "Genomics", "Cloud", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L313-L320
223,137
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
_run_funnel
def _run_funnel(args): """Run funnel TES server with rabix bunny for CWL. """ host = "localhost" port = "8088" main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "funnel_work")) log_file = os.path.join(work_dir, "%s...
python
def _run_funnel(args): """Run funnel TES server with rabix bunny for CWL. """ host = "localhost" port = "8088" main_file, json_file, project_name = _get_main_and_json(args.directory) work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "funnel_work")) log_file = os.path.join(work_dir, "%s...
[ "def", "_run_funnel", "(", "args", ")", ":", "host", "=", "\"localhost\"", "port", "=", "\"8088\"", "main_file", ",", "json_file", ",", "project_name", "=", "_get_main_and_json", "(", "args", ".", "directory", ")", "work_dir", "=", "utils", ".", "safe_makedir"...
Run funnel TES server with rabix bunny for CWL.
[ "Run", "funnel", "TES", "server", "with", "rabix", "bunny", "for", "CWL", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L322-L357
223,138
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
_parse_qualimap_globals_inregion
def _parse_qualimap_globals_inregion(table): """Retrieve metrics from the global targeted region table. """ out = {} for row in table.find_all("tr"): col, val = [x.text for x in row.find_all("td")] if col == "Mapped reads": out.update(_parse_num_pct("%s (in regions)" % col, v...
python
def _parse_qualimap_globals_inregion(table): """Retrieve metrics from the global targeted region table. """ out = {} for row in table.find_all("tr"): col, val = [x.text for x in row.find_all("td")] if col == "Mapped reads": out.update(_parse_num_pct("%s (in regions)" % col, v...
[ "def", "_parse_qualimap_globals_inregion", "(", "table", ")", ":", "out", "=", "{", "}", "for", "row", "in", "table", ".", "find_all", "(", "\"tr\"", ")", ":", "col", ",", "val", "=", "[", "x", ".", "text", "for", "x", "in", "row", ".", "find_all", ...
Retrieve metrics from the global targeted region table.
[ "Retrieve", "metrics", "from", "the", "global", "targeted", "region", "table", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L131-L139
223,139
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
_parse_qualimap_coverage
def _parse_qualimap_coverage(table): """Parse summary qualimap coverage metrics. """ out = {} for row in table.find_all("tr"): col, val = [x.text for x in row.find_all("td")] if col == "Mean": out["Coverage (Mean)"] = val return out
python
def _parse_qualimap_coverage(table): """Parse summary qualimap coverage metrics. """ out = {} for row in table.find_all("tr"): col, val = [x.text for x in row.find_all("td")] if col == "Mean": out["Coverage (Mean)"] = val return out
[ "def", "_parse_qualimap_coverage", "(", "table", ")", ":", "out", "=", "{", "}", "for", "row", "in", "table", ".", "find_all", "(", "\"tr\"", ")", ":", "col", ",", "val", "=", "[", "x", ".", "text", "for", "x", "in", "row", ".", "find_all", "(", ...
Parse summary qualimap coverage metrics.
[ "Parse", "summary", "qualimap", "coverage", "metrics", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L141-L149
223,140
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
_bed_to_bed6
def _bed_to_bed6(orig_file, out_dir): """Convert bed to required bed6 inputs. """ bed6_file = os.path.join(out_dir, "%s-bed6%s" % os.path.splitext(os.path.basename(orig_file))) if not utils.file_exists(bed6_file): with open(bed6_file, "w") as out_handle: for i, region in enumerate(li...
python
def _bed_to_bed6(orig_file, out_dir): """Convert bed to required bed6 inputs. """ bed6_file = os.path.join(out_dir, "%s-bed6%s" % os.path.splitext(os.path.basename(orig_file))) if not utils.file_exists(bed6_file): with open(bed6_file, "w") as out_handle: for i, region in enumerate(li...
[ "def", "_bed_to_bed6", "(", "orig_file", ",", "out_dir", ")", ":", "bed6_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"%s-bed6%s\"", "%", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "orig_file...
Convert bed to required bed6 inputs.
[ "Convert", "bed", "to", "required", "bed6", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L161-L172
223,141
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
_detect_duplicates
def _detect_duplicates(bam_file, out_dir, data): """ count duplicate percentage """ out_file = os.path.join(out_dir, "dup_metrics.txt") if not utils.file_exists(out_file): dup_align_bam = postalign.dedup_bam(bam_file, data) logger.info("Detecting duplicates in %s." % dup_align_bam) ...
python
def _detect_duplicates(bam_file, out_dir, data): """ count duplicate percentage """ out_file = os.path.join(out_dir, "dup_metrics.txt") if not utils.file_exists(out_file): dup_align_bam = postalign.dedup_bam(bam_file, data) logger.info("Detecting duplicates in %s." % dup_align_bam) ...
[ "def", "_detect_duplicates", "(", "bam_file", ",", "out_dir", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"dup_metrics.txt\"", ")", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "d...
count duplicate percentage
[ "count", "duplicate", "percentage" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L219-L239
223,142
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
run_rnaseq
def run_rnaseq(bam_file, data, out_dir): """ Run qualimap for a rnaseq bam file and parse results """ strandedness = {"firststrand": "strand-specific-reverse", "secondstrand": "strand-specific-forward", "unstranded": "non-strand-specific"} # Qualimap results ...
python
def run_rnaseq(bam_file, data, out_dir): """ Run qualimap for a rnaseq bam file and parse results """ strandedness = {"firststrand": "strand-specific-reverse", "secondstrand": "strand-specific-forward", "unstranded": "non-strand-specific"} # Qualimap results ...
[ "def", "run_rnaseq", "(", "bam_file", ",", "data", ",", "out_dir", ")", ":", "strandedness", "=", "{", "\"firststrand\"", ":", "\"strand-specific-reverse\"", ",", "\"secondstrand\"", ":", "\"strand-specific-forward\"", ",", "\"unstranded\"", ":", "\"non-strand-specific\...
Run qualimap for a rnaseq bam file and parse results
[ "Run", "qualimap", "for", "a", "rnaseq", "bam", "file", "and", "parse", "results" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L317-L354
223,143
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
_rnaseq_qualimap_cmd
def _rnaseq_qualimap_cmd(data, bam_file, out_dir, gtf_file=None, library="non-strand-specific"): """ Create command lines for qualimap """ config = data["config"] qualimap = config_utils.get_program("qualimap", config) resources = config_utils.get_resources("qualimap", config) num_cores = re...
python
def _rnaseq_qualimap_cmd(data, bam_file, out_dir, gtf_file=None, library="non-strand-specific"): """ Create command lines for qualimap """ config = data["config"] qualimap = config_utils.get_program("qualimap", config) resources = config_utils.get_resources("qualimap", config) num_cores = re...
[ "def", "_rnaseq_qualimap_cmd", "(", "data", ",", "bam_file", ",", "out_dir", ",", "gtf_file", "=", "None", ",", "library", "=", "\"non-strand-specific\"", ")", ":", "config", "=", "data", "[", "\"config\"", "]", "qualimap", "=", "config_utils", ".", "get_progr...
Create command lines for qualimap
[ "Create", "command", "lines", "for", "qualimap" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L356-L373
223,144
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
_find_qualimap_secondary_files
def _find_qualimap_secondary_files(results_dir, base_file): """Retrieve additional files, avoiding double uploading the base file. """ def not_dup(x): is_dup = (os.path.basename(x) == os.path.basename(base_file) and os.path.getsize(x) == os.path.getsize(base_file)) return n...
python
def _find_qualimap_secondary_files(results_dir, base_file): """Retrieve additional files, avoiding double uploading the base file. """ def not_dup(x): is_dup = (os.path.basename(x) == os.path.basename(base_file) and os.path.getsize(x) == os.path.getsize(base_file)) return n...
[ "def", "_find_qualimap_secondary_files", "(", "results_dir", ",", "base_file", ")", ":", "def", "not_dup", "(", "x", ")", ":", "is_dup", "=", "(", "os", ".", "path", ".", "basename", "(", "x", ")", "==", "os", ".", "path", ".", "basename", "(", "base_f...
Retrieve additional files, avoiding double uploading the base file.
[ "Retrieve", "additional", "files", "avoiding", "double", "uploading", "the", "base", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L375-L392
223,145
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
classifyplot_from_plotfiles
def classifyplot_from_plotfiles(plot_files, out_csv, outtype="png", title=None, size=None): """Create a plot from individual summary csv files with classification metrics. """ dfs = [pd.read_csv(x) for x in plot_files] samples = [] for df in dfs: for sample in df["sample"].unique(): ...
python
def classifyplot_from_plotfiles(plot_files, out_csv, outtype="png", title=None, size=None): """Create a plot from individual summary csv files with classification metrics. """ dfs = [pd.read_csv(x) for x in plot_files] samples = [] for df in dfs: for sample in df["sample"].unique(): ...
[ "def", "classifyplot_from_plotfiles", "(", "plot_files", ",", "out_csv", ",", "outtype", "=", "\"png\"", ",", "title", "=", "None", ",", "size", "=", "None", ")", ":", "dfs", "=", "[", "pd", ".", "read_csv", "(", "x", ")", "for", "x", "in", "plot_files...
Create a plot from individual summary csv files with classification metrics.
[ "Create", "a", "plot", "from", "individual", "summary", "csv", "files", "with", "classification", "metrics", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L22-L33
223,146
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
classifyplot_from_valfile
def classifyplot_from_valfile(val_file, outtype="png", title=None, size=None, samples=None, callers=None): """Create a plot from a summarized validation file. Does new-style plotting of summarized metrics of false negative rate and false discovery rate. https://en.wikipedi...
python
def classifyplot_from_valfile(val_file, outtype="png", title=None, size=None, samples=None, callers=None): """Create a plot from a summarized validation file. Does new-style plotting of summarized metrics of false negative rate and false discovery rate. https://en.wikipedi...
[ "def", "classifyplot_from_valfile", "(", "val_file", ",", "outtype", "=", "\"png\"", ",", "title", "=", "None", ",", "size", "=", "None", ",", "samples", "=", "None", ",", "callers", "=", "None", ")", ":", "mpl", ".", "use", "(", "'Agg'", ",", "force",...
Create a plot from a summarized validation file. Does new-style plotting of summarized metrics of false negative rate and false discovery rate. https://en.wikipedia.org/wiki/Sensitivity_and_specificity
[ "Create", "a", "plot", "from", "a", "summarized", "validation", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L35-L53
223,147
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
create
def create(plot_data, header, ploti, sample_config, out_file_base, outtype="png", title=None, size=None): """Create plots of validation results for a sample, labeling prep strategies. """ if mpl is None or plt is None or sns is None: not_found = ", ".join([x for x in ['mpl', 'plt', 'sns']...
python
def create(plot_data, header, ploti, sample_config, out_file_base, outtype="png", title=None, size=None): """Create plots of validation results for a sample, labeling prep strategies. """ if mpl is None or plt is None or sns is None: not_found = ", ".join([x for x in ['mpl', 'plt', 'sns']...
[ "def", "create", "(", "plot_data", ",", "header", ",", "ploti", ",", "sample_config", ",", "out_file_base", ",", "outtype", "=", "\"png\"", ",", "title", "=", "None", ",", "size", "=", "None", ")", ":", "if", "mpl", "is", "None", "or", "plt", "is", "...
Create plots of validation results for a sample, labeling prep strategies.
[ "Create", "plots", "of", "validation", "results", "for", "a", "sample", "labeling", "prep", "strategies", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L145-L167
223,148
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
plot_prep_methods
def plot_prep_methods(df, prep, prepi, out_file_base, outtype, title=None, size=None): """Plot comparison between BAM preparation methods. """ samples = df[(df["bamprep"] == prep)]["sample"].unique() assert len(samples) >= 1, samples out_file = "%s-%s.%s" % (out_file_base, samp...
python
def plot_prep_methods(df, prep, prepi, out_file_base, outtype, title=None, size=None): """Plot comparison between BAM preparation methods. """ samples = df[(df["bamprep"] == prep)]["sample"].unique() assert len(samples) >= 1, samples out_file = "%s-%s.%s" % (out_file_base, samp...
[ "def", "plot_prep_methods", "(", "df", ",", "prep", ",", "prepi", ",", "out_file_base", ",", "outtype", ",", "title", "=", "None", ",", "size", "=", "None", ")", ":", "samples", "=", "df", "[", "(", "df", "[", "\"bamprep\"", "]", "==", "prep", ")", ...
Plot comparison between BAM preparation methods.
[ "Plot", "comparison", "between", "BAM", "preparation", "methods", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L178-L187
223,149
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
_seaborn
def _seaborn(df, prep, prepi, out_file, title=None, size=None): """Plot using seaborn wrapper around matplotlib. """ plt.ioff() sns.set(style='dark') vtypes = df["variant.type"].unique() callers = sorted(df["caller"].unique()) cats = _check_cats(["concordant", "discordant-missing-total", ...
python
def _seaborn(df, prep, prepi, out_file, title=None, size=None): """Plot using seaborn wrapper around matplotlib. """ plt.ioff() sns.set(style='dark') vtypes = df["variant.type"].unique() callers = sorted(df["caller"].unique()) cats = _check_cats(["concordant", "discordant-missing-total", ...
[ "def", "_seaborn", "(", "df", ",", "prep", ",", "prepi", ",", "out_file", ",", "title", "=", "None", ",", "size", "=", "None", ")", ":", "plt", ".", "ioff", "(", ")", "sns", ".", "set", "(", "style", "=", "'dark'", ")", "vtypes", "=", "df", "["...
Plot using seaborn wrapper around matplotlib.
[ "Plot", "using", "seaborn", "wrapper", "around", "matplotlib", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L189-L228
223,150
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
_check_cats
def _check_cats(cats, vtypes, df, prep, callers): """Only include categories in the final output if they have values. """ out = [] for cat in cats: all_vals = [] for vtype in vtypes: vals, labels, maxval = _get_chart_info(df, vtype, cat, prep, callers) all_vals.ex...
python
def _check_cats(cats, vtypes, df, prep, callers): """Only include categories in the final output if they have values. """ out = [] for cat in cats: all_vals = [] for vtype in vtypes: vals, labels, maxval = _get_chart_info(df, vtype, cat, prep, callers) all_vals.ex...
[ "def", "_check_cats", "(", "cats", ",", "vtypes", ",", "df", ",", "prep", ",", "callers", ")", ":", "out", "=", "[", "]", "for", "cat", "in", "cats", ":", "all_vals", "=", "[", "]", "for", "vtype", "in", "vtypes", ":", "vals", ",", "labels", ",",...
Only include categories in the final output if they have values.
[ "Only", "include", "categories", "in", "the", "final", "output", "if", "they", "have", "values", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L230-L244
223,151
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
_get_chart_info
def _get_chart_info(df, vtype, cat, prep, callers): """Retrieve values for a specific variant type, category and prep method. """ maxval_raw = max(list(df["value.floor"])) curdf = df[(df["variant.type"] == vtype) & (df["category"] == cat) & (df["bamprep"] == prep)] vals = [] label...
python
def _get_chart_info(df, vtype, cat, prep, callers): """Retrieve values for a specific variant type, category and prep method. """ maxval_raw = max(list(df["value.floor"])) curdf = df[(df["variant.type"] == vtype) & (df["category"] == cat) & (df["bamprep"] == prep)] vals = [] label...
[ "def", "_get_chart_info", "(", "df", ",", "vtype", ",", "cat", ",", "prep", ",", "callers", ")", ":", "maxval_raw", "=", "max", "(", "list", "(", "df", "[", "\"value.floor\"", "]", ")", ")", "curdf", "=", "df", "[", "(", "df", "[", "\"variant.type\""...
Retrieve values for a specific variant type, category and prep method.
[ "Retrieve", "values", "for", "a", "specific", "variant", "type", "category", "and", "prep", "method", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L246-L262
223,152
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
_annotate
def _annotate(ax, annotate, height, left, width): """Annotate axis with labels. """ annotate_yrange_factor = 0.010 xticks = np.array(left) + width / 2.0 ymin, ymax = ax.get_ylim() yrange = ymax - ymin # Reset ymax and ymin so there's enough room to see the annotation of # the top-most ...
python
def _annotate(ax, annotate, height, left, width): """Annotate axis with labels. """ annotate_yrange_factor = 0.010 xticks = np.array(left) + width / 2.0 ymin, ymax = ax.get_ylim() yrange = ymax - ymin # Reset ymax and ymin so there's enough room to see the annotation of # the top-most ...
[ "def", "_annotate", "(", "ax", ",", "annotate", ",", "height", ",", "left", ",", "width", ")", ":", "annotate_yrange_factor", "=", "0.010", "xticks", "=", "np", ".", "array", "(", "left", ")", "+", "width", "/", "2.0", "ymin", ",", "ymax", "=", "ax",...
Annotate axis with labels.
[ "Annotate", "axis", "with", "labels", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L264-L302
223,153
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
_ggplot
def _ggplot(df, out_file): """Plot faceted items with ggplot wrapper on top of matplotlib. XXX Not yet functional """ import ggplot as gg df["variant.type"] = [vtype_labels[x] for x in df["variant.type"]] df["category"] = [cat_labels[x] for x in df["category"]] df["caller"] = [caller_labels....
python
def _ggplot(df, out_file): """Plot faceted items with ggplot wrapper on top of matplotlib. XXX Not yet functional """ import ggplot as gg df["variant.type"] = [vtype_labels[x] for x in df["variant.type"]] df["category"] = [cat_labels[x] for x in df["category"]] df["caller"] = [caller_labels....
[ "def", "_ggplot", "(", "df", ",", "out_file", ")", ":", "import", "ggplot", "as", "gg", "df", "[", "\"variant.type\"", "]", "=", "[", "vtype_labels", "[", "x", "]", "for", "x", "in", "df", "[", "\"variant.type\"", "]", "]", "df", "[", "\"category\"", ...
Plot faceted items with ggplot wrapper on top of matplotlib. XXX Not yet functional
[ "Plot", "faceted", "items", "with", "ggplot", "wrapper", "on", "top", "of", "matplotlib", ".", "XXX", "Not", "yet", "functional" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L304-L315
223,154
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
get_floor_value
def get_floor_value(x, cat, vartype, floors): """Modify values so all have the same relative scale for differences. Using the chosen base heights, adjusts an individual sub-plot to be consistent relative to that height. """ all_base = floors[vartype] cur_max = floors[(cat, vartype)] if cur_...
python
def get_floor_value(x, cat, vartype, floors): """Modify values so all have the same relative scale for differences. Using the chosen base heights, adjusts an individual sub-plot to be consistent relative to that height. """ all_base = floors[vartype] cur_max = floors[(cat, vartype)] if cur_...
[ "def", "get_floor_value", "(", "x", ",", "cat", ",", "vartype", ",", "floors", ")", ":", "all_base", "=", "floors", "[", "vartype", "]", "cur_max", "=", "floors", "[", "(", "cat", ",", "vartype", ")", "]", "if", "cur_max", ">", "all_base", ":", "diff...
Modify values so all have the same relative scale for differences. Using the chosen base heights, adjusts an individual sub-plot to be consistent relative to that height.
[ "Modify", "values", "so", "all", "have", "the", "same", "relative", "scale", "for", "differences", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L317-L328
223,155
bcbio/bcbio-nextgen
bcbio/variation/validateplot.py
get_group_floors
def get_group_floors(df, cat_labels): """Retrieve the floor for a given row of comparisons, creating a normalized set of differences. We need to set non-zero floors so large numbers (like concordance) don't drown out small numbers (like discordance). This defines the height for a row of comparisons as eith...
python
def get_group_floors(df, cat_labels): """Retrieve the floor for a given row of comparisons, creating a normalized set of differences. We need to set non-zero floors so large numbers (like concordance) don't drown out small numbers (like discordance). This defines the height for a row of comparisons as eith...
[ "def", "get_group_floors", "(", "df", ",", "cat_labels", ")", ":", "group_maxes", "=", "collections", ".", "defaultdict", "(", "list", ")", "group_diffs", "=", "collections", ".", "defaultdict", "(", "list", ")", "diff_pad", "=", "0.1", "# 10% padding onto diffe...
Retrieve the floor for a given row of comparisons, creating a normalized set of differences. We need to set non-zero floors so large numbers (like concordance) don't drown out small numbers (like discordance). This defines the height for a row of comparisons as either the minimum height of any sub-plot, or...
[ "Retrieve", "the", "floor", "for", "a", "given", "row", "of", "comparisons", "creating", "a", "normalized", "set", "of", "differences", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/validateplot.py#L330-L354
223,156
bcbio/bcbio-nextgen
scripts/bcbio_nextgen.py
_sanity_check_args
def _sanity_check_args(args): """Ensure dependent arguments are correctly specified """ if "scheduler" in args and "queue" in args: if args.scheduler and not args.queue: if args.scheduler != "sge": return "IPython parallel scheduler (-s) specified. This also requires a qu...
python
def _sanity_check_args(args): """Ensure dependent arguments are correctly specified """ if "scheduler" in args and "queue" in args: if args.scheduler and not args.queue: if args.scheduler != "sge": return "IPython parallel scheduler (-s) specified. This also requires a qu...
[ "def", "_sanity_check_args", "(", "args", ")", ":", "if", "\"scheduler\"", "in", "args", "and", "\"queue\"", "in", "args", ":", "if", "args", ".", "scheduler", "and", "not", "args", ".", "queue", ":", "if", "args", ".", "scheduler", "!=", "\"sge\"", ":",...
Ensure dependent arguments are correctly specified
[ "Ensure", "dependent", "arguments", "are", "correctly", "specified" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen.py#L143-L153
223,157
bcbio/bcbio-nextgen
scripts/bcbio_nextgen.py
_add_inputs_to_kwargs
def _add_inputs_to_kwargs(args, kwargs, parser): """Convert input system config, flow cell directory and sample yaml to kwargs. Handles back compatibility with previous commandlines while allowing flexible specification of input parameters. """ inputs = [x for x in [args.global_config, args.fc_dir]...
python
def _add_inputs_to_kwargs(args, kwargs, parser): """Convert input system config, flow cell directory and sample yaml to kwargs. Handles back compatibility with previous commandlines while allowing flexible specification of input parameters. """ inputs = [x for x in [args.global_config, args.fc_dir]...
[ "def", "_add_inputs_to_kwargs", "(", "args", ",", "kwargs", ",", "parser", ")", ":", "inputs", "=", "[", "x", "for", "x", "in", "[", "args", ".", "global_config", ",", "args", ".", "fc_dir", "]", "+", "args", ".", "run_config", "if", "x", "is", "not"...
Convert input system config, flow cell directory and sample yaml to kwargs. Handles back compatibility with previous commandlines while allowing flexible specification of input parameters.
[ "Convert", "input", "system", "config", "flow", "cell", "directory", "and", "sample", "yaml", "to", "kwargs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen.py#L162-L216
223,158
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
_add_commas
def _add_commas(s, sep=','): """Add commas to output counts. From: http://code.activestate.com/recipes/498181 """ if len(s) <= 3: return s return _add_commas(s[:-3], sep) + sep + s[-3:]
python
def _add_commas(s, sep=','): """Add commas to output counts. From: http://code.activestate.com/recipes/498181 """ if len(s) <= 3: return s return _add_commas(s[:-3], sep) + sep + s[-3:]
[ "def", "_add_commas", "(", "s", ",", "sep", "=", "','", ")", ":", "if", "len", "(", "s", ")", "<=", "3", ":", "return", "s", "return", "_add_commas", "(", "s", "[", ":", "-", "3", "]", ",", "sep", ")", "+", "sep", "+", "s", "[", "-", "3", ...
Add commas to output counts. From: http://code.activestate.com/recipes/498181
[ "Add", "commas", "to", "output", "counts", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L428-L436
223,159
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
bed_to_interval
def bed_to_interval(orig_bed, bam_file): """Add header and format BED bait and target files for Picard if necessary. """ with open(orig_bed) as in_handle: line = in_handle.readline() if line.startswith("@"): yield orig_bed else: with pysam.Samfile(bam_file, "rb") as bam_handl...
python
def bed_to_interval(orig_bed, bam_file): """Add header and format BED bait and target files for Picard if necessary. """ with open(orig_bed) as in_handle: line = in_handle.readline() if line.startswith("@"): yield orig_bed else: with pysam.Samfile(bam_file, "rb") as bam_handl...
[ "def", "bed_to_interval", "(", "orig_bed", ",", "bam_file", ")", ":", "with", "open", "(", "orig_bed", ")", "as", "in_handle", ":", "line", "=", "in_handle", ".", "readline", "(", ")", "if", "line", ".", "startswith", "(", "\"@\"", ")", ":", "yield", "...
Add header and format BED bait and target files for Picard if necessary.
[ "Add", "header", "and", "format", "BED", "bait", "and", "target", "files", "for", "Picard", "if", "necessary", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L440-L465
223,160
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
PicardMetricsParser.get_summary_metrics
def get_summary_metrics(self, align_metrics, dup_metrics, insert_metrics=None, hybrid_metrics=None, vrn_vals=None, rnaseq_metrics=None): """Retrieve a high level summary of interesting metrics. """ with open(align_metrics) as in_handle: align_vals = self._pars...
python
def get_summary_metrics(self, align_metrics, dup_metrics, insert_metrics=None, hybrid_metrics=None, vrn_vals=None, rnaseq_metrics=None): """Retrieve a high level summary of interesting metrics. """ with open(align_metrics) as in_handle: align_vals = self._pars...
[ "def", "get_summary_metrics", "(", "self", ",", "align_metrics", ",", "dup_metrics", ",", "insert_metrics", "=", "None", ",", "hybrid_metrics", "=", "None", ",", "vrn_vals", "=", "None", ",", "rnaseq_metrics", "=", "None", ")", ":", "with", "open", "(", "ali...
Retrieve a high level summary of interesting metrics.
[ "Retrieve", "a", "high", "level", "summary", "of", "interesting", "metrics", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L24-L48
223,161
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
PicardMetricsParser.extract_metrics
def extract_metrics(self, metrics_files): """Return summary information for a lane of metrics files. """ extension_maps = dict( align_metrics=(self._parse_align_metrics, "AL"), dup_metrics=(self._parse_dup_metrics, "DUP"), hs_metrics=(self._parse_hybrid_metric...
python
def extract_metrics(self, metrics_files): """Return summary information for a lane of metrics files. """ extension_maps = dict( align_metrics=(self._parse_align_metrics, "AL"), dup_metrics=(self._parse_dup_metrics, "DUP"), hs_metrics=(self._parse_hybrid_metric...
[ "def", "extract_metrics", "(", "self", ",", "metrics_files", ")", ":", "extension_maps", "=", "dict", "(", "align_metrics", "=", "(", "self", ".", "_parse_align_metrics", ",", "\"AL\"", ")", ",", "dup_metrics", "=", "(", "self", ".", "_parse_dup_metrics", ",",...
Return summary information for a lane of metrics files.
[ "Return", "summary", "information", "for", "a", "lane", "of", "metrics", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L50-L72
223,162
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
PicardMetrics.report
def report(self, align_bam, ref_file, is_paired, bait_file, target_file, variant_region_file, config): """Produce report metrics using Picard with sorted aligned BAM file. """ dup_metrics = self._get_current_dup_metrics(align_bam) align_metrics = self._collect_align_metric...
python
def report(self, align_bam, ref_file, is_paired, bait_file, target_file, variant_region_file, config): """Produce report metrics using Picard with sorted aligned BAM file. """ dup_metrics = self._get_current_dup_metrics(align_bam) align_metrics = self._collect_align_metric...
[ "def", "report", "(", "self", ",", "align_bam", ",", "ref_file", ",", "is_paired", ",", "bait_file", ",", "target_file", ",", "variant_region_file", ",", "config", ")", ":", "dup_metrics", "=", "self", ".", "_get_current_dup_metrics", "(", "align_bam", ")", "a...
Produce report metrics using Picard with sorted aligned BAM file.
[ "Produce", "report", "metrics", "using", "Picard", "with", "sorted", "aligned", "BAM", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L287-L319
223,163
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
PicardMetrics._get_current_dup_metrics
def _get_current_dup_metrics(self, align_bam): """Retrieve duplicate information from input BAM file. """ metrics_file = "%s.dup_metrics" % os.path.splitext(align_bam)[0] if not file_exists(metrics_file): dups = 0 with pysam.Samfile(align_bam, "rb") as bam_handle:...
python
def _get_current_dup_metrics(self, align_bam): """Retrieve duplicate information from input BAM file. """ metrics_file = "%s.dup_metrics" % os.path.splitext(align_bam)[0] if not file_exists(metrics_file): dups = 0 with pysam.Samfile(align_bam, "rb") as bam_handle:...
[ "def", "_get_current_dup_metrics", "(", "self", ",", "align_bam", ")", ":", "metrics_file", "=", "\"%s.dup_metrics\"", "%", "os", ".", "path", ".", "splitext", "(", "align_bam", ")", "[", "0", "]", "if", "not", "file_exists", "(", "metrics_file", ")", ":", ...
Retrieve duplicate information from input BAM file.
[ "Retrieve", "duplicate", "information", "from", "input", "BAM", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L321-L335
223,164
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
PicardMetrics._check_metrics_file
def _check_metrics_file(self, bam_name, metrics_ext): """Check for an existing metrics file for the given BAM. """ base, _ = os.path.splitext(bam_name) try: int(base[-1]) can_glob = False except ValueError: can_glob = True check_fname =...
python
def _check_metrics_file(self, bam_name, metrics_ext): """Check for an existing metrics file for the given BAM. """ base, _ = os.path.splitext(bam_name) try: int(base[-1]) can_glob = False except ValueError: can_glob = True check_fname =...
[ "def", "_check_metrics_file", "(", "self", ",", "bam_name", ",", "metrics_ext", ")", ":", "base", ",", "_", "=", "os", ".", "path", ".", "splitext", "(", "bam_name", ")", "try", ":", "int", "(", "base", "[", "-", "1", "]", ")", "can_glob", "=", "Fa...
Check for an existing metrics file for the given BAM.
[ "Check", "for", "an", "existing", "metrics", "file", "for", "the", "given", "BAM", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L337-L352
223,165
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
PicardMetrics._hybrid_select_metrics
def _hybrid_select_metrics(self, dup_bam, bait_file, target_file): """Generate metrics for hybrid selection efficiency. """ metrics = self._check_metrics_file(dup_bam, "hs_metrics") if not file_exists(metrics): with bed_to_interval(bait_file, dup_bam) as ready_bait: ...
python
def _hybrid_select_metrics(self, dup_bam, bait_file, target_file): """Generate metrics for hybrid selection efficiency. """ metrics = self._check_metrics_file(dup_bam, "hs_metrics") if not file_exists(metrics): with bed_to_interval(bait_file, dup_bam) as ready_bait: ...
[ "def", "_hybrid_select_metrics", "(", "self", ",", "dup_bam", ",", "bait_file", ",", "target_file", ")", ":", "metrics", "=", "self", ".", "_check_metrics_file", "(", "dup_bam", ",", "\"hs_metrics\"", ")", "if", "not", "file_exists", "(", "metrics", ")", ":", ...
Generate metrics for hybrid selection efficiency.
[ "Generate", "metrics", "for", "hybrid", "selection", "efficiency", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L354-L373
223,166
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
PicardMetrics._variant_eval_metrics
def _variant_eval_metrics(self, dup_bam): """Find metrics for evaluating variant effectiveness. """ base, ext = os.path.splitext(dup_bam) end_strip = "-dup" base = base[:-len(end_strip)] if base.endswith(end_strip) else base mfiles = glob.glob("%s*eval_metrics" % base) ...
python
def _variant_eval_metrics(self, dup_bam): """Find metrics for evaluating variant effectiveness. """ base, ext = os.path.splitext(dup_bam) end_strip = "-dup" base = base[:-len(end_strip)] if base.endswith(end_strip) else base mfiles = glob.glob("%s*eval_metrics" % base) ...
[ "def", "_variant_eval_metrics", "(", "self", ",", "dup_bam", ")", ":", "base", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "dup_bam", ")", "end_strip", "=", "\"-dup\"", "base", "=", "base", "[", ":", "-", "len", "(", "end_strip", ")", "...
Find metrics for evaluating variant effectiveness.
[ "Find", "metrics", "for", "evaluating", "variant", "effectiveness", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L375-L390
223,167
bcbio/bcbio-nextgen
bcbio/broad/metrics.py
RNASeqPicardMetrics.report
def report(self, align_bam, ref_file, gtf_file, is_paired=False, rrna_file="null"): """Produce report metrics for a RNASeq experiment using Picard with a sorted aligned BAM file. """ # collect duplication metrics dup_metrics = self._get_current_dup_metrics(align_bam) al...
python
def report(self, align_bam, ref_file, gtf_file, is_paired=False, rrna_file="null"): """Produce report metrics for a RNASeq experiment using Picard with a sorted aligned BAM file. """ # collect duplication metrics dup_metrics = self._get_current_dup_metrics(align_bam) al...
[ "def", "report", "(", "self", ",", "align_bam", ",", "ref_file", ",", "gtf_file", ",", "is_paired", "=", "False", ",", "rrna_file", "=", "\"null\"", ")", ":", "# collect duplication metrics", "dup_metrics", "=", "self", ".", "_get_current_dup_metrics", "(", "ali...
Produce report metrics for a RNASeq experiment using Picard with a sorted aligned BAM file.
[ "Produce", "report", "metrics", "for", "a", "RNASeq", "experiment", "using", "Picard", "with", "a", "sorted", "aligned", "BAM", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/metrics.py#L470-L493
223,168
bcbio/bcbio-nextgen
bcbio/variation/gatk.py
standard_cl_params
def standard_cl_params(items): """Shared command line parameters for GATK programs. Handles no removal of duplicate reads for amplicon or non mark duplicate experiments. If we have pre-aligned inputs we ignore the value or mark duplicates (since they may already be marked in the input BAM). """...
python
def standard_cl_params(items): """Shared command line parameters for GATK programs. Handles no removal of duplicate reads for amplicon or non mark duplicate experiments. If we have pre-aligned inputs we ignore the value or mark duplicates (since they may already be marked in the input BAM). """...
[ "def", "standard_cl_params", "(", "items", ")", ":", "out", "=", "[", "]", "def", "_skip_duplicates", "(", "data", ")", ":", "return", "(", "dd", ".", "get_coverage_interval", "(", "data", ")", "==", "\"amplicon\"", "or", "(", "dd", ".", "get_aligner", "...
Shared command line parameters for GATK programs. Handles no removal of duplicate reads for amplicon or non mark duplicate experiments. If we have pre-aligned inputs we ignore the value or mark duplicates (since they may already be marked in the input BAM).
[ "Shared", "command", "line", "parameters", "for", "GATK", "programs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/gatk.py#L17-L36
223,169
bcbio/bcbio-nextgen
bcbio/variation/gatk.py
_shared_gatk_call_prep
def _shared_gatk_call_prep(align_bams, items, ref_file, region, out_file, num_cores=1): """Shared preparation work for GATK variant calling. """ data = items[0] config = data["config"] broad_runner = broad.runner_from_config(config) gatk_type = broad_runner.gatk_type() for x in align_bams: ...
python
def _shared_gatk_call_prep(align_bams, items, ref_file, region, out_file, num_cores=1): """Shared preparation work for GATK variant calling. """ data = items[0] config = data["config"] broad_runner = broad.runner_from_config(config) gatk_type = broad_runner.gatk_type() for x in align_bams: ...
[ "def", "_shared_gatk_call_prep", "(", "align_bams", ",", "items", ",", "ref_file", ",", "region", ",", "out_file", ",", "num_cores", "=", "1", ")", ":", "data", "=", "items", "[", "0", "]", "config", "=", "data", "[", "\"config\"", "]", "broad_runner", "...
Shared preparation work for GATK variant calling.
[ "Shared", "preparation", "work", "for", "GATK", "variant", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/gatk.py#L38-L66
223,170
bcbio/bcbio-nextgen
bcbio/variation/gatk.py
unified_genotyper
def unified_genotyper(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Perform SNP genotyping on the given alignment file. """ if out_file is None: out_file = "%s-variants.vcf.gz" % utils.splitext_plus(align_bams[0])[0] if not utils.file_exists(out...
python
def unified_genotyper(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Perform SNP genotyping on the given alignment file. """ if out_file is None: out_file = "%s-variants.vcf.gz" % utils.splitext_plus(align_bams[0])[0] if not utils.file_exists(out...
[ "def", "unified_genotyper", "(", "align_bams", ",", "items", ",", "ref_file", ",", "assoc_files", ",", "region", "=", "None", ",", "out_file", "=", "None", ")", ":", "if", "out_file", "is", "None", ":", "out_file", "=", "\"%s-variants.vcf.gz\"", "%", "utils"...
Perform SNP genotyping on the given alignment file.
[ "Perform", "SNP", "genotyping", "on", "the", "given", "alignment", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/gatk.py#L68-L87
223,171
bcbio/bcbio-nextgen
bcbio/variation/gatk.py
_joint_calling
def _joint_calling(items): """Determine if this call feeds downstream into joint calls. """ jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), items[0]) if jointcaller: assert len(items) == 1, "Can only do joint calling preparation with GATK with single samples" assert tz.ge...
python
def _joint_calling(items): """Determine if this call feeds downstream into joint calls. """ jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), items[0]) if jointcaller: assert len(items) == 1, "Can only do joint calling preparation with GATK with single samples" assert tz.ge...
[ "def", "_joint_calling", "(", "items", ")", ":", "jointcaller", "=", "tz", ".", "get_in", "(", "(", "\"config\"", ",", "\"algorithm\"", ",", "\"jointcaller\"", ")", ",", "items", "[", "0", "]", ")", "if", "jointcaller", ":", "assert", "len", "(", "items"...
Determine if this call feeds downstream into joint calls.
[ "Determine", "if", "this", "call", "feeds", "downstream", "into", "joint", "calls", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/gatk.py#L89-L97
223,172
bcbio/bcbio-nextgen
bcbio/variation/gatk.py
_supports_avx
def _supports_avx(): """Check for support for Intel AVX acceleration.""" if os.path.exists("/proc/cpuinfo"): with open("/proc/cpuinfo") as in_handle: for line in in_handle: if line.startswith("flags") and line.find("avx") > 0: return True
python
def _supports_avx(): """Check for support for Intel AVX acceleration.""" if os.path.exists("/proc/cpuinfo"): with open("/proc/cpuinfo") as in_handle: for line in in_handle: if line.startswith("flags") and line.find("avx") > 0: return True
[ "def", "_supports_avx", "(", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "\"/proc/cpuinfo\"", ")", ":", "with", "open", "(", "\"/proc/cpuinfo\"", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "if", "line", ".", "startswit...
Check for support for Intel AVX acceleration.
[ "Check", "for", "support", "for", "Intel", "AVX", "acceleration", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/gatk.py#L204-L210
223,173
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
jar_versioner
def jar_versioner(program_name, jar_name): """Retrieve version information based on jar file. """ def get_version(config): try: pdir = config_utils.get_program(program_name, config, "dir") # not configured except ValueError: return "" jar = os.path.bas...
python
def jar_versioner(program_name, jar_name): """Retrieve version information based on jar file. """ def get_version(config): try: pdir = config_utils.get_program(program_name, config, "dir") # not configured except ValueError: return "" jar = os.path.bas...
[ "def", "jar_versioner", "(", "program_name", ",", "jar_name", ")", ":", "def", "get_version", "(", "config", ")", ":", "try", ":", "pdir", "=", "config_utils", ".", "get_program", "(", "program_name", ",", "config", ",", "\"dir\"", ")", "# not configured", "...
Retrieve version information based on jar file.
[ "Retrieve", "version", "information", "based", "on", "jar", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L66-L84
223,174
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
_get_cl_version
def _get_cl_version(p, config): """Retrieve version of a single commandline program. """ if not p.get("has_cl_version", True): return "" try: prog = config_utils.get_program(p["cmd"], config) except config_utils.CmdNotFound: localpy_cmd = os.path.join(os.path.dirname(sys.exe...
python
def _get_cl_version(p, config): """Retrieve version of a single commandline program. """ if not p.get("has_cl_version", True): return "" try: prog = config_utils.get_program(p["cmd"], config) except config_utils.CmdNotFound: localpy_cmd = os.path.join(os.path.dirname(sys.exe...
[ "def", "_get_cl_version", "(", "p", ",", "config", ")", ":", "if", "not", "p", ".", "get", "(", "\"has_cl_version\"", ",", "True", ")", ":", "return", "\"\"", "try", ":", "prog", "=", "config_utils", ".", "get_program", "(", "p", "[", "\"cmd\"", "]", ...
Retrieve version of a single commandline program.
[ "Retrieve", "version", "of", "a", "single", "commandline", "program", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L115-L145
223,175
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
_get_brew_versions
def _get_brew_versions(): """Retrieve versions of tools installed via brew. """ from bcbio import install tooldir = install.get_defaults().get("tooldir") brew_cmd = os.path.join(tooldir, "bin", "brew") if tooldir else "brew" try: vout = subprocess.check_output([brew_cmd, "list", "--versi...
python
def _get_brew_versions(): """Retrieve versions of tools installed via brew. """ from bcbio import install tooldir = install.get_defaults().get("tooldir") brew_cmd = os.path.join(tooldir, "bin", "brew") if tooldir else "brew" try: vout = subprocess.check_output([brew_cmd, "list", "--versi...
[ "def", "_get_brew_versions", "(", ")", ":", "from", "bcbio", "import", "install", "tooldir", "=", "install", ".", "get_defaults", "(", ")", ".", "get", "(", "\"tooldir\"", ")", "brew_cmd", "=", "os", ".", "path", ".", "join", "(", "tooldir", ",", "\"bin\...
Retrieve versions of tools installed via brew.
[ "Retrieve", "versions", "of", "tools", "installed", "via", "brew", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L147-L164
223,176
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
_get_versions
def _get_versions(config=None): """Retrieve details on all programs available on the system. """ try: from bcbio.pipeline import version if hasattr(version, "__version__"): bcbio_version = ("%s-%s" % (version.__version__, version.__git_revision__) if ...
python
def _get_versions(config=None): """Retrieve details on all programs available on the system. """ try: from bcbio.pipeline import version if hasattr(version, "__version__"): bcbio_version = ("%s-%s" % (version.__version__, version.__git_revision__) if ...
[ "def", "_get_versions", "(", "config", "=", "None", ")", ":", "try", ":", "from", "bcbio", ".", "pipeline", "import", "version", "if", "hasattr", "(", "version", ",", "\"__version__\"", ")", ":", "bcbio_version", "=", "(", "\"%s-%s\"", "%", "(", "version",...
Retrieve details on all programs available on the system.
[ "Retrieve", "details", "on", "all", "programs", "available", "on", "the", "system", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L166-L195
223,177
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
_get_versions_manifest
def _get_versions_manifest(manifest_dir): """Retrieve versions from a pre-existing manifest of installed software. """ all_pkgs = _manifest_progs + [p.get("name", p["cmd"]) for p in _cl_progs] + [p["name"] for p in _alt_progs] if os.path.exists(manifest_dir): out = [] for plist in ["tool...
python
def _get_versions_manifest(manifest_dir): """Retrieve versions from a pre-existing manifest of installed software. """ all_pkgs = _manifest_progs + [p.get("name", p["cmd"]) for p in _cl_progs] + [p["name"] for p in _alt_progs] if os.path.exists(manifest_dir): out = [] for plist in ["tool...
[ "def", "_get_versions_manifest", "(", "manifest_dir", ")", ":", "all_pkgs", "=", "_manifest_progs", "+", "[", "p", ".", "get", "(", "\"name\"", ",", "p", "[", "\"cmd\"", "]", ")", "for", "p", "in", "_cl_progs", "]", "+", "[", "p", "[", "\"name\"", "]",...
Retrieve versions from a pre-existing manifest of installed software.
[ "Retrieve", "versions", "from", "a", "pre", "-", "existing", "manifest", "of", "installed", "software", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L224-L247
223,178
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
write_versions
def write_versions(dirs, config=None, is_wrapper=False): """Write CSV file with versions used in analysis pipeline. """ out_file = _get_program_file(dirs) if is_wrapper: assert utils.file_exists(out_file), "Failed to create program versions from VM" elif out_file is None: for p in _g...
python
def write_versions(dirs, config=None, is_wrapper=False): """Write CSV file with versions used in analysis pipeline. """ out_file = _get_program_file(dirs) if is_wrapper: assert utils.file_exists(out_file), "Failed to create program versions from VM" elif out_file is None: for p in _g...
[ "def", "write_versions", "(", "dirs", ",", "config", "=", "None", ",", "is_wrapper", "=", "False", ")", ":", "out_file", "=", "_get_program_file", "(", "dirs", ")", "if", "is_wrapper", ":", "assert", "utils", ".", "file_exists", "(", "out_file", ")", ",", ...
Write CSV file with versions used in analysis pipeline.
[ "Write", "CSV", "file", "with", "versions", "used", "in", "analysis", "pipeline", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L254-L267
223,179
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
get_version_manifest
def get_version_manifest(name, data=None, required=False): """Retrieve a version from the currently installed manifest. """ manifest_dir = _get_manifest_dir(data, name) manifest_vs = _get_versions_manifest(manifest_dir) or [] for x in manifest_vs: if x["program"] == name: v = x.g...
python
def get_version_manifest(name, data=None, required=False): """Retrieve a version from the currently installed manifest. """ manifest_dir = _get_manifest_dir(data, name) manifest_vs = _get_versions_manifest(manifest_dir) or [] for x in manifest_vs: if x["program"] == name: v = x.g...
[ "def", "get_version_manifest", "(", "name", ",", "data", "=", "None", ",", "required", "=", "False", ")", ":", "manifest_dir", "=", "_get_manifest_dir", "(", "data", ",", "name", ")", "manifest_vs", "=", "_get_versions_manifest", "(", "manifest_dir", ")", "or"...
Retrieve a version from the currently installed manifest.
[ "Retrieve", "a", "version", "from", "the", "currently", "installed", "manifest", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L269-L281
223,180
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
add_subparser
def add_subparser(subparsers): """Add command line option for exporting version information. """ parser = subparsers.add_parser("version", help="Export versions of used software to stdout or a file ") parser.add_argument("--workdir", help="Directory export programs to ...
python
def add_subparser(subparsers): """Add command line option for exporting version information. """ parser = subparsers.add_parser("version", help="Export versions of used software to stdout or a file ") parser.add_argument("--workdir", help="Directory export programs to ...
[ "def", "add_subparser", "(", "subparsers", ")", ":", "parser", "=", "subparsers", ".", "add_parser", "(", "\"version\"", ",", "help", "=", "\"Export versions of used software to stdout or a file \"", ")", "parser", ".", "add_argument", "(", "\"--workdir\"", ",", "help...
Add command line option for exporting version information.
[ "Add", "command", "line", "option", "for", "exporting", "version", "information", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L283-L289
223,181
bcbio/bcbio-nextgen
bcbio/provenance/programs.py
get_version
def get_version(name, dirs=None, config=None): """Retrieve the current version of the given program from cached names. """ if dirs: p = _get_program_file(dirs) else: p = tz.get_in(["resources", "program_versions"], config) if p: with open(p) as in_handle: for line...
python
def get_version(name, dirs=None, config=None): """Retrieve the current version of the given program from cached names. """ if dirs: p = _get_program_file(dirs) else: p = tz.get_in(["resources", "program_versions"], config) if p: with open(p) as in_handle: for line...
[ "def", "get_version", "(", "name", ",", "dirs", "=", "None", ",", "config", "=", "None", ")", ":", "if", "dirs", ":", "p", "=", "_get_program_file", "(", "dirs", ")", "else", ":", "p", "=", "tz", ".", "get_in", "(", "[", "\"resources\"", ",", "\"pr...
Retrieve the current version of the given program from cached names.
[ "Retrieve", "the", "current", "version", "of", "the", "given", "program", "from", "cached", "names", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/programs.py#L291-L304
223,182
bcbio/bcbio-nextgen
scripts/utils/hlas_to_pgroups.py
hla_choices
def hla_choices(orig_hla, min_parts=2): """Provide a range of options for HLA type, with decreasing resolution. """ yield orig_hla try: int(orig_hla[-1]) except ValueError: yield orig_hla[:-1] hla_parts = orig_hla.split(":") for sub_i in range(len(hla_parts) - min_parts + 1):...
python
def hla_choices(orig_hla, min_parts=2): """Provide a range of options for HLA type, with decreasing resolution. """ yield orig_hla try: int(orig_hla[-1]) except ValueError: yield orig_hla[:-1] hla_parts = orig_hla.split(":") for sub_i in range(len(hla_parts) - min_parts + 1):...
[ "def", "hla_choices", "(", "orig_hla", ",", "min_parts", "=", "2", ")", ":", "yield", "orig_hla", "try", ":", "int", "(", "orig_hla", "[", "-", "1", "]", ")", "except", "ValueError", ":", "yield", "orig_hla", "[", ":", "-", "1", "]", "hla_parts", "="...
Provide a range of options for HLA type, with decreasing resolution.
[ "Provide", "a", "range", "of", "options", "for", "HLA", "type", "with", "decreasing", "resolution", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hlas_to_pgroups.py#L35-L45
223,183
bcbio/bcbio-nextgen
scripts/utils/hlas_to_pgroups.py
read_pgroups
def read_pgroups(in_file): """Read HLAs and the pgroups they fall in. """ out = {} with open(in_file) as in_handle: for line in (l for l in in_handle if not l.startswith("#")): locus, alleles, group = line.strip().split(";") for allele in alleles.split("/"): ...
python
def read_pgroups(in_file): """Read HLAs and the pgroups they fall in. """ out = {} with open(in_file) as in_handle: for line in (l for l in in_handle if not l.startswith("#")): locus, alleles, group = line.strip().split(";") for allele in alleles.split("/"): ...
[ "def", "read_pgroups", "(", "in_file", ")", ":", "out", "=", "{", "}", "with", "open", "(", "in_file", ")", "as", "in_handle", ":", "for", "line", "in", "(", "l", "for", "l", "in", "in_handle", "if", "not", "l", ".", "startswith", "(", "\"#\"", ")"...
Read HLAs and the pgroups they fall in.
[ "Read", "HLAs", "and", "the", "pgroups", "they", "fall", "in", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hlas_to_pgroups.py#L47-L56
223,184
bcbio/bcbio-nextgen
scripts/utils/hlas_to_pgroups.py
read_hlas
def read_hlas(fasta_fai): """Get HLA alleles from the hg38 fasta fai file. """ out = [] with open(fasta_fai) as in_handle: for line in in_handle: if line.startswith("HLA"): out.append(line.split()[0]) return out
python
def read_hlas(fasta_fai): """Get HLA alleles from the hg38 fasta fai file. """ out = [] with open(fasta_fai) as in_handle: for line in in_handle: if line.startswith("HLA"): out.append(line.split()[0]) return out
[ "def", "read_hlas", "(", "fasta_fai", ")", ":", "out", "=", "[", "]", "with", "open", "(", "fasta_fai", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "if", "line", ".", "startswith", "(", "\"HLA\"", ")", ":", "out", ".", "append...
Get HLA alleles from the hg38 fasta fai file.
[ "Get", "HLA", "alleles", "from", "the", "hg38", "fasta", "fai", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hlas_to_pgroups.py#L58-L66
223,185
bcbio/bcbio-nextgen
bcbio/variation/split.py
split_vcf
def split_vcf(in_file, ref_file, config, out_dir=None): """Split a VCF file into separate files by chromosome. """ if out_dir is None: out_dir = os.path.join(os.path.dirname(in_file), "split") out_files = [] with open(ref.fasta_idx(ref_file, config)) as in_handle: for line in in_hand...
python
def split_vcf(in_file, ref_file, config, out_dir=None): """Split a VCF file into separate files by chromosome. """ if out_dir is None: out_dir = os.path.join(os.path.dirname(in_file), "split") out_files = [] with open(ref.fasta_idx(ref_file, config)) as in_handle: for line in in_hand...
[ "def", "split_vcf", "(", "in_file", ",", "ref_file", ",", "config", ",", "out_dir", "=", "None", ")", ":", "if", "out_dir", "is", "None", ":", "out_dir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "in_file", "...
Split a VCF file into separate files by chromosome.
[ "Split", "a", "VCF", "file", "into", "separate", "files", "by", "chromosome", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/split.py#L12-L25
223,186
bcbio/bcbio-nextgen
bcbio/variation/split.py
subset_vcf
def subset_vcf(in_file, region, out_file, config): """Subset VCF in the given region, handling bgzip and indexing of input. """ work_file = vcfutils.bgzip_and_index(in_file, config) if not file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: bcftools = confi...
python
def subset_vcf(in_file, region, out_file, config): """Subset VCF in the given region, handling bgzip and indexing of input. """ work_file = vcfutils.bgzip_and_index(in_file, config) if not file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: bcftools = confi...
[ "def", "subset_vcf", "(", "in_file", ",", "region", ",", "out_file", ",", "config", ")", ":", "work_file", "=", "vcfutils", ".", "bgzip_and_index", "(", "in_file", ",", "config", ")", "if", "not", "file_exists", "(", "out_file", ")", ":", "with", "file_tra...
Subset VCF in the given region, handling bgzip and indexing of input.
[ "Subset", "VCF", "in", "the", "given", "region", "handling", "bgzip", "and", "indexing", "of", "input", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/split.py#L27-L37
223,187
bcbio/bcbio-nextgen
bcbio/variation/recalibrate.py
prep_recal
def prep_recal(data): """Do pre-BQSR recalibration, calculation of recalibration tables. """ if dd.get_recalibrate(data) in [True, "gatk"]: logger.info("Prepare BQSR tables with GATK: %s " % str(dd.get_sample_name(data))) dbsnp_file = tz.get_in(("genome_resources", "variation", "dbsnp"), dat...
python
def prep_recal(data): """Do pre-BQSR recalibration, calculation of recalibration tables. """ if dd.get_recalibrate(data) in [True, "gatk"]: logger.info("Prepare BQSR tables with GATK: %s " % str(dd.get_sample_name(data))) dbsnp_file = tz.get_in(("genome_resources", "variation", "dbsnp"), dat...
[ "def", "prep_recal", "(", "data", ")", ":", "if", "dd", ".", "get_recalibrate", "(", "data", ")", "in", "[", "True", ",", "\"gatk\"", "]", ":", "logger", ".", "info", "(", "\"Prepare BQSR tables with GATK: %s \"", "%", "str", "(", "dd", ".", "get_sample_na...
Do pre-BQSR recalibration, calculation of recalibration tables.
[ "Do", "pre", "-", "BQSR", "recalibration", "calculation", "of", "recalibration", "tables", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/recalibrate.py#L21-L41
223,188
bcbio/bcbio-nextgen
bcbio/variation/recalibrate.py
apply_recal
def apply_recal(data): """Apply recalibration tables to the sorted aligned BAM, producing recalibrated BAM. """ orig_bam = dd.get_align_bam(data) or dd.get_work_bam(data) had_work_bam = "work_bam" in data if dd.get_recalibrate(data) in [True, "gatk"]: if data.get("prep_recal"): l...
python
def apply_recal(data): """Apply recalibration tables to the sorted aligned BAM, producing recalibrated BAM. """ orig_bam = dd.get_align_bam(data) or dd.get_work_bam(data) had_work_bam = "work_bam" in data if dd.get_recalibrate(data) in [True, "gatk"]: if data.get("prep_recal"): l...
[ "def", "apply_recal", "(", "data", ")", ":", "orig_bam", "=", "dd", ".", "get_align_bam", "(", "data", ")", "or", "dd", ".", "get_work_bam", "(", "data", ")", "had_work_bam", "=", "\"work_bam\"", "in", "data", "if", "dd", ".", "get_recalibrate", "(", "da...
Apply recalibration tables to the sorted aligned BAM, producing recalibrated BAM.
[ "Apply", "recalibration", "tables", "to", "the", "sorted", "aligned", "BAM", "producing", "recalibrated", "BAM", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/recalibrate.py#L43-L63
223,189
bcbio/bcbio-nextgen
bcbio/variation/recalibrate.py
_gatk_base_recalibrator
def _gatk_base_recalibrator(broad_runner, dup_align_bam, ref_file, platform, dbsnp_file, intervals, data): """Step 1 of GATK recalibration process, producing table of covariates. For GATK 4 we use local multicore spark runs: https://github.com/broadinstitute/gatk/issues/2345 ...
python
def _gatk_base_recalibrator(broad_runner, dup_align_bam, ref_file, platform, dbsnp_file, intervals, data): """Step 1 of GATK recalibration process, producing table of covariates. For GATK 4 we use local multicore spark runs: https://github.com/broadinstitute/gatk/issues/2345 ...
[ "def", "_gatk_base_recalibrator", "(", "broad_runner", ",", "dup_align_bam", ",", "ref_file", ",", "platform", ",", "dbsnp_file", ",", "intervals", ",", "data", ")", ":", "target_counts", "=", "1e8", "# 100 million reads per read group, 20x the plotted max", "out_file", ...
Step 1 of GATK recalibration process, producing table of covariates. For GATK 4 we use local multicore spark runs: https://github.com/broadinstitute/gatk/issues/2345 For GATK3, Large whole genome BAM files take an excessively long time to recalibrate and the extra inputs don't help much beyond a certa...
[ "Step", "1", "of", "GATK", "recalibration", "process", "producing", "table", "of", "covariates", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/recalibrate.py#L67-L132
223,190
bcbio/bcbio-nextgen
bcbio/variation/recalibrate.py
_gatk_apply_bqsr
def _gatk_apply_bqsr(data): """Parallel BQSR support for GATK4. Normalized qualities to 3 bin outputs at 10, 20 and 30 based on pipeline standard recommendations, which will help with output file sizes: https://github.com/CCDG/Pipeline-Standardization/blob/master/PipelineStandard.md#base-quality-score-...
python
def _gatk_apply_bqsr(data): """Parallel BQSR support for GATK4. Normalized qualities to 3 bin outputs at 10, 20 and 30 based on pipeline standard recommendations, which will help with output file sizes: https://github.com/CCDG/Pipeline-Standardization/blob/master/PipelineStandard.md#base-quality-score-...
[ "def", "_gatk_apply_bqsr", "(", "data", ")", ":", "in_file", "=", "dd", ".", "get_align_bam", "(", "data", ")", "or", "dd", ".", "get_work_bam", "(", "data", ")", "out_file", "=", "os", ".", "path", ".", "join", "(", "dd", ".", "get_work_dir", "(", "...
Parallel BQSR support for GATK4. Normalized qualities to 3 bin outputs at 10, 20 and 30 based on pipeline standard recommendations, which will help with output file sizes: https://github.com/CCDG/Pipeline-Standardization/blob/master/PipelineStandard.md#base-quality-score-binning-scheme https://github.c...
[ "Parallel", "BQSR", "support", "for", "GATK4", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/recalibrate.py#L134-L179
223,191
bcbio/bcbio-nextgen
bcbio/log/__init__.py
create_base_logger
def create_base_logger(config=None, parallel=None): """Setup base logging configuration, also handling remote logging. Correctly sets up for local, multiprocessing and distributed runs. Creates subscribers for non-local runs that will be references from local logging. Retrieves IP address using ti...
python
def create_base_logger(config=None, parallel=None): """Setup base logging configuration, also handling remote logging. Correctly sets up for local, multiprocessing and distributed runs. Creates subscribers for non-local runs that will be references from local logging. Retrieves IP address using ti...
[ "def", "create_base_logger", "(", "config", "=", "None", ",", "parallel", "=", "None", ")", ":", "if", "parallel", "is", "None", ":", "parallel", "=", "{", "}", "parallel_type", "=", "parallel", ".", "get", "(", "\"type\"", ",", "\"local\"", ")", "cores"...
Setup base logging configuration, also handling remote logging. Correctly sets up for local, multiprocessing and distributed runs. Creates subscribers for non-local runs that will be references from local logging. Retrieves IP address using tips from http://stackoverflow.com/a/1267524/252589
[ "Setup", "base", "logging", "configuration", "also", "handling", "remote", "logging", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/log/__init__.py#L91-L130
223,192
bcbio/bcbio-nextgen
bcbio/log/__init__.py
setup_local_logging
def setup_local_logging(config=None, parallel=None): """Setup logging for a local context, directing messages to appropriate base loggers. Handles local, multiprocessing and distributed setup, connecting to handlers created by the base logger. """ if config is None: config = {} if parallel is N...
python
def setup_local_logging(config=None, parallel=None): """Setup logging for a local context, directing messages to appropriate base loggers. Handles local, multiprocessing and distributed setup, connecting to handlers created by the base logger. """ if config is None: config = {} if parallel is N...
[ "def", "setup_local_logging", "(", "config", "=", "None", ",", "parallel", "=", "None", ")", ":", "if", "config", "is", "None", ":", "config", "=", "{", "}", "if", "parallel", "is", "None", ":", "parallel", "=", "{", "}", "parallel_type", "=", "paralle...
Setup logging for a local context, directing messages to appropriate base loggers. Handles local, multiprocessing and distributed setup, connecting to handlers created by the base logger.
[ "Setup", "logging", "for", "a", "local", "context", "directing", "messages", "to", "appropriate", "base", "loggers", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/log/__init__.py#L132-L151
223,193
bcbio/bcbio-nextgen
bcbio/log/__init__.py
setup_script_logging
def setup_script_logging(): """ Use this logger for standalone scripts, or script-like subcommands, such as bcbio_prepare_samples and bcbio_nextgen.py -w template. """ handlers = [logbook.NullHandler()] format_str = ("[{record.time:%Y-%m-%dT%H:%MZ}] " "{record.level_name}: {rec...
python
def setup_script_logging(): """ Use this logger for standalone scripts, or script-like subcommands, such as bcbio_prepare_samples and bcbio_nextgen.py -w template. """ handlers = [logbook.NullHandler()] format_str = ("[{record.time:%Y-%m-%dT%H:%MZ}] " "{record.level_name}: {rec...
[ "def", "setup_script_logging", "(", ")", ":", "handlers", "=", "[", "logbook", ".", "NullHandler", "(", ")", "]", "format_str", "=", "(", "\"[{record.time:%Y-%m-%dT%H:%MZ}] \"", "\"{record.level_name}: {record.message}\"", ")", "handler", "=", "logbook", ".", "StreamH...
Use this logger for standalone scripts, or script-like subcommands, such as bcbio_prepare_samples and bcbio_nextgen.py -w template.
[ "Use", "this", "logger", "for", "standalone", "scripts", "or", "script", "-", "like", "subcommands", "such", "as", "bcbio_prepare_samples", "and", "bcbio_nextgen", ".", "py", "-", "w", "template", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/log/__init__.py#L153-L165
223,194
bcbio/bcbio-nextgen
scripts/cwltool2wdl.py
_validate
def _validate(wdl_file): """Run validation on the generated WDL output using wdltool. """ start_dir = os.getcwd() os.chdir(os.path.dirname(wdl_file)) print("Validating", wdl_file) subprocess.check_call(["wdltool", "validate", wdl_file]) os.chdir(start_dir)
python
def _validate(wdl_file): """Run validation on the generated WDL output using wdltool. """ start_dir = os.getcwd() os.chdir(os.path.dirname(wdl_file)) print("Validating", wdl_file) subprocess.check_call(["wdltool", "validate", wdl_file]) os.chdir(start_dir)
[ "def", "_validate", "(", "wdl_file", ")", ":", "start_dir", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "os", ".", "path", ".", "dirname", "(", "wdl_file", ")", ")", "print", "(", "\"Validating\"", ",", "wdl_file", ")", "subprocess", ...
Run validation on the generated WDL output using wdltool.
[ "Run", "validation", "on", "the", "generated", "WDL", "output", "using", "wdltool", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/cwltool2wdl.py#L53-L60
223,195
bcbio/bcbio-nextgen
scripts/cwltool2wdl.py
_wf_to_dict
def _wf_to_dict(wf, records): """Parse a workflow into cwl2wdl style dictionaries for base and sub-workflows. """ inputs, outputs, records = _get_wf_inout(wf, records) out = {"name": _id_to_name(_clean_id(wf.tool["id"])), "inputs": inputs, "outputs": outputs, "steps": [], "subworkflows": [], ...
python
def _wf_to_dict(wf, records): """Parse a workflow into cwl2wdl style dictionaries for base and sub-workflows. """ inputs, outputs, records = _get_wf_inout(wf, records) out = {"name": _id_to_name(_clean_id(wf.tool["id"])), "inputs": inputs, "outputs": outputs, "steps": [], "subworkflows": [], ...
[ "def", "_wf_to_dict", "(", "wf", ",", "records", ")", ":", "inputs", ",", "outputs", ",", "records", "=", "_get_wf_inout", "(", "wf", ",", "records", ")", "out", "=", "{", "\"name\"", ":", "_id_to_name", "(", "_clean_id", "(", "wf", ".", "tool", "[", ...
Parse a workflow into cwl2wdl style dictionaries for base and sub-workflows.
[ "Parse", "a", "workflow", "into", "cwl2wdl", "style", "dictionaries", "for", "base", "and", "sub", "-", "workflows", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/cwltool2wdl.py#L62-L83
223,196
bcbio/bcbio-nextgen
scripts/cwltool2wdl.py
_organize_step_scatter
def _organize_step_scatter(step, inputs, remapped): """Add scattering information from inputs, remapping input variables. """ def extract_scatter_id(inp): _, ns_var = inp.split("#") _, var = ns_var.split("/") return var scatter_local = {} if "scatter" in step.tool: as...
python
def _organize_step_scatter(step, inputs, remapped): """Add scattering information from inputs, remapping input variables. """ def extract_scatter_id(inp): _, ns_var = inp.split("#") _, var = ns_var.split("/") return var scatter_local = {} if "scatter" in step.tool: as...
[ "def", "_organize_step_scatter", "(", "step", ",", "inputs", ",", "remapped", ")", ":", "def", "extract_scatter_id", "(", "inp", ")", ":", "_", ",", "ns_var", "=", "inp", ".", "split", "(", "\"#\"", ")", "_", ",", "var", "=", "ns_var", ".", "split", ...
Add scattering information from inputs, remapping input variables.
[ "Add", "scattering", "information", "from", "inputs", "remapping", "input", "variables", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/cwltool2wdl.py#L133-L164
223,197
bcbio/bcbio-nextgen
scripts/cwltool2wdl.py
_variable_type_to_read_fn
def _variable_type_to_read_fn(vartype, records): """Convert variant types into corresponding WDL standard library functions. """ fn_map = {"String": "read_string", "Array[String]": "read_lines", "Array[Array[String]]": "read_tsv", "Object": "read_object", "Array[Object]": "read_o...
python
def _variable_type_to_read_fn(vartype, records): """Convert variant types into corresponding WDL standard library functions. """ fn_map = {"String": "read_string", "Array[String]": "read_lines", "Array[Array[String]]": "read_tsv", "Object": "read_object", "Array[Object]": "read_o...
[ "def", "_variable_type_to_read_fn", "(", "vartype", ",", "records", ")", ":", "fn_map", "=", "{", "\"String\"", ":", "\"read_string\"", ",", "\"Array[String]\"", ":", "\"read_lines\"", ",", "\"Array[Array[String]]\"", ":", "\"read_tsv\"", ",", "\"Object\"", ":", "\"...
Convert variant types into corresponding WDL standard library functions.
[ "Convert", "variant", "types", "into", "corresponding", "WDL", "standard", "library", "functions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/cwltool2wdl.py#L216-L233
223,198
bcbio/bcbio-nextgen
scripts/cwltool2wdl.py
_requirements_to_dict
def _requirements_to_dict(rs): """Convert supported requirements into dictionary for output. """ out = [] added = set([]) for r in rs: if r["class"] == "DockerRequirement" and "docker" not in added: added.add("docker") out.append({"requirement_type": "docker", "value"...
python
def _requirements_to_dict(rs): """Convert supported requirements into dictionary for output. """ out = [] added = set([]) for r in rs: if r["class"] == "DockerRequirement" and "docker" not in added: added.add("docker") out.append({"requirement_type": "docker", "value"...
[ "def", "_requirements_to_dict", "(", "rs", ")", ":", "out", "=", "[", "]", "added", "=", "set", "(", "[", "]", ")", "for", "r", "in", "rs", ":", "if", "r", "[", "\"class\"", "]", "==", "\"DockerRequirement\"", "and", "\"docker\"", "not", "in", "added...
Convert supported requirements into dictionary for output.
[ "Convert", "supported", "requirements", "into", "dictionary", "for", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/cwltool2wdl.py#L306-L325
223,199
bcbio/bcbio-nextgen
bcbio/structural/purple.py
_get_jvm_opts
def _get_jvm_opts(out_file, data): """Retrieve Java options, adjusting memory for available cores. """ resources = config_utils.get_resources("purple", data["config"]) jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx3500m"]) jvm_opts = config_utils.adjust_opts(jvm_opts, {"algorithm": {"memory...
python
def _get_jvm_opts(out_file, data): """Retrieve Java options, adjusting memory for available cores. """ resources = config_utils.get_resources("purple", data["config"]) jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx3500m"]) jvm_opts = config_utils.adjust_opts(jvm_opts, {"algorithm": {"memory...
[ "def", "_get_jvm_opts", "(", "out_file", ",", "data", ")", ":", "resources", "=", "config_utils", ".", "get_resources", "(", "\"purple\"", ",", "data", "[", "\"config\"", "]", ")", "jvm_opts", "=", "resources", ".", "get", "(", "\"jvm_opts\"", ",", "[", "\...
Retrieve Java options, adjusting memory for available cores.
[ "Retrieve", "Java", "options", "adjusting", "memory", "for", "available", "cores", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purple.py#L43-L53