repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
bcbio/bcbio-nextgen
bcbio/pipeline/genome.py
get_resources
def get_resources(genome, ref_file, data): """Retrieve genome information from a genome-references.yaml file. """ base_dir = os.path.normpath(os.path.dirname(ref_file)) resource_file = os.path.join(base_dir, "%s-resources.yaml" % genome.replace("-test", "")) if not os.path.exists(resource_file): ...
python
def get_resources(genome, ref_file, data): """Retrieve genome information from a genome-references.yaml file. """ base_dir = os.path.normpath(os.path.dirname(ref_file)) resource_file = os.path.join(base_dir, "%s-resources.yaml" % genome.replace("-test", "")) if not os.path.exists(resource_file): ...
[ "def", "get_resources", "(", "genome", ",", "ref_file", ",", "data", ")", ":", "base_dir", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "dirname", "(", "ref_file", ")", ")", "resource_file", "=", "os", ".", "path", ".", "join...
Retrieve genome information from a genome-references.yaml file.
[ "Retrieve", "genome", "information", "from", "a", "genome", "-", "references", ".", "yaml", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L24-L42
train
bcbio/bcbio-nextgen
bcbio/pipeline/genome.py
add_required_resources
def add_required_resources(resources): """Add default or empty values for required resources referenced in CWL """ required = [["variation", "cosmic"], ["variation", "clinvar"], ["variation", "dbsnp"], ["variation", "lcr"], ["variation", "polyx"], ["variation", "encode_blackl...
python
def add_required_resources(resources): """Add default or empty values for required resources referenced in CWL """ required = [["variation", "cosmic"], ["variation", "clinvar"], ["variation", "dbsnp"], ["variation", "lcr"], ["variation", "polyx"], ["variation", "encode_blackl...
[ "def", "add_required_resources", "(", "resources", ")", ":", "required", "=", "[", "[", "\"variation\"", ",", "\"cosmic\"", "]", ",", "[", "\"variation\"", ",", "\"clinvar\"", "]", ",", "[", "\"variation\"", ",", "\"dbsnp\"", "]", ",", "[", "\"variation\"", ...
Add default or empty values for required resources referenced in CWL
[ "Add", "default", "or", "empty", "values", "for", "required", "resources", "referenced", "in", "CWL" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L44-L58
train
bcbio/bcbio-nextgen
bcbio/pipeline/genome.py
ensure_annotations
def ensure_annotations(resources, data): """Prepare any potentially missing annotations for downstream processing in a local directory. """ transcript_gff = tz.get_in(["rnaseq", "transcripts"], resources) if transcript_gff and utils.file_exists(transcript_gff): out_dir = os.path.join(tz.get_in([...
python
def ensure_annotations(resources, data): """Prepare any potentially missing annotations for downstream processing in a local directory. """ transcript_gff = tz.get_in(["rnaseq", "transcripts"], resources) if transcript_gff and utils.file_exists(transcript_gff): out_dir = os.path.join(tz.get_in([...
[ "def", "ensure_annotations", "(", "resources", ",", "data", ")", ":", "transcript_gff", "=", "tz", ".", "get_in", "(", "[", "\"rnaseq\"", ",", "\"transcripts\"", "]", ",", "resources", ")", "if", "transcript_gff", "and", "utils", ".", "file_exists", "(", "tr...
Prepare any potentially missing annotations for downstream processing in a local directory.
[ "Prepare", "any", "potentially", "missing", "annotations", "for", "downstream", "processing", "in", "a", "local", "directory", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L60-L68
train
bcbio/bcbio-nextgen
bcbio/pipeline/genome.py
abs_file_paths
def abs_file_paths(xs, base_dir=None, ignore_keys=None, fileonly_keys=None, cur_key=None, do_download=True): """Normalize any file paths found in a subdirectory of configuration input. base_dir -- directory to normalize relative paths to ignore_keys -- algorithm key names to ignore norma...
python
def abs_file_paths(xs, base_dir=None, ignore_keys=None, fileonly_keys=None, cur_key=None, do_download=True): """Normalize any file paths found in a subdirectory of configuration input. base_dir -- directory to normalize relative paths to ignore_keys -- algorithm key names to ignore norma...
[ "def", "abs_file_paths", "(", "xs", ",", "base_dir", "=", "None", ",", "ignore_keys", "=", "None", ",", "fileonly_keys", "=", "None", ",", "cur_key", "=", "None", ",", "do_download", "=", "True", ")", ":", "ignore_keys", "=", "set", "(", "[", "]", ")",...
Normalize any file paths found in a subdirectory of configuration input. base_dir -- directory to normalize relative paths to ignore_keys -- algorithm key names to ignore normalize for (keywords, not files/directories) fileonly_keys -- algorithm key names to only expand files (not directories) cur_key ...
[ "Normalize", "any", "file", "paths", "found", "in", "a", "subdirectory", "of", "configuration", "input", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L72-L113
train
bcbio/bcbio-nextgen
bcbio/pipeline/genome.py
_get_galaxy_tool_info
def _get_galaxy_tool_info(galaxy_base): """Retrieve Galaxy tool-data information from defaults or galaxy config file. """ ini_file = os.path.join(galaxy_base, "universe_wsgi.ini") info = {"tool_data_table_config_path": os.path.join(galaxy_base, "tool_data_table_conf.xml"), "tool_data_path": ...
python
def _get_galaxy_tool_info(galaxy_base): """Retrieve Galaxy tool-data information from defaults or galaxy config file. """ ini_file = os.path.join(galaxy_base, "universe_wsgi.ini") info = {"tool_data_table_config_path": os.path.join(galaxy_base, "tool_data_table_conf.xml"), "tool_data_path": ...
[ "def", "_get_galaxy_tool_info", "(", "galaxy_base", ")", ":", "ini_file", "=", "os", ".", "path", ".", "join", "(", "galaxy_base", ",", "\"universe_wsgi.ini\"", ")", "info", "=", "{", "\"tool_data_table_config_path\"", ":", "os", ".", "path", ".", "join", "(",...
Retrieve Galaxy tool-data information from defaults or galaxy config file.
[ "Retrieve", "Galaxy", "tool", "-", "data", "information", "from", "defaults", "or", "galaxy", "config", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L195-L207
train
bcbio/bcbio-nextgen
bcbio/pipeline/genome.py
get_builds
def get_builds(galaxy_base): """Retrieve configured genome builds and reference files, using Galaxy configuration files. Allows multiple dbkey specifications in the same file, using the most recently added. """ name = "samtools" galaxy_config = _get_galaxy_tool_info(galaxy_base) galaxy_dt = _ge...
python
def get_builds(galaxy_base): """Retrieve configured genome builds and reference files, using Galaxy configuration files. Allows multiple dbkey specifications in the same file, using the most recently added. """ name = "samtools" galaxy_config = _get_galaxy_tool_info(galaxy_base) galaxy_dt = _ge...
[ "def", "get_builds", "(", "galaxy_base", ")", ":", "name", "=", "\"samtools\"", "galaxy_config", "=", "_get_galaxy_tool_info", "(", "galaxy_base", ")", "galaxy_dt", "=", "_get_galaxy_data_table", "(", "name", ",", "galaxy_config", "[", "\"tool_data_table_config_path\"",...
Retrieve configured genome builds and reference files, using Galaxy configuration files. Allows multiple dbkey specifications in the same file, using the most recently added.
[ "Retrieve", "configured", "genome", "builds", "and", "reference", "files", "using", "Galaxy", "configuration", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/genome.py#L268-L285
train
bcbio/bcbio-nextgen
bcbio/variation/varscan.py
_get_jvm_opts
def _get_jvm_opts(config, tmp_dir): """Retrieve common options for running VarScan. Handles jvm_opts, setting user and country to English to avoid issues with different locales producing non-compliant VCF. """ resources = config_utils.get_resources("varscan", config) jvm_opts = resources.get("jv...
python
def _get_jvm_opts(config, tmp_dir): """Retrieve common options for running VarScan. Handles jvm_opts, setting user and country to English to avoid issues with different locales producing non-compliant VCF. """ resources = config_utils.get_resources("varscan", config) jvm_opts = resources.get("jv...
[ "def", "_get_jvm_opts", "(", "config", ",", "tmp_dir", ")", ":", "resources", "=", "config_utils", ".", "get_resources", "(", "\"varscan\"", ",", "config", ")", "jvm_opts", "=", "resources", ".", "get", "(", "\"jvm_opts\"", ",", "[", "\"-Xmx750m\"", ",", "\"...
Retrieve common options for running VarScan. Handles jvm_opts, setting user and country to English to avoid issues with different locales producing non-compliant VCF.
[ "Retrieve", "common", "options", "for", "running", "VarScan", ".", "Handles", "jvm_opts", "setting", "user", "and", "country", "to", "English", "to", "avoid", "issues", "with", "different", "locales", "producing", "non", "-", "compliant", "VCF", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L36-L48
train
bcbio/bcbio-nextgen
bcbio/variation/varscan.py
_varscan_options_from_config
def _varscan_options_from_config(config): """Retrieve additional options for VarScan from the configuration. """ opts = ["--min-coverage 5", "--p-value 0.98", "--strand-filter 1"] resources = config_utils.get_resources("varscan", config) if resources.get("options"): opts += [str(x) for x in ...
python
def _varscan_options_from_config(config): """Retrieve additional options for VarScan from the configuration. """ opts = ["--min-coverage 5", "--p-value 0.98", "--strand-filter 1"] resources = config_utils.get_resources("varscan", config) if resources.get("options"): opts += [str(x) for x in ...
[ "def", "_varscan_options_from_config", "(", "config", ")", ":", "opts", "=", "[", "\"--min-coverage 5\"", ",", "\"--p-value 0.98\"", ",", "\"--strand-filter 1\"", "]", "resources", "=", "config_utils", ".", "get_resources", "(", "\"varscan\"", ",", "config", ")", "i...
Retrieve additional options for VarScan from the configuration.
[ "Retrieve", "additional", "options", "for", "VarScan", "from", "the", "configuration", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L51-L58
train
bcbio/bcbio-nextgen
bcbio/variation/varscan.py
spv_freq_filter
def spv_freq_filter(line, tumor_index): """Filter VarScan calls based on the SPV value and frequency. Removes calls with SPV < 0.05 and a tumor FREQ > 0.35. False positives dominate these higher frequency, low SPV calls. They appear to be primarily non-somatic/germline variants not removed by other fi...
python
def spv_freq_filter(line, tumor_index): """Filter VarScan calls based on the SPV value and frequency. Removes calls with SPV < 0.05 and a tumor FREQ > 0.35. False positives dominate these higher frequency, low SPV calls. They appear to be primarily non-somatic/germline variants not removed by other fi...
[ "def", "spv_freq_filter", "(", "line", ",", "tumor_index", ")", ":", "if", "line", ".", "startswith", "(", "\"#CHROM\"", ")", ":", "headers", "=", "[", "(", "'##FILTER=<ID=SpvFreq,Description=\"High frequency (tumor FREQ > 0.35) '", "'and low p-value for somatic (SPV < 0.05...
Filter VarScan calls based on the SPV value and frequency. Removes calls with SPV < 0.05 and a tumor FREQ > 0.35. False positives dominate these higher frequency, low SPV calls. They appear to be primarily non-somatic/germline variants not removed by other filters.
[ "Filter", "VarScan", "calls", "based", "on", "the", "SPV", "value", "and", "frequency", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L61-L91
train
bcbio/bcbio-nextgen
bcbio/variation/varscan.py
_create_sample_list
def _create_sample_list(in_bams, vcf_file): """Pull sample names from input BAMs and create input sample list. """ out_file = "%s-sample_list.txt" % os.path.splitext(vcf_file)[0] with open(out_file, "w") as out_handle: for in_bam in in_bams: with pysam.Samfile(in_bam, "rb") as work_b...
python
def _create_sample_list(in_bams, vcf_file): """Pull sample names from input BAMs and create input sample list. """ out_file = "%s-sample_list.txt" % os.path.splitext(vcf_file)[0] with open(out_file, "w") as out_handle: for in_bam in in_bams: with pysam.Samfile(in_bam, "rb") as work_b...
[ "def", "_create_sample_list", "(", "in_bams", ",", "vcf_file", ")", ":", "out_file", "=", "\"%s-sample_list.txt\"", "%", "os", ".", "path", ".", "splitext", "(", "vcf_file", ")", "[", "0", "]", "with", "open", "(", "out_file", ",", "\"w\"", ")", "as", "o...
Pull sample names from input BAMs and create input sample list.
[ "Pull", "sample", "names", "from", "input", "BAMs", "and", "create", "input", "sample", "list", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L274-L283
train
bcbio/bcbio-nextgen
bcbio/variation/varscan.py
_varscan_work
def _varscan_work(align_bams, ref_file, items, target_regions, out_file): """Perform SNP and indel genotyping with VarScan. """ config = items[0]["config"] orig_out_file = out_file out_file = orig_out_file.replace(".vcf.gz", ".vcf") max_read_depth = "1000" sample_list = _create_sample_list...
python
def _varscan_work(align_bams, ref_file, items, target_regions, out_file): """Perform SNP and indel genotyping with VarScan. """ config = items[0]["config"] orig_out_file = out_file out_file = orig_out_file.replace(".vcf.gz", ".vcf") max_read_depth = "1000" sample_list = _create_sample_list...
[ "def", "_varscan_work", "(", "align_bams", ",", "ref_file", ",", "items", ",", "target_regions", ",", "out_file", ")", ":", "config", "=", "items", "[", "0", "]", "[", "\"config\"", "]", "orig_out_file", "=", "out_file", "out_file", "=", "orig_out_file", "."...
Perform SNP and indel genotyping with VarScan.
[ "Perform", "SNP", "and", "indel", "genotyping", "with", "VarScan", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/varscan.py#L286-L327
train
bcbio/bcbio-nextgen
bcbio/distributed/ipythontasks.py
apply
def apply(object, args=None, kwargs=None): """Python3 apply replacement for double unpacking of inputs during apply. Thanks to: https://github.com/stefanholek/apply """ if args is None: args = () if kwargs is None: kwargs = {} return object(*args, **kwargs)
python
def apply(object, args=None, kwargs=None): """Python3 apply replacement for double unpacking of inputs during apply. Thanks to: https://github.com/stefanholek/apply """ if args is None: args = () if kwargs is None: kwargs = {} return object(*args, **kwargs)
[ "def", "apply", "(", "object", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "(", ")", "if", "kwargs", "is", "None", ":", "kwargs", "=", "{", "}", "return", "object", "(", "*", "ar...
Python3 apply replacement for double unpacking of inputs during apply. Thanks to: https://github.com/stefanholek/apply
[ "Python3", "apply", "replacement", "for", "double", "unpacking", "of", "inputs", "during", "apply", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/ipythontasks.py#L71-L80
train
bcbio/bcbio-nextgen
bcbio/structural/annotate.py
add_genes
def add_genes(in_file, data, max_distance=10000, work_dir=None): """Add gene annotations to a BED file from pre-prepared RNA-seq data. max_distance -- only keep annotations within this distance of event """ gene_file = regions.get_sv_bed(data, "exons", out_dir=os.path.dirname(in_file)) if gene_file...
python
def add_genes(in_file, data, max_distance=10000, work_dir=None): """Add gene annotations to a BED file from pre-prepared RNA-seq data. max_distance -- only keep annotations within this distance of event """ gene_file = regions.get_sv_bed(data, "exons", out_dir=os.path.dirname(in_file)) if gene_file...
[ "def", "add_genes", "(", "in_file", ",", "data", ",", "max_distance", "=", "10000", ",", "work_dir", "=", "None", ")", ":", "gene_file", "=", "regions", ".", "get_sv_bed", "(", "data", ",", "\"exons\"", ",", "out_dir", "=", "os", ".", "path", ".", "dir...
Add gene annotations to a BED file from pre-prepared RNA-seq data. max_distance -- only keep annotations within this distance of event
[ "Add", "gene", "annotations", "to", "a", "BED", "file", "from", "pre", "-", "prepared", "RNA", "-", "seq", "data", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/annotate.py#L17-L33
train
bcbio/bcbio-nextgen
bcbio/structural/annotate.py
_add_genes_to_bed
def _add_genes_to_bed(in_file, gene_file, fai_file, out_file, data, max_distance=10000): """Re-usable subcomponent that annotates BED file genes from another BED """ try: input_rec = next(iter(pybedtools.BedTool(in_file))) except StopIteration: # empty file utils.copy_plus(in_file, out_...
python
def _add_genes_to_bed(in_file, gene_file, fai_file, out_file, data, max_distance=10000): """Re-usable subcomponent that annotates BED file genes from another BED """ try: input_rec = next(iter(pybedtools.BedTool(in_file))) except StopIteration: # empty file utils.copy_plus(in_file, out_...
[ "def", "_add_genes_to_bed", "(", "in_file", ",", "gene_file", ",", "fai_file", ",", "out_file", ",", "data", ",", "max_distance", "=", "10000", ")", ":", "try", ":", "input_rec", "=", "next", "(", "iter", "(", "pybedtools", ".", "BedTool", "(", "in_file", ...
Re-usable subcomponent that annotates BED file genes from another BED
[ "Re", "-", "usable", "subcomponent", "that", "annotates", "BED", "file", "genes", "from", "another", "BED" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/annotate.py#L35-L72
train
bcbio/bcbio-nextgen
bcbio/distributed/clusterk.py
create
def create(parallel): """Create a queue based on the provided parallel arguments. TODO Startup/tear-down. Currently using default queue for testing """ queue = {k: v for k, v in parallel.items() if k in ["queue", "cores_per_job", "mem"]} yield queue
python
def create(parallel): """Create a queue based on the provided parallel arguments. TODO Startup/tear-down. Currently using default queue for testing """ queue = {k: v for k, v in parallel.items() if k in ["queue", "cores_per_job", "mem"]} yield queue
[ "def", "create", "(", "parallel", ")", ":", "queue", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "parallel", ".", "items", "(", ")", "if", "k", "in", "[", "\"queue\"", ",", "\"cores_per_job\"", ",", "\"mem\"", "]", "}", "yield", "queue" ]
Create a queue based on the provided parallel arguments. TODO Startup/tear-down. Currently using default queue for testing
[ "Create", "a", "queue", "based", "on", "the", "provided", "parallel", "arguments", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clusterk.py#L11-L17
train
bcbio/bcbio-nextgen
bcbio/distributed/clusterk.py
runner
def runner(queue, parallel): """Run individual jobs on an existing queue. """ def run(fn_name, items): logger.info("clusterk: %s" % fn_name) assert "wrapper" in parallel, "Clusterk requires bcbio-nextgen-vm wrapper" fn = getattr(__import__("{base}.clusterktasks".format(base=parallel[...
python
def runner(queue, parallel): """Run individual jobs on an existing queue. """ def run(fn_name, items): logger.info("clusterk: %s" % fn_name) assert "wrapper" in parallel, "Clusterk requires bcbio-nextgen-vm wrapper" fn = getattr(__import__("{base}.clusterktasks".format(base=parallel[...
[ "def", "runner", "(", "queue", ",", "parallel", ")", ":", "def", "run", "(", "fn_name", ",", "items", ")", ":", "logger", ".", "info", "(", "\"clusterk: %s\"", "%", "fn_name", ")", "assert", "\"wrapper\"", "in", "parallel", ",", "\"Clusterk requires bcbio-ne...
Run individual jobs on an existing queue.
[ "Run", "individual", "jobs", "on", "an", "existing", "queue", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clusterk.py#L19-L34
train
bcbio/bcbio-nextgen
bcbio/structural/prioritize.py
is_gene_list
def is_gene_list(bed_file): """Check if the file is only a list of genes, not a BED """ with utils.open_gzipsafe(bed_file) as in_handle: for line in in_handle: if not line.startswith("#"): if len(line.split()) == 1: return True else: ...
python
def is_gene_list(bed_file): """Check if the file is only a list of genes, not a BED """ with utils.open_gzipsafe(bed_file) as in_handle: for line in in_handle: if not line.startswith("#"): if len(line.split()) == 1: return True else: ...
[ "def", "is_gene_list", "(", "bed_file", ")", ":", "with", "utils", ".", "open_gzipsafe", "(", "bed_file", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "if", "not", "line", ".", "startswith", "(", "\"#\"", ")", ":", "if", "len", "...
Check if the file is only a list of genes, not a BED
[ "Check", "if", "the", "file", "is", "only", "a", "list", "of", "genes", "not", "a", "BED" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L51-L60
train
bcbio/bcbio-nextgen
bcbio/structural/prioritize.py
_find_gene_list_from_bed
def _find_gene_list_from_bed(bed_file, base_file, data): """Retrieve list of gene names from input BED file. """ # Check for a gene list, we can just return that. if is_gene_list(bed_file): return bed_file out_file = "%s-genes.txt" % utils.splitext_plus(base_file)[0] if not os.path.exist...
python
def _find_gene_list_from_bed(bed_file, base_file, data): """Retrieve list of gene names from input BED file. """ # Check for a gene list, we can just return that. if is_gene_list(bed_file): return bed_file out_file = "%s-genes.txt" % utils.splitext_plus(base_file)[0] if not os.path.exist...
[ "def", "_find_gene_list_from_bed", "(", "bed_file", ",", "base_file", ",", "data", ")", ":", "# Check for a gene list, we can just return that.", "if", "is_gene_list", "(", "bed_file", ")", ":", "return", "bed_file", "out_file", "=", "\"%s-genes.txt\"", "%", "utils", ...
Retrieve list of gene names from input BED file.
[ "Retrieve", "list", "of", "gene", "names", "from", "input", "BED", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L62-L82
train
bcbio/bcbio-nextgen
bcbio/structural/prioritize.py
_combine_files
def _combine_files(tsv_files, work_dir, data): """Combine multiple priority tsv files into a final sorted output. """ header = "\t".join(["caller", "sample", "chrom", "start", "end", "svtype", "lof", "annotation", "split_read_support", "paired_support_PE", "paired_support_PR"]) s...
python
def _combine_files(tsv_files, work_dir, data): """Combine multiple priority tsv files into a final sorted output. """ header = "\t".join(["caller", "sample", "chrom", "start", "end", "svtype", "lof", "annotation", "split_read_support", "paired_support_PE", "paired_support_PR"]) s...
[ "def", "_combine_files", "(", "tsv_files", ",", "work_dir", ",", "data", ")", ":", "header", "=", "\"\\t\"", ".", "join", "(", "[", "\"caller\"", ",", "\"sample\"", ",", "\"chrom\"", ",", "\"start\"", ",", "\"end\"", ",", "\"svtype\"", ",", "\"lof\"", ",",...
Combine multiple priority tsv files into a final sorted output.
[ "Combine", "multiple", "priority", "tsv", "files", "into", "a", "final", "sorted", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L145-L159
train
bcbio/bcbio-nextgen
bcbio/structural/prioritize.py
_cnvkit_prioritize
def _cnvkit_prioritize(sample, genes, allele_file, metrics_file): """Summarize non-diploid calls with copy numbers and confidence intervals. """ mdf = pd.read_table(metrics_file) mdf.columns = [x.lower() for x in mdf.columns] if len(genes) > 0: mdf = mdf[mdf["gene"].str.contains("|".join(gen...
python
def _cnvkit_prioritize(sample, genes, allele_file, metrics_file): """Summarize non-diploid calls with copy numbers and confidence intervals. """ mdf = pd.read_table(metrics_file) mdf.columns = [x.lower() for x in mdf.columns] if len(genes) > 0: mdf = mdf[mdf["gene"].str.contains("|".join(gen...
[ "def", "_cnvkit_prioritize", "(", "sample", ",", "genes", ",", "allele_file", ",", "metrics_file", ")", ":", "mdf", "=", "pd", ".", "read_table", "(", "metrics_file", ")", "mdf", ".", "columns", "=", "[", "x", ".", "lower", "(", ")", "for", "x", "in", ...
Summarize non-diploid calls with copy numbers and confidence intervals.
[ "Summarize", "non", "-", "diploid", "calls", "with", "copy", "numbers", "and", "confidence", "intervals", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L167-L190
train
bcbio/bcbio-nextgen
bcbio/structural/prioritize.py
_cnv_prioritize
def _cnv_prioritize(data): """Perform confidence interval based prioritization for CNVs. """ supported = {"cnvkit": {"inputs": ["call_file", "segmetrics"], "fn": _cnvkit_prioritize}} pcall = None priority_files = None for call in data.get("sv", []): if call["variantcaller"] in supported:...
python
def _cnv_prioritize(data): """Perform confidence interval based prioritization for CNVs. """ supported = {"cnvkit": {"inputs": ["call_file", "segmetrics"], "fn": _cnvkit_prioritize}} pcall = None priority_files = None for call in data.get("sv", []): if call["variantcaller"] in supported:...
[ "def", "_cnv_prioritize", "(", "data", ")", ":", "supported", "=", "{", "\"cnvkit\"", ":", "{", "\"inputs\"", ":", "[", "\"call_file\"", ",", "\"segmetrics\"", "]", ",", "\"fn\"", ":", "_cnvkit_prioritize", "}", "}", "pcall", "=", "None", "priority_files", "...
Perform confidence interval based prioritization for CNVs.
[ "Perform", "confidence", "interval", "based", "prioritization", "for", "CNVs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/prioritize.py#L192-L217
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
get_default_jvm_opts
def get_default_jvm_opts(tmp_dir=None, parallel_gc=False): """Retrieve default JVM tuning options Avoids issues with multiple spun up Java processes running into out of memory errors. Parallel GC can use a lot of cores on big machines and primarily helps reduce task latency and responsiveness which are...
python
def get_default_jvm_opts(tmp_dir=None, parallel_gc=False): """Retrieve default JVM tuning options Avoids issues with multiple spun up Java processes running into out of memory errors. Parallel GC can use a lot of cores on big machines and primarily helps reduce task latency and responsiveness which are...
[ "def", "get_default_jvm_opts", "(", "tmp_dir", "=", "None", ",", "parallel_gc", "=", "False", ")", ":", "opts", "=", "[", "\"-XX:+UseSerialGC\"", "]", "if", "not", "parallel_gc", "else", "[", "]", "if", "tmp_dir", ":", "opts", ".", "append", "(", "\"-Djava...
Retrieve default JVM tuning options Avoids issues with multiple spun up Java processes running into out of memory errors. Parallel GC can use a lot of cores on big machines and primarily helps reduce task latency and responsiveness which are not needed for batch jobs. https://github.com/bcbio/bcbio-nex...
[ "Retrieve", "default", "JVM", "tuning", "options" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L23-L38
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
_get_gatk_opts
def _get_gatk_opts(config, names, tmp_dir=None, memscale=None, include_gatk=True, parallel_gc=False): """Retrieve GATK memory specifications, moving down a list of potential specifications. """ if include_gatk and "gatk4" in dd.get_tools_off({"config": config}): opts = ["-U", "LENIENT_VCF_PROCESSING...
python
def _get_gatk_opts(config, names, tmp_dir=None, memscale=None, include_gatk=True, parallel_gc=False): """Retrieve GATK memory specifications, moving down a list of potential specifications. """ if include_gatk and "gatk4" in dd.get_tools_off({"config": config}): opts = ["-U", "LENIENT_VCF_PROCESSING...
[ "def", "_get_gatk_opts", "(", "config", ",", "names", ",", "tmp_dir", "=", "None", ",", "memscale", "=", "None", ",", "include_gatk", "=", "True", ",", "parallel_gc", "=", "False", ")", ":", "if", "include_gatk", "and", "\"gatk4\"", "in", "dd", ".", "get...
Retrieve GATK memory specifications, moving down a list of potential specifications.
[ "Retrieve", "GATK", "memory", "specifications", "moving", "down", "a", "list", "of", "potential", "specifications", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L40-L57
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
_clean_java_out
def _clean_java_out(version_str): """Remove extra environmental information reported in java when querying for versions. Java will report information like _JAVA_OPTIONS environmental variables in the output. """ out = [] for line in version_str.decode().split("\n"): if line.startswith("Pick...
python
def _clean_java_out(version_str): """Remove extra environmental information reported in java when querying for versions. Java will report information like _JAVA_OPTIONS environmental variables in the output. """ out = [] for line in version_str.decode().split("\n"): if line.startswith("Pick...
[ "def", "_clean_java_out", "(", "version_str", ")", ":", "out", "=", "[", "]", "for", "line", "in", "version_str", ".", "decode", "(", ")", ".", "split", "(", "\"\\n\"", ")", ":", "if", "line", ".", "startswith", "(", "\"Picked up\"", ")", ":", "pass", ...
Remove extra environmental information reported in java when querying for versions. Java will report information like _JAVA_OPTIONS environmental variables in the output.
[ "Remove", "extra", "environmental", "information", "reported", "in", "java", "when", "querying", "for", "versions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L69-L82
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
get_mutect_version
def get_mutect_version(mutect_jar): """Retrieves version from input jar name since there is not an easy way to get MuTect version. Check mutect jar for SomaticIndelDetector, which is an Appistry feature """ cl = ["java", "-Xms128m", "-Xmx256m"] + get_default_jvm_opts() + ["-jar", mutect_jar, "-h"] w...
python
def get_mutect_version(mutect_jar): """Retrieves version from input jar name since there is not an easy way to get MuTect version. Check mutect jar for SomaticIndelDetector, which is an Appistry feature """ cl = ["java", "-Xms128m", "-Xmx256m"] + get_default_jvm_opts() + ["-jar", mutect_jar, "-h"] w...
[ "def", "get_mutect_version", "(", "mutect_jar", ")", ":", "cl", "=", "[", "\"java\"", ",", "\"-Xms128m\"", ",", "\"-Xmx256m\"", "]", "+", "get_default_jvm_opts", "(", ")", "+", "[", "\"-jar\"", ",", "mutect_jar", ",", "\"-h\"", "]", "with", "closing", "(", ...
Retrieves version from input jar name since there is not an easy way to get MuTect version. Check mutect jar for SomaticIndelDetector, which is an Appistry feature
[ "Retrieves", "version", "from", "input", "jar", "name", "since", "there", "is", "not", "an", "easy", "way", "to", "get", "MuTect", "version", ".", "Check", "mutect", "jar", "for", "SomaticIndelDetector", "which", "is", "an", "Appistry", "feature" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L110-L129
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
gatk_cmd
def gatk_cmd(name, jvm_opts, params, config=None): """Retrieve PATH to gatk using locally installed java. """ if name == "gatk": if isinstance(config, dict) and "config" not in config: data = {"config": config} else: data = config if not data or "gatk4" not in...
python
def gatk_cmd(name, jvm_opts, params, config=None): """Retrieve PATH to gatk using locally installed java. """ if name == "gatk": if isinstance(config, dict) and "config" not in config: data = {"config": config} else: data = config if not data or "gatk4" not in...
[ "def", "gatk_cmd", "(", "name", ",", "jvm_opts", ",", "params", ",", "config", "=", "None", ")", ":", "if", "name", "==", "\"gatk\"", ":", "if", "isinstance", "(", "config", ",", "dict", ")", "and", "\"config\"", "not", "in", "config", ":", "data", "...
Retrieve PATH to gatk using locally installed java.
[ "Retrieve", "PATH", "to", "gatk", "using", "locally", "installed", "java", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L530-L549
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
_gatk4_cmd
def _gatk4_cmd(jvm_opts, params, data): """Retrieve unified command for GATK4, using 'gatk'. GATK3 is 'gatk3'. """ gatk_cmd = utils.which(os.path.join(os.path.dirname(os.path.realpath(sys.executable)), "gatk")) return "%s && export PATH=%s:\"$PATH\" && gatk --java-options '%s' %s" % \ (utils.cle...
python
def _gatk4_cmd(jvm_opts, params, data): """Retrieve unified command for GATK4, using 'gatk'. GATK3 is 'gatk3'. """ gatk_cmd = utils.which(os.path.join(os.path.dirname(os.path.realpath(sys.executable)), "gatk")) return "%s && export PATH=%s:\"$PATH\" && gatk --java-options '%s' %s" % \ (utils.cle...
[ "def", "_gatk4_cmd", "(", "jvm_opts", ",", "params", ",", "data", ")", ":", "gatk_cmd", "=", "utils", ".", "which", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "sys", ...
Retrieve unified command for GATK4, using 'gatk'. GATK3 is 'gatk3'.
[ "Retrieve", "unified", "command", "for", "GATK4", "using", "gatk", ".", "GATK3", "is", "gatk3", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L551-L557
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
runner_from_path
def runner_from_path(cmd, config): """Simple command line runner that expects a bash cmd in the PATH. This makes Picard tools back compatible with new approach of a single jar + bash script. """ if cmd.endswith("picard"): return PicardCmdRunner(cmd, config) else: raise ValueErro...
python
def runner_from_path(cmd, config): """Simple command line runner that expects a bash cmd in the PATH. This makes Picard tools back compatible with new approach of a single jar + bash script. """ if cmd.endswith("picard"): return PicardCmdRunner(cmd, config) else: raise ValueErro...
[ "def", "runner_from_path", "(", "cmd", ",", "config", ")", ":", "if", "cmd", ".", "endswith", "(", "\"picard\"", ")", ":", "return", "PicardCmdRunner", "(", "cmd", ",", "config", ")", "else", ":", "raise", "ValueError", "(", "\"Do not support PATH running for ...
Simple command line runner that expects a bash cmd in the PATH. This makes Picard tools back compatible with new approach of a single jar + bash script.
[ "Simple", "command", "line", "runner", "that", "expects", "a", "bash", "cmd", "in", "the", "PATH", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L587-L596
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner._set_default_versions
def _set_default_versions(self, config): """Retrieve pre-computed version information for expensive to retrieve versions. Starting up GATK takes a lot of resources so we do it once at start of analysis. """ out = [] for name in ["gatk", "gatk4", "picard", "mutect"]: v...
python
def _set_default_versions(self, config): """Retrieve pre-computed version information for expensive to retrieve versions. Starting up GATK takes a lot of resources so we do it once at start of analysis. """ out = [] for name in ["gatk", "gatk4", "picard", "mutect"]: v...
[ "def", "_set_default_versions", "(", "self", ",", "config", ")", ":", "out", "=", "[", "]", "for", "name", "in", "[", "\"gatk\"", ",", "\"gatk4\"", ",", "\"picard\"", ",", "\"mutect\"", "]", ":", "v", "=", "tz", ".", "get_in", "(", "[", "\"resources\""...
Retrieve pre-computed version information for expensive to retrieve versions. Starting up GATK takes a lot of resources so we do it once at start of analysis.
[ "Retrieve", "pre", "-", "computed", "version", "information", "for", "expensive", "to", "retrieve", "versions", ".", "Starting", "up", "GATK", "takes", "a", "lot", "of", "resources", "so", "we", "do", "it", "once", "at", "start", "of", "analysis", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L171-L184
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.new_resources
def new_resources(self, program): """Set new resource usage for the given program. This allows customization of memory usage for particular sub-programs of GATK like HaplotypeCaller. """ resources = config_utils.get_resources(program, self._config) if resources.get("jvm_o...
python
def new_resources(self, program): """Set new resource usage for the given program. This allows customization of memory usage for particular sub-programs of GATK like HaplotypeCaller. """ resources = config_utils.get_resources(program, self._config) if resources.get("jvm_o...
[ "def", "new_resources", "(", "self", ",", "program", ")", ":", "resources", "=", "config_utils", ".", "get_resources", "(", "program", ",", "self", ".", "_config", ")", "if", "resources", ".", "get", "(", "\"jvm_opts\"", ")", ":", "self", ".", "_jvm_opts",...
Set new resource usage for the given program. This allows customization of memory usage for particular sub-programs of GATK like HaplotypeCaller.
[ "Set", "new", "resource", "usage", "for", "the", "given", "program", ".", "This", "allows", "customization", "of", "memory", "usage", "for", "particular", "sub", "-", "programs", "of", "GATK", "like", "HaplotypeCaller", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L186-L193
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.run_fn
def run_fn(self, name, *args, **kwds): """Run pre-built functionality that used Broad tools by name. See the gatkrun, picardrun module for available functions. """ fn = None to_check = [picardrun] for ns in to_check: try: fn = getattr(ns, name...
python
def run_fn(self, name, *args, **kwds): """Run pre-built functionality that used Broad tools by name. See the gatkrun, picardrun module for available functions. """ fn = None to_check = [picardrun] for ns in to_check: try: fn = getattr(ns, name...
[ "def", "run_fn", "(", "self", ",", "name", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "fn", "=", "None", "to_check", "=", "[", "picardrun", "]", "for", "ns", "in", "to_check", ":", "try", ":", "fn", "=", "getattr", "(", "ns", ",", "name...
Run pre-built functionality that used Broad tools by name. See the gatkrun, picardrun module for available functions.
[ "Run", "pre", "-", "built", "functionality", "that", "used", "Broad", "tools", "by", "name", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L195-L209
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.cl_picard
def cl_picard(self, command, options, memscale=None): """Prepare a Picard commandline. """ options = ["%s=%s" % (x, y) for x, y in options] options.append("VALIDATION_STRINGENCY=SILENT") return self._get_picard_cmd(command, memscale=memscale) + options
python
def cl_picard(self, command, options, memscale=None): """Prepare a Picard commandline. """ options = ["%s=%s" % (x, y) for x, y in options] options.append("VALIDATION_STRINGENCY=SILENT") return self._get_picard_cmd(command, memscale=memscale) + options
[ "def", "cl_picard", "(", "self", ",", "command", ",", "options", ",", "memscale", "=", "None", ")", ":", "options", "=", "[", "\"%s=%s\"", "%", "(", "x", ",", "y", ")", "for", "x", ",", "y", "in", "options", "]", "options", ".", "append", "(", "\...
Prepare a Picard commandline.
[ "Prepare", "a", "Picard", "commandline", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L211-L216
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.run
def run(self, command, options, pipe=False, get_stdout=False, memscale=None): """Run a Picard command with the provided option pairs. """ cl = self.cl_picard(command, options, memscale=memscale) if pipe: subprocess.Popen(cl) elif get_stdout: p = subprocess...
python
def run(self, command, options, pipe=False, get_stdout=False, memscale=None): """Run a Picard command with the provided option pairs. """ cl = self.cl_picard(command, options, memscale=memscale) if pipe: subprocess.Popen(cl) elif get_stdout: p = subprocess...
[ "def", "run", "(", "self", ",", "command", ",", "options", ",", "pipe", "=", "False", ",", "get_stdout", "=", "False", ",", "memscale", "=", "None", ")", ":", "cl", "=", "self", ".", "cl_picard", "(", "command", ",", "options", ",", "memscale", "=", ...
Run a Picard command with the provided option pairs.
[ "Run", "a", "Picard", "command", "with", "the", "provided", "option", "pairs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L218-L231
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.cl_mutect
def cl_mutect(self, params, tmp_dir): """Define parameters to run the mutect paired algorithm. """ gatk_jar = self._get_jar("muTect", ["mutect"]) # Decrease memory slightly from configuration to avoid memory allocation errors jvm_opts = config_utils.adjust_opts(self._jvm_opts, ...
python
def cl_mutect(self, params, tmp_dir): """Define parameters to run the mutect paired algorithm. """ gatk_jar = self._get_jar("muTect", ["mutect"]) # Decrease memory slightly from configuration to avoid memory allocation errors jvm_opts = config_utils.adjust_opts(self._jvm_opts, ...
[ "def", "cl_mutect", "(", "self", ",", "params", ",", "tmp_dir", ")", ":", "gatk_jar", "=", "self", ".", "_get_jar", "(", "\"muTect\"", ",", "[", "\"mutect\"", "]", ")", "# Decrease memory slightly from configuration to avoid memory allocation errors", "jvm_opts", "=",...
Define parameters to run the mutect paired algorithm.
[ "Define", "parameters", "to", "run", "the", "mutect", "paired", "algorithm", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L330-L339
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.run_gatk
def run_gatk(self, params, tmp_dir=None, log_error=True, data=None, region=None, memscale=None, parallel_gc=False, ld_preload=False): """Top level interface to running a GATK command. ld_preload injects required libraries for Java JNI calls: https://gatkforums.broadinstitute.or...
python
def run_gatk(self, params, tmp_dir=None, log_error=True, data=None, region=None, memscale=None, parallel_gc=False, ld_preload=False): """Top level interface to running a GATK command. ld_preload injects required libraries for Java JNI calls: https://gatkforums.broadinstitute.or...
[ "def", "run_gatk", "(", "self", ",", "params", ",", "tmp_dir", "=", "None", ",", "log_error", "=", "True", ",", "data", "=", "None", ",", "region", "=", "None", ",", "memscale", "=", "None", ",", "parallel_gc", "=", "False", ",", "ld_preload", "=", "...
Top level interface to running a GATK command. ld_preload injects required libraries for Java JNI calls: https://gatkforums.broadinstitute.org/gatk/discussion/8810/something-about-create-pon-workflow
[ "Top", "level", "interface", "to", "running", "a", "GATK", "command", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L341-L365
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.get_gatk_version
def get_gatk_version(self): """Retrieve GATK version, handling locally and config cached versions. Calling version can be expensive due to all the startup and shutdown of JVMs, so we prefer cached version information. """ if self._gatk_version is None: self._set_defau...
python
def get_gatk_version(self): """Retrieve GATK version, handling locally and config cached versions. Calling version can be expensive due to all the startup and shutdown of JVMs, so we prefer cached version information. """ if self._gatk_version is None: self._set_defau...
[ "def", "get_gatk_version", "(", "self", ")", ":", "if", "self", ".", "_gatk_version", "is", "None", ":", "self", ".", "_set_default_versions", "(", "self", ".", "_config", ")", "if", "\"gatk4\"", "not", "in", "dd", ".", "get_tools_off", "(", "{", "\"config...
Retrieve GATK version, handling locally and config cached versions. Calling version can be expensive due to all the startup and shutdown of JVMs, so we prefer cached version information.
[ "Retrieve", "GATK", "version", "handling", "locally", "and", "config", "cached", "versions", ".", "Calling", "version", "can", "be", "expensive", "due", "to", "all", "the", "startup", "and", "shutdown", "of", "JVMs", "so", "we", "prefer", "cached", "version", ...
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L376-L398
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.get_mutect_version
def get_mutect_version(self): """Retrieve the Mutect version. """ if self._mutect_version is None: mutect_jar = self._get_jar("muTect", ["mutect"]) self._mutect_version = get_mutect_version(mutect_jar) return self._mutect_version
python
def get_mutect_version(self): """Retrieve the Mutect version. """ if self._mutect_version is None: mutect_jar = self._get_jar("muTect", ["mutect"]) self._mutect_version = get_mutect_version(mutect_jar) return self._mutect_version
[ "def", "get_mutect_version", "(", "self", ")", ":", "if", "self", ".", "_mutect_version", "is", "None", ":", "mutect_jar", "=", "self", ".", "_get_jar", "(", "\"muTect\"", ",", "[", "\"mutect\"", "]", ")", "self", ".", "_mutect_version", "=", "get_mutect_ver...
Retrieve the Mutect version.
[ "Retrieve", "the", "Mutect", "version", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L400-L406
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner.gatk_major_version
def gatk_major_version(self): """Retrieve the GATK major version, handling multiple GATK distributions. Has special cases for GATK nightly builds, Appistry releases and GATK prior to 2.3. """ full_version = self.get_gatk_version() # Working with a recent version if using...
python
def gatk_major_version(self): """Retrieve the GATK major version, handling multiple GATK distributions. Has special cases for GATK nightly builds, Appistry releases and GATK prior to 2.3. """ full_version = self.get_gatk_version() # Working with a recent version if using...
[ "def", "gatk_major_version", "(", "self", ")", ":", "full_version", "=", "self", ".", "get_gatk_version", "(", ")", "# Working with a recent version if using nightlies", "if", "full_version", ".", "startswith", "(", "\"nightly-\"", ")", ":", "return", "\"3.6\"", "part...
Retrieve the GATK major version, handling multiple GATK distributions. Has special cases for GATK nightly builds, Appistry releases and GATK prior to 2.3.
[ "Retrieve", "the", "GATK", "major", "version", "handling", "multiple", "GATK", "distributions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L420-L444
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner._get_picard_cmd
def _get_picard_cmd(self, command, memscale=None): """Retrieve the base Picard command, handling both shell scripts and directory of jars. """ resources = config_utils.get_resources("picard", self._config) if memscale: jvm_opts = get_picard_opts(self._config, memscale=memscal...
python
def _get_picard_cmd(self, command, memscale=None): """Retrieve the base Picard command, handling both shell scripts and directory of jars. """ resources = config_utils.get_resources("picard", self._config) if memscale: jvm_opts = get_picard_opts(self._config, memscale=memscal...
[ "def", "_get_picard_cmd", "(", "self", ",", "command", ",", "memscale", "=", "None", ")", ":", "resources", "=", "config_utils", ".", "get_resources", "(", "\"picard\"", ",", "self", ".", "_config", ")", "if", "memscale", ":", "jvm_opts", "=", "get_picard_op...
Retrieve the base Picard command, handling both shell scripts and directory of jars.
[ "Retrieve", "the", "base", "Picard", "command", "handling", "both", "shell", "scripts", "and", "directory", "of", "jars", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L446-L461
train
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
BroadRunner._get_jar
def _get_jar(self, command, alts=None, allow_missing=False): """Retrieve the jar for running the specified command. """ dirs = [] for bdir in [self._gatk_dir, self._picard_ref]: dirs.extend([bdir, os.path.join(bdir, os.pardir, "gatk")]) if alt...
python
def _get_jar(self, command, alts=None, allow_missing=False): """Retrieve the jar for running the specified command. """ dirs = [] for bdir in [self._gatk_dir, self._picard_ref]: dirs.extend([bdir, os.path.join(bdir, os.pardir, "gatk")]) if alt...
[ "def", "_get_jar", "(", "self", ",", "command", ",", "alts", "=", "None", ",", "allow_missing", "=", "False", ")", ":", "dirs", "=", "[", "]", "for", "bdir", "in", "[", "self", ".", "_gatk_dir", ",", "self", ".", "_picard_ref", "]", ":", "dirs", "....
Retrieve the jar for running the specified command.
[ "Retrieve", "the", "jar", "for", "running", "the", "specified", "command", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L463-L484
train
bcbio/bcbio-nextgen
bcbio/utils.py
cpmap
def cpmap(cores=1): """Configurable parallel map context manager. Returns appropriate map compatible function based on configuration: - Local single core (the default) - Multiple local cores """ if int(cores) == 1: yield itertools.imap else: if futures is None: r...
python
def cpmap(cores=1): """Configurable parallel map context manager. Returns appropriate map compatible function based on configuration: - Local single core (the default) - Multiple local cores """ if int(cores) == 1: yield itertools.imap else: if futures is None: r...
[ "def", "cpmap", "(", "cores", "=", "1", ")", ":", "if", "int", "(", "cores", ")", "==", "1", ":", "yield", "itertools", ".", "imap", "else", ":", "if", "futures", "is", "None", ":", "raise", "ImportError", "(", "\"concurrent.futures not available\"", ")"...
Configurable parallel map context manager. Returns appropriate map compatible function based on configuration: - Local single core (the default) - Multiple local cores
[ "Configurable", "parallel", "map", "context", "manager", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L34-L48
train
bcbio/bcbio-nextgen
bcbio/utils.py
map_wrap
def map_wrap(f): """Wrap standard function to easily pass into 'map' processing. """ @functools.wraps(f) def wrapper(*args, **kwargs): return f(*args, **kwargs) return wrapper
python
def map_wrap(f): """Wrap standard function to easily pass into 'map' processing. """ @functools.wraps(f) def wrapper(*args, **kwargs): return f(*args, **kwargs) return wrapper
[ "def", "map_wrap", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "wrapper" ]
Wrap standard function to easily pass into 'map' processing.
[ "Wrap", "standard", "function", "to", "easily", "pass", "into", "map", "processing", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L50-L56
train
bcbio/bcbio-nextgen
bcbio/utils.py
unpack_worlds
def unpack_worlds(items): """Handle all the ways we can pass multiple samples for back-compatibility. """ # Unpack nested lists of samples grouped together (old IPython style) if isinstance(items[0], (list, tuple)) and len(items[0]) == 1: out = [] for d in items: assert len(d...
python
def unpack_worlds(items): """Handle all the ways we can pass multiple samples for back-compatibility. """ # Unpack nested lists of samples grouped together (old IPython style) if isinstance(items[0], (list, tuple)) and len(items[0]) == 1: out = [] for d in items: assert len(d...
[ "def", "unpack_worlds", "(", "items", ")", ":", "# Unpack nested lists of samples grouped together (old IPython style)", "if", "isinstance", "(", "items", "[", "0", "]", ",", "(", "list", ",", "tuple", ")", ")", "and", "len", "(", "items", "[", "0", "]", ")", ...
Handle all the ways we can pass multiple samples for back-compatibility.
[ "Handle", "all", "the", "ways", "we", "can", "pass", "multiple", "samples", "for", "back", "-", "compatibility", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L160-L174
train
bcbio/bcbio-nextgen
bcbio/utils.py
safe_makedir
def safe_makedir(dname): """Make a directory if it doesn't exist, handling concurrent race conditions. """ if not dname: return dname num_tries = 0 max_tries = 5 while not os.path.exists(dname): # we could get an error here if multiple processes are creating # the directo...
python
def safe_makedir(dname): """Make a directory if it doesn't exist, handling concurrent race conditions. """ if not dname: return dname num_tries = 0 max_tries = 5 while not os.path.exists(dname): # we could get an error here if multiple processes are creating # the directo...
[ "def", "safe_makedir", "(", "dname", ")", ":", "if", "not", "dname", ":", "return", "dname", "num_tries", "=", "0", "max_tries", "=", "5", "while", "not", "os", ".", "path", ".", "exists", "(", "dname", ")", ":", "# we could get an error here if multiple pro...
Make a directory if it doesn't exist, handling concurrent race conditions.
[ "Make", "a", "directory", "if", "it", "doesn", "t", "exist", "handling", "concurrent", "race", "conditions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L176-L193
train
bcbio/bcbio-nextgen
bcbio/utils.py
tmpfile
def tmpfile(*args, **kwargs): """Make a tempfile, safely cleaning up file descriptors on completion. """ (fd, fname) = tempfile.mkstemp(*args, **kwargs) try: yield fname finally: os.close(fd) if os.path.exists(fname): os.remove(fname)
python
def tmpfile(*args, **kwargs): """Make a tempfile, safely cleaning up file descriptors on completion. """ (fd, fname) = tempfile.mkstemp(*args, **kwargs) try: yield fname finally: os.close(fd) if os.path.exists(fname): os.remove(fname)
[ "def", "tmpfile", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "(", "fd", ",", "fname", ")", "=", "tempfile", ".", "mkstemp", "(", "*", "args", ",", "*", "*", "kwargs", ")", "try", ":", "yield", "fname", "finally", ":", "os", ".", "clos...
Make a tempfile, safely cleaning up file descriptors on completion.
[ "Make", "a", "tempfile", "safely", "cleaning", "up", "file", "descriptors", "on", "completion", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L221-L230
train
bcbio/bcbio-nextgen
bcbio/utils.py
file_exists
def file_exists(fname): """Check if a file exists and is non-empty. """ try: return fname and os.path.exists(fname) and os.path.getsize(fname) > 0 except OSError: return False
python
def file_exists(fname): """Check if a file exists and is non-empty. """ try: return fname and os.path.exists(fname) and os.path.getsize(fname) > 0 except OSError: return False
[ "def", "file_exists", "(", "fname", ")", ":", "try", ":", "return", "fname", "and", "os", ".", "path", ".", "exists", "(", "fname", ")", "and", "os", ".", "path", ".", "getsize", "(", "fname", ")", ">", "0", "except", "OSError", ":", "return", "Fal...
Check if a file exists and is non-empty.
[ "Check", "if", "a", "file", "exists", "and", "is", "non", "-", "empty", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L232-L238
train
bcbio/bcbio-nextgen
bcbio/utils.py
get_size
def get_size(path): """ Returns the size in bytes if `path` is a file, or the size of all files in `path` if it's a directory. Analogous to `du -s`. """ if os.path.isfile(path): return os.path.getsize(path) return sum(get_size(os.path.join(path, f)) for f in os.listdir(path))
python
def get_size(path): """ Returns the size in bytes if `path` is a file, or the size of all files in `path` if it's a directory. Analogous to `du -s`. """ if os.path.isfile(path): return os.path.getsize(path) return sum(get_size(os.path.join(path, f)) for f in os.listdir(path))
[ "def", "get_size", "(", "path", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "os", ".", "path", ".", "getsize", "(", "path", ")", "return", "sum", "(", "get_size", "(", "os", ".", "path", ".", "join", "(", ...
Returns the size in bytes if `path` is a file, or the size of all files in `path` if it's a directory. Analogous to `du -s`.
[ "Returns", "the", "size", "in", "bytes", "if", "path", "is", "a", "file", "or", "the", "size", "of", "all", "files", "in", "path", "if", "it", "s", "a", "directory", ".", "Analogous", "to", "du", "-", "s", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L241-L248
train
bcbio/bcbio-nextgen
bcbio/utils.py
read_galaxy_amqp_config
def read_galaxy_amqp_config(galaxy_config, base_dir): """Read connection information on the RabbitMQ server from Galaxy config. """ galaxy_config = add_full_path(galaxy_config, base_dir) config = six.moves.configparser.ConfigParser() config.read(galaxy_config) amqp_config = {} for option in ...
python
def read_galaxy_amqp_config(galaxy_config, base_dir): """Read connection information on the RabbitMQ server from Galaxy config. """ galaxy_config = add_full_path(galaxy_config, base_dir) config = six.moves.configparser.ConfigParser() config.read(galaxy_config) amqp_config = {} for option in ...
[ "def", "read_galaxy_amqp_config", "(", "galaxy_config", ",", "base_dir", ")", ":", "galaxy_config", "=", "add_full_path", "(", "galaxy_config", ",", "base_dir", ")", "config", "=", "six", ".", "moves", ".", "configparser", ".", "ConfigParser", "(", ")", "config"...
Read connection information on the RabbitMQ server from Galaxy config.
[ "Read", "connection", "information", "on", "the", "RabbitMQ", "server", "from", "Galaxy", "config", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L279-L288
train
bcbio/bcbio-nextgen
bcbio/utils.py
move_safe
def move_safe(origin, target): """ Move file, skip if exists """ if origin == target: return origin if file_exists(target): return target shutil.move(origin, target) return target
python
def move_safe(origin, target): """ Move file, skip if exists """ if origin == target: return origin if file_exists(target): return target shutil.move(origin, target) return target
[ "def", "move_safe", "(", "origin", ",", "target", ")", ":", "if", "origin", "==", "target", ":", "return", "origin", "if", "file_exists", "(", "target", ")", ":", "return", "target", "shutil", ".", "move", "(", "origin", ",", "target", ")", "return", "...
Move file, skip if exists
[ "Move", "file", "skip", "if", "exists" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L315-L324
train
bcbio/bcbio-nextgen
bcbio/utils.py
file_plus_index
def file_plus_index(fname): """Convert a file name into the file plus required indexes. """ exts = {".vcf": ".idx", ".bam": ".bai", ".vcf.gz": ".tbi", ".bed.gz": ".tbi", ".fq.gz": ".gbi"} ext = splitext_plus(fname)[-1] if ext in exts: return [fname, fname + exts[ext]] else: ...
python
def file_plus_index(fname): """Convert a file name into the file plus required indexes. """ exts = {".vcf": ".idx", ".bam": ".bai", ".vcf.gz": ".tbi", ".bed.gz": ".tbi", ".fq.gz": ".gbi"} ext = splitext_plus(fname)[-1] if ext in exts: return [fname, fname + exts[ext]] else: ...
[ "def", "file_plus_index", "(", "fname", ")", ":", "exts", "=", "{", "\".vcf\"", ":", "\".idx\"", ",", "\".bam\"", ":", "\".bai\"", ",", "\".vcf.gz\"", ":", "\".tbi\"", ",", "\".bed.gz\"", ":", "\".tbi\"", ",", "\".fq.gz\"", ":", "\".gbi\"", "}", "ext", "="...
Convert a file name into the file plus required indexes.
[ "Convert", "a", "file", "name", "into", "the", "file", "plus", "required", "indexes", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L326-L335
train
bcbio/bcbio-nextgen
bcbio/utils.py
remove_plus
def remove_plus(orig): """Remove a fils, including biological index files. """ for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]: if os.path.exists(orig + ext): remove_safe(orig + ext)
python
def remove_plus(orig): """Remove a fils, including biological index files. """ for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]: if os.path.exists(orig + ext): remove_safe(orig + ext)
[ "def", "remove_plus", "(", "orig", ")", ":", "for", "ext", "in", "[", "\"\"", ",", "\".idx\"", ",", "\".gbi\"", ",", "\".tbi\"", ",", "\".bai\"", "]", ":", "if", "os", ".", "path", ".", "exists", "(", "orig", "+", "ext", ")", ":", "remove_safe", "(...
Remove a fils, including biological index files.
[ "Remove", "a", "fils", "including", "biological", "index", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L337-L342
train
bcbio/bcbio-nextgen
bcbio/utils.py
copy_plus
def copy_plus(orig, new): """Copy a fils, including biological index files. """ for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]: if os.path.exists(orig + ext) and (not os.path.lexists(new + ext) or not os.path.exists(new + ext)): shutil.copyfile(orig + ext, new + ext)
python
def copy_plus(orig, new): """Copy a fils, including biological index files. """ for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]: if os.path.exists(orig + ext) and (not os.path.lexists(new + ext) or not os.path.exists(new + ext)): shutil.copyfile(orig + ext, new + ext)
[ "def", "copy_plus", "(", "orig", ",", "new", ")", ":", "for", "ext", "in", "[", "\"\"", ",", "\".idx\"", ",", "\".gbi\"", ",", "\".tbi\"", ",", "\".bai\"", "]", ":", "if", "os", ".", "path", ".", "exists", "(", "orig", "+", "ext", ")", "and", "("...
Copy a fils, including biological index files.
[ "Copy", "a", "fils", "including", "biological", "index", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L344-L349
train
bcbio/bcbio-nextgen
bcbio/utils.py
merge_config_files
def merge_config_files(fnames): """Merge configuration files, preferring definitions in latter files. """ def _load_yaml(fname): with open(fname) as in_handle: config = yaml.safe_load(in_handle) return config out = _load_yaml(fnames[0]) for fname in fnames[1:]: cu...
python
def merge_config_files(fnames): """Merge configuration files, preferring definitions in latter files. """ def _load_yaml(fname): with open(fname) as in_handle: config = yaml.safe_load(in_handle) return config out = _load_yaml(fnames[0]) for fname in fnames[1:]: cu...
[ "def", "merge_config_files", "(", "fnames", ")", ":", "def", "_load_yaml", "(", "fname", ")", ":", "with", "open", "(", "fname", ")", "as", "in_handle", ":", "config", "=", "yaml", ".", "safe_load", "(", "in_handle", ")", "return", "config", "out", "=", ...
Merge configuration files, preferring definitions in latter files.
[ "Merge", "configuration", "files", "preferring", "definitions", "in", "latter", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L475-L490
train
bcbio/bcbio-nextgen
bcbio/utils.py
deepish_copy
def deepish_copy(org): """Improved speed deep copy for dictionaries of simple python types. Thanks to Gregg Lind: http://writeonly.wordpress.com/2009/05/07/deepcopy-is-a-pig-for-simple-data/ """ out = dict().fromkeys(org) for k, v in org.items(): if isinstance(v, dict): out[...
python
def deepish_copy(org): """Improved speed deep copy for dictionaries of simple python types. Thanks to Gregg Lind: http://writeonly.wordpress.com/2009/05/07/deepcopy-is-a-pig-for-simple-data/ """ out = dict().fromkeys(org) for k, v in org.items(): if isinstance(v, dict): out[...
[ "def", "deepish_copy", "(", "org", ")", ":", "out", "=", "dict", "(", ")", ".", "fromkeys", "(", "org", ")", "for", "k", ",", "v", "in", "org", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "out", "[", "k",...
Improved speed deep copy for dictionaries of simple python types. Thanks to Gregg Lind: http://writeonly.wordpress.com/2009/05/07/deepcopy-is-a-pig-for-simple-data/
[ "Improved", "speed", "deep", "copy", "for", "dictionaries", "of", "simple", "python", "types", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L492-L510
train
bcbio/bcbio-nextgen
bcbio/utils.py
reservoir_sample
def reservoir_sample(stream, num_items, item_parser=lambda x: x): """ samples num_items from the stream keeping each with equal probability """ kept = [] for index, item in enumerate(stream): if index < num_items: kept.append(item_parser(item)) else: r = rando...
python
def reservoir_sample(stream, num_items, item_parser=lambda x: x): """ samples num_items from the stream keeping each with equal probability """ kept = [] for index, item in enumerate(stream): if index < num_items: kept.append(item_parser(item)) else: r = rando...
[ "def", "reservoir_sample", "(", "stream", ",", "num_items", ",", "item_parser", "=", "lambda", "x", ":", "x", ")", ":", "kept", "=", "[", "]", "for", "index", ",", "item", "in", "enumerate", "(", "stream", ")", ":", "if", "index", "<", "num_items", "...
samples num_items from the stream keeping each with equal probability
[ "samples", "num_items", "from", "the", "stream", "keeping", "each", "with", "equal", "probability" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L663-L675
train
bcbio/bcbio-nextgen
bcbio/utils.py
dictapply
def dictapply(d, fn): """ apply a function to all non-dict values in a dictionary """ for k, v in d.items(): if isinstance(v, dict): v = dictapply(v, fn) else: d[k] = fn(v) return d
python
def dictapply(d, fn): """ apply a function to all non-dict values in a dictionary """ for k, v in d.items(): if isinstance(v, dict): v = dictapply(v, fn) else: d[k] = fn(v) return d
[ "def", "dictapply", "(", "d", ",", "fn", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "v", "=", "dictapply", "(", "v", ",", "fn", ")", "else", ":", "d", "[", ...
apply a function to all non-dict values in a dictionary
[ "apply", "a", "function", "to", "all", "non", "-", "dict", "values", "in", "a", "dictionary" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L681-L690
train
bcbio/bcbio-nextgen
bcbio/utils.py
Rscript_cmd
def Rscript_cmd(): """Retrieve path to locally installed Rscript or first in PATH. Prefers Rscript version installed via conda to a system version. """ rscript = which(os.path.join(get_bcbio_bin(), "Rscript")) if rscript: return rscript else: return which("Rscript")
python
def Rscript_cmd(): """Retrieve path to locally installed Rscript or first in PATH. Prefers Rscript version installed via conda to a system version. """ rscript = which(os.path.join(get_bcbio_bin(), "Rscript")) if rscript: return rscript else: return which("Rscript")
[ "def", "Rscript_cmd", "(", ")", ":", "rscript", "=", "which", "(", "os", ".", "path", ".", "join", "(", "get_bcbio_bin", "(", ")", ",", "\"Rscript\"", ")", ")", "if", "rscript", ":", "return", "rscript", "else", ":", "return", "which", "(", "\"Rscript\...
Retrieve path to locally installed Rscript or first in PATH. Prefers Rscript version installed via conda to a system version.
[ "Retrieve", "path", "to", "locally", "installed", "Rscript", "or", "first", "in", "PATH", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L692-L701
train
bcbio/bcbio-nextgen
bcbio/utils.py
R_package_resource
def R_package_resource(package, resource): """ return a path to an R package resource, if it is available """ package_path = R_package_path(package) if not package_path: return None package_resource = os.path.join(package_path, resource) if not file_exists(package_resource): ...
python
def R_package_resource(package, resource): """ return a path to an R package resource, if it is available """ package_path = R_package_path(package) if not package_path: return None package_resource = os.path.join(package_path, resource) if not file_exists(package_resource): ...
[ "def", "R_package_resource", "(", "package", ",", "resource", ")", ":", "package_path", "=", "R_package_path", "(", "package", ")", "if", "not", "package_path", ":", "return", "None", "package_resource", "=", "os", ".", "path", ".", "join", "(", "package_path"...
return a path to an R package resource, if it is available
[ "return", "a", "path", "to", "an", "R", "package", "resource", "if", "it", "is", "available" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L727-L738
train
bcbio/bcbio-nextgen
bcbio/utils.py
get_java_binpath
def get_java_binpath(cmd=None): """Retrieve path for java to use, handling custom BCBIO_JAVA_HOME Defaults to the dirname of cmd, or local anaconda directory """ if os.environ.get("BCBIO_JAVA_HOME"): test_cmd = os.path.join(os.environ["BCBIO_JAVA_HOME"], "bin", "java") if os.path.exists...
python
def get_java_binpath(cmd=None): """Retrieve path for java to use, handling custom BCBIO_JAVA_HOME Defaults to the dirname of cmd, or local anaconda directory """ if os.environ.get("BCBIO_JAVA_HOME"): test_cmd = os.path.join(os.environ["BCBIO_JAVA_HOME"], "bin", "java") if os.path.exists...
[ "def", "get_java_binpath", "(", "cmd", "=", "None", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "\"BCBIO_JAVA_HOME\"", ")", ":", "test_cmd", "=", "os", ".", "path", ".", "join", "(", "os", ".", "environ", "[", "\"BCBIO_JAVA_HOME\"", "]", ","...
Retrieve path for java to use, handling custom BCBIO_JAVA_HOME Defaults to the dirname of cmd, or local anaconda directory
[ "Retrieve", "path", "for", "java", "to", "use", "handling", "custom", "BCBIO_JAVA_HOME" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L740-L751
train
bcbio/bcbio-nextgen
bcbio/utils.py
clear_java_home
def clear_java_home(): """Clear JAVA_HOME environment or reset to BCBIO_JAVA_HOME. Avoids accidental java injection but respects custom BCBIO_JAVA_HOME command. """ if os.environ.get("BCBIO_JAVA_HOME"): test_cmd = os.path.join(os.environ["BCBIO_JAVA_HOME"], "bin", "java") if os.path...
python
def clear_java_home(): """Clear JAVA_HOME environment or reset to BCBIO_JAVA_HOME. Avoids accidental java injection but respects custom BCBIO_JAVA_HOME command. """ if os.environ.get("BCBIO_JAVA_HOME"): test_cmd = os.path.join(os.environ["BCBIO_JAVA_HOME"], "bin", "java") if os.path...
[ "def", "clear_java_home", "(", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "\"BCBIO_JAVA_HOME\"", ")", ":", "test_cmd", "=", "os", ".", "path", ".", "join", "(", "os", ".", "environ", "[", "\"BCBIO_JAVA_HOME\"", "]", ",", "\"bin\"", ",", "\"...
Clear JAVA_HOME environment or reset to BCBIO_JAVA_HOME. Avoids accidental java injection but respects custom BCBIO_JAVA_HOME command.
[ "Clear", "JAVA_HOME", "environment", "or", "reset", "to", "BCBIO_JAVA_HOME", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L753-L763
train
bcbio/bcbio-nextgen
bcbio/utils.py
perl_cmd
def perl_cmd(): """Retrieve path to locally installed conda Perl or first in PATH. """ perl = which(os.path.join(get_bcbio_bin(), "perl")) if perl: return perl else: return which("perl")
python
def perl_cmd(): """Retrieve path to locally installed conda Perl or first in PATH. """ perl = which(os.path.join(get_bcbio_bin(), "perl")) if perl: return perl else: return which("perl")
[ "def", "perl_cmd", "(", ")", ":", "perl", "=", "which", "(", "os", ".", "path", ".", "join", "(", "get_bcbio_bin", "(", ")", ",", "\"perl\"", ")", ")", "if", "perl", ":", "return", "perl", "else", ":", "return", "which", "(", "\"perl\"", ")" ]
Retrieve path to locally installed conda Perl or first in PATH.
[ "Retrieve", "path", "to", "locally", "installed", "conda", "Perl", "or", "first", "in", "PATH", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L773-L780
train
bcbio/bcbio-nextgen
bcbio/utils.py
get_perl_exports
def get_perl_exports(tmpdir=None): """Environmental exports to use conda installed perl. """ perl_path = os.path.dirname(perl_cmd()) out = "unset PERL5LIB && export PATH=%s:\"$PATH\"" % (perl_path) if tmpdir: out += " && export TMPDIR=%s" % (tmpdir) return out
python
def get_perl_exports(tmpdir=None): """Environmental exports to use conda installed perl. """ perl_path = os.path.dirname(perl_cmd()) out = "unset PERL5LIB && export PATH=%s:\"$PATH\"" % (perl_path) if tmpdir: out += " && export TMPDIR=%s" % (tmpdir) return out
[ "def", "get_perl_exports", "(", "tmpdir", "=", "None", ")", ":", "perl_path", "=", "os", ".", "path", ".", "dirname", "(", "perl_cmd", "(", ")", ")", "out", "=", "\"unset PERL5LIB && export PATH=%s:\\\"$PATH\\\"\"", "%", "(", "perl_path", ")", "if", "tmpdir", ...
Environmental exports to use conda installed perl.
[ "Environmental", "exports", "to", "use", "conda", "installed", "perl", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L782-L789
train
bcbio/bcbio-nextgen
bcbio/utils.py
get_all_conda_bins
def get_all_conda_bins(): """Retrieve all possible conda bin directories, including environments. """ bcbio_bin = get_bcbio_bin() conda_dir = os.path.dirname(bcbio_bin) if os.path.join("anaconda", "envs") in conda_dir: conda_dir = os.path.join(conda_dir[:conda_dir.rfind(os.path.join("anacond...
python
def get_all_conda_bins(): """Retrieve all possible conda bin directories, including environments. """ bcbio_bin = get_bcbio_bin() conda_dir = os.path.dirname(bcbio_bin) if os.path.join("anaconda", "envs") in conda_dir: conda_dir = os.path.join(conda_dir[:conda_dir.rfind(os.path.join("anacond...
[ "def", "get_all_conda_bins", "(", ")", ":", "bcbio_bin", "=", "get_bcbio_bin", "(", ")", "conda_dir", "=", "os", ".", "path", ".", "dirname", "(", "bcbio_bin", ")", "if", "os", ".", "path", ".", "join", "(", "\"anaconda\"", ",", "\"envs\"", ")", "in", ...
Retrieve all possible conda bin directories, including environments.
[ "Retrieve", "all", "possible", "conda", "bin", "directories", "including", "environments", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L809-L816
train
bcbio/bcbio-nextgen
bcbio/utils.py
get_program_python
def get_program_python(cmd): """Get the full path to a python version linked to the command. Allows finding python based programs in python 2 versus python 3 environments. """ full_cmd = os.path.realpath(which(cmd)) cmd_python = os.path.join(os.path.dirname(full_cmd), "python") env_python =...
python
def get_program_python(cmd): """Get the full path to a python version linked to the command. Allows finding python based programs in python 2 versus python 3 environments. """ full_cmd = os.path.realpath(which(cmd)) cmd_python = os.path.join(os.path.dirname(full_cmd), "python") env_python =...
[ "def", "get_program_python", "(", "cmd", ")", ":", "full_cmd", "=", "os", ".", "path", ".", "realpath", "(", "which", "(", "cmd", ")", ")", "cmd_python", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "full_cmd", ...
Get the full path to a python version linked to the command. Allows finding python based programs in python 2 versus python 3 environments.
[ "Get", "the", "full", "path", "to", "a", "python", "version", "linked", "to", "the", "command", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L818-L835
train
bcbio/bcbio-nextgen
bcbio/utils.py
local_path_export
def local_path_export(at_start=True, env_cmd=None): """Retrieve paths to local install, also including environment paths if env_cmd included. """ paths = [get_bcbio_bin()] if env_cmd: env_path = os.path.dirname(get_program_python(env_cmd)) if env_path not in paths: paths.inse...
python
def local_path_export(at_start=True, env_cmd=None): """Retrieve paths to local install, also including environment paths if env_cmd included. """ paths = [get_bcbio_bin()] if env_cmd: env_path = os.path.dirname(get_program_python(env_cmd)) if env_path not in paths: paths.inse...
[ "def", "local_path_export", "(", "at_start", "=", "True", ",", "env_cmd", "=", "None", ")", ":", "paths", "=", "[", "get_bcbio_bin", "(", ")", "]", "if", "env_cmd", ":", "env_path", "=", "os", ".", "path", ".", "dirname", "(", "get_program_python", "(", ...
Retrieve paths to local install, also including environment paths if env_cmd included.
[ "Retrieve", "paths", "to", "local", "install", "also", "including", "environment", "paths", "if", "env_cmd", "included", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L837-L848
train
bcbio/bcbio-nextgen
bcbio/utils.py
rbind
def rbind(dfs): """ acts like rbind for pandas dataframes """ if len(dfs) == 1: return dfs[0] df = dfs[0] for d in dfs[1:]: df = df.append(d) return df
python
def rbind(dfs): """ acts like rbind for pandas dataframes """ if len(dfs) == 1: return dfs[0] df = dfs[0] for d in dfs[1:]: df = df.append(d) return df
[ "def", "rbind", "(", "dfs", ")", ":", "if", "len", "(", "dfs", ")", "==", "1", ":", "return", "dfs", "[", "0", "]", "df", "=", "dfs", "[", "0", "]", "for", "d", "in", "dfs", "[", "1", ":", "]", ":", "df", "=", "df", ".", "append", "(", ...
acts like rbind for pandas dataframes
[ "acts", "like", "rbind", "for", "pandas", "dataframes" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L902-L911
train
bcbio/bcbio-nextgen
bcbio/utils.py
sort_filenames
def sort_filenames(filenames): """ sort a list of files by filename only, ignoring the directory names """ basenames = [os.path.basename(x) for x in filenames] indexes = [i[0] for i in sorted(enumerate(basenames), key=lambda x:x[1])] return [filenames[x] for x in indexes]
python
def sort_filenames(filenames): """ sort a list of files by filename only, ignoring the directory names """ basenames = [os.path.basename(x) for x in filenames] indexes = [i[0] for i in sorted(enumerate(basenames), key=lambda x:x[1])] return [filenames[x] for x in indexes]
[ "def", "sort_filenames", "(", "filenames", ")", ":", "basenames", "=", "[", "os", ".", "path", ".", "basename", "(", "x", ")", "for", "x", "in", "filenames", "]", "indexes", "=", "[", "i", "[", "0", "]", "for", "i", "in", "sorted", "(", "enumerate"...
sort a list of files by filename only, ignoring the directory names
[ "sort", "a", "list", "of", "files", "by", "filename", "only", "ignoring", "the", "directory", "names" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L936-L942
train
bcbio/bcbio-nextgen
bcbio/utils.py
walk_json
def walk_json(d, func): """ Walk over a parsed JSON nested structure `d`, apply `func` to each leaf element and replace it with result """ if isinstance(d, Mapping): return OrderedDict((k, walk_json(v, func)) for k, v in d.items()) elif isinstance(d, list): return [walk_json(v, func) for...
python
def walk_json(d, func): """ Walk over a parsed JSON nested structure `d`, apply `func` to each leaf element and replace it with result """ if isinstance(d, Mapping): return OrderedDict((k, walk_json(v, func)) for k, v in d.items()) elif isinstance(d, list): return [walk_json(v, func) for...
[ "def", "walk_json", "(", "d", ",", "func", ")", ":", "if", "isinstance", "(", "d", ",", "Mapping", ")", ":", "return", "OrderedDict", "(", "(", "k", ",", "walk_json", "(", "v", ",", "func", ")", ")", "for", "k", ",", "v", "in", "d", ".", "items...
Walk over a parsed JSON nested structure `d`, apply `func` to each leaf element and replace it with result
[ "Walk", "over", "a", "parsed", "JSON", "nested", "structure", "d", "apply", "func", "to", "each", "leaf", "element", "and", "replace", "it", "with", "result" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L989-L997
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
_link_bam_file
def _link_bam_file(in_file, new_dir, data): """Provide symlinks of BAM file and existing indexes if needed. """ new_dir = utils.safe_makedir(new_dir) out_file = os.path.join(new_dir, os.path.basename(in_file)) if not utils.file_exists(out_file): out_file = os.path.join(new_dir, "%s-prealign....
python
def _link_bam_file(in_file, new_dir, data): """Provide symlinks of BAM file and existing indexes if needed. """ new_dir = utils.safe_makedir(new_dir) out_file = os.path.join(new_dir, os.path.basename(in_file)) if not utils.file_exists(out_file): out_file = os.path.join(new_dir, "%s-prealign....
[ "def", "_link_bam_file", "(", "in_file", ",", "new_dir", ",", "data", ")", ":", "new_dir", "=", "utils", ".", "safe_makedir", "(", "new_dir", ")", "out_file", "=", "os", ".", "path", ".", "join", "(", "new_dir", ",", "os", ".", "path", ".", "basename",...
Provide symlinks of BAM file and existing indexes if needed.
[ "Provide", "symlinks", "of", "BAM", "file", "and", "existing", "indexes", "if", "needed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L69-L84
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
_add_supplemental_bams
def _add_supplemental_bams(data): """Add supplemental files produced by alignment, useful for structural variant calling. """ file_key = "work_bam" if data.get(file_key): for supext in ["disc", "sr"]: base, ext = os.path.splitext(data[file_key]) test_file = "%s-%s%s" ...
python
def _add_supplemental_bams(data): """Add supplemental files produced by alignment, useful for structural variant calling. """ file_key = "work_bam" if data.get(file_key): for supext in ["disc", "sr"]: base, ext = os.path.splitext(data[file_key]) test_file = "%s-%s%s" ...
[ "def", "_add_supplemental_bams", "(", "data", ")", ":", "file_key", "=", "\"work_bam\"", "if", "data", ".", "get", "(", "file_key", ")", ":", "for", "supext", "in", "[", "\"disc\"", ",", "\"sr\"", "]", ":", "base", ",", "ext", "=", "os", ".", "path", ...
Add supplemental files produced by alignment, useful for structural variant calling.
[ "Add", "supplemental", "files", "produced", "by", "alignment", "useful", "for", "structural", "variant", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L86-L100
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
_add_hla_files
def _add_hla_files(data): """Add extracted fastq files of HLA alleles for typing. """ if "hla" not in data: data["hla"] = {} align_file = dd.get_align_bam(data) hla_dir = os.path.join(os.path.dirname(align_file), "hla") if not os.path.exists(hla_dir): hla_files = None else: ...
python
def _add_hla_files(data): """Add extracted fastq files of HLA alleles for typing. """ if "hla" not in data: data["hla"] = {} align_file = dd.get_align_bam(data) hla_dir = os.path.join(os.path.dirname(align_file), "hla") if not os.path.exists(hla_dir): hla_files = None else: ...
[ "def", "_add_hla_files", "(", "data", ")", ":", "if", "\"hla\"", "not", "in", "data", ":", "data", "[", "\"hla\"", "]", "=", "{", "}", "align_file", "=", "dd", ".", "get_align_bam", "(", "data", ")", "hla_dir", "=", "os", ".", "path", ".", "join", ...
Add extracted fastq files of HLA alleles for typing.
[ "Add", "extracted", "fastq", "files", "of", "HLA", "alleles", "for", "typing", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L102-L114
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
prep_samples
def prep_samples(*items): """Handle any global preparatory steps for samples with potentially shared data. Avoids race conditions in postprocess alignment when performing prep tasks on shared files between multiple similar samples. Cleans input BED files to avoid issues with overlapping input segments...
python
def prep_samples(*items): """Handle any global preparatory steps for samples with potentially shared data. Avoids race conditions in postprocess alignment when performing prep tasks on shared files between multiple similar samples. Cleans input BED files to avoid issues with overlapping input segments...
[ "def", "prep_samples", "(", "*", "items", ")", ":", "out", "=", "[", "]", "for", "data", "in", "(", "utils", ".", "to_single_data", "(", "x", ")", "for", "x", "in", "items", ")", ":", "data", "=", "cwlutils", ".", "normalize_missing", "(", "data", ...
Handle any global preparatory steps for samples with potentially shared data. Avoids race conditions in postprocess alignment when performing prep tasks on shared files between multiple similar samples. Cleans input BED files to avoid issues with overlapping input segments.
[ "Handle", "any", "global", "preparatory", "steps", "for", "samples", "with", "potentially", "shared", "data", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L192-L206
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
clean_inputs
def clean_inputs(data): """Clean BED input files to avoid overlapping segments that cause downstream issues. Per-merges inputs to avoid needing to call multiple times during later parallel steps. """ if not utils.get_in(data, ("config", "algorithm", "variant_regions_orig")): data["config"]["alg...
python
def clean_inputs(data): """Clean BED input files to avoid overlapping segments that cause downstream issues. Per-merges inputs to avoid needing to call multiple times during later parallel steps. """ if not utils.get_in(data, ("config", "algorithm", "variant_regions_orig")): data["config"]["alg...
[ "def", "clean_inputs", "(", "data", ")", ":", "if", "not", "utils", ".", "get_in", "(", "data", ",", "(", "\"config\"", ",", "\"algorithm\"", ",", "\"variant_regions_orig\"", ")", ")", ":", "data", "[", "\"config\"", "]", "[", "\"algorithm\"", "]", "[", ...
Clean BED input files to avoid overlapping segments that cause downstream issues. Per-merges inputs to avoid needing to call multiple times during later parallel steps.
[ "Clean", "BED", "input", "files", "to", "avoid", "overlapping", "segments", "that", "cause", "downstream", "issues", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L208-L236
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
postprocess_alignment
def postprocess_alignment(data): """Perform post-processing steps required on full BAM files. Prepares list of callable genome regions allowing subsequent parallelization. """ data = cwlutils.normalize_missing(utils.to_single_data(data)) data = cwlutils.unpack_tarballs(data, data) bam_file = dat...
python
def postprocess_alignment(data): """Perform post-processing steps required on full BAM files. Prepares list of callable genome regions allowing subsequent parallelization. """ data = cwlutils.normalize_missing(utils.to_single_data(data)) data = cwlutils.unpack_tarballs(data, data) bam_file = dat...
[ "def", "postprocess_alignment", "(", "data", ")", ":", "data", "=", "cwlutils", ".", "normalize_missing", "(", "utils", ".", "to_single_data", "(", "data", ")", ")", "data", "=", "cwlutils", ".", "unpack_tarballs", "(", "data", ",", "data", ")", "bam_file", ...
Perform post-processing steps required on full BAM files. Prepares list of callable genome regions allowing subsequent parallelization.
[ "Perform", "post", "-", "processing", "steps", "required", "on", "full", "BAM", "files", ".", "Prepares", "list", "of", "callable", "genome", "regions", "allowing", "subsequent", "parallelization", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L238-L270
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
_merge_out_from_infiles
def _merge_out_from_infiles(in_files): """Generate output merged file name from set of input files. Handles non-shared filesystems where we don't know output path when setting up split parts. """ fname = os.path.commonprefix([os.path.basename(f) for f in in_files]) while fname.endswith(("-", "_...
python
def _merge_out_from_infiles(in_files): """Generate output merged file name from set of input files. Handles non-shared filesystems where we don't know output path when setting up split parts. """ fname = os.path.commonprefix([os.path.basename(f) for f in in_files]) while fname.endswith(("-", "_...
[ "def", "_merge_out_from_infiles", "(", "in_files", ")", ":", "fname", "=", "os", ".", "path", ".", "commonprefix", "(", "[", "os", ".", "path", ".", "basename", "(", "f", ")", "for", "f", "in", "in_files", "]", ")", "while", "fname", ".", "endswith", ...
Generate output merged file name from set of input files. Handles non-shared filesystems where we don't know output path when setting up split parts.
[ "Generate", "output", "merged", "file", "name", "from", "set", "of", "input", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L272-L285
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
delayed_bam_merge
def delayed_bam_merge(data): """Perform a merge on previously prepped files, delayed in processing. Handles merging of associated split read and discordant files if present. """ if data.get("combine"): assert len(data["combine"].keys()) == 1 file_key = list(data["combine"].keys())[0] ...
python
def delayed_bam_merge(data): """Perform a merge on previously prepped files, delayed in processing. Handles merging of associated split read and discordant files if present. """ if data.get("combine"): assert len(data["combine"].keys()) == 1 file_key = list(data["combine"].keys())[0] ...
[ "def", "delayed_bam_merge", "(", "data", ")", ":", "if", "data", ".", "get", "(", "\"combine\"", ")", ":", "assert", "len", "(", "data", "[", "\"combine\"", "]", ".", "keys", "(", ")", ")", "==", "1", "file_key", "=", "list", "(", "data", "[", "\"c...
Perform a merge on previously prepped files, delayed in processing. Handles merging of associated split read and discordant files if present.
[ "Perform", "a", "merge", "on", "previously", "prepped", "files", "delayed", "in", "processing", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L287-L330
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
merge_split_alignments
def merge_split_alignments(data): """Merge split BAM inputs generated by common workflow language runs. """ data = utils.to_single_data(data) data = _merge_align_bams(data) data = _merge_hla_fastq_inputs(data) return [[data]]
python
def merge_split_alignments(data): """Merge split BAM inputs generated by common workflow language runs. """ data = utils.to_single_data(data) data = _merge_align_bams(data) data = _merge_hla_fastq_inputs(data) return [[data]]
[ "def", "merge_split_alignments", "(", "data", ")", ":", "data", "=", "utils", ".", "to_single_data", "(", "data", ")", "data", "=", "_merge_align_bams", "(", "data", ")", "data", "=", "_merge_hla_fastq_inputs", "(", "data", ")", "return", "[", "[", "data", ...
Merge split BAM inputs generated by common workflow language runs.
[ "Merge", "split", "BAM", "inputs", "generated", "by", "common", "workflow", "language", "runs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L332-L338
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
_merge_align_bams
def _merge_align_bams(data): """Merge multiple alignment BAMs, including split and discordant reads. """ for key in (["work_bam"], ["work_bam_plus", "disc"], ["work_bam_plus", "sr"], ["umi_bam"]): in_files = tz.get_in(key, data, []) if not isinstance(in_files, (list, tuple)): in_...
python
def _merge_align_bams(data): """Merge multiple alignment BAMs, including split and discordant reads. """ for key in (["work_bam"], ["work_bam_plus", "disc"], ["work_bam_plus", "sr"], ["umi_bam"]): in_files = tz.get_in(key, data, []) if not isinstance(in_files, (list, tuple)): in_...
[ "def", "_merge_align_bams", "(", "data", ")", ":", "for", "key", "in", "(", "[", "\"work_bam\"", "]", ",", "[", "\"work_bam_plus\"", ",", "\"disc\"", "]", ",", "[", "\"work_bam_plus\"", ",", "\"sr\"", "]", ",", "[", "\"umi_bam\"", "]", ")", ":", "in_file...
Merge multiple alignment BAMs, including split and discordant reads.
[ "Merge", "multiple", "alignment", "BAMs", "including", "split", "and", "discordant", "reads", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L340-L359
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
_merge_hla_fastq_inputs
def _merge_hla_fastq_inputs(data): """Merge HLA inputs from a split initial alignment. """ hla_key = ["hla", "fastq"] hla_sample_files = [x for x in (tz.get_in(hla_key, data) or []) if x and x != "None"] merged_hlas = None if hla_sample_files: out_files = collections.defaultdict(list) ...
python
def _merge_hla_fastq_inputs(data): """Merge HLA inputs from a split initial alignment. """ hla_key = ["hla", "fastq"] hla_sample_files = [x for x in (tz.get_in(hla_key, data) or []) if x and x != "None"] merged_hlas = None if hla_sample_files: out_files = collections.defaultdict(list) ...
[ "def", "_merge_hla_fastq_inputs", "(", "data", ")", ":", "hla_key", "=", "[", "\"hla\"", ",", "\"fastq\"", "]", "hla_sample_files", "=", "[", "x", "for", "x", "in", "(", "tz", ".", "get_in", "(", "hla_key", ",", "data", ")", "or", "[", "]", ")", "if"...
Merge HLA inputs from a split initial alignment.
[ "Merge", "HLA", "inputs", "from", "a", "split", "initial", "alignment", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L361-L383
train
bcbio/bcbio-nextgen
bcbio/pipeline/sample.py
prepare_bcbio_samples
def prepare_bcbio_samples(sample): """ Function that will use specific function to merge input files """ logger.info("Preparing %s files %s to merge into %s." % (sample['name'], sample['files'], sample['out_file'])) if sample['fn'] == "fq_merge": out_file = fq_merge(sample['files'], sample['...
python
def prepare_bcbio_samples(sample): """ Function that will use specific function to merge input files """ logger.info("Preparing %s files %s to merge into %s." % (sample['name'], sample['files'], sample['out_file'])) if sample['fn'] == "fq_merge": out_file = fq_merge(sample['files'], sample['...
[ "def", "prepare_bcbio_samples", "(", "sample", ")", ":", "logger", ".", "info", "(", "\"Preparing %s files %s to merge into %s.\"", "%", "(", "sample", "[", "'name'", "]", ",", "sample", "[", "'files'", "]", ",", "sample", "[", "'out_file'", "]", ")", ")", "...
Function that will use specific function to merge input files
[ "Function", "that", "will", "use", "specific", "function", "to", "merge", "input", "files" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sample.py#L385-L399
train
bcbio/bcbio-nextgen
bcbio/heterogeneity/__init__.py
_get_calls
def _get_calls(data, cnv_only=False): """Retrieve calls, organized by name, to use for heterogeneity analysis. """ cnvs_supported = set(["cnvkit", "battenberg"]) out = {} for sv in data.get("sv", []): if not cnv_only or sv["variantcaller"] in cnvs_supported: out[sv["variantcaller...
python
def _get_calls(data, cnv_only=False): """Retrieve calls, organized by name, to use for heterogeneity analysis. """ cnvs_supported = set(["cnvkit", "battenberg"]) out = {} for sv in data.get("sv", []): if not cnv_only or sv["variantcaller"] in cnvs_supported: out[sv["variantcaller...
[ "def", "_get_calls", "(", "data", ",", "cnv_only", "=", "False", ")", ":", "cnvs_supported", "=", "set", "(", "[", "\"cnvkit\"", ",", "\"battenberg\"", "]", ")", "out", "=", "{", "}", "for", "sv", "in", "data", ".", "get", "(", "\"sv\"", ",", "[", ...
Retrieve calls, organized by name, to use for heterogeneity analysis.
[ "Retrieve", "calls", "organized", "by", "name", "to", "use", "for", "heterogeneity", "analysis", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/__init__.py#L17-L25
train
bcbio/bcbio-nextgen
bcbio/heterogeneity/__init__.py
get_variants
def get_variants(data, include_germline=False): """Retrieve set of variant calls to use for heterogeneity analysis. """ data = utils.deepish_copy(data) supported = ["precalled", "vardict", "vardict-java", "vardict-perl", "freebayes", "octopus", "strelka2"] # Right now mutect2 and mu...
python
def get_variants(data, include_germline=False): """Retrieve set of variant calls to use for heterogeneity analysis. """ data = utils.deepish_copy(data) supported = ["precalled", "vardict", "vardict-java", "vardict-perl", "freebayes", "octopus", "strelka2"] # Right now mutect2 and mu...
[ "def", "get_variants", "(", "data", ",", "include_germline", "=", "False", ")", ":", "data", "=", "utils", ".", "deepish_copy", "(", "data", ")", "supported", "=", "[", "\"precalled\"", ",", "\"vardict\"", ",", "\"vardict-java\"", ",", "\"vardict-perl\"", ",",...
Retrieve set of variant calls to use for heterogeneity analysis.
[ "Retrieve", "set", "of", "variant", "calls", "to", "use", "for", "heterogeneity", "analysis", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/__init__.py#L27-L57
train
bcbio/bcbio-nextgen
bcbio/heterogeneity/__init__.py
_ready_for_het_analysis
def _ready_for_het_analysis(items): """Check if a sample has input information for heterogeneity analysis. We currently require a tumor/normal sample containing both CNV and variant calls. """ paired = vcfutils.get_paired_bams([dd.get_align_bam(d) for d in items], items) has_het = any(dd.get_hetcal...
python
def _ready_for_het_analysis(items): """Check if a sample has input information for heterogeneity analysis. We currently require a tumor/normal sample containing both CNV and variant calls. """ paired = vcfutils.get_paired_bams([dd.get_align_bam(d) for d in items], items) has_het = any(dd.get_hetcal...
[ "def", "_ready_for_het_analysis", "(", "items", ")", ":", "paired", "=", "vcfutils", ".", "get_paired_bams", "(", "[", "dd", ".", "get_align_bam", "(", "d", ")", "for", "d", "in", "items", "]", ",", "items", ")", "has_het", "=", "any", "(", "dd", ".", ...
Check if a sample has input information for heterogeneity analysis. We currently require a tumor/normal sample containing both CNV and variant calls.
[ "Check", "if", "a", "sample", "has", "input", "information", "for", "heterogeneity", "analysis", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/__init__.py#L59-L67
train
bcbio/bcbio-nextgen
bcbio/heterogeneity/__init__.py
run
def run(items, run_parallel): """Top level entry point for calculating heterogeneity, handles organization and job distribution. """ to_process = [] extras = [] for batch, cur_items in _group_by_batches(items).items(): if _ready_for_het_analysis(cur_items): to_process.append((bat...
python
def run(items, run_parallel): """Top level entry point for calculating heterogeneity, handles organization and job distribution. """ to_process = [] extras = [] for batch, cur_items in _group_by_batches(items).items(): if _ready_for_het_analysis(cur_items): to_process.append((bat...
[ "def", "run", "(", "items", ",", "run_parallel", ")", ":", "to_process", "=", "[", "]", "extras", "=", "[", "]", "for", "batch", ",", "cur_items", "in", "_group_by_batches", "(", "items", ")", ".", "items", "(", ")", ":", "if", "_ready_for_het_analysis",...
Top level entry point for calculating heterogeneity, handles organization and job distribution.
[ "Top", "level", "entry", "point", "for", "calculating", "heterogeneity", "handles", "organization", "and", "job", "distribution", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/__init__.py#L122-L134
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
create_inputs
def create_inputs(data): """Index input reads and prepare groups of reads to process concurrently. Allows parallelization of alignment beyond processors available on a single machine. Prepares a bgzip and grabix indexed file for retrieving sections of files. """ from bcbio.pipeline import sampl...
python
def create_inputs(data): """Index input reads and prepare groups of reads to process concurrently. Allows parallelization of alignment beyond processors available on a single machine. Prepares a bgzip and grabix indexed file for retrieving sections of files. """ from bcbio.pipeline import sampl...
[ "def", "create_inputs", "(", "data", ")", ":", "from", "bcbio", ".", "pipeline", "import", "sample", "data", "=", "cwlutils", ".", "normalize_missing", "(", "data", ")", "aligner", "=", "tz", ".", "get_in", "(", "(", "\"config\"", ",", "\"algorithm\"", ","...
Index input reads and prepare groups of reads to process concurrently. Allows parallelization of alignment beyond processors available on a single machine. Prepares a bgzip and grabix indexed file for retrieving sections of files.
[ "Index", "input", "reads", "and", "prepare", "groups", "of", "reads", "to", "process", "concurrently", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L25-L62
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_set_align_split_size
def _set_align_split_size(data): """Set useful align_split_size, generating an estimate if it doesn't exist. We try to split on larger inputs and avoid too many pieces, aiming for size chunks of 5Gb or at most 50 maximum splits. The size estimate used in calculations is 20 million reads for ~5Gb. ...
python
def _set_align_split_size(data): """Set useful align_split_size, generating an estimate if it doesn't exist. We try to split on larger inputs and avoid too many pieces, aiming for size chunks of 5Gb or at most 50 maximum splits. The size estimate used in calculations is 20 million reads for ~5Gb. ...
[ "def", "_set_align_split_size", "(", "data", ")", ":", "if", "cwlutils", ".", "is_cwl_run", "(", "data", ")", ":", "target_size", "=", "20", "# Gb", "target_size_reads", "=", "80", "# million reads", "else", ":", "target_size", "=", "5", "# Gb", "target_size_r...
Set useful align_split_size, generating an estimate if it doesn't exist. We try to split on larger inputs and avoid too many pieces, aiming for size chunks of 5Gb or at most 50 maximum splits. The size estimate used in calculations is 20 million reads for ~5Gb. For UMI calculations we skip splitting ...
[ "Set", "useful", "align_split_size", "generating", "an", "estimate", "if", "it", "doesn", "t", "exist", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L64-L101
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_pick_align_split_size
def _pick_align_split_size(total_size, target_size, target_size_reads, max_splits): """Do the work of picking an alignment split size for the given criteria. """ # Too many pieces, increase our target size to get max_splits pieces if total_size // target_size > max_splits: piece_size = total_siz...
python
def _pick_align_split_size(total_size, target_size, target_size_reads, max_splits): """Do the work of picking an alignment split size for the given criteria. """ # Too many pieces, increase our target size to get max_splits pieces if total_size // target_size > max_splits: piece_size = total_siz...
[ "def", "_pick_align_split_size", "(", "total_size", ",", "target_size", ",", "target_size_reads", ",", "max_splits", ")", ":", "# Too many pieces, increase our target size to get max_splits pieces", "if", "total_size", "//", "target_size", ">", "max_splits", ":", "piece_size"...
Do the work of picking an alignment split size for the given criteria.
[ "Do", "the", "work", "of", "picking", "an", "alignment", "split", "size", "for", "the", "given", "criteria", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L103-L111
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
split_namedpipe_cls
def split_namedpipe_cls(pair1_file, pair2_file, data): """Create a commandline suitable for use as a named pipe with reads in a given region. """ if "align_split" in data: start, end = [int(x) for x in data["align_split"].split("-")] else: start, end = None, None if pair1_file.endswi...
python
def split_namedpipe_cls(pair1_file, pair2_file, data): """Create a commandline suitable for use as a named pipe with reads in a given region. """ if "align_split" in data: start, end = [int(x) for x in data["align_split"].split("-")] else: start, end = None, None if pair1_file.endswi...
[ "def", "split_namedpipe_cls", "(", "pair1_file", ",", "pair2_file", ",", "data", ")", ":", "if", "\"align_split\"", "in", "data", ":", "start", ",", "end", "=", "[", "int", "(", "x", ")", "for", "x", "in", "data", "[", "\"align_split\"", "]", ".", "spl...
Create a commandline suitable for use as a named pipe with reads in a given region.
[ "Create", "a", "commandline", "suitable", "for", "use", "as", "a", "named", "pipe", "with", "reads", "in", "a", "given", "region", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L113-L131
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_seqtk_fastq_prep_cl
def _seqtk_fastq_prep_cl(data, in_file=None, read_num=0): """Provide a commandline for prep of fastq inputs with seqtk. Handles fast conversion of fastq quality scores and trimming. """ needs_convert = dd.get_quality_format(data).lower() == "illumina" trim_ends = dd.get_trim_ends(data) seqtk = ...
python
def _seqtk_fastq_prep_cl(data, in_file=None, read_num=0): """Provide a commandline for prep of fastq inputs with seqtk. Handles fast conversion of fastq quality scores and trimming. """ needs_convert = dd.get_quality_format(data).lower() == "illumina" trim_ends = dd.get_trim_ends(data) seqtk = ...
[ "def", "_seqtk_fastq_prep_cl", "(", "data", ",", "in_file", "=", "None", ",", "read_num", "=", "0", ")", ":", "needs_convert", "=", "dd", ".", "get_quality_format", "(", "data", ")", ".", "lower", "(", ")", "==", "\"illumina\"", "trim_ends", "=", "dd", "...
Provide a commandline for prep of fastq inputs with seqtk. Handles fast conversion of fastq quality scores and trimming.
[ "Provide", "a", "commandline", "for", "prep", "of", "fastq", "inputs", "with", "seqtk", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L133-L154
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
fastq_convert_pipe_cl
def fastq_convert_pipe_cl(in_file, data): """Create an anonymous pipe converting Illumina 1.3-1.7 to Sanger. Uses seqtk: https://github.com/lh3/seqt """ cmd = _seqtk_fastq_prep_cl(data, in_file) if not cmd: cat_cmd = "zcat" if in_file.endswith(".gz") else "cat" cmd = cat_cmd + " " +...
python
def fastq_convert_pipe_cl(in_file, data): """Create an anonymous pipe converting Illumina 1.3-1.7 to Sanger. Uses seqtk: https://github.com/lh3/seqt """ cmd = _seqtk_fastq_prep_cl(data, in_file) if not cmd: cat_cmd = "zcat" if in_file.endswith(".gz") else "cat" cmd = cat_cmd + " " +...
[ "def", "fastq_convert_pipe_cl", "(", "in_file", ",", "data", ")", ":", "cmd", "=", "_seqtk_fastq_prep_cl", "(", "data", ",", "in_file", ")", "if", "not", "cmd", ":", "cat_cmd", "=", "\"zcat\"", "if", "in_file", ".", "endswith", "(", "\".gz\"", ")", "else",...
Create an anonymous pipe converting Illumina 1.3-1.7 to Sanger. Uses seqtk: https://github.com/lh3/seqt
[ "Create", "an", "anonymous", "pipe", "converting", "Illumina", "1", ".", "3", "-", "1", ".", "7", "to", "Sanger", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L156-L165
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
parallel_multiplier
def parallel_multiplier(items): """Determine if we will be parallelizing items during processing. """ multiplier = 1 for data in (x[0] for x in items): if (tz.get_in(["config", "algorithm", "align_split_size"], data) is not False and tz.get_in(["algorithm", "align_split_size"], dat...
python
def parallel_multiplier(items): """Determine if we will be parallelizing items during processing. """ multiplier = 1 for data in (x[0] for x in items): if (tz.get_in(["config", "algorithm", "align_split_size"], data) is not False and tz.get_in(["algorithm", "align_split_size"], dat...
[ "def", "parallel_multiplier", "(", "items", ")", ":", "multiplier", "=", "1", "for", "data", "in", "(", "x", "[", "0", "]", "for", "x", "in", "items", ")", ":", "if", "(", "tz", ".", "get_in", "(", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"a...
Determine if we will be parallelizing items during processing.
[ "Determine", "if", "we", "will", "be", "parallelizing", "items", "during", "processing", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L169-L177
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
setup_combine
def setup_combine(final_file, data): """Setup the data and outputs to allow merging data back together. """ if "align_split" not in data: return final_file, data align_dir = os.path.dirname(final_file) base, ext = os.path.splitext(os.path.basename(final_file)) start, end = [int(x) for x ...
python
def setup_combine(final_file, data): """Setup the data and outputs to allow merging data back together. """ if "align_split" not in data: return final_file, data align_dir = os.path.dirname(final_file) base, ext = os.path.splitext(os.path.basename(final_file)) start, end = [int(x) for x ...
[ "def", "setup_combine", "(", "final_file", ",", "data", ")", ":", "if", "\"align_split\"", "not", "in", "data", ":", "return", "final_file", ",", "data", "align_dir", "=", "os", ".", "path", ".", "dirname", "(", "final_file", ")", "base", ",", "ext", "="...
Setup the data and outputs to allow merging data back together.
[ "Setup", "the", "data", "and", "outputs", "to", "allow", "merging", "data", "back", "together", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L181-L192
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
merge_split_alignments
def merge_split_alignments(samples, run_parallel): """Manage merging split alignments back into a final working BAM file. Perform de-duplication on the final merged file. """ ready = [] file_key = "work_bam" to_merge = collections.defaultdict(list) for data in (xs[0] for xs in samples): ...
python
def merge_split_alignments(samples, run_parallel): """Manage merging split alignments back into a final working BAM file. Perform de-duplication on the final merged file. """ ready = [] file_key = "work_bam" to_merge = collections.defaultdict(list) for data in (xs[0] for xs in samples): ...
[ "def", "merge_split_alignments", "(", "samples", ",", "run_parallel", ")", ":", "ready", "=", "[", "]", "file_key", "=", "\"work_bam\"", "to_merge", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "data", "in", "(", "xs", "[", "0", "]", ...
Manage merging split alignments back into a final working BAM file. Perform de-duplication on the final merged file.
[ "Manage", "merging", "split", "alignments", "back", "into", "a", "final", "working", "BAM", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L194-L252
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_save_fastq_space
def _save_fastq_space(items): """Potentially save fastq space prior to merging, since alignments done. """ to_cleanup = {} for data in (utils.to_single_data(x) for x in items): for fname in data.get("files", []): if os.path.realpath(fname).startswith(dd.get_work_dir(data)): ...
python
def _save_fastq_space(items): """Potentially save fastq space prior to merging, since alignments done. """ to_cleanup = {} for data in (utils.to_single_data(x) for x in items): for fname in data.get("files", []): if os.path.realpath(fname).startswith(dd.get_work_dir(data)): ...
[ "def", "_save_fastq_space", "(", "items", ")", ":", "to_cleanup", "=", "{", "}", "for", "data", "in", "(", "utils", ".", "to_single_data", "(", "x", ")", "for", "x", "in", "items", ")", ":", "for", "fname", "in", "data", ".", "get", "(", "\"files\"",...
Potentially save fastq space prior to merging, since alignments done.
[ "Potentially", "save", "fastq", "space", "prior", "to", "merging", "since", "alignments", "done", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L254-L263
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
total_reads_from_grabix
def total_reads_from_grabix(in_file): """Retrieve total reads in a fastq file from grabix index. """ gbi_file = _get_grabix_index(in_file) if gbi_file: with open(gbi_file) as in_handle: next(in_handle) # throw away num_lines = int(next(in_handle).strip()) assert ...
python
def total_reads_from_grabix(in_file): """Retrieve total reads in a fastq file from grabix index. """ gbi_file = _get_grabix_index(in_file) if gbi_file: with open(gbi_file) as in_handle: next(in_handle) # throw away num_lines = int(next(in_handle).strip()) assert ...
[ "def", "total_reads_from_grabix", "(", "in_file", ")", ":", "gbi_file", "=", "_get_grabix_index", "(", "in_file", ")", "if", "gbi_file", ":", "with", "open", "(", "gbi_file", ")", "as", "in_handle", ":", "next", "(", "in_handle", ")", "# throw away", "num_line...
Retrieve total reads in a fastq file from grabix index.
[ "Retrieve", "total", "reads", "in", "a", "fastq", "file", "from", "grabix", "index", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L281-L292
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_find_read_splits
def _find_read_splits(in_file, split_size): """Determine sections of fastq files to process in splits. Assumes a 4 line order to input files (name, read, name, quality). grabix is 1-based inclusive, so return coordinates in that format. """ num_lines = total_reads_from_grabix(in_file) * 4 asser...
python
def _find_read_splits(in_file, split_size): """Determine sections of fastq files to process in splits. Assumes a 4 line order to input files (name, read, name, quality). grabix is 1-based inclusive, so return coordinates in that format. """ num_lines = total_reads_from_grabix(in_file) * 4 asser...
[ "def", "_find_read_splits", "(", "in_file", ",", "split_size", ")", ":", "num_lines", "=", "total_reads_from_grabix", "(", "in_file", ")", "*", "4", "assert", "num_lines", "and", "num_lines", ">", "0", ",", "\"Did not find grabix index reads: %s %s\"", "%", "(", "...
Determine sections of fastq files to process in splits. Assumes a 4 line order to input files (name, read, name, quality). grabix is 1-based inclusive, so return coordinates in that format.
[ "Determine", "sections", "of", "fastq", "files", "to", "process", "in", "splits", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L294-L309
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_ready_gzip_fastq
def _ready_gzip_fastq(in_files, data, require_bgzip=False): """Check if we have gzipped fastq and don't need format conversion or splitting. Avoid forcing bgzip if we don't need indexed files. """ all_gzipped = all([not x or x.endswith(".gz") for x in in_files]) if require_bgzip and all_gzipped: ...
python
def _ready_gzip_fastq(in_files, data, require_bgzip=False): """Check if we have gzipped fastq and don't need format conversion or splitting. Avoid forcing bgzip if we don't need indexed files. """ all_gzipped = all([not x or x.endswith(".gz") for x in in_files]) if require_bgzip and all_gzipped: ...
[ "def", "_ready_gzip_fastq", "(", "in_files", ",", "data", ",", "require_bgzip", "=", "False", ")", ":", "all_gzipped", "=", "all", "(", "[", "not", "x", "or", "x", ".", "endswith", "(", "\".gz\"", ")", "for", "x", "in", "in_files", "]", ")", "if", "r...
Check if we have gzipped fastq and don't need format conversion or splitting. Avoid forcing bgzip if we don't need indexed files.
[ "Check", "if", "we", "have", "gzipped", "fastq", "and", "don", "t", "need", "format", "conversion", "or", "splitting", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L319-L331
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
prep_fastq_inputs
def prep_fastq_inputs(in_files, data): """Prepare bgzipped fastq inputs """ if len(in_files) == 1 and _is_bam_input(in_files): out = _bgzip_from_bam(in_files[0], data["dirs"], data) elif len(in_files) == 1 and _is_cram_input(in_files): out = _bgzip_from_cram(in_files[0], data["dirs"], da...
python
def prep_fastq_inputs(in_files, data): """Prepare bgzipped fastq inputs """ if len(in_files) == 1 and _is_bam_input(in_files): out = _bgzip_from_bam(in_files[0], data["dirs"], data) elif len(in_files) == 1 and _is_cram_input(in_files): out = _bgzip_from_cram(in_files[0], data["dirs"], da...
[ "def", "prep_fastq_inputs", "(", "in_files", ",", "data", ")", ":", "if", "len", "(", "in_files", ")", "==", "1", "and", "_is_bam_input", "(", "in_files", ")", ":", "out", "=", "_bgzip_from_bam", "(", "in_files", "[", "0", "]", ",", "data", "[", "\"dir...
Prepare bgzipped fastq inputs
[ "Prepare", "bgzipped", "fastq", "inputs" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L333-L359
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_symlink_or_copy_grabix
def _symlink_or_copy_grabix(in_file, out_file, data): """We cannot symlink in CWL, but may be able to use inputs or copy """ if cwlutils.is_cwl_run(data): # Has grabix indexes, we're okay to go if utils.file_exists(in_file + ".gbi"): out_file = in_file else: u...
python
def _symlink_or_copy_grabix(in_file, out_file, data): """We cannot symlink in CWL, but may be able to use inputs or copy """ if cwlutils.is_cwl_run(data): # Has grabix indexes, we're okay to go if utils.file_exists(in_file + ".gbi"): out_file = in_file else: u...
[ "def", "_symlink_or_copy_grabix", "(", "in_file", ",", "out_file", ",", "data", ")", ":", "if", "cwlutils", ".", "is_cwl_run", "(", "data", ")", ":", "# Has grabix indexes, we're okay to go", "if", "utils", ".", "file_exists", "(", "in_file", "+", "\".gbi\"", ")...
We cannot symlink in CWL, but may be able to use inputs or copy
[ "We", "cannot", "symlink", "in", "CWL", "but", "may", "be", "able", "to", "use", "inputs", "or", "copy" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L372-L383
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
_prep_grabix_indexes
def _prep_grabix_indexes(in_files, data): """Parallel preparation of grabix indexes for files. """ # if we have gzipped but not bgzipped, add a fake index for CWL support # Also skips bgzip indexing if we don't need alignment splitting if _ready_gzip_fastq(in_files, data) and (not _ready_gzip_fastq(...
python
def _prep_grabix_indexes(in_files, data): """Parallel preparation of grabix indexes for files. """ # if we have gzipped but not bgzipped, add a fake index for CWL support # Also skips bgzip indexing if we don't need alignment splitting if _ready_gzip_fastq(in_files, data) and (not _ready_gzip_fastq(...
[ "def", "_prep_grabix_indexes", "(", "in_files", ",", "data", ")", ":", "# if we have gzipped but not bgzipped, add a fake index for CWL support", "# Also skips bgzip indexing if we don't need alignment splitting", "if", "_ready_gzip_fastq", "(", "in_files", ",", "data", ")", "and",...
Parallel preparation of grabix indexes for files.
[ "Parallel", "preparation", "of", "grabix", "indexes", "for", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L385-L400
train