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/bam/coverage.py
plot_multiple_regions_coverage
def plot_multiple_regions_coverage(samples, out_file, data, region_bed=None, stem_bed=None): """ given a list of bcbio samples and a bed file or BedTool of regions, makes a plot of the coverage in the regions for the set of samples if given a bed file or BedTool of locations in stem_bed with a label, ...
python
def plot_multiple_regions_coverage(samples, out_file, data, region_bed=None, stem_bed=None): """ given a list of bcbio samples and a bed file or BedTool of regions, makes a plot of the coverage in the regions for the set of samples if given a bed file or BedTool of locations in stem_bed with a label, ...
[ "def", "plot_multiple_regions_coverage", "(", "samples", ",", "out_file", ",", "data", ",", "region_bed", "=", "None", ",", "stem_bed", "=", "None", ")", ":", "mpl", ".", "use", "(", "'Agg'", ",", "force", "=", "True", ")", "PAD", "=", "100", "if", "fi...
given a list of bcbio samples and a bed file or BedTool of regions, makes a plot of the coverage in the regions for the set of samples if given a bed file or BedTool of locations in stem_bed with a label, plots lollipops at those locations
[ "given", "a", "list", "of", "bcbio", "samples", "and", "a", "bed", "file", "or", "BedTool", "of", "regions", "makes", "a", "plot", "of", "the", "coverage", "in", "the", "regions", "for", "the", "set", "of", "samples" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/coverage.py#L110-L148
train
bcbio/bcbio-nextgen
bcbio/variation/mutect.py
_config_params
def _config_params(base_config, assoc_files, region, out_file, items): """Add parameters based on configuration variables, associated files and genomic regions. """ params = [] dbsnp = assoc_files.get("dbsnp") if dbsnp: params += ["--dbsnp", dbsnp] cosmic = assoc_files.get("cosmic") ...
python
def _config_params(base_config, assoc_files, region, out_file, items): """Add parameters based on configuration variables, associated files and genomic regions. """ params = [] dbsnp = assoc_files.get("dbsnp") if dbsnp: params += ["--dbsnp", dbsnp] cosmic = assoc_files.get("cosmic") ...
[ "def", "_config_params", "(", "base_config", ",", "assoc_files", ",", "region", ",", "out_file", ",", "items", ")", ":", "params", "=", "[", "]", "dbsnp", "=", "assoc_files", ".", "get", "(", "\"dbsnp\"", ")", "if", "dbsnp", ":", "params", "+=", "[", "...
Add parameters based on configuration variables, associated files and genomic regions.
[ "Add", "parameters", "based", "on", "configuration", "variables", "associated", "files", "and", "genomic", "regions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L46-L75
train
bcbio/bcbio-nextgen
bcbio/variation/mutect.py
_mutect_call_prep
def _mutect_call_prep(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Preparation work for MuTect. """ base_config = items[0]["config"] broad_runner = broad.runner_from_path("picard", base_config) broad_runner.run_fn("picard_index_ref", ref_file) ...
python
def _mutect_call_prep(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Preparation work for MuTect. """ base_config = items[0]["config"] broad_runner = broad.runner_from_path("picard", base_config) broad_runner.run_fn("picard_index_ref", ref_file) ...
[ "def", "_mutect_call_prep", "(", "align_bams", ",", "items", ",", "ref_file", ",", "assoc_files", ",", "region", "=", "None", ",", "out_file", "=", "None", ")", ":", "base_config", "=", "items", "[", "0", "]", "[", "\"config\"", "]", "broad_runner", "=", ...
Preparation work for MuTect.
[ "Preparation", "work", "for", "MuTect", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L77-L106
train
bcbio/bcbio-nextgen
bcbio/variation/mutect.py
_SID_call_prep
def _SID_call_prep(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Preparation work for SomaticIndelDetector. """ base_config = items[0]["config"] for x in align_bams: bam.index(x, base_config) params = ["-R", ref_file, "-T", "SomaticIndelDetector", "-U", "ALLOW_N_...
python
def _SID_call_prep(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Preparation work for SomaticIndelDetector. """ base_config = items[0]["config"] for x in align_bams: bam.index(x, base_config) params = ["-R", ref_file, "-T", "SomaticIndelDetector", "-U", "ALLOW_N_...
[ "def", "_SID_call_prep", "(", "align_bams", ",", "items", ",", "ref_file", ",", "assoc_files", ",", "region", "=", "None", ",", "out_file", "=", "None", ")", ":", "base_config", "=", "items", "[", "0", "]", "[", "\"config\"", "]", "for", "x", "in", "al...
Preparation work for SomaticIndelDetector.
[ "Preparation", "work", "for", "SomaticIndelDetector", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L191-L217
train
bcbio/bcbio-nextgen
bcbio/variation/mutect.py
_fix_mutect_output
def _fix_mutect_output(orig_file, config, out_file, is_paired): """Adjust MuTect output to match other callers. - Rename allelic fraction field in mutect output from FA to FREQ to standarize with other tools - Remove extra 'none' samples introduced when calling tumor-only samples """ out_file_noc =...
python
def _fix_mutect_output(orig_file, config, out_file, is_paired): """Adjust MuTect output to match other callers. - Rename allelic fraction field in mutect output from FA to FREQ to standarize with other tools - Remove extra 'none' samples introduced when calling tumor-only samples """ out_file_noc =...
[ "def", "_fix_mutect_output", "(", "orig_file", ",", "config", ",", "out_file", ",", "is_paired", ")", ":", "out_file_noc", "=", "out_file", ".", "replace", "(", "\".vcf.gz\"", ",", "\".vcf\"", ")", "none_index", "=", "-", "1", "with", "file_transaction", "(", ...
Adjust MuTect output to match other callers. - Rename allelic fraction field in mutect output from FA to FREQ to standarize with other tools - Remove extra 'none' samples introduced when calling tumor-only samples
[ "Adjust", "MuTect", "output", "to", "match", "other", "callers", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L219-L245
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
prep_gemini_db
def prep_gemini_db(fnames, call_info, samples, extras): """Prepare a gemini database from VCF inputs prepared with snpEff. """ data = samples[0] name, caller, is_batch = call_info build_type = _get_build_type(fnames, samples, caller) out_dir = utils.safe_makedir(os.path.join(data["dirs"]["work"]...
python
def prep_gemini_db(fnames, call_info, samples, extras): """Prepare a gemini database from VCF inputs prepared with snpEff. """ data = samples[0] name, caller, is_batch = call_info build_type = _get_build_type(fnames, samples, caller) out_dir = utils.safe_makedir(os.path.join(data["dirs"]["work"]...
[ "def", "prep_gemini_db", "(", "fnames", ",", "call_info", ",", "samples", ",", "extras", ")", ":", "data", "=", "samples", "[", "0", "]", "name", ",", "caller", ",", "is_batch", "=", "call_info", "build_type", "=", "_get_build_type", "(", "fnames", ",", ...
Prepare a gemini database from VCF inputs prepared with snpEff.
[ "Prepare", "a", "gemini", "database", "from", "VCF", "inputs", "prepared", "with", "snpEff", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L25-L54
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
_back_compatible_gemini
def _back_compatible_gemini(conf_files, data): """Provide old install directory for configuration with GEMINI supplied tidy VCFs. Handles new style (bcbio installed) and old style (GEMINI installed) configuration and data locations. """ if vcfanno.is_human(data, builds=["37"]): for f in con...
python
def _back_compatible_gemini(conf_files, data): """Provide old install directory for configuration with GEMINI supplied tidy VCFs. Handles new style (bcbio installed) and old style (GEMINI installed) configuration and data locations. """ if vcfanno.is_human(data, builds=["37"]): for f in con...
[ "def", "_back_compatible_gemini", "(", "conf_files", ",", "data", ")", ":", "if", "vcfanno", ".", "is_human", "(", "data", ",", "builds", "=", "[", "\"37\"", "]", ")", ":", "for", "f", "in", "conf_files", ":", "if", "f", "and", "os", ".", "path", "."...
Provide old install directory for configuration with GEMINI supplied tidy VCFs. Handles new style (bcbio installed) and old style (GEMINI installed) configuration and data locations.
[ "Provide", "old", "install", "directory", "for", "configuration", "with", "GEMINI", "supplied", "tidy", "VCFs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L56-L71
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
run_vcfanno
def run_vcfanno(vcf_file, data, decomposed=False): """Run vcfanno, providing annotations from external databases if needed. Puts together lua and conf files from multiple inputs by file names. """ conf_files = dd.get_vcfanno(data) if conf_files: with_basepaths = collections.defaultdict(list...
python
def run_vcfanno(vcf_file, data, decomposed=False): """Run vcfanno, providing annotations from external databases if needed. Puts together lua and conf files from multiple inputs by file names. """ conf_files = dd.get_vcfanno(data) if conf_files: with_basepaths = collections.defaultdict(list...
[ "def", "run_vcfanno", "(", "vcf_file", ",", "data", ",", "decomposed", "=", "False", ")", ":", "conf_files", "=", "dd", ".", "get_vcfanno", "(", "data", ")", "if", "conf_files", ":", "with_basepaths", "=", "collections", ".", "defaultdict", "(", "list", ")...
Run vcfanno, providing annotations from external databases if needed. Puts together lua and conf files from multiple inputs by file names.
[ "Run", "vcfanno", "providing", "annotations", "from", "external", "databases", "if", "needed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L73-L123
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
get_ped_info
def get_ped_info(data, samples): """Retrieve all PED info from metadata """ family_id = tz.get_in(["metadata", "family_id"], data, None) if not family_id: family_id = _find_shared_batch(samples) return { "gender": {"male": 1, "female": 2, "unknown": 0}.get(get_gender(data)), ...
python
def get_ped_info(data, samples): """Retrieve all PED info from metadata """ family_id = tz.get_in(["metadata", "family_id"], data, None) if not family_id: family_id = _find_shared_batch(samples) return { "gender": {"male": 1, "female": 2, "unknown": 0}.get(get_gender(data)), ...
[ "def", "get_ped_info", "(", "data", ",", "samples", ")", ":", "family_id", "=", "tz", ".", "get_in", "(", "[", "\"metadata\"", ",", "\"family_id\"", "]", ",", "data", ",", "None", ")", "if", "not", "family_id", ":", "family_id", "=", "_find_shared_batch", ...
Retrieve all PED info from metadata
[ "Retrieve", "all", "PED", "info", "from", "metadata" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L224-L238
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
create_ped_file
def create_ped_file(samples, base_vcf, out_dir=None): """Create a GEMINI-compatible PED file, including gender, family and phenotype information. Checks for a specified `ped` file in metadata, and will use sample information from this file before reconstituting from metadata information. """ out_fi...
python
def create_ped_file(samples, base_vcf, out_dir=None): """Create a GEMINI-compatible PED file, including gender, family and phenotype information. Checks for a specified `ped` file in metadata, and will use sample information from this file before reconstituting from metadata information. """ out_fi...
[ "def", "create_ped_file", "(", "samples", ",", "base_vcf", ",", "out_dir", "=", "None", ")", ":", "out_file", "=", "\"%s.ped\"", "%", "utils", ".", "splitext_plus", "(", "base_vcf", ")", "[", "0", "]", "if", "out_dir", ":", "out_file", "=", "os", ".", ...
Create a GEMINI-compatible PED file, including gender, family and phenotype information. Checks for a specified `ped` file in metadata, and will use sample information from this file before reconstituting from metadata information.
[ "Create", "a", "GEMINI", "-", "compatible", "PED", "file", "including", "gender", "family", "and", "phenotype", "information", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L240-L278
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
_is_small_vcf
def _is_small_vcf(vcf_file): """Check for small VCFs which we want to analyze quicker. """ count = 0 small_thresh = 250 with utils.open_gzipsafe(vcf_file) as in_handle: for line in in_handle: if not line.startswith("#"): count += 1 if count > small_thr...
python
def _is_small_vcf(vcf_file): """Check for small VCFs which we want to analyze quicker. """ count = 0 small_thresh = 250 with utils.open_gzipsafe(vcf_file) as in_handle: for line in in_handle: if not line.startswith("#"): count += 1 if count > small_thr...
[ "def", "_is_small_vcf", "(", "vcf_file", ")", ":", "count", "=", "0", "small_thresh", "=", "250", "with", "utils", ".", "open_gzipsafe", "(", "vcf_file", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "if", "not", "line", ".", "start...
Check for small VCFs which we want to analyze quicker.
[ "Check", "for", "small", "VCFs", "which", "we", "want", "to", "analyze", "quicker", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L286-L297
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
get_multisample_vcf
def get_multisample_vcf(fnames, name, caller, data): """Retrieve a multiple sample VCF file in a standard location. Handles inputs with multiple repeated input files from batches. """ unique_fnames = [] for f in fnames: if f not in unique_fnames: unique_fnames.append(f) out_...
python
def get_multisample_vcf(fnames, name, caller, data): """Retrieve a multiple sample VCF file in a standard location. Handles inputs with multiple repeated input files from batches. """ unique_fnames = [] for f in fnames: if f not in unique_fnames: unique_fnames.append(f) out_...
[ "def", "get_multisample_vcf", "(", "fnames", ",", "name", ",", "caller", ",", "data", ")", ":", "unique_fnames", "=", "[", "]", "for", "f", "in", "fnames", ":", "if", "f", "not", "in", "unique_fnames", ":", "unique_fnames", ".", "append", "(", "f", ")"...
Retrieve a multiple sample VCF file in a standard location. Handles inputs with multiple repeated input files from batches.
[ "Retrieve", "a", "multiple", "sample", "VCF", "file", "in", "a", "standard", "location", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L299-L324
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
get_gemini_files
def get_gemini_files(data): """Enumerate available gemini data files in a standard installation. """ try: from gemini import annotations, config except ImportError: return {} return {"base": config.read_gemini_config()["annotation_dir"], "files": annotations.get_anno_file...
python
def get_gemini_files(data): """Enumerate available gemini data files in a standard installation. """ try: from gemini import annotations, config except ImportError: return {} return {"base": config.read_gemini_config()["annotation_dir"], "files": annotations.get_anno_file...
[ "def", "get_gemini_files", "(", "data", ")", ":", "try", ":", "from", "gemini", "import", "annotations", ",", "config", "except", "ImportError", ":", "return", "{", "}", "return", "{", "\"base\"", ":", "config", ".", "read_gemini_config", "(", ")", "[", "\...
Enumerate available gemini data files in a standard installation.
[ "Enumerate", "available", "gemini", "data", "files", "in", "a", "standard", "installation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L348-L356
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
_group_by_batches
def _group_by_batches(samples, check_fn): """Group data items into batches, providing details to retrieve results. """ batch_groups = collections.defaultdict(list) singles = [] out_retrieve = [] extras = [] for data in [x[0] for x in samples]: if check_fn(data): batch = t...
python
def _group_by_batches(samples, check_fn): """Group data items into batches, providing details to retrieve results. """ batch_groups = collections.defaultdict(list) singles = [] out_retrieve = [] extras = [] for data in [x[0] for x in samples]: if check_fn(data): batch = t...
[ "def", "_group_by_batches", "(", "samples", ",", "check_fn", ")", ":", "batch_groups", "=", "collections", ".", "defaultdict", "(", "list", ")", "singles", "=", "[", "]", "out_retrieve", "=", "[", "]", "extras", "=", "[", "]", "for", "data", "in", "[", ...
Group data items into batches, providing details to retrieve results.
[ "Group", "data", "items", "into", "batches", "providing", "details", "to", "retrieve", "results", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L358-L381
train
bcbio/bcbio-nextgen
bcbio/variation/population.py
prep_db_parallel
def prep_db_parallel(samples, parallel_fn): """Prepares gemini databases in parallel, handling jointly called populations. """ batch_groups, singles, out_retrieve, extras = _group_by_batches(samples, _has_variant_calls) to_process = [] has_batches = False for (name, caller), info in batch_groups...
python
def prep_db_parallel(samples, parallel_fn): """Prepares gemini databases in parallel, handling jointly called populations. """ batch_groups, singles, out_retrieve, extras = _group_by_batches(samples, _has_variant_calls) to_process = [] has_batches = False for (name, caller), info in batch_groups...
[ "def", "prep_db_parallel", "(", "samples", ",", "parallel_fn", ")", ":", "batch_groups", ",", "singles", ",", "out_retrieve", ",", "extras", "=", "_group_by_batches", "(", "samples", ",", "_has_variant_calls", ")", "to_process", "=", "[", "]", "has_batches", "="...
Prepares gemini databases in parallel, handling jointly called populations.
[ "Prepares", "gemini", "databases", "in", "parallel", "handling", "jointly", "called", "populations", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/population.py#L389-L417
train
bcbio/bcbio-nextgen
bcbio/workflow/stormseq.py
_get_s3_files
def _get_s3_files(local_dir, file_info, params): """Retrieve s3 files to local directory, handling STORMSeq inputs. """ assert len(file_info) == 1 files = file_info.values()[0] fnames = [] for k in ["1", "2"]: if files[k] not in fnames: fnames.append(files[k]) out = [] ...
python
def _get_s3_files(local_dir, file_info, params): """Retrieve s3 files to local directory, handling STORMSeq inputs. """ assert len(file_info) == 1 files = file_info.values()[0] fnames = [] for k in ["1", "2"]: if files[k] not in fnames: fnames.append(files[k]) out = [] ...
[ "def", "_get_s3_files", "(", "local_dir", ",", "file_info", ",", "params", ")", ":", "assert", "len", "(", "file_info", ")", "==", "1", "files", "=", "file_info", ".", "values", "(", ")", "[", "0", "]", "fnames", "=", "[", "]", "for", "k", "in", "[...
Retrieve s3 files to local directory, handling STORMSeq inputs.
[ "Retrieve", "s3", "files", "to", "local", "directory", "handling", "STORMSeq", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/stormseq.py#L22-L38
train
bcbio/bcbio-nextgen
bcbio/pipeline/fastq.py
_gzip_fastq
def _gzip_fastq(in_file, out_dir=None): """ gzip a fastq file if it is not already gzipped, handling conversion from bzip to gzipped files """ if fastq.is_fastq(in_file) and not objectstore.is_remote(in_file): if utils.is_bzipped(in_file): return _bzip_gzip(in_file, out_dir) ...
python
def _gzip_fastq(in_file, out_dir=None): """ gzip a fastq file if it is not already gzipped, handling conversion from bzip to gzipped files """ if fastq.is_fastq(in_file) and not objectstore.is_remote(in_file): if utils.is_bzipped(in_file): return _bzip_gzip(in_file, out_dir) ...
[ "def", "_gzip_fastq", "(", "in_file", ",", "out_dir", "=", "None", ")", ":", "if", "fastq", ".", "is_fastq", "(", "in_file", ")", "and", "not", "objectstore", ".", "is_remote", "(", "in_file", ")", ":", "if", "utils", ".", "is_bzipped", "(", "in_file", ...
gzip a fastq file if it is not already gzipped, handling conversion from bzip to gzipped files
[ "gzip", "a", "fastq", "file", "if", "it", "is", "not", "already", "gzipped", "handling", "conversion", "from", "bzip", "to", "gzipped", "files" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L51-L72
train
bcbio/bcbio-nextgen
bcbio/pipeline/fastq.py
_pipeline_needs_fastq
def _pipeline_needs_fastq(config, data): """Determine if the pipeline can proceed with a BAM file, or needs fastq conversion. """ aligner = config["algorithm"].get("aligner") support_bam = aligner in alignment.metadata.get("support_bam", []) return aligner and not support_bam
python
def _pipeline_needs_fastq(config, data): """Determine if the pipeline can proceed with a BAM file, or needs fastq conversion. """ aligner = config["algorithm"].get("aligner") support_bam = aligner in alignment.metadata.get("support_bam", []) return aligner and not support_bam
[ "def", "_pipeline_needs_fastq", "(", "config", ",", "data", ")", ":", "aligner", "=", "config", "[", "\"algorithm\"", "]", ".", "get", "(", "\"aligner\"", ")", "support_bam", "=", "aligner", "in", "alignment", ".", "metadata", ".", "get", "(", "\"support_bam...
Determine if the pipeline can proceed with a BAM file, or needs fastq conversion.
[ "Determine", "if", "the", "pipeline", "can", "proceed", "with", "a", "BAM", "file", "or", "needs", "fastq", "conversion", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L95-L100
train
bcbio/bcbio-nextgen
bcbio/pipeline/fastq.py
convert_bam_to_fastq
def convert_bam_to_fastq(in_file, work_dir, data, dirs, config): """Convert BAM input file into FASTQ files. """ return alignprep.prep_fastq_inputs([in_file], data)
python
def convert_bam_to_fastq(in_file, work_dir, data, dirs, config): """Convert BAM input file into FASTQ files. """ return alignprep.prep_fastq_inputs([in_file], data)
[ "def", "convert_bam_to_fastq", "(", "in_file", ",", "work_dir", ",", "data", ",", "dirs", ",", "config", ")", ":", "return", "alignprep", ".", "prep_fastq_inputs", "(", "[", "in_file", "]", ",", "data", ")" ]
Convert BAM input file into FASTQ files.
[ "Convert", "BAM", "input", "file", "into", "FASTQ", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L103-L106
train
bcbio/bcbio-nextgen
bcbio/pipeline/fastq.py
merge
def merge(files, out_file, config): """merge smartly fastq files. It recognizes paired fastq files.""" pair1 = [fastq_file[0] for fastq_file in files] if len(files[0]) > 1: path = splitext_plus(out_file) pair1_out_file = path[0] + "_R1" + path[1] pair2 = [fastq_file[1] for fastq_file...
python
def merge(files, out_file, config): """merge smartly fastq files. It recognizes paired fastq files.""" pair1 = [fastq_file[0] for fastq_file in files] if len(files[0]) > 1: path = splitext_plus(out_file) pair1_out_file = path[0] + "_R1" + path[1] pair2 = [fastq_file[1] for fastq_file...
[ "def", "merge", "(", "files", ",", "out_file", ",", "config", ")", ":", "pair1", "=", "[", "fastq_file", "[", "0", "]", "for", "fastq_file", "in", "files", "]", "if", "len", "(", "files", "[", "0", "]", ")", ">", "1", ":", "path", "=", "splitext_...
merge smartly fastq files. It recognizes paired fastq files.
[ "merge", "smartly", "fastq", "files", ".", "It", "recognizes", "paired", "fastq", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L108-L120
train
bcbio/bcbio-nextgen
bcbio/pipeline/fastq.py
_merge_list_fastqs
def _merge_list_fastqs(files, out_file, config): """merge list of fastq files into one""" if not all(map(fastq.is_fastq, files)): raise ValueError("Not all of the files to merge are fastq files: %s " % (files)) assert all(map(utils.file_exists, files)), ("Not all of the files to merge " ...
python
def _merge_list_fastqs(files, out_file, config): """merge list of fastq files into one""" if not all(map(fastq.is_fastq, files)): raise ValueError("Not all of the files to merge are fastq files: %s " % (files)) assert all(map(utils.file_exists, files)), ("Not all of the files to merge " ...
[ "def", "_merge_list_fastqs", "(", "files", ",", "out_file", ",", "config", ")", ":", "if", "not", "all", "(", "map", "(", "fastq", ".", "is_fastq", ",", "files", ")", ")", ":", "raise", "ValueError", "(", "\"Not all of the files to merge are fastq files: %s \"",...
merge list of fastq files into one
[ "merge", "list", "of", "fastq", "files", "into", "one" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/fastq.py#L122-L140
train
bcbio/bcbio-nextgen
bcbio/bed/__init__.py
decomment
def decomment(bed_file, out_file): """ clean a BED file """ if file_exists(out_file): return out_file with utils.open_gzipsafe(bed_file) as in_handle, open(out_file, "w") as out_handle: for line in in_handle: if line.startswith("#") or line.startswith("browser") or line....
python
def decomment(bed_file, out_file): """ clean a BED file """ if file_exists(out_file): return out_file with utils.open_gzipsafe(bed_file) as in_handle, open(out_file, "w") as out_handle: for line in in_handle: if line.startswith("#") or line.startswith("browser") or line....
[ "def", "decomment", "(", "bed_file", ",", "out_file", ")", ":", "if", "file_exists", "(", "out_file", ")", ":", "return", "out_file", "with", "utils", ".", "open_gzipsafe", "(", "bed_file", ")", "as", "in_handle", ",", "open", "(", "out_file", ",", "\"w\""...
clean a BED file
[ "clean", "a", "BED", "file" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bed/__init__.py#L5-L18
train
bcbio/bcbio-nextgen
bcbio/bed/__init__.py
concat
def concat(bed_files, catted=None): """ recursively concat a set of BED files, returning a sorted bedtools object of the result """ bed_files = [x for x in bed_files if x] if len(bed_files) == 0: if catted: # move to a .bed extension for downstream tools if not already ...
python
def concat(bed_files, catted=None): """ recursively concat a set of BED files, returning a sorted bedtools object of the result """ bed_files = [x for x in bed_files if x] if len(bed_files) == 0: if catted: # move to a .bed extension for downstream tools if not already ...
[ "def", "concat", "(", "bed_files", ",", "catted", "=", "None", ")", ":", "bed_files", "=", "[", "x", "for", "x", "in", "bed_files", "if", "x", "]", "if", "len", "(", "bed_files", ")", "==", "0", ":", "if", "catted", ":", "# move to a .bed extension for...
recursively concat a set of BED files, returning a sorted bedtools object of the result
[ "recursively", "concat", "a", "set", "of", "BED", "files", "returning", "a", "sorted", "bedtools", "object", "of", "the", "result" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bed/__init__.py#L20-L44
train
bcbio/bcbio-nextgen
bcbio/bed/__init__.py
merge
def merge(bedfiles): """ given a BED file or list of BED files merge them an return a bedtools object """ if isinstance(bedfiles, list): catted = concat(bedfiles) else: catted = concat([bedfiles]) if catted: return concat(bedfiles).sort().merge() else: return ...
python
def merge(bedfiles): """ given a BED file or list of BED files merge them an return a bedtools object """ if isinstance(bedfiles, list): catted = concat(bedfiles) else: catted = concat([bedfiles]) if catted: return concat(bedfiles).sort().merge() else: return ...
[ "def", "merge", "(", "bedfiles", ")", ":", "if", "isinstance", "(", "bedfiles", ",", "list", ")", ":", "catted", "=", "concat", "(", "bedfiles", ")", "else", ":", "catted", "=", "concat", "(", "[", "bedfiles", "]", ")", "if", "catted", ":", "return",...
given a BED file or list of BED files merge them an return a bedtools object
[ "given", "a", "BED", "file", "or", "list", "of", "BED", "files", "merge", "them", "an", "return", "a", "bedtools", "object" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bed/__init__.py#L46-L57
train
bcbio/bcbio-nextgen
bcbio/structural/hydra.py
select_unaligned_read_pairs
def select_unaligned_read_pairs(in_bam, extra, out_dir, config): """Retrieve unaligned read pairs from input alignment BAM, as two fastq files. """ runner = broad.runner_from_config(config) base, ext = os.path.splitext(os.path.basename(in_bam)) nomap_bam = os.path.join(out_dir, "{}-{}{}".format(base...
python
def select_unaligned_read_pairs(in_bam, extra, out_dir, config): """Retrieve unaligned read pairs from input alignment BAM, as two fastq files. """ runner = broad.runner_from_config(config) base, ext = os.path.splitext(os.path.basename(in_bam)) nomap_bam = os.path.join(out_dir, "{}-{}{}".format(base...
[ "def", "select_unaligned_read_pairs", "(", "in_bam", ",", "extra", ",", "out_dir", ",", "config", ")", ":", "runner", "=", "broad", ".", "runner_from_config", "(", "config", ")", "base", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "os", "."...
Retrieve unaligned read pairs from input alignment BAM, as two fastq files.
[ "Retrieve", "unaligned", "read", "pairs", "from", "input", "alignment", "BAM", "as", "two", "fastq", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L22-L46
train
bcbio/bcbio-nextgen
bcbio/structural/hydra.py
remove_nopairs
def remove_nopairs(in_bam, out_dir, config): """Remove any reads without both pairs present in the file. """ runner = broad.runner_from_config(config) out_bam = os.path.join(out_dir, "{}-safepair{}".format(*os.path.splitext(os.path.basename(in_bam)))) if not utils.file_exists(out_bam): read_...
python
def remove_nopairs(in_bam, out_dir, config): """Remove any reads without both pairs present in the file. """ runner = broad.runner_from_config(config) out_bam = os.path.join(out_dir, "{}-safepair{}".format(*os.path.splitext(os.path.basename(in_bam)))) if not utils.file_exists(out_bam): read_...
[ "def", "remove_nopairs", "(", "in_bam", ",", "out_dir", ",", "config", ")", ":", "runner", "=", "broad", ".", "runner_from_config", "(", "config", ")", "out_bam", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"{}-safepair{}\"", ".", "format",...
Remove any reads without both pairs present in the file.
[ "Remove", "any", "reads", "without", "both", "pairs", "present", "in", "the", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L48-L65
train
bcbio/bcbio-nextgen
bcbio/structural/hydra.py
tiered_alignment
def tiered_alignment(in_bam, tier_num, multi_mappers, extra_args, genome_build, pair_stats, work_dir, dirs, config): """Perform the alignment of non-mapped reads from previous tier. """ nomap_fq1, nomap_fq2 = select_unaligned_read_pairs(in_bam, "tier{}".format(tier_...
python
def tiered_alignment(in_bam, tier_num, multi_mappers, extra_args, genome_build, pair_stats, work_dir, dirs, config): """Perform the alignment of non-mapped reads from previous tier. """ nomap_fq1, nomap_fq2 = select_unaligned_read_pairs(in_bam, "tier{}".format(tier_...
[ "def", "tiered_alignment", "(", "in_bam", ",", "tier_num", ",", "multi_mappers", ",", "extra_args", ",", "genome_build", ",", "pair_stats", ",", "work_dir", ",", "dirs", ",", "config", ")", ":", "nomap_fq1", ",", "nomap_fq2", "=", "select_unaligned_read_pairs", ...
Perform the alignment of non-mapped reads from previous tier.
[ "Perform", "the", "alignment", "of", "non", "-", "mapped", "reads", "from", "previous", "tier", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L68-L91
train
bcbio/bcbio-nextgen
bcbio/structural/hydra.py
convert_bam_to_bed
def convert_bam_to_bed(in_bam, out_file): """Convert BAM to bed file using BEDTools. """ with file_transaction(out_file) as tx_out_file: with open(tx_out_file, "w") as out_handle: subprocess.check_call(["bamToBed", "-i", in_bam, "-tag", "NM"], stdout=out...
python
def convert_bam_to_bed(in_bam, out_file): """Convert BAM to bed file using BEDTools. """ with file_transaction(out_file) as tx_out_file: with open(tx_out_file, "w") as out_handle: subprocess.check_call(["bamToBed", "-i", in_bam, "-tag", "NM"], stdout=out...
[ "def", "convert_bam_to_bed", "(", "in_bam", ",", "out_file", ")", ":", "with", "file_transaction", "(", "out_file", ")", "as", "tx_out_file", ":", "with", "open", "(", "tx_out_file", ",", "\"w\"", ")", "as", "out_handle", ":", "subprocess", ".", "check_call", ...
Convert BAM to bed file using BEDTools.
[ "Convert", "BAM", "to", "bed", "file", "using", "BEDTools", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L96-L103
train
bcbio/bcbio-nextgen
bcbio/structural/hydra.py
hydra_breakpoints
def hydra_breakpoints(in_bam, pair_stats): """Detect structural variation breakpoints with hydra. """ in_bed = convert_bam_to_bed(in_bam) if os.path.getsize(in_bed) > 0: pair_bed = pair_discordants(in_bed, pair_stats) dedup_bed = dedup_discordants(pair_bed) return run_hydra(dedup...
python
def hydra_breakpoints(in_bam, pair_stats): """Detect structural variation breakpoints with hydra. """ in_bed = convert_bam_to_bed(in_bam) if os.path.getsize(in_bed) > 0: pair_bed = pair_discordants(in_bed, pair_stats) dedup_bed = dedup_discordants(pair_bed) return run_hydra(dedup...
[ "def", "hydra_breakpoints", "(", "in_bam", ",", "pair_stats", ")", ":", "in_bed", "=", "convert_bam_to_bed", "(", "in_bam", ")", "if", "os", ".", "path", ".", "getsize", "(", "in_bed", ")", ">", "0", ":", "pair_bed", "=", "pair_discordants", "(", "in_bed",...
Detect structural variation breakpoints with hydra.
[ "Detect", "structural", "variation", "breakpoints", "with", "hydra", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L135-L144
train
bcbio/bcbio-nextgen
bcbio/structural/hydra.py
detect_sv
def detect_sv(align_bam, genome_build, dirs, config): """Detect structural variation from discordant aligned pairs. """ work_dir = utils.safe_makedir(os.path.join(dirs["work"], "structural")) pair_stats = shared.calc_paired_insert_stats(align_bam) fix_bam = remove_nopairs(align_bam, work_dir, config...
python
def detect_sv(align_bam, genome_build, dirs, config): """Detect structural variation from discordant aligned pairs. """ work_dir = utils.safe_makedir(os.path.join(dirs["work"], "structural")) pair_stats = shared.calc_paired_insert_stats(align_bam) fix_bam = remove_nopairs(align_bam, work_dir, config...
[ "def", "detect_sv", "(", "align_bam", ",", "genome_build", ",", "dirs", ",", "config", ")", ":", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "dirs", "[", "\"work\"", "]", ",", "\"structural\"", ")", ")", "pa...
Detect structural variation from discordant aligned pairs.
[ "Detect", "structural", "variation", "from", "discordant", "aligned", "pairs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/hydra.py#L148-L162
train
bcbio/bcbio-nextgen
bcbio/log/logbook_zmqpush.py
inject
def inject(**params): """ A Logbook processor to inject arbitrary information into log records. Simply pass in keyword arguments and use as a context manager: >>> with inject(identifier=str(uuid.uuid4())).applicationbound(): ... logger.debug('Something happened') """ def call...
python
def inject(**params): """ A Logbook processor to inject arbitrary information into log records. Simply pass in keyword arguments and use as a context manager: >>> with inject(identifier=str(uuid.uuid4())).applicationbound(): ... logger.debug('Something happened') """ def call...
[ "def", "inject", "(", "*", "*", "params", ")", ":", "def", "callback", "(", "log_record", ")", ":", "log_record", ".", "extra", ".", "update", "(", "params", ")", "return", "logbook", ".", "Processor", "(", "callback", ")" ]
A Logbook processor to inject arbitrary information into log records. Simply pass in keyword arguments and use as a context manager: >>> with inject(identifier=str(uuid.uuid4())).applicationbound(): ... logger.debug('Something happened')
[ "A", "Logbook", "processor", "to", "inject", "arbitrary", "information", "into", "log", "records", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/log/logbook_zmqpush.py#L121-L134
train
bcbio/bcbio-nextgen
bcbio/log/logbook_zmqpush.py
ZeroMQPullSubscriber.recv
def recv(self, timeout=None): """Overwrite standard recv for timeout calls to catch interrupt errors. """ if timeout: try: testsock = self._zmq.select([self.socket], [], [], timeout)[0] except zmq.ZMQError as e: if e.errno == errno.EINTR: ...
python
def recv(self, timeout=None): """Overwrite standard recv for timeout calls to catch interrupt errors. """ if timeout: try: testsock = self._zmq.select([self.socket], [], [], timeout)[0] except zmq.ZMQError as e: if e.errno == errno.EINTR: ...
[ "def", "recv", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", ":", "try", ":", "testsock", "=", "self", ".", "_zmq", ".", "select", "(", "[", "self", ".", "socket", "]", ",", "[", "]", ",", "[", "]", ",", "timeout", ")", ...
Overwrite standard recv for timeout calls to catch interrupt errors.
[ "Overwrite", "standard", "recv", "for", "timeout", "calls", "to", "catch", "interrupt", "errors", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/log/logbook_zmqpush.py#L98-L114
train
bcbio/bcbio-nextgen
bcbio/variation/pisces.py
run
def run(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Run tumor only pisces calling Handles bgzipping output file and fixing VCF sample naming to match BAM sample. """ paired = vcfutils.get_paired_bams(align_bams, items) assert paired and not paired.normal_bam, ("Pisces ...
python
def run(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Run tumor only pisces calling Handles bgzipping output file and fixing VCF sample naming to match BAM sample. """ paired = vcfutils.get_paired_bams(align_bams, items) assert paired and not paired.normal_bam, ("Pisces ...
[ "def", "run", "(", "align_bams", ",", "items", ",", "ref_file", ",", "assoc_files", ",", "region", "=", "None", ",", "out_file", "=", "None", ")", ":", "paired", "=", "vcfutils", ".", "get_paired_bams", "(", "align_bams", ",", "items", ")", "assert", "pa...
Run tumor only pisces calling Handles bgzipping output file and fixing VCF sample naming to match BAM sample.
[ "Run", "tumor", "only", "pisces", "calling" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/pisces.py#L17-L54
train
bcbio/bcbio-nextgen
bcbio/variation/pisces.py
_prep_genome
def _prep_genome(out_dir, data): """Create prepped reference directory for pisces. Requires a custom GenomeSize.xml file present. """ genome_name = utils.splitext_plus(os.path.basename(dd.get_ref_file(data)))[0] out_dir = utils.safe_makedir(os.path.join(out_dir, genome_name)) ref_file = dd.get_...
python
def _prep_genome(out_dir, data): """Create prepped reference directory for pisces. Requires a custom GenomeSize.xml file present. """ genome_name = utils.splitext_plus(os.path.basename(dd.get_ref_file(data)))[0] out_dir = utils.safe_makedir(os.path.join(out_dir, genome_name)) ref_file = dd.get_...
[ "def", "_prep_genome", "(", "out_dir", ",", "data", ")", ":", "genome_name", "=", "utils", ".", "splitext_plus", "(", "os", ".", "path", ".", "basename", "(", "dd", ".", "get_ref_file", "(", "data", ")", ")", ")", "[", "0", "]", "out_dir", "=", "util...
Create prepped reference directory for pisces. Requires a custom GenomeSize.xml file present.
[ "Create", "prepped", "reference", "directory", "for", "pisces", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/pisces.py#L56-L73
train
bcbio/bcbio-nextgen
bcbio/variation/deepvariant.py
run
def run(align_bams, items, ref_file, assoc_files, region, out_file): """Return DeepVariant calling on germline samples. region can be a single region or list of multiple regions for multicore calling. """ assert not vcfutils.is_paired_analysis(align_bams, items), \ ("DeepVariant currently only ...
python
def run(align_bams, items, ref_file, assoc_files, region, out_file): """Return DeepVariant calling on germline samples. region can be a single region or list of multiple regions for multicore calling. """ assert not vcfutils.is_paired_analysis(align_bams, items), \ ("DeepVariant currently only ...
[ "def", "run", "(", "align_bams", ",", "items", ",", "ref_file", ",", "assoc_files", ",", "region", ",", "out_file", ")", ":", "assert", "not", "vcfutils", ".", "is_paired_analysis", "(", "align_bams", ",", "items", ")", ",", "(", "\"DeepVariant currently only ...
Return DeepVariant calling on germline samples. region can be a single region or list of multiple regions for multicore calling.
[ "Return", "DeepVariant", "calling", "on", "germline", "samples", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L12-L25
train
bcbio/bcbio-nextgen
bcbio/variation/deepvariant.py
_run_germline
def _run_germline(bam_file, data, ref_file, region, out_file): """Single sample germline variant calling. """ work_dir = utils.safe_makedir("%s-work" % utils.splitext_plus(out_file)[0]) region_bed = strelka2.get_region_bed(region, [data], out_file, want_gzip=False) example_dir = _make_examples(bam_f...
python
def _run_germline(bam_file, data, ref_file, region, out_file): """Single sample germline variant calling. """ work_dir = utils.safe_makedir("%s-work" % utils.splitext_plus(out_file)[0]) region_bed = strelka2.get_region_bed(region, [data], out_file, want_gzip=False) example_dir = _make_examples(bam_f...
[ "def", "_run_germline", "(", "bam_file", ",", "data", ",", "ref_file", ",", "region", ",", "out_file", ")", ":", "work_dir", "=", "utils", ".", "safe_makedir", "(", "\"%s-work\"", "%", "utils", ".", "splitext_plus", "(", "out_file", ")", "[", "0", "]", "...
Single sample germline variant calling.
[ "Single", "sample", "germline", "variant", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L27-L37
train
bcbio/bcbio-nextgen
bcbio/variation/deepvariant.py
_make_examples
def _make_examples(bam_file, data, ref_file, region_bed, out_file, work_dir): """Create example pileup images to feed into variant calling. """ log_dir = utils.safe_makedir(os.path.join(work_dir, "log")) example_dir = utils.safe_makedir(os.path.join(work_dir, "examples")) if len(glob.glob(os.path.jo...
python
def _make_examples(bam_file, data, ref_file, region_bed, out_file, work_dir): """Create example pileup images to feed into variant calling. """ log_dir = utils.safe_makedir(os.path.join(work_dir, "log")) example_dir = utils.safe_makedir(os.path.join(work_dir, "examples")) if len(glob.glob(os.path.jo...
[ "def", "_make_examples", "(", "bam_file", ",", "data", ",", "ref_file", ",", "region_bed", ",", "out_file", ",", "work_dir", ")", ":", "log_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"log\"", ")"...
Create example pileup images to feed into variant calling.
[ "Create", "example", "pileup", "images", "to", "feed", "into", "variant", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L42-L55
train
bcbio/bcbio-nextgen
bcbio/variation/deepvariant.py
_call_variants
def _call_variants(example_dir, region_bed, data, out_file): """Call variants from prepared pileup examples, creating tensorflow record file. """ tf_out_file = "%s-tfrecord.gz" % utils.splitext_plus(out_file)[0] if not utils.file_exists(tf_out_file): with file_transaction(data, tf_out_file) as t...
python
def _call_variants(example_dir, region_bed, data, out_file): """Call variants from prepared pileup examples, creating tensorflow record file. """ tf_out_file = "%s-tfrecord.gz" % utils.splitext_plus(out_file)[0] if not utils.file_exists(tf_out_file): with file_transaction(data, tf_out_file) as t...
[ "def", "_call_variants", "(", "example_dir", ",", "region_bed", ",", "data", ",", "out_file", ")", ":", "tf_out_file", "=", "\"%s-tfrecord.gz\"", "%", "utils", ".", "splitext_plus", "(", "out_file", ")", "[", "0", "]", "if", "not", "utils", ".", "file_exists...
Call variants from prepared pileup examples, creating tensorflow record file.
[ "Call", "variants", "from", "prepared", "pileup", "examples", "creating", "tensorflow", "record", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L57-L68
train
bcbio/bcbio-nextgen
bcbio/variation/deepvariant.py
_postprocess_variants
def _postprocess_variants(record_file, data, ref_file, out_file): """Post-process variants, converting into standard VCF file. """ if not utils.file_uptodate(out_file, record_file): with file_transaction(data, out_file) as tx_out_file: cmd = ["dv_postprocess_variants.py", "--ref", ref_fi...
python
def _postprocess_variants(record_file, data, ref_file, out_file): """Post-process variants, converting into standard VCF file. """ if not utils.file_uptodate(out_file, record_file): with file_transaction(data, out_file) as tx_out_file: cmd = ["dv_postprocess_variants.py", "--ref", ref_fi...
[ "def", "_postprocess_variants", "(", "record_file", ",", "data", ",", "ref_file", ",", "out_file", ")", ":", "if", "not", "utils", ".", "file_uptodate", "(", "out_file", ",", "record_file", ")", ":", "with", "file_transaction", "(", "data", ",", "out_file", ...
Post-process variants, converting into standard VCF file.
[ "Post", "-", "process", "variants", "converting", "into", "standard", "VCF", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/deepvariant.py#L70-L78
train
bcbio/bcbio-nextgen
bcbio/qc/qsignature.py
run
def run(bam_file, data, out_dir): """ Run SignatureGenerator to create normalize vcf that later will be input of qsignature_summary :param bam_file: (str) path of the bam_file :param data: (list) list containing the all the dictionary for this sample :param out_dir: (str) path of t...
python
def run(bam_file, data, out_dir): """ Run SignatureGenerator to create normalize vcf that later will be input of qsignature_summary :param bam_file: (str) path of the bam_file :param data: (list) list containing the all the dictionary for this sample :param out_dir: (str) path of t...
[ "def", "run", "(", "bam_file", ",", "data", ",", "out_dir", ")", ":", "qsig", "=", "config_utils", ".", "get_program", "(", "\"qsignature\"", ",", "data", "[", "\"config\"", "]", ")", "res_qsig", "=", "config_utils", ".", "get_resources", "(", "\"qsignature\...
Run SignatureGenerator to create normalize vcf that later will be input of qsignature_summary :param bam_file: (str) path of the bam_file :param data: (list) list containing the all the dictionary for this sample :param out_dir: (str) path of the output :returns: (string) output n...
[ "Run", "SignatureGenerator", "to", "create", "normalize", "vcf", "that", "later", "will", "be", "input", "of", "qsignature_summary" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L20-L69
train
bcbio/bcbio-nextgen
bcbio/qc/qsignature.py
summary
def summary(*samples): """Run SignatureCompareRelatedSimple module from qsignature tool. Creates a matrix of pairwise comparison among samples. The function will not run if the output exists :param samples: list with only one element containing all samples information :returns: (dict) with the pat...
python
def summary(*samples): """Run SignatureCompareRelatedSimple module from qsignature tool. Creates a matrix of pairwise comparison among samples. The function will not run if the output exists :param samples: list with only one element containing all samples information :returns: (dict) with the pat...
[ "def", "summary", "(", "*", "samples", ")", ":", "warnings", ",", "similar", "=", "[", "]", ",", "[", "]", "qsig", "=", "config_utils", ".", "get_program", "(", "\"qsignature\"", ",", "samples", "[", "0", "]", "[", "0", "]", "[", "\"config\"", "]", ...
Run SignatureCompareRelatedSimple module from qsignature tool. Creates a matrix of pairwise comparison among samples. The function will not run if the output exists :param samples: list with only one element containing all samples information :returns: (dict) with the path of the output to be joined t...
[ "Run", "SignatureCompareRelatedSimple", "module", "from", "qsignature", "tool", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L71-L118
train
bcbio/bcbio-nextgen
bcbio/qc/qsignature.py
_parse_qsignature_output
def _parse_qsignature_output(in_file, out_file, warning_file, data): """ Parse xml file produced by qsignature :param in_file: (str) with the path to the xml file :param out_file: (str) with the path to output file :param warning_file: (str) with the path to warning file :returns: (list) with samp...
python
def _parse_qsignature_output(in_file, out_file, warning_file, data): """ Parse xml file produced by qsignature :param in_file: (str) with the path to the xml file :param out_file: (str) with the path to output file :param warning_file: (str) with the path to warning file :returns: (list) with samp...
[ "def", "_parse_qsignature_output", "(", "in_file", ",", "out_file", ",", "warning_file", ",", "data", ")", ":", "name", "=", "{", "}", "error", ",", "warnings", ",", "similar", "=", "set", "(", ")", ",", "set", "(", ")", ",", "set", "(", ")", "same",...
Parse xml file produced by qsignature :param in_file: (str) with the path to the xml file :param out_file: (str) with the path to output file :param warning_file: (str) with the path to warning file :returns: (list) with samples that could be duplicated
[ "Parse", "xml", "file", "produced", "by", "qsignature" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L125-L166
train
bcbio/bcbio-nextgen
bcbio/qc/qsignature.py
_slice_bam_chr21
def _slice_bam_chr21(in_bam, data): """ return only one BAM file with only chromosome 21 """ sambamba = config_utils.get_program("sambamba", data["config"]) out_file = "%s-chr%s" % os.path.splitext(in_bam) if not utils.file_exists(out_file): bam.index(in_bam, data['config']) with...
python
def _slice_bam_chr21(in_bam, data): """ return only one BAM file with only chromosome 21 """ sambamba = config_utils.get_program("sambamba", data["config"]) out_file = "%s-chr%s" % os.path.splitext(in_bam) if not utils.file_exists(out_file): bam.index(in_bam, data['config']) with...
[ "def", "_slice_bam_chr21", "(", "in_bam", ",", "data", ")", ":", "sambamba", "=", "config_utils", ".", "get_program", "(", "\"sambamba\"", ",", "data", "[", "\"config\"", "]", ")", "out_file", "=", "\"%s-chr%s\"", "%", "os", ".", "path", ".", "splitext", "...
return only one BAM file with only chromosome 21
[ "return", "only", "one", "BAM", "file", "with", "only", "chromosome", "21" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L168-L184
train
bcbio/bcbio-nextgen
bcbio/qc/qsignature.py
_slice_vcf_chr21
def _slice_vcf_chr21(vcf_file, out_dir): """ Slice chr21 of qsignature SNPs to reduce computation time """ tmp_file = os.path.join(out_dir, "chr21_qsignature.vcf") if not utils.file_exists(tmp_file): cmd = ("grep chr21 {vcf_file} > {tmp_file}").format(**locals()) out = subprocess.che...
python
def _slice_vcf_chr21(vcf_file, out_dir): """ Slice chr21 of qsignature SNPs to reduce computation time """ tmp_file = os.path.join(out_dir, "chr21_qsignature.vcf") if not utils.file_exists(tmp_file): cmd = ("grep chr21 {vcf_file} > {tmp_file}").format(**locals()) out = subprocess.che...
[ "def", "_slice_vcf_chr21", "(", "vcf_file", ",", "out_dir", ")", ":", "tmp_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"chr21_qsignature.vcf\"", ")", "if", "not", "utils", ".", "file_exists", "(", "tmp_file", ")", ":", "cmd", "=", ...
Slice chr21 of qsignature SNPs to reduce computation time
[ "Slice", "chr21", "of", "qsignature", "SNPs", "to", "reduce", "computation", "time" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qsignature.py#L186-L194
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
_combine_files
def _combine_files(orig_files, base_out_file, data, fill_paths=True): """Combine multiple input files, fixing file paths if needed. We fill in full paths from files in the data dictionary if we're not using basepath (old style GEMINI). """ orig_files = [x for x in orig_files if x and utils.file_exi...
python
def _combine_files(orig_files, base_out_file, data, fill_paths=True): """Combine multiple input files, fixing file paths if needed. We fill in full paths from files in the data dictionary if we're not using basepath (old style GEMINI). """ orig_files = [x for x in orig_files if x and utils.file_exi...
[ "def", "_combine_files", "(", "orig_files", ",", "base_out_file", ",", "data", ",", "fill_paths", "=", "True", ")", ":", "orig_files", "=", "[", "x", "for", "x", "in", "orig_files", "if", "x", "and", "utils", ".", "file_exists", "(", "x", ")", "]", "if...
Combine multiple input files, fixing file paths if needed. We fill in full paths from files in the data dictionary if we're not using basepath (old style GEMINI).
[ "Combine", "multiple", "input", "files", "fixing", "file", "paths", "if", "needed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L47-L66
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
_fill_file_path
def _fill_file_path(line, data): """Fill in a full file path in the configuration file from data dictionary. """ def _find_file(xs, target): if isinstance(xs, dict): for v in xs.values(): f = _find_file(v, target) if f: return f ...
python
def _fill_file_path(line, data): """Fill in a full file path in the configuration file from data dictionary. """ def _find_file(xs, target): if isinstance(xs, dict): for v in xs.values(): f = _find_file(v, target) if f: return f ...
[ "def", "_fill_file_path", "(", "line", ",", "data", ")", ":", "def", "_find_file", "(", "xs", ",", "target", ")", ":", "if", "isinstance", "(", "xs", ",", "dict", ")", ":", "for", "v", "in", "xs", ".", "values", "(", ")", ":", "f", "=", "_find_fi...
Fill in a full file path in the configuration file from data dictionary.
[ "Fill", "in", "a", "full", "file", "path", "in", "the", "configuration", "file", "from", "data", "dictionary", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L68-L89
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
find_annotations
def find_annotations(data, retriever=None): """Find annotation configuration files for vcfanno, using pre-installed inputs. Creates absolute paths for user specified inputs and finds locally installed defaults. Default annotations: - gemini for variant pipelines - somatic for variant tumor...
python
def find_annotations(data, retriever=None): """Find annotation configuration files for vcfanno, using pre-installed inputs. Creates absolute paths for user specified inputs and finds locally installed defaults. Default annotations: - gemini for variant pipelines - somatic for variant tumor...
[ "def", "find_annotations", "(", "data", ",", "retriever", "=", "None", ")", ":", "conf_files", "=", "dd", ".", "get_vcfanno", "(", "data", ")", "if", "not", "isinstance", "(", "conf_files", ",", "(", "list", ",", "tuple", ")", ")", ":", "conf_files", "...
Find annotation configuration files for vcfanno, using pre-installed inputs. Creates absolute paths for user specified inputs and finds locally installed defaults. Default annotations: - gemini for variant pipelines - somatic for variant tumor pipelines - rnaedit for RNA-seq variant call...
[ "Find", "annotation", "configuration", "files", "for", "vcfanno", "using", "pre", "-", "installed", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L91-L137
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
annotate_gemini
def annotate_gemini(data, retriever=None): """Annotate with population calls if have data installed. """ r = dd.get_variation_resources(data) return all([r.get(k) and objectstore.file_exists_or_remote(r[k]) for k in ["exac", "gnomad_exome"]])
python
def annotate_gemini(data, retriever=None): """Annotate with population calls if have data installed. """ r = dd.get_variation_resources(data) return all([r.get(k) and objectstore.file_exists_or_remote(r[k]) for k in ["exac", "gnomad_exome"]])
[ "def", "annotate_gemini", "(", "data", ",", "retriever", "=", "None", ")", ":", "r", "=", "dd", ".", "get_variation_resources", "(", "data", ")", "return", "all", "(", "[", "r", ".", "get", "(", "k", ")", "and", "objectstore", ".", "file_exists_or_remote...
Annotate with population calls if have data installed.
[ "Annotate", "with", "population", "calls", "if", "have", "data", "installed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L150-L154
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
_annotate_somatic
def _annotate_somatic(data, retriever=None): """Annotate somatic calls if we have cosmic data installed. """ if is_human(data): paired = vcfutils.get_paired([data]) if paired: r = dd.get_variation_resources(data) if r.get("cosmic") and objectstore.file_exists_or_remot...
python
def _annotate_somatic(data, retriever=None): """Annotate somatic calls if we have cosmic data installed. """ if is_human(data): paired = vcfutils.get_paired([data]) if paired: r = dd.get_variation_resources(data) if r.get("cosmic") and objectstore.file_exists_or_remot...
[ "def", "_annotate_somatic", "(", "data", ",", "retriever", "=", "None", ")", ":", "if", "is_human", "(", "data", ")", ":", "paired", "=", "vcfutils", ".", "get_paired", "(", "[", "data", "]", ")", "if", "paired", ":", "r", "=", "dd", ".", "get_variat...
Annotate somatic calls if we have cosmic data installed.
[ "Annotate", "somatic", "calls", "if", "we", "have", "cosmic", "data", "installed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L156-L165
train
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
is_human
def is_human(data, builds=None): """Check if human, optionally with build number, search by name or extra GL contigs. """ def has_build37_contigs(data): for contig in ref.file_contigs(dd.get_ref_file(data)): if contig.name.startswith("GL") or contig.name.find("_gl") >= 0: ...
python
def is_human(data, builds=None): """Check if human, optionally with build number, search by name or extra GL contigs. """ def has_build37_contigs(data): for contig in ref.file_contigs(dd.get_ref_file(data)): if contig.name.startswith("GL") or contig.name.find("_gl") >= 0: ...
[ "def", "is_human", "(", "data", ",", "builds", "=", "None", ")", ":", "def", "has_build37_contigs", "(", "data", ")", ":", "for", "contig", "in", "ref", ".", "file_contigs", "(", "dd", ".", "get_ref_file", "(", "data", ")", ")", ":", "if", "contig", ...
Check if human, optionally with build number, search by name or extra GL contigs.
[ "Check", "if", "human", "optionally", "with", "build", "number", "search", "by", "name", "or", "extra", "GL", "contigs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L167-L188
train
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
_get_resource_programs
def _get_resource_programs(progs, algs): """Retrieve programs used in analysis based on algorithm configurations. Handles special cases like aligners and variant callers. """ checks = {"gatk-vqsr": config_utils.use_vqsr, "snpeff": config_utils.use_snpeff, "bcbio-variation-rec...
python
def _get_resource_programs(progs, algs): """Retrieve programs used in analysis based on algorithm configurations. Handles special cases like aligners and variant callers. """ checks = {"gatk-vqsr": config_utils.use_vqsr, "snpeff": config_utils.use_snpeff, "bcbio-variation-rec...
[ "def", "_get_resource_programs", "(", "progs", ",", "algs", ")", ":", "checks", "=", "{", "\"gatk-vqsr\"", ":", "config_utils", ".", "use_vqsr", ",", "\"snpeff\"", ":", "config_utils", ".", "use_snpeff", ",", "\"bcbio-variation-recall\"", ":", "config_utils", ".",...
Retrieve programs used in analysis based on algorithm configurations. Handles special cases like aligners and variant callers.
[ "Retrieve", "programs", "used", "in", "analysis", "based", "on", "algorithm", "configurations", ".", "Handles", "special", "cases", "like", "aligners", "and", "variant", "callers", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L14-L49
train
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
_parent_prefix
def _parent_prefix(prefix): """Identify a parent prefix we should add to resources if present in a caller name. """ def run(algs): for alg in algs: vcs = alg.get("variantcaller") if vcs: if isinstance(vcs, dict): vcs = reduce(operator.add, ...
python
def _parent_prefix(prefix): """Identify a parent prefix we should add to resources if present in a caller name. """ def run(algs): for alg in algs: vcs = alg.get("variantcaller") if vcs: if isinstance(vcs, dict): vcs = reduce(operator.add, ...
[ "def", "_parent_prefix", "(", "prefix", ")", ":", "def", "run", "(", "algs", ")", ":", "for", "alg", "in", "algs", ":", "vcs", "=", "alg", ".", "get", "(", "\"variantcaller\"", ")", "if", "vcs", ":", "if", "isinstance", "(", "vcs", ",", "dict", ")"...
Identify a parent prefix we should add to resources if present in a caller name.
[ "Identify", "a", "parent", "prefix", "we", "should", "add", "to", "resources", "if", "present", "in", "a", "caller", "name", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L51-L63
train
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
_ensure_min_resources
def _ensure_min_resources(progs, cores, memory, min_memory): """Ensure setting match minimum resources required for used programs. """ for p in progs: if p in min_memory: if not memory or cores * memory < min_memory[p]: memory = float(min_memory[p]) / cores return cor...
python
def _ensure_min_resources(progs, cores, memory, min_memory): """Ensure setting match minimum resources required for used programs. """ for p in progs: if p in min_memory: if not memory or cores * memory < min_memory[p]: memory = float(min_memory[p]) / cores return cor...
[ "def", "_ensure_min_resources", "(", "progs", ",", "cores", ",", "memory", ",", "min_memory", ")", ":", "for", "p", "in", "progs", ":", "if", "p", "in", "min_memory", ":", "if", "not", "memory", "or", "cores", "*", "memory", "<", "min_memory", "[", "p"...
Ensure setting match minimum resources required for used programs.
[ "Ensure", "setting", "match", "minimum", "resources", "required", "for", "used", "programs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L65-L72
train
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
_get_prog_memory
def _get_prog_memory(resources, cores_per_job): """Get expected memory usage, in Gb per core, for a program from resource specification. """ out = None for jvm_opt in resources.get("jvm_opts", []): if jvm_opt.startswith("-Xmx"): out = _str_memory_to_gb(jvm_opt[4:]) memory = resou...
python
def _get_prog_memory(resources, cores_per_job): """Get expected memory usage, in Gb per core, for a program from resource specification. """ out = None for jvm_opt in resources.get("jvm_opts", []): if jvm_opt.startswith("-Xmx"): out = _str_memory_to_gb(jvm_opt[4:]) memory = resou...
[ "def", "_get_prog_memory", "(", "resources", ",", "cores_per_job", ")", ":", "out", "=", "None", "for", "jvm_opt", "in", "resources", ".", "get", "(", "\"jvm_opts\"", ",", "[", "]", ")", ":", "if", "jvm_opt", ".", "startswith", "(", "\"-Xmx\"", ")", ":",...
Get expected memory usage, in Gb per core, for a program from resource specification.
[ "Get", "expected", "memory", "usage", "in", "Gb", "per", "core", "for", "a", "program", "from", "resource", "specification", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L83-L98
train
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
_scale_cores_to_memory
def _scale_cores_to_memory(cores, mem_per_core, sysinfo, system_memory): """Scale multicore usage to avoid excessive memory usage based on system information. """ total_mem = "%.2f" % (cores * mem_per_core + system_memory) if "cores" not in sysinfo: return cores, total_mem, 1.0 total_mem = ...
python
def _scale_cores_to_memory(cores, mem_per_core, sysinfo, system_memory): """Scale multicore usage to avoid excessive memory usage based on system information. """ total_mem = "%.2f" % (cores * mem_per_core + system_memory) if "cores" not in sysinfo: return cores, total_mem, 1.0 total_mem = ...
[ "def", "_scale_cores_to_memory", "(", "cores", ",", "mem_per_core", ",", "sysinfo", ",", "system_memory", ")", ":", "total_mem", "=", "\"%.2f\"", "%", "(", "cores", "*", "mem_per_core", "+", "system_memory", ")", "if", "\"cores\"", "not", "in", "sysinfo", ":",...
Scale multicore usage to avoid excessive memory usage based on system information.
[ "Scale", "multicore", "usage", "to", "avoid", "excessive", "memory", "usage", "based", "on", "system", "information", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L100-L117
train
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
_scale_jobs_to_memory
def _scale_jobs_to_memory(jobs, mem_per_core, sysinfo): """When scheduling jobs with single cores, avoid overscheduling due to memory. """ if "cores" not in sysinfo: return jobs, 1.0 sys_mem_per_core = float(sysinfo["memory"]) / float(sysinfo["cores"]) if sys_mem_per_core < mem_per_core: ...
python
def _scale_jobs_to_memory(jobs, mem_per_core, sysinfo): """When scheduling jobs with single cores, avoid overscheduling due to memory. """ if "cores" not in sysinfo: return jobs, 1.0 sys_mem_per_core = float(sysinfo["memory"]) / float(sysinfo["cores"]) if sys_mem_per_core < mem_per_core: ...
[ "def", "_scale_jobs_to_memory", "(", "jobs", ",", "mem_per_core", ",", "sysinfo", ")", ":", "if", "\"cores\"", "not", "in", "sysinfo", ":", "return", "jobs", ",", "1.0", "sys_mem_per_core", "=", "float", "(", "sysinfo", "[", "\"memory\"", "]", ")", "/", "f...
When scheduling jobs with single cores, avoid overscheduling due to memory.
[ "When", "scheduling", "jobs", "with", "single", "cores", "avoid", "overscheduling", "due", "to", "memory", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L119-L130
train
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
calculate
def calculate(parallel, items, sysinfo, config, multiplier=1, max_multicore=None): """Determine cores and workers to use for this stage based on used programs. multiplier specifies the number of regions items will be split into during processing. max_multicore specifies an optional limit o...
python
def calculate(parallel, items, sysinfo, config, multiplier=1, max_multicore=None): """Determine cores and workers to use for this stage based on used programs. multiplier specifies the number of regions items will be split into during processing. max_multicore specifies an optional limit o...
[ "def", "calculate", "(", "parallel", ",", "items", ",", "sysinfo", ",", "config", ",", "multiplier", "=", "1", ",", "max_multicore", "=", "None", ")", ":", "assert", "len", "(", "items", ")", ">", "0", ",", "\"Finding job resources but no items to process\"", ...
Determine cores and workers to use for this stage based on used programs. multiplier specifies the number of regions items will be split into during processing. max_multicore specifies an optional limit on the maximum cores. Can use to force single core processing during specific tasks. sysinfo spec...
[ "Determine", "cores", "and", "workers", "to", "use", "for", "this", "stage", "based", "on", "used", "programs", ".", "multiplier", "specifies", "the", "number", "of", "regions", "items", "will", "be", "split", "into", "during", "processing", ".", "max_multicor...
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L159-L234
train
bcbio/bcbio-nextgen
bcbio/ngsalign/hisat2.py
create_splicesites_file
def create_splicesites_file(gtf_file, align_dir, data): """ if not pre-created, make a splicesites file to use with hisat2 """ out_file = os.path.join(align_dir, "ref-transcripts-splicesites.txt") if file_exists(out_file): return out_file safe_makedir(align_dir) hisat2_ss = config_ut...
python
def create_splicesites_file(gtf_file, align_dir, data): """ if not pre-created, make a splicesites file to use with hisat2 """ out_file = os.path.join(align_dir, "ref-transcripts-splicesites.txt") if file_exists(out_file): return out_file safe_makedir(align_dir) hisat2_ss = config_ut...
[ "def", "create_splicesites_file", "(", "gtf_file", ",", "align_dir", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "align_dir", ",", "\"ref-transcripts-splicesites.txt\"", ")", "if", "file_exists", "(", "out_file", ")", ":", "ret...
if not pre-created, make a splicesites file to use with hisat2
[ "if", "not", "pre", "-", "created", "make", "a", "splicesites", "file", "to", "use", "with", "hisat2" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/hisat2.py#L63-L76
train
bcbio/bcbio-nextgen
bcbio/ngsalign/hisat2.py
get_splicejunction_file
def get_splicejunction_file(align_dir, data): """ locate the splice junction file from hisat2. hisat2 outputs a novel splicesites file to go along with the provided file, if available. this combines the two together and outputs a combined file of all of the known and novel splice junctions """ ...
python
def get_splicejunction_file(align_dir, data): """ locate the splice junction file from hisat2. hisat2 outputs a novel splicesites file to go along with the provided file, if available. this combines the two together and outputs a combined file of all of the known and novel splice junctions """ ...
[ "def", "get_splicejunction_file", "(", "align_dir", ",", "data", ")", ":", "samplename", "=", "dd", ".", "get_sample_name", "(", "data", ")", "align_dir", "=", "os", ".", "path", ".", "dirname", "(", "dd", ".", "get_work_bam", "(", "data", ")", ")", "kno...
locate the splice junction file from hisat2. hisat2 outputs a novel splicesites file to go along with the provided file, if available. this combines the two together and outputs a combined file of all of the known and novel splice junctions
[ "locate", "the", "splice", "junction", "file", "from", "hisat2", ".", "hisat2", "outputs", "a", "novel", "splicesites", "file", "to", "go", "along", "with", "the", "provided", "file", "if", "available", ".", "this", "combines", "the", "two", "together", "and...
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/hisat2.py#L127-L146
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
write_info
def write_info(dirs, parallel, config): """Write cluster or local filesystem resources, spinning up cluster if not present. """ if parallel["type"] in ["ipython"] and not parallel.get("run_local"): out_file = _get_cache_file(dirs, parallel) if not utils.file_exists(out_file): sys...
python
def write_info(dirs, parallel, config): """Write cluster or local filesystem resources, spinning up cluster if not present. """ if parallel["type"] in ["ipython"] and not parallel.get("run_local"): out_file = _get_cache_file(dirs, parallel) if not utils.file_exists(out_file): sys...
[ "def", "write_info", "(", "dirs", ",", "parallel", ",", "config", ")", ":", "if", "parallel", "[", "\"type\"", "]", "in", "[", "\"ipython\"", "]", "and", "not", "parallel", ".", "get", "(", "\"run_local\"", ")", ":", "out_file", "=", "_get_cache_file", "...
Write cluster or local filesystem resources, spinning up cluster if not present.
[ "Write", "cluster", "or", "local", "filesystem", "resources", "spinning", "up", "cluster", "if", "not", "present", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L25-L34
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_get_machine_info
def _get_machine_info(parallel, sys_config, dirs, config): """Get machine resource information from the job scheduler via either the command line or the queue. """ if parallel.get("queue") and parallel.get("scheduler"): # dictionary as switch statement; can add new scheduler implementation functions...
python
def _get_machine_info(parallel, sys_config, dirs, config): """Get machine resource information from the job scheduler via either the command line or the queue. """ if parallel.get("queue") and parallel.get("scheduler"): # dictionary as switch statement; can add new scheduler implementation functions...
[ "def", "_get_machine_info", "(", "parallel", ",", "sys_config", ",", "dirs", ",", "config", ")", ":", "if", "parallel", ".", "get", "(", "\"queue\"", ")", "and", "parallel", ".", "get", "(", "\"scheduler\"", ")", ":", "# dictionary as switch statement; can add n...
Get machine resource information from the job scheduler via either the command line or the queue.
[ "Get", "machine", "resource", "information", "from", "the", "job", "scheduler", "via", "either", "the", "command", "line", "or", "the", "queue", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L36-L59
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_slurm_info
def _slurm_info(queue): """Returns machine information for a slurm job scheduler. """ cl = "sinfo -h -p {} --format '%c %m %D'".format(queue) num_cpus, mem, num_nodes = subprocess.check_output(shlex.split(cl)).decode().split() # if the queue contains multiple memory configurations, the minimum value...
python
def _slurm_info(queue): """Returns machine information for a slurm job scheduler. """ cl = "sinfo -h -p {} --format '%c %m %D'".format(queue) num_cpus, mem, num_nodes = subprocess.check_output(shlex.split(cl)).decode().split() # if the queue contains multiple memory configurations, the minimum value...
[ "def", "_slurm_info", "(", "queue", ")", ":", "cl", "=", "\"sinfo -h -p {} --format '%c %m %D'\"", ".", "format", "(", "queue", ")", "num_cpus", ",", "mem", ",", "num_nodes", "=", "subprocess", ".", "check_output", "(", "shlex", ".", "split", "(", "cl", ")",...
Returns machine information for a slurm job scheduler.
[ "Returns", "machine", "information", "for", "a", "slurm", "job", "scheduler", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L61-L75
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_torque_info
def _torque_info(queue): """Return machine information for a torque job scheduler using pbsnodes. To identify which host to use it tries to parse available hosts from qstat -Qf `acl_hosts`. If found, it uses these and gets the first node from pbsnodes matching to the list. If no attached hosts are ...
python
def _torque_info(queue): """Return machine information for a torque job scheduler using pbsnodes. To identify which host to use it tries to parse available hosts from qstat -Qf `acl_hosts`. If found, it uses these and gets the first node from pbsnodes matching to the list. If no attached hosts are ...
[ "def", "_torque_info", "(", "queue", ")", ":", "nodes", "=", "_torque_queue_nodes", "(", "queue", ")", "pbs_out", "=", "subprocess", ".", "check_output", "(", "[", "\"pbsnodes\"", "]", ")", ".", "decode", "(", ")", "info", "=", "{", "}", "for", "i", ",...
Return machine information for a torque job scheduler using pbsnodes. To identify which host to use it tries to parse available hosts from qstat -Qf `acl_hosts`. If found, it uses these and gets the first node from pbsnodes matching to the list. If no attached hosts are available, it uses the first hos...
[ "Return", "machine", "information", "for", "a", "torque", "job", "scheduler", "using", "pbsnodes", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L77-L99
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_torque_queue_nodes
def _torque_queue_nodes(queue): """Retrieve the nodes available for a queue. Parses out nodes from `acl_hosts` in qstat -Qf and extracts the initial names of nodes used in pbsnodes. """ qstat_out = subprocess.check_output(["qstat", "-Qf", queue]).decode() hosts = [] in_hosts = False for...
python
def _torque_queue_nodes(queue): """Retrieve the nodes available for a queue. Parses out nodes from `acl_hosts` in qstat -Qf and extracts the initial names of nodes used in pbsnodes. """ qstat_out = subprocess.check_output(["qstat", "-Qf", queue]).decode() hosts = [] in_hosts = False for...
[ "def", "_torque_queue_nodes", "(", "queue", ")", ":", "qstat_out", "=", "subprocess", ".", "check_output", "(", "[", "\"qstat\"", ",", "\"-Qf\"", ",", "queue", "]", ")", ".", "decode", "(", ")", "hosts", "=", "[", "]", "in_hosts", "=", "False", "for", ...
Retrieve the nodes available for a queue. Parses out nodes from `acl_hosts` in qstat -Qf and extracts the initial names of nodes used in pbsnodes.
[ "Retrieve", "the", "nodes", "available", "for", "a", "queue", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L101-L119
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_sge_info
def _sge_info(queue): """Returns machine information for an sge job scheduler. """ qhost_out = subprocess.check_output(["qhost", "-q", "-xml"]).decode() qstat_queue = ["-q", queue] if queue and "," not in queue else [] qstat_out = subprocess.check_output(["qstat", "-f", "-xml"] + qstat_queue).decode...
python
def _sge_info(queue): """Returns machine information for an sge job scheduler. """ qhost_out = subprocess.check_output(["qhost", "-q", "-xml"]).decode() qstat_queue = ["-q", queue] if queue and "," not in queue else [] qstat_out = subprocess.check_output(["qstat", "-f", "-xml"] + qstat_queue).decode...
[ "def", "_sge_info", "(", "queue", ")", ":", "qhost_out", "=", "subprocess", ".", "check_output", "(", "[", "\"qhost\"", ",", "\"-q\"", ",", "\"-xml\"", "]", ")", ".", "decode", "(", ")", "qstat_queue", "=", "[", "\"-q\"", ",", "queue", "]", "if", "queu...
Returns machine information for an sge job scheduler.
[ "Returns", "machine", "information", "for", "an", "sge", "job", "scheduler", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L128-L144
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_sge_get_slots
def _sge_get_slots(xmlstring): """ Get slot information from qstat """ rootxml = ET.fromstring(xmlstring) my_machine_dict = {} for queue_list in rootxml.iter("Queue-List"): # find all hosts supporting queues my_hostname = queue_list.find("name").text.rsplit("@")[-1] my_slots ...
python
def _sge_get_slots(xmlstring): """ Get slot information from qstat """ rootxml = ET.fromstring(xmlstring) my_machine_dict = {} for queue_list in rootxml.iter("Queue-List"): # find all hosts supporting queues my_hostname = queue_list.find("name").text.rsplit("@")[-1] my_slots ...
[ "def", "_sge_get_slots", "(", "xmlstring", ")", ":", "rootxml", "=", "ET", ".", "fromstring", "(", "xmlstring", ")", "my_machine_dict", "=", "{", "}", "for", "queue_list", "in", "rootxml", ".", "iter", "(", "\"Queue-List\"", ")", ":", "# find all hosts support...
Get slot information from qstat
[ "Get", "slot", "information", "from", "qstat" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L146-L157
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
_sge_get_mem
def _sge_get_mem(xmlstring, queue_name): """ Get memory information from qhost """ rootxml = ET.fromstring(xmlstring) my_machine_dict = {} # on some machines rootxml.tag looks like "{...}qhost" where the "{...}" gets prepended to all attributes rootTag = rootxml.tag.rstrip("qhost") for host ...
python
def _sge_get_mem(xmlstring, queue_name): """ Get memory information from qhost """ rootxml = ET.fromstring(xmlstring) my_machine_dict = {} # on some machines rootxml.tag looks like "{...}qhost" where the "{...}" gets prepended to all attributes rootTag = rootxml.tag.rstrip("qhost") for host ...
[ "def", "_sge_get_mem", "(", "xmlstring", ",", "queue_name", ")", ":", "rootxml", "=", "ET", ".", "fromstring", "(", "xmlstring", ")", "my_machine_dict", "=", "{", "}", "# on some machines rootxml.tag looks like \"{...}qhost\" where the \"{...}\" gets prepended to all attribut...
Get memory information from qhost
[ "Get", "memory", "information", "from", "qhost" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L159-L186
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
get_info
def get_info(dirs, parallel, resources=None): """Retrieve cluster or local filesystem resources from pre-retrieved information. """ # Allow custom specification of cores/memory in resources if resources and isinstance(resources, dict) and "machine" in resources: minfo = resources["machine"] ...
python
def get_info(dirs, parallel, resources=None): """Retrieve cluster or local filesystem resources from pre-retrieved information. """ # Allow custom specification of cores/memory in resources if resources and isinstance(resources, dict) and "machine" in resources: minfo = resources["machine"] ...
[ "def", "get_info", "(", "dirs", ",", "parallel", ",", "resources", "=", "None", ")", ":", "# Allow custom specification of cores/memory in resources", "if", "resources", "and", "isinstance", "(", "resources", ",", "dict", ")", "and", "\"machine\"", "in", "resources"...
Retrieve cluster or local filesystem resources from pre-retrieved information.
[ "Retrieve", "cluster", "or", "local", "filesystem", "resources", "from", "pre", "-", "retrieved", "information", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L194-L212
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
machine_info
def machine_info(): """Retrieve core and memory information for the current machine. """ import psutil BYTES_IN_GIG = 1073741824.0 free_bytes = psutil.virtual_memory().total return [{"memory": float("%.1f" % (free_bytes / BYTES_IN_GIG)), "cores": multiprocessing.cpu_count(), "name":...
python
def machine_info(): """Retrieve core and memory information for the current machine. """ import psutil BYTES_IN_GIG = 1073741824.0 free_bytes = psutil.virtual_memory().total return [{"memory": float("%.1f" % (free_bytes / BYTES_IN_GIG)), "cores": multiprocessing.cpu_count(), "name":...
[ "def", "machine_info", "(", ")", ":", "import", "psutil", "BYTES_IN_GIG", "=", "1073741824.0", "free_bytes", "=", "psutil", ".", "virtual_memory", "(", ")", ".", "total", "return", "[", "{", "\"memory\"", ":", "float", "(", "\"%.1f\"", "%", "(", "free_bytes"...
Retrieve core and memory information for the current machine.
[ "Retrieve", "core", "and", "memory", "information", "for", "the", "current", "machine", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L214-L221
train
bcbio/bcbio-nextgen
bcbio/rnaseq/dexseq.py
run_count
def run_count(bam_file, dexseq_gff, stranded, out_file, data): """ run dexseq_count on a BAM file """ assert file_exists(bam_file), "%s does not exist." % bam_file sort_order = bam._get_sort_order(bam_file, {}) assert sort_order, "Cannot determine sort order of %s." % bam_file strand_flag = ...
python
def run_count(bam_file, dexseq_gff, stranded, out_file, data): """ run dexseq_count on a BAM file """ assert file_exists(bam_file), "%s does not exist." % bam_file sort_order = bam._get_sort_order(bam_file, {}) assert sort_order, "Cannot determine sort order of %s." % bam_file strand_flag = ...
[ "def", "run_count", "(", "bam_file", ",", "dexseq_gff", ",", "stranded", ",", "out_file", ",", "data", ")", ":", "assert", "file_exists", "(", "bam_file", ")", ",", "\"%s does not exist.\"", "%", "bam_file", "sort_order", "=", "bam", ".", "_get_sort_order", "(...
run dexseq_count on a BAM file
[ "run", "dexseq_count", "on", "a", "BAM", "file" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/dexseq.py#L27-L65
train
bcbio/bcbio-nextgen
bcbio/bam/trim.py
_trim_adapters
def _trim_adapters(fastq_files, out_dir, data): """ for small insert sizes, the read length can be longer than the insert resulting in the reverse complement of the 3' adapter being sequenced. this takes adapter sequences and trims the only the reverse complement of the adapter MYSEQUENCEAAAARE...
python
def _trim_adapters(fastq_files, out_dir, data): """ for small insert sizes, the read length can be longer than the insert resulting in the reverse complement of the 3' adapter being sequenced. this takes adapter sequences and trims the only the reverse complement of the adapter MYSEQUENCEAAAARE...
[ "def", "_trim_adapters", "(", "fastq_files", ",", "out_dir", ",", "data", ")", ":", "to_trim", "=", "_get_sequences_to_trim", "(", "data", "[", "\"config\"", "]", ",", "SUPPORTED_ADAPTERS", ")", "if", "dd", ".", "get_trim_reads", "(", "data", ")", "==", "\"f...
for small insert sizes, the read length can be longer than the insert resulting in the reverse complement of the 3' adapter being sequenced. this takes adapter sequences and trims the only the reverse complement of the adapter MYSEQUENCEAAAARETPADA -> MYSEQUENCEAAAA (no polyA trim)
[ "for", "small", "insert", "sizes", "the", "read", "length", "can", "be", "longer", "than", "the", "insert", "resulting", "in", "the", "reverse", "complement", "of", "the", "3", "adapter", "being", "sequenced", ".", "this", "takes", "adapter", "sequences", "a...
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/trim.py#L36-L59
train
bcbio/bcbio-nextgen
bcbio/bam/trim.py
_cutadapt_trim
def _cutadapt_trim(fastq_files, quality_format, adapters, out_files, log_file, data): """Trimming with cutadapt. """ if all([utils.file_exists(x) for x in out_files]): return out_files cmd = _cutadapt_trim_cmd(fastq_files, quality_format, adapters, out_files, data) if len(fastq_files) == 1: ...
python
def _cutadapt_trim(fastq_files, quality_format, adapters, out_files, log_file, data): """Trimming with cutadapt. """ if all([utils.file_exists(x) for x in out_files]): return out_files cmd = _cutadapt_trim_cmd(fastq_files, quality_format, adapters, out_files, data) if len(fastq_files) == 1: ...
[ "def", "_cutadapt_trim", "(", "fastq_files", ",", "quality_format", ",", "adapters", ",", "out_files", ",", "log_file", ",", "data", ")", ":", "if", "all", "(", "[", "utils", ".", "file_exists", "(", "x", ")", "for", "x", "in", "out_files", "]", ")", "...
Trimming with cutadapt.
[ "Trimming", "with", "cutadapt", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/trim.py#L192-L214
train
bcbio/bcbio-nextgen
bcbio/bam/trim.py
_cutadapt_trim_cmd
def _cutadapt_trim_cmd(fastq_files, quality_format, adapters, out_files, data): """Trimming with cutadapt, using version installed with bcbio-nextgen. """ if all([utils.file_exists(x) for x in out_files]): return out_files if quality_format == "illumina": quality_base = "64" else: ...
python
def _cutadapt_trim_cmd(fastq_files, quality_format, adapters, out_files, data): """Trimming with cutadapt, using version installed with bcbio-nextgen. """ if all([utils.file_exists(x) for x in out_files]): return out_files if quality_format == "illumina": quality_base = "64" else: ...
[ "def", "_cutadapt_trim_cmd", "(", "fastq_files", ",", "quality_format", ",", "adapters", ",", "out_files", ",", "data", ")", ":", "if", "all", "(", "[", "utils", ".", "file_exists", "(", "x", ")", "for", "x", "in", "out_files", "]", ")", ":", "return", ...
Trimming with cutadapt, using version installed with bcbio-nextgen.
[ "Trimming", "with", "cutadapt", "using", "version", "installed", "with", "bcbio", "-", "nextgen", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/trim.py#L216-L244
train
bcbio/bcbio-nextgen
bcbio/bam/trim.py
_cutadapt_se_cmd
def _cutadapt_se_cmd(fastq_files, out_files, base_cmd, data): """ this has to use the -o option, not redirect to stdout in order for gzipping to be supported """ min_length = dd.get_min_read_length(data) cmd = base_cmd + " --minimum-length={min_length} ".format(**locals()) fq1 = objectstore....
python
def _cutadapt_se_cmd(fastq_files, out_files, base_cmd, data): """ this has to use the -o option, not redirect to stdout in order for gzipping to be supported """ min_length = dd.get_min_read_length(data) cmd = base_cmd + " --minimum-length={min_length} ".format(**locals()) fq1 = objectstore....
[ "def", "_cutadapt_se_cmd", "(", "fastq_files", ",", "out_files", ",", "base_cmd", ",", "data", ")", ":", "min_length", "=", "dd", ".", "get_min_read_length", "(", "data", ")", "cmd", "=", "base_cmd", "+", "\" --minimum-length={min_length} \"", ".", "format", "("...
this has to use the -o option, not redirect to stdout in order for gzipping to be supported
[ "this", "has", "to", "use", "the", "-", "o", "option", "not", "redirect", "to", "stdout", "in", "order", "for", "gzipping", "to", "be", "supported" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/trim.py#L246-L257
train
bcbio/bcbio-nextgen
bcbio/bam/trim.py
_cutadapt_pe_cmd
def _cutadapt_pe_cmd(fastq_files, out_files, quality_format, base_cmd, data): """ run cutadapt in paired end mode """ fq1, fq2 = [objectstore.cl_input(x) for x in fastq_files] of1, of2 = out_files base_cmd += " --minimum-length={min_length} ".format(min_length=dd.get_min_read_length(data)) f...
python
def _cutadapt_pe_cmd(fastq_files, out_files, quality_format, base_cmd, data): """ run cutadapt in paired end mode """ fq1, fq2 = [objectstore.cl_input(x) for x in fastq_files] of1, of2 = out_files base_cmd += " --minimum-length={min_length} ".format(min_length=dd.get_min_read_length(data)) f...
[ "def", "_cutadapt_pe_cmd", "(", "fastq_files", ",", "out_files", ",", "quality_format", ",", "base_cmd", ",", "data", ")", ":", "fq1", ",", "fq2", "=", "[", "objectstore", ".", "cl_input", "(", "x", ")", "for", "x", "in", "fastq_files", "]", "of1", ",", ...
run cutadapt in paired end mode
[ "run", "cutadapt", "in", "paired", "end", "mode" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/trim.py#L259-L267
train
bcbio/bcbio-nextgen
bcbio/variation/realign.py
gatk_realigner_targets
def gatk_realigner_targets(runner, align_bam, ref_file, config, dbsnp=None, region=None, out_file=None, deep_coverage=False, variant_regions=None, known_vrns=None): """Generate a list of interval regions for realignment around indels. """ if not known_vr...
python
def gatk_realigner_targets(runner, align_bam, ref_file, config, dbsnp=None, region=None, out_file=None, deep_coverage=False, variant_regions=None, known_vrns=None): """Generate a list of interval regions for realignment around indels. """ if not known_vr...
[ "def", "gatk_realigner_targets", "(", "runner", ",", "align_bam", ",", "ref_file", ",", "config", ",", "dbsnp", "=", "None", ",", "region", "=", "None", ",", "out_file", "=", "None", ",", "deep_coverage", "=", "False", ",", "variant_regions", "=", "None", ...
Generate a list of interval regions for realignment around indels.
[ "Generate", "a", "list", "of", "interval", "regions", "for", "realignment", "around", "indels", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/realign.py#L15-L47
train
bcbio/bcbio-nextgen
bcbio/variation/realign.py
gatk_indel_realignment_cl
def gatk_indel_realignment_cl(runner, align_bam, ref_file, intervals, tmp_dir, region=None, deep_coverage=False, known_vrns=None): """Prepare input arguments for GATK indel realignment. """ if not known_vrns: known_vrns = {} params = ["...
python
def gatk_indel_realignment_cl(runner, align_bam, ref_file, intervals, tmp_dir, region=None, deep_coverage=False, known_vrns=None): """Prepare input arguments for GATK indel realignment. """ if not known_vrns: known_vrns = {} params = ["...
[ "def", "gatk_indel_realignment_cl", "(", "runner", ",", "align_bam", ",", "ref_file", ",", "intervals", ",", "tmp_dir", ",", "region", "=", "None", ",", "deep_coverage", "=", "False", ",", "known_vrns", "=", "None", ")", ":", "if", "not", "known_vrns", ":", ...
Prepare input arguments for GATK indel realignment.
[ "Prepare", "input", "arguments", "for", "GATK", "indel", "realignment", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/realign.py#L49-L70
train
bcbio/bcbio-nextgen
bcbio/variation/realign.py
has_aligned_reads
def has_aligned_reads(align_bam, region=None): """Check if the aligned BAM file has any reads in the region. region can be a chromosome string ("chr22"), a tuple region (("chr22", 1, 100)) or a file of regions. """ import pybedtools if region is not None: if isinstance(region, six.strin...
python
def has_aligned_reads(align_bam, region=None): """Check if the aligned BAM file has any reads in the region. region can be a chromosome string ("chr22"), a tuple region (("chr22", 1, 100)) or a file of regions. """ import pybedtools if region is not None: if isinstance(region, six.strin...
[ "def", "has_aligned_reads", "(", "align_bam", ",", "region", "=", "None", ")", ":", "import", "pybedtools", "if", "region", "is", "not", "None", ":", "if", "isinstance", "(", "region", ",", "six", ".", "string_types", ")", "and", "os", ".", "path", ".", ...
Check if the aligned BAM file has any reads in the region. region can be a chromosome string ("chr22"), a tuple region (("chr22", 1, 100)) or a file of regions.
[ "Check", "if", "the", "aligned", "BAM", "file", "has", "any", "reads", "in", "the", "region", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/realign.py#L74-L99
train
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
s
def s(name, parallel, inputs, outputs, image, programs=None, disk=None, cores=None, unlist=None, no_files=False): """Represent a step in a workflow. name -- The run function name, which must match a definition in distributed/multitasks inputs -- List of input keys required for the function. Each key ...
python
def s(name, parallel, inputs, outputs, image, programs=None, disk=None, cores=None, unlist=None, no_files=False): """Represent a step in a workflow. name -- The run function name, which must match a definition in distributed/multitasks inputs -- List of input keys required for the function. Each key ...
[ "def", "s", "(", "name", ",", "parallel", ",", "inputs", ",", "outputs", ",", "image", ",", "programs", "=", "None", ",", "disk", "=", "None", ",", "cores", "=", "None", ",", "unlist", "=", "None", ",", "no_files", "=", "False", ")", ":", "Step", ...
Represent a step in a workflow. name -- The run function name, which must match a definition in distributed/multitasks inputs -- List of input keys required for the function. Each key is of the type: ["toplevel", "sublevel"] -- an argument you could pass to toolz.get_in. outputs -- List of outputs wi...
[ "Represent", "a", "step", "in", "a", "workflow", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L17-L54
train
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
w
def w(name, parallel, workflow, internal): """A workflow, allowing specification of sub-workflows for nested parallelization. name and parallel are documented under the Step (s) function. workflow -- a list of Step tuples defining the sub-workflow internal -- variables used in the sub-workflow but not ...
python
def w(name, parallel, workflow, internal): """A workflow, allowing specification of sub-workflows for nested parallelization. name and parallel are documented under the Step (s) function. workflow -- a list of Step tuples defining the sub-workflow internal -- variables used in the sub-workflow but not ...
[ "def", "w", "(", "name", ",", "parallel", ",", "workflow", ",", "internal", ")", ":", "Workflow", "=", "collections", ".", "namedtuple", "(", "\"Workflow\"", ",", "\"name parallel workflow internal\"", ")", "return", "Workflow", "(", "name", ",", "parallel", "...
A workflow, allowing specification of sub-workflows for nested parallelization. name and parallel are documented under the Step (s) function. workflow -- a list of Step tuples defining the sub-workflow internal -- variables used in the sub-workflow but not exposed to subsequent steps
[ "A", "workflow", "allowing", "specification", "of", "sub", "-", "workflows", "for", "nested", "parallelization", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L56-L64
train
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
et
def et(name, parallel, inputs, outputs, expression): """Represent an ExpressionTool that reorders inputs using javascript. """ ExpressionTool = collections.namedtuple("ExpressionTool", "name inputs outputs expression parallel") return ExpressionTool(name, inputs, outputs, expression, parallel)
python
def et(name, parallel, inputs, outputs, expression): """Represent an ExpressionTool that reorders inputs using javascript. """ ExpressionTool = collections.namedtuple("ExpressionTool", "name inputs outputs expression parallel") return ExpressionTool(name, inputs, outputs, expression, parallel)
[ "def", "et", "(", "name", ",", "parallel", ",", "inputs", ",", "outputs", ",", "expression", ")", ":", "ExpressionTool", "=", "collections", ".", "namedtuple", "(", "\"ExpressionTool\"", ",", "\"name inputs outputs expression parallel\"", ")", "return", "ExpressionT...
Represent an ExpressionTool that reorders inputs using javascript.
[ "Represent", "an", "ExpressionTool", "that", "reorders", "inputs", "using", "javascript", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L66-L70
train
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
cwlout
def cwlout(key, valtype=None, extensions=None, fields=None, exclude=None): """Definition of an output variable, defining the type and associated secondary files. """ out = {"id": key} if valtype: out["type"] = valtype if fields: out["fields"] = fields if extensions: out["...
python
def cwlout(key, valtype=None, extensions=None, fields=None, exclude=None): """Definition of an output variable, defining the type and associated secondary files. """ out = {"id": key} if valtype: out["type"] = valtype if fields: out["fields"] = fields if extensions: out["...
[ "def", "cwlout", "(", "key", ",", "valtype", "=", "None", ",", "extensions", "=", "None", ",", "fields", "=", "None", ",", "exclude", "=", "None", ")", ":", "out", "=", "{", "\"id\"", ":", "key", "}", "if", "valtype", ":", "out", "[", "\"type\"", ...
Definition of an output variable, defining the type and associated secondary files.
[ "Definition", "of", "an", "output", "variable", "defining", "the", "type", "and", "associated", "secondary", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L72-L84
train
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
_variant_hla
def _variant_hla(checkpoints): """Add hla analysis to workflow, if configured. """ if not checkpoints.get("hla"): return [], [] hla = [s("hla_to_rec", "multi-batch", [["hla", "fastq"], ["config", "algorithm", "hlacaller"]], [cwlout("hla_rec", "record")],...
python
def _variant_hla(checkpoints): """Add hla analysis to workflow, if configured. """ if not checkpoints.get("hla"): return [], [] hla = [s("hla_to_rec", "multi-batch", [["hla", "fastq"], ["config", "algorithm", "hlacaller"]], [cwlout("hla_rec", "record")],...
[ "def", "_variant_hla", "(", "checkpoints", ")", ":", "if", "not", "checkpoints", ".", "get", "(", "\"hla\"", ")", ":", "return", "[", "]", ",", "[", "]", "hla", "=", "[", "s", "(", "\"hla_to_rec\"", ",", "\"multi-batch\"", ",", "[", "[", "\"hla\"", "...
Add hla analysis to workflow, if configured.
[ "Add", "hla", "analysis", "to", "workflow", "if", "configured", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L128-L143
train
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
variant
def variant(samples): """Variant calling workflow definition for CWL generation. """ checkpoints = _variant_checkpoints(samples) if checkpoints["align"]: align_wf = _alignment(checkpoints) alignin = [["files"], ["analysis"], ["config", "algorithm", "align_split_size"],...
python
def variant(samples): """Variant calling workflow definition for CWL generation. """ checkpoints = _variant_checkpoints(samples) if checkpoints["align"]: align_wf = _alignment(checkpoints) alignin = [["files"], ["analysis"], ["config", "algorithm", "align_split_size"],...
[ "def", "variant", "(", "samples", ")", ":", "checkpoints", "=", "_variant_checkpoints", "(", "samples", ")", "if", "checkpoints", "[", "\"align\"", "]", ":", "align_wf", "=", "_alignment", "(", "checkpoints", ")", "alignin", "=", "[", "[", "\"files\"", "]", ...
Variant calling workflow definition for CWL generation.
[ "Variant", "calling", "workflow", "definition", "for", "CWL", "generation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L414-L461
train
bcbio/bcbio-nextgen
bcbio/structural/plot.py
breakpoints_by_caller
def breakpoints_by_caller(bed_files): """ given a list of BED files of the form chrom start end caller return a BedTool of breakpoints as each line with the fourth column the caller with evidence for the breakpoint chr1 1 10 caller1 -> chr1 1 1 caller1 chr1 1 20 caller2 chr1 1 1 caller2 ...
python
def breakpoints_by_caller(bed_files): """ given a list of BED files of the form chrom start end caller return a BedTool of breakpoints as each line with the fourth column the caller with evidence for the breakpoint chr1 1 10 caller1 -> chr1 1 1 caller1 chr1 1 20 caller2 chr1 1 1 caller2 ...
[ "def", "breakpoints_by_caller", "(", "bed_files", ")", ":", "merged", "=", "concat", "(", "bed_files", ")", "if", "not", "merged", ":", "return", "[", "]", "grouped_start", "=", "merged", ".", "groupby", "(", "g", "=", "[", "1", ",", "2", ",", "2", "...
given a list of BED files of the form chrom start end caller return a BedTool of breakpoints as each line with the fourth column the caller with evidence for the breakpoint chr1 1 10 caller1 -> chr1 1 1 caller1 chr1 1 20 caller2 chr1 1 1 caller2 chr1 10 10 caller1 ...
[ "given", "a", "list", "of", "BED", "files", "of", "the", "form", "chrom", "start", "end", "caller", "return", "a", "BedTool", "of", "breakpoints", "as", "each", "line", "with", "the", "fourth", "column", "the", "caller", "with", "evidence", "for", "the", ...
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/plot.py#L17-L37
train
bcbio/bcbio-nextgen
bcbio/structural/plot.py
_get_sv_callers
def _get_sv_callers(items): """ return a sorted list of all of the structural variant callers run """ callers = [] for data in items: for sv in data.get("sv", []): callers.append(sv["variantcaller"]) return list(set([x for x in callers if x != "sv-ensemble"])).sort()
python
def _get_sv_callers(items): """ return a sorted list of all of the structural variant callers run """ callers = [] for data in items: for sv in data.get("sv", []): callers.append(sv["variantcaller"]) return list(set([x for x in callers if x != "sv-ensemble"])).sort()
[ "def", "_get_sv_callers", "(", "items", ")", ":", "callers", "=", "[", "]", "for", "data", "in", "items", ":", "for", "sv", "in", "data", ".", "get", "(", "\"sv\"", ",", "[", "]", ")", ":", "callers", ".", "append", "(", "sv", "[", "\"variantcaller...
return a sorted list of all of the structural variant callers run
[ "return", "a", "sorted", "list", "of", "all", "of", "the", "structural", "variant", "callers", "run" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/plot.py#L39-L47
train
bcbio/bcbio-nextgen
bcbio/structural/plot.py
_prioritize_plot_regions
def _prioritize_plot_regions(region_bt, data, out_dir=None): """Avoid plotting large numbers of regions due to speed issues. Prioritize most interesting. XXX For now, just removes larger regions and avoid plotting thousands of regions. Longer term we'll insert biology-based prioritization. """ max_...
python
def _prioritize_plot_regions(region_bt, data, out_dir=None): """Avoid plotting large numbers of regions due to speed issues. Prioritize most interesting. XXX For now, just removes larger regions and avoid plotting thousands of regions. Longer term we'll insert biology-based prioritization. """ max_...
[ "def", "_prioritize_plot_regions", "(", "region_bt", ",", "data", ",", "out_dir", "=", "None", ")", ":", "max_plots", "=", "1000", "max_size", "=", "100", "*", "1000", "# 100kb", "out_file", "=", "\"%s-priority%s\"", "%", "utils", ".", "splitext_plus", "(", ...
Avoid plotting large numbers of regions due to speed issues. Prioritize most interesting. XXX For now, just removes larger regions and avoid plotting thousands of regions. Longer term we'll insert biology-based prioritization.
[ "Avoid", "plotting", "large", "numbers", "of", "regions", "due", "to", "speed", "issues", ".", "Prioritize", "most", "interesting", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/plot.py#L76-L96
train
bcbio/bcbio-nextgen
bcbio/structural/plot.py
by_regions
def by_regions(items): """Plot for a union set of combined ensemble regions across all of the data items. """ work_dir = os.path.join(dd.get_work_dir(items[0]), "structural", "coverage") safe_makedir(work_dir) out_file = os.path.join(work_dir, "%s-coverage.pdf" % (dd.get_sample_name(items[0])...
python
def by_regions(items): """Plot for a union set of combined ensemble regions across all of the data items. """ work_dir = os.path.join(dd.get_work_dir(items[0]), "structural", "coverage") safe_makedir(work_dir) out_file = os.path.join(work_dir, "%s-coverage.pdf" % (dd.get_sample_name(items[0])...
[ "def", "by_regions", "(", "items", ")", ":", "work_dir", "=", "os", ".", "path", ".", "join", "(", "dd", ".", "get_work_dir", "(", "items", "[", "0", "]", ")", ",", "\"structural\"", ",", "\"coverage\"", ")", "safe_makedir", "(", "work_dir", ")", "out_...
Plot for a union set of combined ensemble regions across all of the data items.
[ "Plot", "for", "a", "union", "set", "of", "combined", "ensemble", "regions", "across", "all", "of", "the", "data", "items", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/plot.py#L98-L116
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
finalize_sv
def finalize_sv(orig_vcf, data, items): """Finalize structural variants, adding effects and splitting if needed. """ paired = vcfutils.get_paired(items) # For paired/somatic, attach combined calls to tumor sample if paired: sample_vcf = orig_vcf if paired.tumor_name == dd.get_sample_name(dat...
python
def finalize_sv(orig_vcf, data, items): """Finalize structural variants, adding effects and splitting if needed. """ paired = vcfutils.get_paired(items) # For paired/somatic, attach combined calls to tumor sample if paired: sample_vcf = orig_vcf if paired.tumor_name == dd.get_sample_name(dat...
[ "def", "finalize_sv", "(", "orig_vcf", ",", "data", ",", "items", ")", ":", "paired", "=", "vcfutils", ".", "get_paired", "(", "items", ")", "# For paired/somatic, attach combined calls to tumor sample", "if", "paired", ":", "sample_vcf", "=", "orig_vcf", "if", "p...
Finalize structural variants, adding effects and splitting if needed.
[ "Finalize", "structural", "variants", "adding", "effects", "and", "splitting", "if", "needed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L25-L39
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
_get_sv_exclude_file
def _get_sv_exclude_file(items): """Retrieve SV file of regions to exclude. """ sv_bed = utils.get_in(items[0], ("genome_resources", "variation", "sv_repeat")) if sv_bed and os.path.exists(sv_bed): return sv_bed
python
def _get_sv_exclude_file(items): """Retrieve SV file of regions to exclude. """ sv_bed = utils.get_in(items[0], ("genome_resources", "variation", "sv_repeat")) if sv_bed and os.path.exists(sv_bed): return sv_bed
[ "def", "_get_sv_exclude_file", "(", "items", ")", ":", "sv_bed", "=", "utils", ".", "get_in", "(", "items", "[", "0", "]", ",", "(", "\"genome_resources\"", ",", "\"variation\"", ",", "\"sv_repeat\"", ")", ")", "if", "sv_bed", "and", "os", ".", "path", "...
Retrieve SV file of regions to exclude.
[ "Retrieve", "SV", "file", "of", "regions", "to", "exclude", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L86-L91
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
_get_variant_regions
def _get_variant_regions(items): """Retrieve variant regions defined in any of the input items. """ return list(filter(lambda x: x is not None, [tz.get_in(("config", "algorithm", "variant_regions"), data) for data in items if tz.get_in([...
python
def _get_variant_regions(items): """Retrieve variant regions defined in any of the input items. """ return list(filter(lambda x: x is not None, [tz.get_in(("config", "algorithm", "variant_regions"), data) for data in items if tz.get_in([...
[ "def", "_get_variant_regions", "(", "items", ")", ":", "return", "list", "(", "filter", "(", "lambda", "x", ":", "x", "is", "not", "None", ",", "[", "tz", ".", "get_in", "(", "(", "\"config\"", ",", "\"algorithm\"", ",", "\"variant_regions\"", ")", ",", ...
Retrieve variant regions defined in any of the input items.
[ "Retrieve", "variant", "regions", "defined", "in", "any", "of", "the", "input", "items", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L93-L99
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
prepare_exclude_file
def prepare_exclude_file(items, base_file, chrom=None): """Prepare a BED file for exclusion. Excludes high depth and centromere regions which contribute to long run times and false positive structural variant calls. """ items = shared.add_highdepth_genome_exclusion(items) out_file = "%s-exclude...
python
def prepare_exclude_file(items, base_file, chrom=None): """Prepare a BED file for exclusion. Excludes high depth and centromere regions which contribute to long run times and false positive structural variant calls. """ items = shared.add_highdepth_genome_exclusion(items) out_file = "%s-exclude...
[ "def", "prepare_exclude_file", "(", "items", ",", "base_file", ",", "chrom", "=", "None", ")", ":", "items", "=", "shared", ".", "add_highdepth_genome_exclusion", "(", "items", ")", "out_file", "=", "\"%s-exclude%s.bed\"", "%", "(", "utils", ".", "splitext_plus"...
Prepare a BED file for exclusion. Excludes high depth and centromere regions which contribute to long run times and false positive structural variant calls.
[ "Prepare", "a", "BED", "file", "for", "exclusion", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L112-L137
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
exclude_by_ends
def exclude_by_ends(in_file, exclude_file, data, in_params=None): """Exclude calls based on overlap of the ends with exclusion regions. Removes structural variants with either end being in a repeat: a large source of false positives. Parameters tuned based on removal of LCR overlapping false positives...
python
def exclude_by_ends(in_file, exclude_file, data, in_params=None): """Exclude calls based on overlap of the ends with exclusion regions. Removes structural variants with either end being in a repeat: a large source of false positives. Parameters tuned based on removal of LCR overlapping false positives...
[ "def", "exclude_by_ends", "(", "in_file", ",", "exclude_file", ",", "data", ",", "in_params", "=", "None", ")", ":", "params", "=", "{", "\"end_buffer\"", ":", "50", ",", "\"rpt_pct\"", ":", "0.9", ",", "\"total_rpt_pct\"", ":", "0.2", ",", "\"sv_pct\"", "...
Exclude calls based on overlap of the ends with exclusion regions. Removes structural variants with either end being in a repeat: a large source of false positives. Parameters tuned based on removal of LCR overlapping false positives in DREAM synthetic 3 data.
[ "Exclude", "calls", "based", "on", "overlap", "of", "the", "ends", "with", "exclusion", "regions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L139-L174
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
_find_to_filter
def _find_to_filter(in_file, exclude_file, params, to_exclude): """Identify regions in the end file that overlap the exclusion file. We look for ends with a large percentage in a repeat or where the end contains an entire repeat. """ for feat in pybedtools.BedTool(in_file).intersect(pybedtools.BedT...
python
def _find_to_filter(in_file, exclude_file, params, to_exclude): """Identify regions in the end file that overlap the exclusion file. We look for ends with a large percentage in a repeat or where the end contains an entire repeat. """ for feat in pybedtools.BedTool(in_file).intersect(pybedtools.BedT...
[ "def", "_find_to_filter", "(", "in_file", ",", "exclude_file", ",", "params", ",", "to_exclude", ")", ":", "for", "feat", "in", "pybedtools", ".", "BedTool", "(", "in_file", ")", ".", "intersect", "(", "pybedtools", ".", "BedTool", "(", "exclude_file", ")", ...
Identify regions in the end file that overlap the exclusion file. We look for ends with a large percentage in a repeat or where the end contains an entire repeat.
[ "Identify", "regions", "in", "the", "end", "file", "that", "overlap", "the", "exclusion", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L176-L190
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
get_sv_chroms
def get_sv_chroms(items, exclude_file): """Retrieve chromosomes to process on, avoiding extra skipped chromosomes. """ exclude_regions = {} for region in pybedtools.BedTool(exclude_file): if int(region.start) == 0: exclude_regions[region.chrom] = int(region.end) out = [] with...
python
def get_sv_chroms(items, exclude_file): """Retrieve chromosomes to process on, avoiding extra skipped chromosomes. """ exclude_regions = {} for region in pybedtools.BedTool(exclude_file): if int(region.start) == 0: exclude_regions[region.chrom] = int(region.end) out = [] with...
[ "def", "get_sv_chroms", "(", "items", ",", "exclude_file", ")", ":", "exclude_regions", "=", "{", "}", "for", "region", "in", "pybedtools", ".", "BedTool", "(", "exclude_file", ")", ":", "if", "int", "(", "region", ".", "start", ")", "==", "0", ":", "e...
Retrieve chromosomes to process on, avoiding extra skipped chromosomes.
[ "Retrieve", "chromosomes", "to", "process", "on", "avoiding", "extra", "skipped", "chromosomes", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L209-L222
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
_extract_split_and_discordants
def _extract_split_and_discordants(in_bam, work_dir, data): """Retrieve split-read alignments from input BAM file. """ sr_file = os.path.join(work_dir, "%s-sr.bam" % os.path.splitext(os.path.basename(in_bam))[0]) disc_file = os.path.join(work_dir, "%s-disc.bam" % os.path.splitext(os.path.basename(in_bam...
python
def _extract_split_and_discordants(in_bam, work_dir, data): """Retrieve split-read alignments from input BAM file. """ sr_file = os.path.join(work_dir, "%s-sr.bam" % os.path.splitext(os.path.basename(in_bam))[0]) disc_file = os.path.join(work_dir, "%s-disc.bam" % os.path.splitext(os.path.basename(in_bam...
[ "def", "_extract_split_and_discordants", "(", "in_bam", ",", "work_dir", ",", "data", ")", ":", "sr_file", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"%s-sr.bam\"", "%", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", ...
Retrieve split-read alignments from input BAM file.
[ "Retrieve", "split", "-", "read", "alignments", "from", "input", "BAM", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L226-L241
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
find_existing_split_discordants
def find_existing_split_discordants(data): """Check for pre-calculated split reads and discordants done as part of alignment streaming. """ in_bam = dd.get_align_bam(data) sr_file = "%s-sr.bam" % os.path.splitext(in_bam)[0] disc_file = "%s-disc.bam" % os.path.splitext(in_bam)[0] if utils.file_ex...
python
def find_existing_split_discordants(data): """Check for pre-calculated split reads and discordants done as part of alignment streaming. """ in_bam = dd.get_align_bam(data) sr_file = "%s-sr.bam" % os.path.splitext(in_bam)[0] disc_file = "%s-disc.bam" % os.path.splitext(in_bam)[0] if utils.file_ex...
[ "def", "find_existing_split_discordants", "(", "data", ")", ":", "in_bam", "=", "dd", ".", "get_align_bam", "(", "data", ")", "sr_file", "=", "\"%s-sr.bam\"", "%", "os", ".", "path", ".", "splitext", "(", "in_bam", ")", "[", "0", "]", "disc_file", "=", "...
Check for pre-calculated split reads and discordants done as part of alignment streaming.
[ "Check", "for", "pre", "-", "calculated", "split", "reads", "and", "discordants", "done", "as", "part", "of", "alignment", "streaming", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L243-L257
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
get_split_discordants
def get_split_discordants(data, work_dir): """Retrieve split and discordant reads, potentially calculating with extract_sv_reads as needed. """ align_bam = dd.get_align_bam(data) sr_bam, disc_bam = find_existing_split_discordants(data) if not sr_bam: work_dir = (work_dir if not os.access(os....
python
def get_split_discordants(data, work_dir): """Retrieve split and discordant reads, potentially calculating with extract_sv_reads as needed. """ align_bam = dd.get_align_bam(data) sr_bam, disc_bam = find_existing_split_discordants(data) if not sr_bam: work_dir = (work_dir if not os.access(os....
[ "def", "get_split_discordants", "(", "data", ",", "work_dir", ")", ":", "align_bam", "=", "dd", ".", "get_align_bam", "(", "data", ")", "sr_bam", ",", "disc_bam", "=", "find_existing_split_discordants", "(", "data", ")", "if", "not", "sr_bam", ":", "work_dir",...
Retrieve split and discordant reads, potentially calculating with extract_sv_reads as needed.
[ "Retrieve", "split", "and", "discordant", "reads", "potentially", "calculating", "with", "extract_sv_reads", "as", "needed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L259-L268
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
get_cur_batch
def get_cur_batch(items): """Retrieve name of the batch shared between all items in a group. """ batches = [] for data in items: batch = tz.get_in(["metadata", "batch"], data, []) batches.append(set(batch) if isinstance(batch, (list, tuple)) else set([batch])) combo_batches = reduce(...
python
def get_cur_batch(items): """Retrieve name of the batch shared between all items in a group. """ batches = [] for data in items: batch = tz.get_in(["metadata", "batch"], data, []) batches.append(set(batch) if isinstance(batch, (list, tuple)) else set([batch])) combo_batches = reduce(...
[ "def", "get_cur_batch", "(", "items", ")", ":", "batches", "=", "[", "]", "for", "data", "in", "items", ":", "batch", "=", "tz", ".", "get_in", "(", "[", "\"metadata\"", ",", "\"batch\"", "]", ",", "data", ",", "[", "]", ")", "batches", ".", "appen...
Retrieve name of the batch shared between all items in a group.
[ "Retrieve", "name", "of", "the", "batch", "shared", "between", "all", "items", "in", "a", "group", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L270-L283
train
bcbio/bcbio-nextgen
bcbio/structural/shared.py
calc_paired_insert_stats
def calc_paired_insert_stats(in_bam, nsample=1000000): """Retrieve statistics for paired end read insert distances. """ dists = [] n = 0 with pysam.Samfile(in_bam, "rb") as in_pysam: for read in in_pysam: if read.is_proper_pair and read.is_read1: n += 1 ...
python
def calc_paired_insert_stats(in_bam, nsample=1000000): """Retrieve statistics for paired end read insert distances. """ dists = [] n = 0 with pysam.Samfile(in_bam, "rb") as in_pysam: for read in in_pysam: if read.is_proper_pair and read.is_read1: n += 1 ...
[ "def", "calc_paired_insert_stats", "(", "in_bam", ",", "nsample", "=", "1000000", ")", ":", "dists", "=", "[", "]", "n", "=", "0", "with", "pysam", ".", "Samfile", "(", "in_bam", ",", "\"rb\"", ")", "as", "in_pysam", ":", "for", "read", "in", "in_pysam...
Retrieve statistics for paired end read insert distances.
[ "Retrieve", "statistics", "for", "paired", "end", "read", "insert", "distances", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L307-L319
train