id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
224,200
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
get_indelcaller
def get_indelcaller(d_or_c): """Retrieve string for indelcaller to use, or empty string if not specified. """ config = d_or_c if isinstance(d_or_c, dict) and "config" in d_or_c else d_or_c indelcaller = config["algorithm"].get("indelcaller", "") if not indelcaller: indelcaller = "" if is...
python
def get_indelcaller(d_or_c): """Retrieve string for indelcaller to use, or empty string if not specified. """ config = d_or_c if isinstance(d_or_c, dict) and "config" in d_or_c else d_or_c indelcaller = config["algorithm"].get("indelcaller", "") if not indelcaller: indelcaller = "" if is...
[ "def", "get_indelcaller", "(", "d_or_c", ")", ":", "config", "=", "d_or_c", "if", "isinstance", "(", "d_or_c", ",", "dict", ")", "and", "\"config\"", "in", "d_or_c", "else", "d_or_c", "indelcaller", "=", "config", "[", "\"algorithm\"", "]", ".", "get", "("...
Retrieve string for indelcaller to use, or empty string if not specified.
[ "Retrieve", "string", "for", "indelcaller", "to", "use", "or", "empty", "string", "if", "not", "specified", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L140-L149
224,201
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
split_snps_indels
def split_snps_indels(orig_file, ref_file, config): """Split a variant call file into SNPs and INDELs for processing. """ base, ext = utils.splitext_plus(orig_file) snp_file = "{base}-snp{ext}".format(base=base, ext=ext) indel_file = "{base}-indel{ext}".format(base=base, ext=ext) for out_file, s...
python
def split_snps_indels(orig_file, ref_file, config): """Split a variant call file into SNPs and INDELs for processing. """ base, ext = utils.splitext_plus(orig_file) snp_file = "{base}-snp{ext}".format(base=base, ext=ext) indel_file = "{base}-indel{ext}".format(base=base, ext=ext) for out_file, s...
[ "def", "split_snps_indels", "(", "orig_file", ",", "ref_file", ",", "config", ")", ":", "base", ",", "ext", "=", "utils", ".", "splitext_plus", "(", "orig_file", ")", "snp_file", "=", "\"{base}-snp{ext}\"", ".", "format", "(", "base", "=", "base", ",", "ex...
Split a variant call file into SNPs and INDELs for processing.
[ "Split", "a", "variant", "call", "file", "into", "SNPs", "and", "INDELs", "for", "processing", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L183-L199
224,202
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
get_samples
def get_samples(in_file): """Retrieve samples present in a VCF file """ with utils.open_gzipsafe(in_file) as in_handle: for line in in_handle: if line.startswith("#CHROM"): parts = line.strip().split("\t") return parts[9:] raise ValueError("Did not fin...
python
def get_samples(in_file): """Retrieve samples present in a VCF file """ with utils.open_gzipsafe(in_file) as in_handle: for line in in_handle: if line.startswith("#CHROM"): parts = line.strip().split("\t") return parts[9:] raise ValueError("Did not fin...
[ "def", "get_samples", "(", "in_file", ")", ":", "with", "utils", ".", "open_gzipsafe", "(", "in_file", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "if", "line", ".", "startswith", "(", "\"#CHROM\"", ")", ":", "parts", "=", "line",...
Retrieve samples present in a VCF file
[ "Retrieve", "samples", "present", "in", "a", "VCF", "file" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L210-L218
224,203
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_get_exclude_samples
def _get_exclude_samples(in_file, to_exclude): """Identify samples in the exclusion list which are actually in the VCF. """ include, exclude = [], [] to_exclude = set(to_exclude) for s in get_samples(in_file): if s in to_exclude: exclude.append(s) else: includ...
python
def _get_exclude_samples(in_file, to_exclude): """Identify samples in the exclusion list which are actually in the VCF. """ include, exclude = [], [] to_exclude = set(to_exclude) for s in get_samples(in_file): if s in to_exclude: exclude.append(s) else: includ...
[ "def", "_get_exclude_samples", "(", "in_file", ",", "to_exclude", ")", ":", "include", ",", "exclude", "=", "[", "]", ",", "[", "]", "to_exclude", "=", "set", "(", "to_exclude", ")", "for", "s", "in", "get_samples", "(", "in_file", ")", ":", "if", "s",...
Identify samples in the exclusion list which are actually in the VCF.
[ "Identify", "samples", "in", "the", "exclusion", "list", "which", "are", "actually", "in", "the", "VCF", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L220-L230
224,204
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
exclude_samples
def exclude_samples(in_file, out_file, to_exclude, ref_file, config, filters=None): """Exclude specific samples from an input VCF file. """ include, exclude = _get_exclude_samples(in_file, to_exclude) # can use the input sample, all exclusions already gone if len(exclude) == 0: out_file = in...
python
def exclude_samples(in_file, out_file, to_exclude, ref_file, config, filters=None): """Exclude specific samples from an input VCF file. """ include, exclude = _get_exclude_samples(in_file, to_exclude) # can use the input sample, all exclusions already gone if len(exclude) == 0: out_file = in...
[ "def", "exclude_samples", "(", "in_file", ",", "out_file", ",", "to_exclude", ",", "ref_file", ",", "config", ",", "filters", "=", "None", ")", ":", "include", ",", "exclude", "=", "_get_exclude_samples", "(", "in_file", ",", "to_exclude", ")", "# can use the ...
Exclude specific samples from an input VCF file.
[ "Exclude", "specific", "samples", "from", "an", "input", "VCF", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L232-L247
224,205
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
select_sample
def select_sample(in_file, sample, out_file, config, filters=None): """Select a single sample from the supplied multisample VCF file. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: if len(get_samples(in_file)) == 1: shutil....
python
def select_sample(in_file, sample, out_file, config, filters=None): """Select a single sample from the supplied multisample VCF file. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: if len(get_samples(in_file)) == 1: shutil....
[ "def", "select_sample", "(", "in_file", ",", "sample", ",", "out_file", ",", "config", ",", "filters", "=", "None", ")", ":", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "with", "file_transaction", "(", "config", ",", "out_file", ...
Select a single sample from the supplied multisample VCF file.
[ "Select", "a", "single", "sample", "from", "the", "supplied", "multisample", "VCF", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L249-L266
224,206
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
merge_variant_files
def merge_variant_files(orig_files, out_file, ref_file, config, region=None): """Combine multiple VCF files with different samples into a single output file. Uses bcftools merge on bgzipped input files, handling both tricky merge and concatenation of files. Does not correctly handle files with the same ...
python
def merge_variant_files(orig_files, out_file, ref_file, config, region=None): """Combine multiple VCF files with different samples into a single output file. Uses bcftools merge on bgzipped input files, handling both tricky merge and concatenation of files. Does not correctly handle files with the same ...
[ "def", "merge_variant_files", "(", "orig_files", ",", "out_file", ",", "ref_file", ",", "config", ",", "region", "=", "None", ")", ":", "in_pipeline", "=", "False", "if", "isinstance", "(", "orig_files", ",", "dict", ")", ":", "file_key", "=", "config", "[...
Combine multiple VCF files with different samples into a single output file. Uses bcftools merge on bgzipped input files, handling both tricky merge and concatenation of files. Does not correctly handle files with the same sample (use combine_variant_files instead).
[ "Combine", "multiple", "VCF", "files", "with", "different", "samples", "into", "a", "single", "output", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L288-L304
224,207
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_do_merge
def _do_merge(orig_files, out_file, config, region): """Do the actual work of merging with bcftools merge. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: _check_samples_nodups(orig_files) prep_files = run_multicore(p_bgzip_and_...
python
def _do_merge(orig_files, out_file, config, region): """Do the actual work of merging with bcftools merge. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: _check_samples_nodups(orig_files) prep_files = run_multicore(p_bgzip_and_...
[ "def", "_do_merge", "(", "orig_files", ",", "out_file", ",", "config", ",", "region", ")", ":", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "with", "file_transaction", "(", "config", ",", "out_file", ")", "as", "tx_out_file", ":", ...
Do the actual work of merging with bcftools merge.
[ "Do", "the", "actual", "work", "of", "merging", "with", "bcftools", "merge", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L306-L324
224,208
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_check_samples_nodups
def _check_samples_nodups(fnames): """Ensure a set of input VCFs do not have duplicate samples. """ counts = defaultdict(int) for f in fnames: for s in get_samples(f): counts[s] += 1 duplicates = [s for s, c in counts.items() if c > 1] if duplicates: raise ValueError(...
python
def _check_samples_nodups(fnames): """Ensure a set of input VCFs do not have duplicate samples. """ counts = defaultdict(int) for f in fnames: for s in get_samples(f): counts[s] += 1 duplicates = [s for s, c in counts.items() if c > 1] if duplicates: raise ValueError(...
[ "def", "_check_samples_nodups", "(", "fnames", ")", ":", "counts", "=", "defaultdict", "(", "int", ")", "for", "f", "in", "fnames", ":", "for", "s", "in", "get_samples", "(", "f", ")", ":", "counts", "[", "s", "]", "+=", "1", "duplicates", "=", "[", ...
Ensure a set of input VCFs do not have duplicate samples.
[ "Ensure", "a", "set", "of", "input", "VCFs", "do", "not", "have", "duplicate", "samples", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L326-L335
224,209
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_sort_by_region
def _sort_by_region(fnames, regions, ref_file, config): """Sort a set of regionally split files by region for ordered output. """ contig_order = {} for i, sq in enumerate(ref.file_contigs(ref_file, config)): contig_order[sq.name] = i sitems = [] assert len(regions) == len(fnames), (regio...
python
def _sort_by_region(fnames, regions, ref_file, config): """Sort a set of regionally split files by region for ordered output. """ contig_order = {} for i, sq in enumerate(ref.file_contigs(ref_file, config)): contig_order[sq.name] = i sitems = [] assert len(regions) == len(fnames), (regio...
[ "def", "_sort_by_region", "(", "fnames", ",", "regions", ",", "ref_file", ",", "config", ")", ":", "contig_order", "=", "{", "}", "for", "i", ",", "sq", "in", "enumerate", "(", "ref", ".", "file_contigs", "(", "ref_file", ",", "config", ")", ")", ":", ...
Sort a set of regionally split files by region for ordered output.
[ "Sort", "a", "set", "of", "regionally", "split", "files", "by", "region", "for", "ordered", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L337-L359
224,210
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
concat_variant_files
def concat_variant_files(orig_files, out_file, regions, ref_file, config): """Concatenate multiple variant files from regions into a single output file. Uses GATK4's GatherVcfs, falling back to bcftools concat --naive if it fails. These both only combine samples and avoid parsing, allowing scaling to large...
python
def concat_variant_files(orig_files, out_file, regions, ref_file, config): """Concatenate multiple variant files from regions into a single output file. Uses GATK4's GatherVcfs, falling back to bcftools concat --naive if it fails. These both only combine samples and avoid parsing, allowing scaling to large...
[ "def", "concat_variant_files", "(", "orig_files", ",", "out_file", ",", "regions", ",", "ref_file", ",", "config", ")", ":", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "input_file_list", "=", "_get_file_list", "(", "orig_files", ",", ...
Concatenate multiple variant files from regions into a single output file. Uses GATK4's GatherVcfs, falling back to bcftools concat --naive if it fails. These both only combine samples and avoid parsing, allowing scaling to large file sizes.
[ "Concatenate", "multiple", "variant", "files", "from", "regions", "into", "a", "single", "output", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L361-L381
224,211
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_run_concat_variant_files_gatk4
def _run_concat_variant_files_gatk4(input_file_list, out_file, config): """Use GATK4 GatherVcfs for concatenation of scattered VCFs. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: params = ["-T", "GatherVcfs", "-I", input_file_list, "-O", ...
python
def _run_concat_variant_files_gatk4(input_file_list, out_file, config): """Use GATK4 GatherVcfs for concatenation of scattered VCFs. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: params = ["-T", "GatherVcfs", "-I", input_file_list, "-O", ...
[ "def", "_run_concat_variant_files_gatk4", "(", "input_file_list", ",", "out_file", ",", "config", ")", ":", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "with", "file_transaction", "(", "config", ",", "out_file", ")", "as", "tx_out_file",...
Use GATK4 GatherVcfs for concatenation of scattered VCFs.
[ "Use", "GATK4", "GatherVcfs", "for", "concatenation", "of", "scattered", "VCFs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L383-L400
224,212
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_get_file_list
def _get_file_list(orig_files, out_file, regions, ref_file, config): """Create file with region sorted list of non-empty VCFs for concatenating. """ sorted_files = _sort_by_region(orig_files, regions, ref_file, config) exist_files = [(c, x) for c, x in sorted_files if os.path.exists(x) and vcf_has_varia...
python
def _get_file_list(orig_files, out_file, regions, ref_file, config): """Create file with region sorted list of non-empty VCFs for concatenating. """ sorted_files = _sort_by_region(orig_files, regions, ref_file, config) exist_files = [(c, x) for c, x in sorted_files if os.path.exists(x) and vcf_has_varia...
[ "def", "_get_file_list", "(", "orig_files", ",", "out_file", ",", "regions", ",", "ref_file", ",", "config", ")", ":", "sorted_files", "=", "_sort_by_region", "(", "orig_files", ",", "regions", ",", "ref_file", ",", "config", ")", "exist_files", "=", "[", "(...
Create file with region sorted list of non-empty VCFs for concatenating.
[ "Create", "file", "with", "region", "sorted", "list", "of", "non", "-", "empty", "VCFs", "for", "concatenating", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L402-L418
224,213
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_fix_gatk_header
def _fix_gatk_header(exist_files, out_file, config): """Ensure consistent headers for VCF concatenation. Fixes problems for genomes that start with chrM by reheadering the first file. These files do haploid variant calling which lack the PID phasing key/value pair in FORMAT, so initial chrM samples cau...
python
def _fix_gatk_header(exist_files, out_file, config): """Ensure consistent headers for VCF concatenation. Fixes problems for genomes that start with chrM by reheadering the first file. These files do haploid variant calling which lack the PID phasing key/value pair in FORMAT, so initial chrM samples cau...
[ "def", "_fix_gatk_header", "(", "exist_files", ",", "out_file", ",", "config", ")", ":", "from", "bcbio", ".", "variation", "import", "ploidy", "c", ",", "base_file", "=", "exist_files", "[", "0", "]", "replace_file", "=", "base_file", "items", "=", "[", "...
Ensure consistent headers for VCF concatenation. Fixes problems for genomes that start with chrM by reheadering the first file. These files do haploid variant calling which lack the PID phasing key/value pair in FORMAT, so initial chrM samples cause errors during concatenation due to the lack of header...
[ "Ensure", "consistent", "headers", "for", "VCF", "concatenation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L420-L451
224,214
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
_run_concat_variant_files_bcftools
def _run_concat_variant_files_bcftools(in_list, out_file, config, naive=False): """Concatenate variant files using bcftools concat, potentially using the fast naive option. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: bcftools = config_u...
python
def _run_concat_variant_files_bcftools(in_list, out_file, config, naive=False): """Concatenate variant files using bcftools concat, potentially using the fast naive option. """ if not utils.file_exists(out_file): with file_transaction(config, out_file) as tx_out_file: bcftools = config_u...
[ "def", "_run_concat_variant_files_bcftools", "(", "in_list", ",", "out_file", ",", "config", ",", "naive", "=", "False", ")", ":", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "with", "file_transaction", "(", "config", ",", "out_file", ...
Concatenate variant files using bcftools concat, potentially using the fast naive option.
[ "Concatenate", "variant", "files", "using", "bcftools", "concat", "potentially", "using", "the", "fast", "naive", "option", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L465-L480
224,215
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
combine_variant_files
def combine_variant_files(orig_files, out_file, ref_file, config, quiet_out=True, region=None): """Combine VCF files from the same sample into a single output file. Handles cases where we split files into SNPs/Indels for processing then need to merge back into a final file. ""...
python
def combine_variant_files(orig_files, out_file, ref_file, config, quiet_out=True, region=None): """Combine VCF files from the same sample into a single output file. Handles cases where we split files into SNPs/Indels for processing then need to merge back into a final file. ""...
[ "def", "combine_variant_files", "(", "orig_files", ",", "out_file", ",", "ref_file", ",", "config", ",", "quiet_out", "=", "True", ",", "region", "=", "None", ")", ":", "in_pipeline", "=", "False", "if", "isinstance", "(", "orig_files", ",", "dict", ")", "...
Combine VCF files from the same sample into a single output file. Handles cases where we split files into SNPs/Indels for processing then need to merge back into a final file.
[ "Combine", "VCF", "files", "from", "the", "same", "sample", "into", "a", "single", "output", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L482-L511
224,216
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
sort_by_ref
def sort_by_ref(vcf_file, data): """Sort a VCF file by genome reference and position, adding contig information. """ out_file = "%s-prep.vcf.gz" % utils.splitext_plus(vcf_file)[0] if not utils.file_uptodate(out_file, vcf_file): with file_transaction(data, out_file) as tx_out_file: he...
python
def sort_by_ref(vcf_file, data): """Sort a VCF file by genome reference and position, adding contig information. """ out_file = "%s-prep.vcf.gz" % utils.splitext_plus(vcf_file)[0] if not utils.file_uptodate(out_file, vcf_file): with file_transaction(data, out_file) as tx_out_file: he...
[ "def", "sort_by_ref", "(", "vcf_file", ",", "data", ")", ":", "out_file", "=", "\"%s-prep.vcf.gz\"", "%", "utils", ".", "splitext_plus", "(", "vcf_file", ")", "[", "0", "]", "if", "not", "utils", ".", "file_uptodate", "(", "out_file", ",", "vcf_file", ")",...
Sort a VCF file by genome reference and position, adding contig information.
[ "Sort", "a", "VCF", "file", "by", "genome", "reference", "and", "position", "adding", "contig", "information", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L513-L528
224,217
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
add_contig_to_header
def add_contig_to_header(line, ref_file): """Streaming target to add contigs to a VCF file header. """ if line.startswith("##fileformat=VCF"): out = [line] for region in ref.file_contigs(ref_file): out.append("##contig=<ID=%s,length=%s>" % (region.name, region.size)) retu...
python
def add_contig_to_header(line, ref_file): """Streaming target to add contigs to a VCF file header. """ if line.startswith("##fileformat=VCF"): out = [line] for region in ref.file_contigs(ref_file): out.append("##contig=<ID=%s,length=%s>" % (region.name, region.size)) retu...
[ "def", "add_contig_to_header", "(", "line", ",", "ref_file", ")", ":", "if", "line", ".", "startswith", "(", "\"##fileformat=VCF\"", ")", ":", "out", "=", "[", "line", "]", "for", "region", "in", "ref", ".", "file_contigs", "(", "ref_file", ")", ":", "ou...
Streaming target to add contigs to a VCF file header.
[ "Streaming", "target", "to", "add", "contigs", "to", "a", "VCF", "file", "header", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L539-L548
224,218
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
parallel_combine_variants
def parallel_combine_variants(orig_files, out_file, ref_file, config, run_parallel): """Combine variants in parallel by chromosome, concatenating final outputs. """ file_key = "vcf_files" def split_by_region(data): base, ext = utils.splitext_plus(os.path.basename(out_file)) args = [] ...
python
def parallel_combine_variants(orig_files, out_file, ref_file, config, run_parallel): """Combine variants in parallel by chromosome, concatenating final outputs. """ file_key = "vcf_files" def split_by_region(data): base, ext = utils.splitext_plus(os.path.basename(out_file)) args = [] ...
[ "def", "parallel_combine_variants", "(", "orig_files", ",", "out_file", ",", "ref_file", ",", "config", ",", "run_parallel", ")", ":", "file_key", "=", "\"vcf_files\"", "def", "split_by_region", "(", "data", ")", ":", "base", ",", "ext", "=", "utils", ".", "...
Combine variants in parallel by chromosome, concatenating final outputs.
[ "Combine", "variants", "in", "parallel", "by", "chromosome", "concatenating", "final", "outputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L552-L572
224,219
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
move_vcf
def move_vcf(orig_file, new_file): """Move a VCF file with associated index. """ for ext in ["", ".idx", ".tbi"]: to_move = orig_file + ext if os.path.exists(to_move): shutil.move(to_move, new_file + ext)
python
def move_vcf(orig_file, new_file): """Move a VCF file with associated index. """ for ext in ["", ".idx", ".tbi"]: to_move = orig_file + ext if os.path.exists(to_move): shutil.move(to_move, new_file + ext)
[ "def", "move_vcf", "(", "orig_file", ",", "new_file", ")", ":", "for", "ext", "in", "[", "\"\"", ",", "\".idx\"", ",", "\".tbi\"", "]", ":", "to_move", "=", "orig_file", "+", "ext", "if", "os", ".", "path", ".", "exists", "(", "to_move", ")", ":", ...
Move a VCF file with associated index.
[ "Move", "a", "VCF", "file", "with", "associated", "index", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L576-L582
224,220
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
bgzip_and_index
def bgzip_and_index(in_file, config=None, remove_orig=True, prep_cmd="", tabix_args=None, out_dir=None): """bgzip and tabix index an input file, handling VCF and BED. """ if config is None: config = {} out_file = in_file if in_file.endswith(".gz") else in_file + ".gz" if out_dir: rem...
python
def bgzip_and_index(in_file, config=None, remove_orig=True, prep_cmd="", tabix_args=None, out_dir=None): """bgzip and tabix index an input file, handling VCF and BED. """ if config is None: config = {} out_file = in_file if in_file.endswith(".gz") else in_file + ".gz" if out_dir: rem...
[ "def", "bgzip_and_index", "(", "in_file", ",", "config", "=", "None", ",", "remove_orig", "=", "True", ",", "prep_cmd", "=", "\"\"", ",", "tabix_args", "=", "None", ",", "out_dir", "=", "None", ")", ":", "if", "config", "is", "None", ":", "config", "="...
bgzip and tabix index an input file, handling VCF and BED.
[ "bgzip", "and", "tabix", "index", "an", "input", "file", "handling", "VCF", "and", "BED", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L584-L616
224,221
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
tabix_index
def tabix_index(in_file, config, preset=None, tabix_args=None): """Index a file using tabix. """ in_file = os.path.abspath(in_file) out_file = in_file + ".tbi" if not utils.file_exists(out_file) or not utils.file_uptodate(out_file, in_file): # Remove old index files to prevent linking into t...
python
def tabix_index(in_file, config, preset=None, tabix_args=None): """Index a file using tabix. """ in_file = os.path.abspath(in_file) out_file = in_file + ".tbi" if not utils.file_exists(out_file) or not utils.file_uptodate(out_file, in_file): # Remove old index files to prevent linking into t...
[ "def", "tabix_index", "(", "in_file", ",", "config", ",", "preset", "=", "None", ",", "tabix_args", "=", "None", ")", ":", "in_file", "=", "os", ".", "path", ".", "abspath", "(", "in_file", ")", "out_file", "=", "in_file", "+", "\".tbi\"", "if", "not",...
Index a file using tabix.
[ "Index", "a", "file", "using", "tabix", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L635-L653
224,222
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
is_gvcf_file
def is_gvcf_file(in_file): """Check if an input file is raw gVCF """ to_check = 100 n = 0 with utils.open_gzipsafe(in_file) as in_handle: for line in in_handle: if not line.startswith("##"): if n > to_check: break n += 1 ...
python
def is_gvcf_file(in_file): """Check if an input file is raw gVCF """ to_check = 100 n = 0 with utils.open_gzipsafe(in_file) as in_handle: for line in in_handle: if not line.startswith("##"): if n > to_check: break n += 1 ...
[ "def", "is_gvcf_file", "(", "in_file", ")", ":", "to_check", "=", "100", "n", "=", "0", "with", "utils", ".", "open_gzipsafe", "(", "in_file", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "if", "not", "line", ".", "startswith", "...
Check if an input file is raw gVCF
[ "Check", "if", "an", "input", "file", "is", "raw", "gVCF" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L655-L678
224,223
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
cyvcf_add_filter
def cyvcf_add_filter(rec, name): """Add a FILTER value to a cyvcf2 record """ if rec.FILTER: filters = rec.FILTER.split(";") else: filters = [] if name not in filters: filters.append(name) rec.FILTER = filters return rec
python
def cyvcf_add_filter(rec, name): """Add a FILTER value to a cyvcf2 record """ if rec.FILTER: filters = rec.FILTER.split(";") else: filters = [] if name not in filters: filters.append(name) rec.FILTER = filters return rec
[ "def", "cyvcf_add_filter", "(", "rec", ",", "name", ")", ":", "if", "rec", ".", "FILTER", ":", "filters", "=", "rec", ".", "FILTER", ".", "split", "(", "\";\"", ")", "else", ":", "filters", "=", "[", "]", "if", "name", "not", "in", "filters", ":", ...
Add a FILTER value to a cyvcf2 record
[ "Add", "a", "FILTER", "value", "to", "a", "cyvcf2", "record" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L680-L690
224,224
bcbio/bcbio-nextgen
bcbio/variation/vcfutils.py
cyvcf_remove_filter
def cyvcf_remove_filter(rec, name): """Remove filter with the given name from a cyvcf2 record """ if rec.FILTER: filters = rec.FILTER.split(";") else: filters = [] new_filters = [x for x in filters if not str(x) == name] if len(new_filters) == 0: new_filters = ["PASS"] ...
python
def cyvcf_remove_filter(rec, name): """Remove filter with the given name from a cyvcf2 record """ if rec.FILTER: filters = rec.FILTER.split(";") else: filters = [] new_filters = [x for x in filters if not str(x) == name] if len(new_filters) == 0: new_filters = ["PASS"] ...
[ "def", "cyvcf_remove_filter", "(", "rec", ",", "name", ")", ":", "if", "rec", ".", "FILTER", ":", "filters", "=", "rec", ".", "FILTER", ".", "split", "(", "\";\"", ")", "else", ":", "filters", "=", "[", "]", "new_filters", "=", "[", "x", "for", "x"...
Remove filter with the given name from a cyvcf2 record
[ "Remove", "filter", "with", "the", "given", "name", "from", "a", "cyvcf2", "record" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfutils.py#L692-L703
224,225
bcbio/bcbio-nextgen
bcbio/pipeline/alignment.py
organize_noalign
def organize_noalign(data): """CWL target to skip alignment and organize input data. """ data = utils.to_single_data(data[0]) work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "align", dd.get_sample_name(data))) work_bam = os.path.join(work_dir, "%s-input.bam" % dd.get_sample_name(da...
python
def organize_noalign(data): """CWL target to skip alignment and organize input data. """ data = utils.to_single_data(data[0]) work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "align", dd.get_sample_name(data))) work_bam = os.path.join(work_dir, "%s-input.bam" % dd.get_sample_name(da...
[ "def", "organize_noalign", "(", "data", ")", ":", "data", "=", "utils", ".", "to_single_data", "(", "data", "[", "0", "]", ")", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "dd", ".", "get_work_dir", "(", "...
CWL target to skip alignment and organize input data.
[ "CWL", "target", "to", "skip", "alignment", "and", "organize", "input", "data", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/alignment.py#L53-L69
224,226
bcbio/bcbio-nextgen
bcbio/pipeline/alignment.py
align_to_sort_bam
def align_to_sort_bam(fastq1, fastq2, aligner, data): """Align to the named genome build, returning a sorted BAM file. """ names = data["rgnames"] align_dir_parts = [data["dirs"]["work"], "align", names["sample"]] if data.get("disambiguate"): align_dir_parts.append(data["disambiguate"]["geno...
python
def align_to_sort_bam(fastq1, fastq2, aligner, data): """Align to the named genome build, returning a sorted BAM file. """ names = data["rgnames"] align_dir_parts = [data["dirs"]["work"], "align", names["sample"]] if data.get("disambiguate"): align_dir_parts.append(data["disambiguate"]["geno...
[ "def", "align_to_sort_bam", "(", "fastq1", ",", "fastq2", ",", "aligner", ",", "data", ")", ":", "names", "=", "data", "[", "\"rgnames\"", "]", "align_dir_parts", "=", "[", "data", "[", "\"dirs\"", "]", "[", "\"work\"", "]", ",", "\"align\"", ",", "names...
Align to the named genome build, returning a sorted BAM file.
[ "Align", "to", "the", "named", "genome", "build", "returning", "a", "sorted", "BAM", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/alignment.py#L71-L98
224,227
bcbio/bcbio-nextgen
bcbio/pipeline/alignment.py
get_aligner_with_aliases
def get_aligner_with_aliases(aligner, data): """Retrieve aligner index retriever, including aliases for shared. Handles tricky cases like gridss where we need bwa indices even with no aligner specified since they're used internally within GRIDSS. """ aligner_aliases = {"sentieon-bwa": "bwa"} fr...
python
def get_aligner_with_aliases(aligner, data): """Retrieve aligner index retriever, including aliases for shared. Handles tricky cases like gridss where we need bwa indices even with no aligner specified since they're used internally within GRIDSS. """ aligner_aliases = {"sentieon-bwa": "bwa"} fr...
[ "def", "get_aligner_with_aliases", "(", "aligner", ",", "data", ")", ":", "aligner_aliases", "=", "{", "\"sentieon-bwa\"", ":", "\"bwa\"", "}", "from", "bcbio", "import", "structural", "if", "not", "aligner", "and", "\"gridss\"", "in", "structural", ".", "get_sv...
Retrieve aligner index retriever, including aliases for shared. Handles tricky cases like gridss where we need bwa indices even with no aligner specified since they're used internally within GRIDSS.
[ "Retrieve", "aligner", "index", "retriever", "including", "aliases", "for", "shared", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/alignment.py#L100-L110
224,228
bcbio/bcbio-nextgen
bcbio/pipeline/alignment.py
_get_aligner_index
def _get_aligner_index(aligner, data): """Handle multiple specifications of aligner indexes, returning value to pass to aligner. Original bcbio case -- a list of indices. CWL case: a single file with secondaryFiles staged in the same directory. """ aligner_indexes = tz.get_in(("reference", get_alig...
python
def _get_aligner_index(aligner, data): """Handle multiple specifications of aligner indexes, returning value to pass to aligner. Original bcbio case -- a list of indices. CWL case: a single file with secondaryFiles staged in the same directory. """ aligner_indexes = tz.get_in(("reference", get_alig...
[ "def", "_get_aligner_index", "(", "aligner", ",", "data", ")", ":", "aligner_indexes", "=", "tz", ".", "get_in", "(", "(", "\"reference\"", ",", "get_aligner_with_aliases", "(", "aligner", ",", "data", ")", ",", "\"indexes\"", ")", ",", "data", ")", "# stand...
Handle multiple specifications of aligner indexes, returning value to pass to aligner. Original bcbio case -- a list of indices. CWL case: a single file with secondaryFiles staged in the same directory.
[ "Handle", "multiple", "specifications", "of", "aligner", "indexes", "returning", "value", "to", "pass", "to", "aligner", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/alignment.py#L115-L139
224,229
bcbio/bcbio-nextgen
bcbio/pipeline/alignment.py
_align_from_fastq
def _align_from_fastq(fastq1, fastq2, aligner, align_ref, sam_ref, names, align_dir, data): """Align from fastq inputs, producing sorted BAM output. """ config = data["config"] align_fn = TOOLS[aligner].align_fn out = align_fn(fastq1, fastq2, align_ref, names, align_dir, data) ...
python
def _align_from_fastq(fastq1, fastq2, aligner, align_ref, sam_ref, names, align_dir, data): """Align from fastq inputs, producing sorted BAM output. """ config = data["config"] align_fn = TOOLS[aligner].align_fn out = align_fn(fastq1, fastq2, align_ref, names, align_dir, data) ...
[ "def", "_align_from_fastq", "(", "fastq1", ",", "fastq2", ",", "aligner", ",", "align_ref", ",", "sam_ref", ",", "names", ",", "align_dir", ",", "data", ")", ":", "config", "=", "data", "[", "\"config\"", "]", "align_fn", "=", "TOOLS", "[", "aligner", "]...
Align from fastq inputs, producing sorted BAM output.
[ "Align", "from", "fastq", "inputs", "producing", "sorted", "BAM", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/alignment.py#L155-L170
224,230
bcbio/bcbio-nextgen
bcbio/structural/gridss.py
_finalize_memory
def _finalize_memory(jvm_opts): """GRIDSS does not recommend setting memory between 32 and 48Gb. https://github.com/PapenfussLab/gridss#memory-usage """ avoid_min = 32 avoid_max = 48 out_opts = [] for opt in jvm_opts: if opt.startswith("-Xmx"): spec = opt[4:] ...
python
def _finalize_memory(jvm_opts): """GRIDSS does not recommend setting memory between 32 and 48Gb. https://github.com/PapenfussLab/gridss#memory-usage """ avoid_min = 32 avoid_max = 48 out_opts = [] for opt in jvm_opts: if opt.startswith("-Xmx"): spec = opt[4:] ...
[ "def", "_finalize_memory", "(", "jvm_opts", ")", ":", "avoid_min", "=", "32", "avoid_max", "=", "48", "out_opts", "=", "[", "]", "for", "opt", "in", "jvm_opts", ":", "if", "opt", ".", "startswith", "(", "\"-Xmx\"", ")", ":", "spec", "=", "opt", "[", ...
GRIDSS does not recommend setting memory between 32 and 48Gb. https://github.com/PapenfussLab/gridss#memory-usage
[ "GRIDSS", "does", "not", "recommend", "setting", "memory", "between", "32", "and", "48Gb", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gridss.py#L70-L94
224,231
bcbio/bcbio-nextgen
bcbio/structural/gridss.py
_setup_reference_files
def _setup_reference_files(data, tx_out_dir): """Create a reference directory with fasta and bwa indices. GRIDSS requires all files in a single directory, so setup with symlinks. This needs bwa aligner indices available, which we ensure with `get_aligner_with_aliases` during YAML sample setup. """ ...
python
def _setup_reference_files(data, tx_out_dir): """Create a reference directory with fasta and bwa indices. GRIDSS requires all files in a single directory, so setup with symlinks. This needs bwa aligner indices available, which we ensure with `get_aligner_with_aliases` during YAML sample setup. """ ...
[ "def", "_setup_reference_files", "(", "data", ",", "tx_out_dir", ")", ":", "aligner", "=", "dd", ".", "get_aligner", "(", "data", ")", "or", "\"bwa\"", "out_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "tx_out_dir", ...
Create a reference directory with fasta and bwa indices. GRIDSS requires all files in a single directory, so setup with symlinks. This needs bwa aligner indices available, which we ensure with `get_aligner_with_aliases` during YAML sample setup.
[ "Create", "a", "reference", "directory", "with", "fasta", "and", "bwa", "indices", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gridss.py#L96-L109
224,232
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_add_versions
def _add_versions(samples): """Add tool and data versions to the summary. """ samples[0]["versions"] = {"tools": programs.write_versions(samples[0]["dirs"], samples[0]["config"]), "data": provenancedata.write_versions(samples[0]["dirs"], samples)} return samples
python
def _add_versions(samples): """Add tool and data versions to the summary. """ samples[0]["versions"] = {"tools": programs.write_versions(samples[0]["dirs"], samples[0]["config"]), "data": provenancedata.write_versions(samples[0]["dirs"], samples)} return samples
[ "def", "_add_versions", "(", "samples", ")", ":", "samples", "[", "0", "]", "[", "\"versions\"", "]", "=", "{", "\"tools\"", ":", "programs", ".", "write_versions", "(", "samples", "[", "0", "]", "[", "\"dirs\"", "]", ",", "samples", "[", "0", "]", "...
Add tool and data versions to the summary.
[ "Add", "tool", "and", "data", "versions", "to", "the", "summary", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L109-L114
224,233
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_summarize_inputs
def _summarize_inputs(samples, out_dir): """Summarize inputs for MultiQC reporting in display. """ logger.info("summarize target information") if samples[0].get("analysis", "").lower() in ["variant", "variant2"]: metrics_dir = utils.safe_makedir(os.path.join(out_dir, "report", "metrics")) ...
python
def _summarize_inputs(samples, out_dir): """Summarize inputs for MultiQC reporting in display. """ logger.info("summarize target information") if samples[0].get("analysis", "").lower() in ["variant", "variant2"]: metrics_dir = utils.safe_makedir(os.path.join(out_dir, "report", "metrics")) ...
[ "def", "_summarize_inputs", "(", "samples", ",", "out_dir", ")", ":", "logger", ".", "info", "(", "\"summarize target information\"", ")", "if", "samples", "[", "0", "]", ".", "get", "(", "\"analysis\"", ",", "\"\"", ")", ".", "lower", "(", ")", "in", "[...
Summarize inputs for MultiQC reporting in display.
[ "Summarize", "inputs", "for", "MultiQC", "reporting", "in", "display", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L116-L135
224,234
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_work_path_to_rel_final_path
def _work_path_to_rel_final_path(path, upload_path_mapping, upload_base_dir): """ Check if `path` is a work-rooted path, and convert to a relative final-rooted path """ if not path or not isinstance(path, str): return path upload_path = None # First, check in the mapping: if it's there is a...
python
def _work_path_to_rel_final_path(path, upload_path_mapping, upload_base_dir): """ Check if `path` is a work-rooted path, and convert to a relative final-rooted path """ if not path or not isinstance(path, str): return path upload_path = None # First, check in the mapping: if it's there is a...
[ "def", "_work_path_to_rel_final_path", "(", "path", ",", "upload_path_mapping", ",", "upload_base_dir", ")", ":", "if", "not", "path", "or", "not", "isinstance", "(", "path", ",", "str", ")", ":", "return", "path", "upload_path", "=", "None", "# First, check in ...
Check if `path` is a work-rooted path, and convert to a relative final-rooted path
[ "Check", "if", "path", "is", "a", "work", "-", "rooted", "path", "and", "convert", "to", "a", "relative", "final", "-", "rooted", "path" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L195-L222
224,235
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_one_exists
def _one_exists(input_files): """ at least one file must exist for multiqc to run properly """ for f in input_files: if os.path.exists(f): return True return False
python
def _one_exists(input_files): """ at least one file must exist for multiqc to run properly """ for f in input_files: if os.path.exists(f): return True return False
[ "def", "_one_exists", "(", "input_files", ")", ":", "for", "f", "in", "input_files", ":", "if", "os", ".", "path", ".", "exists", "(", "f", ")", ":", "return", "True", "return", "False" ]
at least one file must exist for multiqc to run properly
[ "at", "least", "one", "file", "must", "exist", "for", "multiqc", "to", "run", "properly" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L224-L231
224,236
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_get_input_files
def _get_input_files(samples, base_dir, tx_out_dir): """Retrieve input files, keyed by sample and QC method name. Stages files into the work directory to ensure correct names for MultiQC sample assessment when running with CWL. """ in_files = collections.defaultdict(list) for data in samples: ...
python
def _get_input_files(samples, base_dir, tx_out_dir): """Retrieve input files, keyed by sample and QC method name. Stages files into the work directory to ensure correct names for MultiQC sample assessment when running with CWL. """ in_files = collections.defaultdict(list) for data in samples: ...
[ "def", "_get_input_files", "(", "samples", ",", "base_dir", ",", "tx_out_dir", ")", ":", "in_files", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "data", "in", "samples", ":", "sum_qc", "=", "tz", ".", "get_in", "(", "[", "\"summary\"",...
Retrieve input files, keyed by sample and QC method name. Stages files into the work directory to ensure correct names for MultiQC sample assessment when running with CWL.
[ "Retrieve", "input", "files", "keyed", "by", "sample", "and", "QC", "method", "name", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L233-L276
224,237
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_group_by_sample_and_batch
def _group_by_sample_and_batch(samples): """Group samples split by QC method back one per sample-batch. """ out = collections.defaultdict(list) for data in samples: out[(dd.get_sample_name(data), dd.get_align_bam(data), tuple(_get_batches(data)))].append(data) return [xs[0] for xs in out.val...
python
def _group_by_sample_and_batch(samples): """Group samples split by QC method back one per sample-batch. """ out = collections.defaultdict(list) for data in samples: out[(dd.get_sample_name(data), dd.get_align_bam(data), tuple(_get_batches(data)))].append(data) return [xs[0] for xs in out.val...
[ "def", "_group_by_sample_and_batch", "(", "samples", ")", ":", "out", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "data", "in", "samples", ":", "out", "[", "(", "dd", ".", "get_sample_name", "(", "data", ")", ",", "dd", ".", "get_ali...
Group samples split by QC method back one per sample-batch.
[ "Group", "samples", "split", "by", "QC", "method", "back", "one", "per", "sample", "-", "batch", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L287-L293
224,238
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_has_bcftools_germline_stats
def _has_bcftools_germline_stats(data): """Check for the presence of a germline stats file, CWL compatible. """ stats_file = tz.get_in(["summary", "qc"], data) if isinstance(stats_file, dict): stats_file = tz.get_in(["variants", "base"], stats_file) if not stats_file: stats_file = ""...
python
def _has_bcftools_germline_stats(data): """Check for the presence of a germline stats file, CWL compatible. """ stats_file = tz.get_in(["summary", "qc"], data) if isinstance(stats_file, dict): stats_file = tz.get_in(["variants", "base"], stats_file) if not stats_file: stats_file = ""...
[ "def", "_has_bcftools_germline_stats", "(", "data", ")", ":", "stats_file", "=", "tz", ".", "get_in", "(", "[", "\"summary\"", ",", "\"qc\"", "]", ",", "data", ")", "if", "isinstance", "(", "stats_file", ",", "dict", ")", ":", "stats_file", "=", "tz", "....
Check for the presence of a germline stats file, CWL compatible.
[ "Check", "for", "the", "presence", "of", "a", "germline", "stats", "file", "CWL", "compatible", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L397-L405
224,239
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_is_good_file_for_multiqc
def _is_good_file_for_multiqc(fpath): """Returns False if the file is binary or image.""" # Use mimetypes to exclude binary files where possible (ftype, encoding) = mimetypes.guess_type(fpath) if encoding is not None: return False if ftype is not None and ftype.startswith('image'): r...
python
def _is_good_file_for_multiqc(fpath): """Returns False if the file is binary or image.""" # Use mimetypes to exclude binary files where possible (ftype, encoding) = mimetypes.guess_type(fpath) if encoding is not None: return False if ftype is not None and ftype.startswith('image'): r...
[ "def", "_is_good_file_for_multiqc", "(", "fpath", ")", ":", "# Use mimetypes to exclude binary files where possible", "(", "ftype", ",", "encoding", ")", "=", "mimetypes", ".", "guess_type", "(", "fpath", ")", "if", "encoding", "is", "not", "None", ":", "return", ...
Returns False if the file is binary or image.
[ "Returns", "False", "if", "the", "file", "is", "binary", "or", "image", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L414-L422
224,240
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_parse_disambiguate
def _parse_disambiguate(disambiguatestatsfilename): """Parse disambiguation stats from given file. """ disambig_stats = [0, 0, 0] with open(disambiguatestatsfilename, "r") as in_handle: for i, line in enumerate(in_handle): fields = line.strip().split("\t") if i == 0: ...
python
def _parse_disambiguate(disambiguatestatsfilename): """Parse disambiguation stats from given file. """ disambig_stats = [0, 0, 0] with open(disambiguatestatsfilename, "r") as in_handle: for i, line in enumerate(in_handle): fields = line.strip().split("\t") if i == 0: ...
[ "def", "_parse_disambiguate", "(", "disambiguatestatsfilename", ")", ":", "disambig_stats", "=", "[", "0", ",", "0", ",", "0", "]", "with", "open", "(", "disambiguatestatsfilename", ",", "\"r\"", ")", "as", "in_handle", ":", "for", "i", ",", "line", "in", ...
Parse disambiguation stats from given file.
[ "Parse", "disambiguation", "stats", "from", "given", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L424-L435
224,241
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_merge_metrics
def _merge_metrics(samples, out_dir): """Merge metrics from multiple QC steps """ logger.info("summarize metrics") out_dir = utils.safe_makedir(os.path.join(out_dir, "report", "metrics")) sample_metrics = collections.defaultdict(dict) for s in samples: s = _add_disambiguate(s) m ...
python
def _merge_metrics(samples, out_dir): """Merge metrics from multiple QC steps """ logger.info("summarize metrics") out_dir = utils.safe_makedir(os.path.join(out_dir, "report", "metrics")) sample_metrics = collections.defaultdict(dict) for s in samples: s = _add_disambiguate(s) m ...
[ "def", "_merge_metrics", "(", "samples", ",", "out_dir", ")", ":", "logger", ".", "info", "(", "\"summarize metrics\"", ")", "out_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"report\"", ",", "\"metri...
Merge metrics from multiple QC steps
[ "Merge", "metrics", "from", "multiple", "QC", "steps" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L456-L484
224,242
bcbio/bcbio-nextgen
bcbio/qc/multiqc.py
_merge_fastqc
def _merge_fastqc(samples): """ merge all fastqc samples into one by module """ fastqc_list = collections.defaultdict(list) seen = set() for data in samples: name = dd.get_sample_name(data) if name in seen: continue seen.add(name) fns = glob.glob(os.pa...
python
def _merge_fastqc(samples): """ merge all fastqc samples into one by module """ fastqc_list = collections.defaultdict(list) seen = set() for data in samples: name = dd.get_sample_name(data) if name in seen: continue seen.add(name) fns = glob.glob(os.pa...
[ "def", "_merge_fastqc", "(", "samples", ")", ":", "fastqc_list", "=", "collections", ".", "defaultdict", "(", "list", ")", "seen", "=", "set", "(", ")", "for", "data", "in", "samples", ":", "name", "=", "dd", ".", "get_sample_name", "(", "data", ")", "...
merge all fastqc samples into one by module
[ "merge", "all", "fastqc", "samples", "into", "one", "by", "module" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/multiqc.py#L486-L511
224,243
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
_create_plot
def _create_plot(tumor, in_glob, out_ext, page=1): """Create an output plot for the given PDF in the images directory. """ out_dir = utils.safe_makedir("images") out_name = os.path.join(out_dir, "%s-%s" % (tumor, out_ext)) in_file = glob.glob(in_glob)[0] cmd = ["pdftoppm", in_file, out_name, "-p...
python
def _create_plot(tumor, in_glob, out_ext, page=1): """Create an output plot for the given PDF in the images directory. """ out_dir = utils.safe_makedir("images") out_name = os.path.join(out_dir, "%s-%s" % (tumor, out_ext)) in_file = glob.glob(in_glob)[0] cmd = ["pdftoppm", in_file, out_name, "-p...
[ "def", "_create_plot", "(", "tumor", ",", "in_glob", ",", "out_ext", ",", "page", "=", "1", ")", ":", "out_dir", "=", "utils", ".", "safe_makedir", "(", "\"images\"", ")", "out_name", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"%s-%s\"...
Create an output plot for the given PDF in the images directory.
[ "Create", "an", "output", "plot", "for", "the", "given", "PDF", "in", "the", "images", "directory", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L64-L73
224,244
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
_get_cromwell_execution_dir
def _get_cromwell_execution_dir(base_dir, target_glob): """Retrieve the baseline directory with cromwell output files. Handles Cromwell restarts where there are multiple work directories and we traverse symlinks back to the original. """ cur_dir = glob.glob(os.path.join(base_dir, target_glob))[0] ...
python
def _get_cromwell_execution_dir(base_dir, target_glob): """Retrieve the baseline directory with cromwell output files. Handles Cromwell restarts where there are multiple work directories and we traverse symlinks back to the original. """ cur_dir = glob.glob(os.path.join(base_dir, target_glob))[0] ...
[ "def", "_get_cromwell_execution_dir", "(", "base_dir", ",", "target_glob", ")", ":", "cur_dir", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "base_dir", ",", "target_glob", ")", ")", "[", "0", "]", "if", "os", ".", "path", ".", ...
Retrieve the baseline directory with cromwell output files. Handles Cromwell restarts where there are multiple work directories and we traverse symlinks back to the original.
[ "Retrieve", "the", "baseline", "directory", "with", "cromwell", "output", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L232-L245
224,245
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
prep_bam_inputs
def prep_bam_inputs(out_dir, sample, call_file, bam_file): """Prepare expected input BAM files from pre-aligned. """ base = utils.splitext_plus(os.path.basename(bam_file))[0] with open(call_file) as in_handle: for cur_hla in (x.strip() for x in in_handle): out_file = os.path.join(uti...
python
def prep_bam_inputs(out_dir, sample, call_file, bam_file): """Prepare expected input BAM files from pre-aligned. """ base = utils.splitext_plus(os.path.basename(bam_file))[0] with open(call_file) as in_handle: for cur_hla in (x.strip() for x in in_handle): out_file = os.path.join(uti...
[ "def", "prep_bam_inputs", "(", "out_dir", ",", "sample", ",", "call_file", ",", "bam_file", ")", ":", "base", "=", "utils", ".", "splitext_plus", "(", "os", ".", "path", ".", "basename", "(", "bam_file", ")", ")", "[", "0", "]", "with", "open", "(", ...
Prepare expected input BAM files from pre-aligned.
[ "Prepare", "expected", "input", "BAM", "files", "from", "pre", "-", "aligned", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L247-L257
224,246
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
get_hla
def get_hla(sample, cromwell_dir, hla_glob): """Retrieve HLA calls and input fastqs for a sample. """ hla_dir = glob.glob(os.path.join(cromwell_dir, hla_glob, "align", sample, "hla"))[0] fastq = os.path.join(hla_dir, "OptiType-HLA-A_B_C-input.fq") calls = os.path.join(hla_dir, "%s-optitype.csv" % sa...
python
def get_hla(sample, cromwell_dir, hla_glob): """Retrieve HLA calls and input fastqs for a sample. """ hla_dir = glob.glob(os.path.join(cromwell_dir, hla_glob, "align", sample, "hla"))[0] fastq = os.path.join(hla_dir, "OptiType-HLA-A_B_C-input.fq") calls = os.path.join(hla_dir, "%s-optitype.csv" % sa...
[ "def", "get_hla", "(", "sample", ",", "cromwell_dir", ",", "hla_glob", ")", ":", "hla_dir", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "cromwell_dir", ",", "hla_glob", ",", "\"align\"", ",", "sample", ",", "\"hla\"", ")", ")", ...
Retrieve HLA calls and input fastqs for a sample.
[ "Retrieve", "HLA", "calls", "and", "input", "fastqs", "for", "a", "sample", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L278-L284
224,247
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
name_to_absolute
def name_to_absolute(x): """Convert standard hg38 HLA name into ABSOLUTE naming. """ for c in ["-", "*", ":"]: x = x.replace(c, "_") x = x.lower() return x
python
def name_to_absolute(x): """Convert standard hg38 HLA name into ABSOLUTE naming. """ for c in ["-", "*", ":"]: x = x.replace(c, "_") x = x.lower() return x
[ "def", "name_to_absolute", "(", "x", ")", ":", "for", "c", "in", "[", "\"-\"", ",", "\"*\"", ",", "\":\"", "]", ":", "x", "=", "x", ".", "replace", "(", "c", ",", "\"_\"", ")", "x", "=", "x", ".", "lower", "(", ")", "return", "x" ]
Convert standard hg38 HLA name into ABSOLUTE naming.
[ "Convert", "standard", "hg38", "HLA", "name", "into", "ABSOLUTE", "naming", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L286-L292
224,248
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
get_hla_choice
def get_hla_choice(h, hlas, normal_bam, tumor_bam): """Retrieve matching HLA with best read support in both tumor and normal """ def get_counts(bam_file): counts = {} for line in subprocess.check_output(["samtools", "idxstats", bam_file]).split("\n"): if line.startswith(h): ...
python
def get_hla_choice(h, hlas, normal_bam, tumor_bam): """Retrieve matching HLA with best read support in both tumor and normal """ def get_counts(bam_file): counts = {} for line in subprocess.check_output(["samtools", "idxstats", bam_file]).split("\n"): if line.startswith(h): ...
[ "def", "get_hla_choice", "(", "h", ",", "hlas", ",", "normal_bam", ",", "tumor_bam", ")", ":", "def", "get_counts", "(", "bam_file", ")", ":", "counts", "=", "{", "}", "for", "line", "in", "subprocess", ".", "check_output", "(", "[", "\"samtools\"", ",",...
Retrieve matching HLA with best read support in both tumor and normal
[ "Retrieve", "matching", "HLA", "with", "best", "read", "support", "in", "both", "tumor", "and", "normal" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L294-L309
224,249
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
prep_hla
def prep_hla(work_dir, sample, calls, hlas, normal_bam, tumor_bam): """Convert HLAs into ABSOLUTE format for use with LOHHLA. LOHHLA hard codes names to hla_a, hla_b, hla_c so need to move """ work_dir = utils.safe_makedir(os.path.join(work_dir, sample, "inputs")) hla_file = os.path.join(work_dir, ...
python
def prep_hla(work_dir, sample, calls, hlas, normal_bam, tumor_bam): """Convert HLAs into ABSOLUTE format for use with LOHHLA. LOHHLA hard codes names to hla_a, hla_b, hla_c so need to move """ work_dir = utils.safe_makedir(os.path.join(work_dir, sample, "inputs")) hla_file = os.path.join(work_dir, ...
[ "def", "prep_hla", "(", "work_dir", ",", "sample", ",", "calls", ",", "hlas", ",", "normal_bam", ",", "tumor_bam", ")", ":", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "work_dir", ",", "sample", ",", "\"inp...
Convert HLAs into ABSOLUTE format for use with LOHHLA. LOHHLA hard codes names to hla_a, hla_b, hla_c so need to move
[ "Convert", "HLAs", "into", "ABSOLUTE", "format", "for", "use", "with", "LOHHLA", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L311-L326
224,250
bcbio/bcbio-nextgen
scripts/utils/hla_loh_comparison.py
prep_ploidy
def prep_ploidy(work_dir, sample, bam_file, cromwell_dir, sv_glob): """Create LOHHLA compatible input ploidy file from PureCN output. """ purecn_file = _get_cromwell_file(cromwell_dir, sv_glob, dict(sample=sample, method="purecn", ext="purecn.csv")) work_dir = utils.safe_makedir(os.path.join(work_dir, s...
python
def prep_ploidy(work_dir, sample, bam_file, cromwell_dir, sv_glob): """Create LOHHLA compatible input ploidy file from PureCN output. """ purecn_file = _get_cromwell_file(cromwell_dir, sv_glob, dict(sample=sample, method="purecn", ext="purecn.csv")) work_dir = utils.safe_makedir(os.path.join(work_dir, s...
[ "def", "prep_ploidy", "(", "work_dir", ",", "sample", ",", "bam_file", ",", "cromwell_dir", ",", "sv_glob", ")", ":", "purecn_file", "=", "_get_cromwell_file", "(", "cromwell_dir", ",", "sv_glob", ",", "dict", "(", "sample", "=", "sample", ",", "method", "="...
Create LOHHLA compatible input ploidy file from PureCN output.
[ "Create", "LOHHLA", "compatible", "input", "ploidy", "file", "from", "PureCN", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hla_loh_comparison.py#L328-L342
224,251
bcbio/bcbio-nextgen
bcbio/ngsalign/bowtie.py
_bowtie_args_from_config
def _bowtie_args_from_config(data): """Configurable high level options for bowtie. """ config = data['config'] qual_format = config["algorithm"].get("quality_format", "") if qual_format.lower() == "illumina": qual_flags = ["--phred64-quals"] else: qual_flags = [] multi_mapper...
python
def _bowtie_args_from_config(data): """Configurable high level options for bowtie. """ config = data['config'] qual_format = config["algorithm"].get("quality_format", "") if qual_format.lower() == "illumina": qual_flags = ["--phred64-quals"] else: qual_flags = [] multi_mapper...
[ "def", "_bowtie_args_from_config", "(", "data", ")", ":", "config", "=", "data", "[", "'config'", "]", "qual_format", "=", "config", "[", "\"algorithm\"", "]", ".", "get", "(", "\"quality_format\"", ",", "\"\"", ")", "if", "qual_format", ".", "lower", "(", ...
Configurable high level options for bowtie.
[ "Configurable", "high", "level", "options", "for", "bowtie", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bowtie.py#L13-L28
224,252
bcbio/bcbio-nextgen
bcbio/ngsalign/bowtie.py
align
def align(fastq_file, pair_file, ref_file, names, align_dir, data, extra_args=None): """Do standard or paired end alignment with bowtie. """ num_hits = 1 if data["analysis"].lower().startswith("smallrna-seq"): num_hits = 1000 config = data['config'] out_file = os.path.join(alig...
python
def align(fastq_file, pair_file, ref_file, names, align_dir, data, extra_args=None): """Do standard or paired end alignment with bowtie. """ num_hits = 1 if data["analysis"].lower().startswith("smallrna-seq"): num_hits = 1000 config = data['config'] out_file = os.path.join(alig...
[ "def", "align", "(", "fastq_file", ",", "pair_file", ",", "ref_file", ",", "names", ",", "align_dir", ",", "data", ",", "extra_args", "=", "None", ")", ":", "num_hits", "=", "1", "if", "data", "[", "\"analysis\"", "]", ".", "lower", "(", ")", ".", "s...
Do standard or paired end alignment with bowtie.
[ "Do", "standard", "or", "paired", "end", "alignment", "with", "bowtie", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bowtie.py#L30-L74
224,253
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
subset_by_supported
def subset_by_supported(input_file, get_coords, calls_by_name, work_dir, data, headers=("#",)): """Limit CNVkit input to calls with support from another caller. get_coords is a function that return chrom, start, end from a line of the input_file, allowing handling of multiple input ...
python
def subset_by_supported(input_file, get_coords, calls_by_name, work_dir, data, headers=("#",)): """Limit CNVkit input to calls with support from another caller. get_coords is a function that return chrom, start, end from a line of the input_file, allowing handling of multiple input ...
[ "def", "subset_by_supported", "(", "input_file", ",", "get_coords", ",", "calls_by_name", ",", "work_dir", ",", "data", ",", "headers", "=", "(", "\"#\"", ",", ")", ")", ":", "support_files", "=", "[", "(", "c", ",", "tz", ".", "get_in", "(", "[", "c",...
Limit CNVkit input to calls with support from another caller. get_coords is a function that return chrom, start, end from a line of the input_file, allowing handling of multiple input file types.
[ "Limit", "CNVkit", "input", "to", "calls", "with", "support", "from", "another", "caller", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L43-L76
224,254
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
_input_to_bed
def _input_to_bed(theta_input, work_dir, get_coords, headers): """Convert input file to a BED file for comparisons """ theta_bed = os.path.join(work_dir, "%s.bed" % os.path.splitext(os.path.basename(theta_input))[0]) with open(theta_input) as in_handle: with open(theta_bed, "w") as out_handle: ...
python
def _input_to_bed(theta_input, work_dir, get_coords, headers): """Convert input file to a BED file for comparisons """ theta_bed = os.path.join(work_dir, "%s.bed" % os.path.splitext(os.path.basename(theta_input))[0]) with open(theta_input) as in_handle: with open(theta_bed, "w") as out_handle: ...
[ "def", "_input_to_bed", "(", "theta_input", ",", "work_dir", ",", "get_coords", ",", "headers", ")", ":", "theta_bed", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"%s.bed\"", "%", "os", ".", "path", ".", "splitext", "(", "os", ".", "pa...
Convert input file to a BED file for comparisons
[ "Convert", "input", "file", "to", "a", "BED", "file", "for", "comparisons" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L88-L98
224,255
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
_run_theta
def _run_theta(cnv_info, data, work_dir, run_n3=True): """Run theta, calculating subpopulations and normal contamination. """ out = {"caller": "theta"} max_normal = "0.9" opts = ["-m", max_normal] n2_result = _safe_run_theta(cnv_info["theta_input"], os.path.join(work_dir, "n2"), ".n2.results", ...
python
def _run_theta(cnv_info, data, work_dir, run_n3=True): """Run theta, calculating subpopulations and normal contamination. """ out = {"caller": "theta"} max_normal = "0.9" opts = ["-m", max_normal] n2_result = _safe_run_theta(cnv_info["theta_input"], os.path.join(work_dir, "n2"), ".n2.results", ...
[ "def", "_run_theta", "(", "cnv_info", ",", "data", ",", "work_dir", ",", "run_n3", "=", "True", ")", ":", "out", "=", "{", "\"caller\"", ":", "\"theta\"", "}", "max_normal", "=", "\"0.9\"", "opts", "=", "[", "\"-m\"", ",", "max_normal", "]", "n2_result",...
Run theta, calculating subpopulations and normal contamination.
[ "Run", "theta", "calculating", "subpopulations", "and", "normal", "contamination", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L100-L120
224,256
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
_update_with_calls
def _update_with_calls(result_file, cnv_file): """Update bounds with calls from CNVkit, inferred copy numbers and p-values from THetA. """ results = {} with open(result_file) as in_handle: in_handle.readline() # header _, _, cs, ps = in_handle.readline().strip().split() for i, (...
python
def _update_with_calls(result_file, cnv_file): """Update bounds with calls from CNVkit, inferred copy numbers and p-values from THetA. """ results = {} with open(result_file) as in_handle: in_handle.readline() # header _, _, cs, ps = in_handle.readline().strip().split() for i, (...
[ "def", "_update_with_calls", "(", "result_file", ",", "cnv_file", ")", ":", "results", "=", "{", "}", "with", "open", "(", "result_file", ")", "as", "in_handle", ":", "in_handle", ".", "readline", "(", ")", "# header", "_", ",", "_", ",", "cs", ",", "p...
Update bounds with calls from CNVkit, inferred copy numbers and p-values from THetA.
[ "Update", "bounds", "with", "calls", "from", "CNVkit", "inferred", "copy", "numbers", "and", "p", "-", "values", "from", "THetA", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L122-L142
224,257
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
_merge_theta_calls
def _merge_theta_calls(bounds_file, result_file, cnv_file, data): """Create a final output file with merged CNVkit and THetA copy and population estimates. """ out_file = "%s-merged.txt" % (result_file.replace(".BEST.results", "")) if not utils.file_uptodate(out_file, result_file): with file_tra...
python
def _merge_theta_calls(bounds_file, result_file, cnv_file, data): """Create a final output file with merged CNVkit and THetA copy and population estimates. """ out_file = "%s-merged.txt" % (result_file.replace(".BEST.results", "")) if not utils.file_uptodate(out_file, result_file): with file_tra...
[ "def", "_merge_theta_calls", "(", "bounds_file", ",", "result_file", ",", "cnv_file", ",", "data", ")", ":", "out_file", "=", "\"%s-merged.txt\"", "%", "(", "result_file", ".", "replace", "(", "\".BEST.results\"", ",", "\"\"", ")", ")", "if", "not", "utils", ...
Create a final output file with merged CNVkit and THetA copy and population estimates.
[ "Create", "a", "final", "output", "file", "with", "merged", "CNVkit", "and", "THetA", "copy", "and", "population", "estimates", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L144-L162
224,258
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
_select_model
def _select_model(n2_bounds, n2_result, n3_result, out_dir, data): """Run final model selection from n=2 and n=3 options. """ n2_out_file = n2_result.replace(".n2.results", ".BEST.results") n3_out_file = n3_result.replace(".n3.results", ".BEST.results") if not utils.file_exists(n2_out_file) and not ...
python
def _select_model(n2_bounds, n2_result, n3_result, out_dir, data): """Run final model selection from n=2 and n=3 options. """ n2_out_file = n2_result.replace(".n2.results", ".BEST.results") n3_out_file = n3_result.replace(".n3.results", ".BEST.results") if not utils.file_exists(n2_out_file) and not ...
[ "def", "_select_model", "(", "n2_bounds", ",", "n2_result", ",", "n3_result", ",", "out_dir", ",", "data", ")", ":", "n2_out_file", "=", "n2_result", ".", "replace", "(", "\".n2.results\"", ",", "\".BEST.results\"", ")", "n3_out_file", "=", "n3_result", ".", "...
Run final model selection from n=2 and n=3 options.
[ "Run", "final", "model", "selection", "from", "n", "=", "2", "and", "n", "=", "3", "options", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L164-L176
224,259
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
_safe_run_theta
def _safe_run_theta(input_file, out_dir, output_ext, args, data): """Run THetA, catching and continuing on any errors. """ out_file = os.path.join(out_dir, _split_theta_ext(input_file) + output_ext) skip_file = out_file + ".skipped" if utils.file_exists(skip_file): return None if not uti...
python
def _safe_run_theta(input_file, out_dir, output_ext, args, data): """Run THetA, catching and continuing on any errors. """ out_file = os.path.join(out_dir, _split_theta_ext(input_file) + output_ext) skip_file = out_file + ".skipped" if utils.file_exists(skip_file): return None if not uti...
[ "def", "_safe_run_theta", "(", "input_file", ",", "out_dir", ",", "output_ext", ",", "args", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "_split_theta_ext", "(", "input_file", ")", "+", "output_ext", ")", ...
Run THetA, catching and continuing on any errors.
[ "Run", "THetA", "catching", "and", "continuing", "on", "any", "errors", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L178-L201
224,260
bcbio/bcbio-nextgen
bcbio/heterogeneity/theta.py
_get_cmd
def _get_cmd(cmd): """Retrieve required commands for running THetA with our local bcbio python. """ check_cmd = "RunTHetA.py" try: local_cmd = subprocess.check_output(["which", check_cmd]).strip() except subprocess.CalledProcessError: return None return [sys.executable, "%s/%s" %...
python
def _get_cmd(cmd): """Retrieve required commands for running THetA with our local bcbio python. """ check_cmd = "RunTHetA.py" try: local_cmd = subprocess.check_output(["which", check_cmd]).strip() except subprocess.CalledProcessError: return None return [sys.executable, "%s/%s" %...
[ "def", "_get_cmd", "(", "cmd", ")", ":", "check_cmd", "=", "\"RunTHetA.py\"", "try", ":", "local_cmd", "=", "subprocess", ".", "check_output", "(", "[", "\"which\"", ",", "check_cmd", "]", ")", ".", "strip", "(", ")", "except", "subprocess", ".", "CalledPr...
Retrieve required commands for running THetA with our local bcbio python.
[ "Retrieve", "required", "commands", "for", "running", "THetA", "with", "our", "local", "bcbio", "python", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/theta.py#L213-L221
224,261
bcbio/bcbio-nextgen
bcbio/srna/mirge.py
run
def run(data): """Proxy function to run the tool""" sample = data[0][0] work_dir = dd.get_work_dir(sample) out_dir = os.path.join(work_dir, "mirge") lib = _find_lib(sample) mirge = _find_mirge(sample) bowtie = _find_bowtie(sample) sps = dd.get_species(sample) species = SPS.get(sps, "...
python
def run(data): """Proxy function to run the tool""" sample = data[0][0] work_dir = dd.get_work_dir(sample) out_dir = os.path.join(work_dir, "mirge") lib = _find_lib(sample) mirge = _find_mirge(sample) bowtie = _find_bowtie(sample) sps = dd.get_species(sample) species = SPS.get(sps, "...
[ "def", "run", "(", "data", ")", ":", "sample", "=", "data", "[", "0", "]", "[", "0", "]", "work_dir", "=", "dd", ".", "get_work_dir", "(", "sample", ")", "out_dir", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"mirge\"", ")", "lib...
Proxy function to run the tool
[ "Proxy", "function", "to", "run", "the", "tool" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirge.py#L20-L41
224,262
bcbio/bcbio-nextgen
bcbio/srna/mirge.py
_create_sample_file
def _create_sample_file(data, out_dir): """from data list all the fastq files in a file""" sample_file = os.path.join(out_dir, "sample_file.txt") with open(sample_file, 'w') as outh: for sample in data: outh.write(sample[0]["clean_fastq"] + "\n") return sample_file
python
def _create_sample_file(data, out_dir): """from data list all the fastq files in a file""" sample_file = os.path.join(out_dir, "sample_file.txt") with open(sample_file, 'w') as outh: for sample in data: outh.write(sample[0]["clean_fastq"] + "\n") return sample_file
[ "def", "_create_sample_file", "(", "data", ",", "out_dir", ")", ":", "sample_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"sample_file.txt\"", ")", "with", "open", "(", "sample_file", ",", "'w'", ")", "as", "outh", ":", "for", "samp...
from data list all the fastq files in a file
[ "from", "data", "list", "all", "the", "fastq", "files", "in", "a", "file" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirge.py#L55-L61
224,263
bcbio/bcbio-nextgen
bcbio/srna/mirge.py
_find_lib
def _find_lib(data): """Find mirge libs""" options = " ".join(data.get('resources', {}).get('mirge', {}).get("options", "")) if options.find("-lib") > -1 and utils.file_exists(options.split()[1]): return options if not options: logger.warning("miRge libraries not found. Follow these inst...
python
def _find_lib(data): """Find mirge libs""" options = " ".join(data.get('resources', {}).get('mirge', {}).get("options", "")) if options.find("-lib") > -1 and utils.file_exists(options.split()[1]): return options if not options: logger.warning("miRge libraries not found. Follow these inst...
[ "def", "_find_lib", "(", "data", ")", ":", "options", "=", "\" \"", ".", "join", "(", "data", ".", "get", "(", "'resources'", ",", "{", "}", ")", ".", "get", "(", "'mirge'", ",", "{", "}", ")", ".", "get", "(", "\"options\"", ",", "\"\"", ")", ...
Find mirge libs
[ "Find", "mirge", "libs" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirge.py#L71-L80
224,264
bcbio/bcbio-nextgen
bcbio/pipeline/datadict.py
get_input_sequence_files
def get_input_sequence_files(data, default=None): """ returns the input sequencing files, these can be single or paired FASTQ files or BAM files """ if "files" not in data or data.get("files") is None: file1, file2 = None, None elif len(data["files"]) == 2: file1, file2 = data["f...
python
def get_input_sequence_files(data, default=None): """ returns the input sequencing files, these can be single or paired FASTQ files or BAM files """ if "files" not in data or data.get("files") is None: file1, file2 = None, None elif len(data["files"]) == 2: file1, file2 = data["f...
[ "def", "get_input_sequence_files", "(", "data", ",", "default", "=", "None", ")", ":", "if", "\"files\"", "not", "in", "data", "or", "data", ".", "get", "(", "\"files\"", ")", "is", "None", ":", "file1", ",", "file2", "=", "None", ",", "None", "elif", ...
returns the input sequencing files, these can be single or paired FASTQ files or BAM files
[ "returns", "the", "input", "sequencing", "files", "these", "can", "be", "single", "or", "paired", "FASTQ", "files", "or", "BAM", "files" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L223-L235
224,265
bcbio/bcbio-nextgen
bcbio/pipeline/datadict.py
get_umi_consensus
def get_umi_consensus(data): """Retrieve UMI for consensus based preparation. We specify this either as a separate fastq file or embedded in the read name as `fastq_name`.` """ consensus_choices = (["fastq_name"]) umi = tz.get_in(["config", "algorithm", "umi_type"], data) # don't run consen...
python
def get_umi_consensus(data): """Retrieve UMI for consensus based preparation. We specify this either as a separate fastq file or embedded in the read name as `fastq_name`.` """ consensus_choices = (["fastq_name"]) umi = tz.get_in(["config", "algorithm", "umi_type"], data) # don't run consen...
[ "def", "get_umi_consensus", "(", "data", ")", ":", "consensus_choices", "=", "(", "[", "\"fastq_name\"", "]", ")", "umi", "=", "tz", ".", "get_in", "(", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"umi_type\"", "]", ",", "data", ")", "# don't run consens...
Retrieve UMI for consensus based preparation. We specify this either as a separate fastq file or embedded in the read name as `fastq_name`.`
[ "Retrieve", "UMI", "for", "consensus", "based", "preparation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L237-L251
224,266
bcbio/bcbio-nextgen
bcbio/pipeline/datadict.py
get_dexseq_gff
def get_dexseq_gff(config, default=None): """ some older versions of the genomes have the DEXseq gff file as gff instead of gff3, so this handles that by looking for either one """ dexseq_gff = tz.get_in(tz.get_in(['dexseq_gff', 'keys'], LOOKUPS, {}), config, None) if ...
python
def get_dexseq_gff(config, default=None): """ some older versions of the genomes have the DEXseq gff file as gff instead of gff3, so this handles that by looking for either one """ dexseq_gff = tz.get_in(tz.get_in(['dexseq_gff', 'keys'], LOOKUPS, {}), config, None) if ...
[ "def", "get_dexseq_gff", "(", "config", ",", "default", "=", "None", ")", ":", "dexseq_gff", "=", "tz", ".", "get_in", "(", "tz", ".", "get_in", "(", "[", "'dexseq_gff'", ",", "'keys'", "]", ",", "LOOKUPS", ",", "{", "}", ")", ",", "config", ",", "...
some older versions of the genomes have the DEXseq gff file as gff instead of gff3, so this handles that by looking for either one
[ "some", "older", "versions", "of", "the", "genomes", "have", "the", "DEXseq", "gff", "file", "as", "gff", "instead", "of", "gff3", "so", "this", "handles", "that", "by", "looking", "for", "either", "one" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L253-L275
224,267
bcbio/bcbio-nextgen
bcbio/pipeline/datadict.py
get_in_samples
def get_in_samples(samples, fn): """ for a list of samples, return the value of a global option """ for sample in samples: sample = to_single_data(sample) if fn(sample, None): return fn(sample) return None
python
def get_in_samples(samples, fn): """ for a list of samples, return the value of a global option """ for sample in samples: sample = to_single_data(sample) if fn(sample, None): return fn(sample) return None
[ "def", "get_in_samples", "(", "samples", ",", "fn", ")", ":", "for", "sample", "in", "samples", ":", "sample", "=", "to_single_data", "(", "sample", ")", "if", "fn", "(", "sample", ",", "None", ")", ":", "return", "fn", "(", "sample", ")", "return", ...
for a list of samples, return the value of a global option
[ "for", "a", "list", "of", "samples", "return", "the", "value", "of", "a", "global", "option" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L329-L337
224,268
bcbio/bcbio-nextgen
bcbio/pipeline/datadict.py
update_summary_qc
def update_summary_qc(data, key, base=None, secondary=None): """ updates summary_qc with a new section, keyed by key. stick files into summary_qc if you want them propagated forward and available for multiqc """ summary = get_summary_qc(data, {}) if base and secondary: summary[key] =...
python
def update_summary_qc(data, key, base=None, secondary=None): """ updates summary_qc with a new section, keyed by key. stick files into summary_qc if you want them propagated forward and available for multiqc """ summary = get_summary_qc(data, {}) if base and secondary: summary[key] =...
[ "def", "update_summary_qc", "(", "data", ",", "key", ",", "base", "=", "None", ",", "secondary", "=", "None", ")", ":", "summary", "=", "get_summary_qc", "(", "data", ",", "{", "}", ")", "if", "base", "and", "secondary", ":", "summary", "[", "key", "...
updates summary_qc with a new section, keyed by key. stick files into summary_qc if you want them propagated forward and available for multiqc
[ "updates", "summary_qc", "with", "a", "new", "section", "keyed", "by", "key", ".", "stick", "files", "into", "summary_qc", "if", "you", "want", "them", "propagated", "forward", "and", "available", "for", "multiqc" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L351-L365
224,269
bcbio/bcbio-nextgen
bcbio/pipeline/datadict.py
has_variantcalls
def has_variantcalls(data): """ returns True if the data dictionary is configured for variant calling """ analysis = get_analysis(data).lower() variant_pipeline = analysis.startswith(("standard", "variant", "variant2")) variantcaller = get_variantcaller(data) return variant_pipeline or varia...
python
def has_variantcalls(data): """ returns True if the data dictionary is configured for variant calling """ analysis = get_analysis(data).lower() variant_pipeline = analysis.startswith(("standard", "variant", "variant2")) variantcaller = get_variantcaller(data) return variant_pipeline or varia...
[ "def", "has_variantcalls", "(", "data", ")", ":", "analysis", "=", "get_analysis", "(", "data", ")", ".", "lower", "(", ")", "variant_pipeline", "=", "analysis", ".", "startswith", "(", "(", "\"standard\"", ",", "\"variant\"", ",", "\"variant2\"", ")", ")", ...
returns True if the data dictionary is configured for variant calling
[ "returns", "True", "if", "the", "data", "dictionary", "is", "configured", "for", "variant", "calling" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/datadict.py#L367-L374
224,270
bcbio/bcbio-nextgen
bcbio/rnaseq/qc.py
estimate_library_complexity
def estimate_library_complexity(df, algorithm="RNA-seq"): """ estimate library complexity from the number of reads vs. number of unique start sites. returns "NA" if there are not enough data points to fit the line """ DEFAULT_CUTOFFS = {"RNA-seq": (0.25, 0.40)} cutoffs = DEFAULT_CUTOFFS[algo...
python
def estimate_library_complexity(df, algorithm="RNA-seq"): """ estimate library complexity from the number of reads vs. number of unique start sites. returns "NA" if there are not enough data points to fit the line """ DEFAULT_CUTOFFS = {"RNA-seq": (0.25, 0.40)} cutoffs = DEFAULT_CUTOFFS[algo...
[ "def", "estimate_library_complexity", "(", "df", ",", "algorithm", "=", "\"RNA-seq\"", ")", ":", "DEFAULT_CUTOFFS", "=", "{", "\"RNA-seq\"", ":", "(", "0.25", ",", "0.40", ")", "}", "cutoffs", "=", "DEFAULT_CUTOFFS", "[", "algorithm", "]", "if", "len", "(", ...
estimate library complexity from the number of reads vs. number of unique start sites. returns "NA" if there are not enough data points to fit the line
[ "estimate", "library", "complexity", "from", "the", "number", "of", "reads", "vs", ".", "number", "of", "unique", "start", "sites", ".", "returns", "NA", "if", "there", "are", "not", "enough", "data", "points", "to", "fit", "the", "line" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/qc.py#L42-L64
224,271
bcbio/bcbio-nextgen
bcbio/galaxy/api.py
GalaxyApiAccess.run_details
def run_details(self, run_bc, run_date=None): """Next Gen LIMS specific API functionality. """ try: details = self._get("/nglims/api_run_details", dict(run=run_bc)) except ValueError: raise ValueError("Could not find information in Galaxy for run: %s" % run_bc) ...
python
def run_details(self, run_bc, run_date=None): """Next Gen LIMS specific API functionality. """ try: details = self._get("/nglims/api_run_details", dict(run=run_bc)) except ValueError: raise ValueError("Could not find information in Galaxy for run: %s" % run_bc) ...
[ "def", "run_details", "(", "self", ",", "run_bc", ",", "run_date", "=", "None", ")", ":", "try", ":", "details", "=", "self", ".", "_get", "(", "\"/nglims/api_run_details\"", ",", "dict", "(", "run", "=", "run_bc", ")", ")", "except", "ValueError", ":", ...
Next Gen LIMS specific API functionality.
[ "Next", "Gen", "LIMS", "specific", "API", "functionality", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/galaxy/api.py#L52-L64
224,272
bcbio/bcbio-nextgen
bcbio/pipeline/cleanbam.py
fixrg
def fixrg(in_bam, names, ref_file, dirs, data): """Fix read group in a file, using samtools addreplacerg. addreplacerg does not remove the old read group, causing confusion when checking. We use reheader to work around this """ work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "bamc...
python
def fixrg(in_bam, names, ref_file, dirs, data): """Fix read group in a file, using samtools addreplacerg. addreplacerg does not remove the old read group, causing confusion when checking. We use reheader to work around this """ work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "bamc...
[ "def", "fixrg", "(", "in_bam", ",", "names", ",", "ref_file", ",", "dirs", ",", "data", ")", ":", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "dd", ".", "get_work_dir", "(", "data", ")", ",", "\"bamclean\"...
Fix read group in a file, using samtools addreplacerg. addreplacerg does not remove the old read group, causing confusion when checking. We use reheader to work around this
[ "Fix", "read", "group", "in", "a", "file", "using", "samtools", "addreplacerg", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L20-L40
224,273
bcbio/bcbio-nextgen
bcbio/pipeline/cleanbam.py
_target_chroms_and_header
def _target_chroms_and_header(bam_file, data): """Get a list of chromosomes to target and new updated ref_file header. Could potentially handle remapping from chr1 -> 1 but currently disabled due to speed issues. """ special_remaps = {"chrM": "MT", "MT": "chrM"} target_chroms = dict([(x.name, i...
python
def _target_chroms_and_header(bam_file, data): """Get a list of chromosomes to target and new updated ref_file header. Could potentially handle remapping from chr1 -> 1 but currently disabled due to speed issues. """ special_remaps = {"chrM": "MT", "MT": "chrM"} target_chroms = dict([(x.name, i...
[ "def", "_target_chroms_and_header", "(", "bam_file", ",", "data", ")", ":", "special_remaps", "=", "{", "\"chrM\"", ":", "\"MT\"", ",", "\"MT\"", ":", "\"chrM\"", "}", "target_chroms", "=", "dict", "(", "[", "(", "x", ".", "name", ",", "i", ")", "for", ...
Get a list of chromosomes to target and new updated ref_file header. Could potentially handle remapping from chr1 -> 1 but currently disabled due to speed issues.
[ "Get", "a", "list", "of", "chromosomes", "to", "target", "and", "new", "updated", "ref_file", "header", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L75-L106
224,274
bcbio/bcbio-nextgen
bcbio/pipeline/cleanbam.py
picard_prep
def picard_prep(in_bam, names, ref_file, dirs, data): """Prepare input BAM using Picard and GATK cleaning tools. - ReorderSam to reorder file to reference - AddOrReplaceReadGroups to add read group information and coordinate sort - PrintReads to filters to remove problem records: - filterMBQ to rem...
python
def picard_prep(in_bam, names, ref_file, dirs, data): """Prepare input BAM using Picard and GATK cleaning tools. - ReorderSam to reorder file to reference - AddOrReplaceReadGroups to add read group information and coordinate sort - PrintReads to filters to remove problem records: - filterMBQ to rem...
[ "def", "picard_prep", "(", "in_bam", ",", "names", ",", "ref_file", ",", "dirs", ",", "data", ")", ":", "runner", "=", "broad", ".", "runner_from_path", "(", "\"picard\"", ",", "data", "[", "\"config\"", "]", ")", "work_dir", "=", "utils", ".", "safe_mak...
Prepare input BAM using Picard and GATK cleaning tools. - ReorderSam to reorder file to reference - AddOrReplaceReadGroups to add read group information and coordinate sort - PrintReads to filters to remove problem records: - filterMBQ to remove reads with mismatching bases and base qualities
[ "Prepare", "input", "BAM", "using", "Picard", "and", "GATK", "cleaning", "tools", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L122-L139
224,275
bcbio/bcbio-nextgen
bcbio/pipeline/cleanbam.py
_filter_bad_reads
def _filter_bad_reads(in_bam, ref_file, data): """Use GATK filter to remove problem reads which choke GATK and Picard. """ bam.index(in_bam, data["config"]) out_file = "%s-gatkfilter.bam" % os.path.splitext(in_bam)[0] if not utils.file_exists(out_file): with tx_tmpdir(data) as tmp_dir: ...
python
def _filter_bad_reads(in_bam, ref_file, data): """Use GATK filter to remove problem reads which choke GATK and Picard. """ bam.index(in_bam, data["config"]) out_file = "%s-gatkfilter.bam" % os.path.splitext(in_bam)[0] if not utils.file_exists(out_file): with tx_tmpdir(data) as tmp_dir: ...
[ "def", "_filter_bad_reads", "(", "in_bam", ",", "ref_file", ",", "data", ")", ":", "bam", ".", "index", "(", "in_bam", ",", "data", "[", "\"config\"", "]", ")", "out_file", "=", "\"%s-gatkfilter.bam\"", "%", "os", ".", "path", ".", "splitext", "(", "in_b...
Use GATK filter to remove problem reads which choke GATK and Picard.
[ "Use", "GATK", "filter", "to", "remove", "problem", "reads", "which", "choke", "GATK", "and", "Picard", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L141-L161
224,276
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
generate_parallel
def generate_parallel(samples, run_parallel): """Provide parallel preparation of summary information for alignment and variant calling. """ to_analyze, extras = _split_samples_by_qc(samples) qced = run_parallel("pipeline_summary", to_analyze) samples = _combine_qc_samples(qced) + extras qsign_in...
python
def generate_parallel(samples, run_parallel): """Provide parallel preparation of summary information for alignment and variant calling. """ to_analyze, extras = _split_samples_by_qc(samples) qced = run_parallel("pipeline_summary", to_analyze) samples = _combine_qc_samples(qced) + extras qsign_in...
[ "def", "generate_parallel", "(", "samples", ",", "run_parallel", ")", ":", "to_analyze", ",", "extras", "=", "_split_samples_by_qc", "(", "samples", ")", "qced", "=", "run_parallel", "(", "\"pipeline_summary\"", ",", "to_analyze", ")", "samples", "=", "_combine_qc...
Provide parallel preparation of summary information for alignment and variant calling.
[ "Provide", "parallel", "preparation", "of", "summary", "information", "for", "alignment", "and", "variant", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L38-L58
224,277
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
pipeline_summary
def pipeline_summary(data): """Provide summary information on processing sample. Handles standard and CWL (single QC output) cases. """ data = utils.to_single_data(data) work_bam = dd.get_align_bam(data) or dd.get_work_bam(data) if not work_bam or not work_bam.endswith(".bam"): work_bam...
python
def pipeline_summary(data): """Provide summary information on processing sample. Handles standard and CWL (single QC output) cases. """ data = utils.to_single_data(data) work_bam = dd.get_align_bam(data) or dd.get_work_bam(data) if not work_bam or not work_bam.endswith(".bam"): work_bam...
[ "def", "pipeline_summary", "(", "data", ")", ":", "data", "=", "utils", ".", "to_single_data", "(", "data", ")", "work_bam", "=", "dd", ".", "get_align_bam", "(", "data", ")", "or", "dd", ".", "get_work_bam", "(", "data", ")", "if", "not", "work_bam", ...
Provide summary information on processing sample. Handles standard and CWL (single QC output) cases.
[ "Provide", "summary", "information", "on", "processing", "sample", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L60-L76
224,278
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
get_qc_tools
def get_qc_tools(data): """Retrieve a list of QC tools to use based on configuration and analysis type. Uses defaults if previously set. """ if dd.get_algorithm_qc(data): return dd.get_algorithm_qc(data) analysis = data["analysis"].lower() to_run = [] if tz.get_in(["config", "algori...
python
def get_qc_tools(data): """Retrieve a list of QC tools to use based on configuration and analysis type. Uses defaults if previously set. """ if dd.get_algorithm_qc(data): return dd.get_algorithm_qc(data) analysis = data["analysis"].lower() to_run = [] if tz.get_in(["config", "algori...
[ "def", "get_qc_tools", "(", "data", ")", ":", "if", "dd", ".", "get_algorithm_qc", "(", "data", ")", ":", "return", "dd", ".", "get_algorithm_qc", "(", "data", ")", "analysis", "=", "data", "[", "\"analysis\"", "]", ".", "lower", "(", ")", "to_run", "=...
Retrieve a list of QC tools to use based on configuration and analysis type. Uses defaults if previously set.
[ "Retrieve", "a", "list", "of", "QC", "tools", "to", "use", "based", "on", "configuration", "and", "analysis", "type", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L78-L123
224,279
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_run_qc_tools
def _run_qc_tools(bam_file, data): """Run a set of third party quality control tools, returning QC directory and metrics. :param bam_file: alignments in bam format :param data: dict with all configuration information :returns: dict with output of different tools """ from bcbio.qc i...
python
def _run_qc_tools(bam_file, data): """Run a set of third party quality control tools, returning QC directory and metrics. :param bam_file: alignments in bam format :param data: dict with all configuration information :returns: dict with output of different tools """ from bcbio.qc i...
[ "def", "_run_qc_tools", "(", "bam_file", ",", "data", ")", ":", "from", "bcbio", ".", "qc", "import", "(", "atropos", ",", "contamination", ",", "coverage", ",", "damage", ",", "fastqc", ",", "kraken", ",", "qsignature", ",", "qualimap", ",", "samtools", ...
Run a set of third party quality control tools, returning QC directory and metrics. :param bam_file: alignments in bam format :param data: dict with all configuration information :returns: dict with output of different tools
[ "Run", "a", "set", "of", "third", "party", "quality", "control", "tools", "returning", "QC", "directory", "and", "metrics", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L125-L187
224,280
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_organize_qc_files
def _organize_qc_files(program, qc_dir): """Organize outputs from quality control runs into a base file and secondary outputs. Provides compatibility with CWL output. Returns None if no files created during processing. """ base_files = {"fastqc": "fastqc_report.html", "qualimap_rnaseq...
python
def _organize_qc_files(program, qc_dir): """Organize outputs from quality control runs into a base file and secondary outputs. Provides compatibility with CWL output. Returns None if no files created during processing. """ base_files = {"fastqc": "fastqc_report.html", "qualimap_rnaseq...
[ "def", "_organize_qc_files", "(", "program", ",", "qc_dir", ")", ":", "base_files", "=", "{", "\"fastqc\"", ":", "\"fastqc_report.html\"", ",", "\"qualimap_rnaseq\"", ":", "\"qualimapReport.html\"", ",", "\"qualimap\"", ":", "\"qualimapReport.html\"", "}", "if", "os",...
Organize outputs from quality control runs into a base file and secondary outputs. Provides compatibility with CWL output. Returns None if no files created during processing.
[ "Organize", "outputs", "from", "quality", "control", "runs", "into", "a", "base", "file", "and", "secondary", "outputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L189-L220
224,281
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_split_samples_by_qc
def _split_samples_by_qc(samples): """Split data into individual quality control steps for a run. """ to_process = [] extras = [] for data in [utils.to_single_data(x) for x in samples]: qcs = dd.get_algorithm_qc(data) # kraken doesn't need bam if qcs and (dd.get_align_bam(dat...
python
def _split_samples_by_qc(samples): """Split data into individual quality control steps for a run. """ to_process = [] extras = [] for data in [utils.to_single_data(x) for x in samples]: qcs = dd.get_algorithm_qc(data) # kraken doesn't need bam if qcs and (dd.get_align_bam(dat...
[ "def", "_split_samples_by_qc", "(", "samples", ")", ":", "to_process", "=", "[", "]", "extras", "=", "[", "]", "for", "data", "in", "[", "utils", ".", "to_single_data", "(", "x", ")", "for", "x", "in", "samples", "]", ":", "qcs", "=", "dd", ".", "g...
Split data into individual quality control steps for a run.
[ "Split", "data", "into", "individual", "quality", "control", "steps", "for", "a", "run", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L224-L240
224,282
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_combine_qc_samples
def _combine_qc_samples(samples): """Combine split QC analyses into single samples based on BAM files. """ by_bam = collections.defaultdict(list) for data in [utils.to_single_data(x) for x in samples]: batch = dd.get_batch(data) or dd.get_sample_name(data) if not isinstance(batch, (list,...
python
def _combine_qc_samples(samples): """Combine split QC analyses into single samples based on BAM files. """ by_bam = collections.defaultdict(list) for data in [utils.to_single_data(x) for x in samples]: batch = dd.get_batch(data) or dd.get_sample_name(data) if not isinstance(batch, (list,...
[ "def", "_combine_qc_samples", "(", "samples", ")", ":", "by_bam", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "data", "in", "[", "utils", ".", "to_single_data", "(", "x", ")", "for", "x", "in", "samples", "]", ":", "batch", "=", "d...
Combine split QC analyses into single samples based on BAM files.
[ "Combine", "split", "QC", "analyses", "into", "single", "samples", "based", "on", "BAM", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L242-L266
224,283
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
write_project_summary
def write_project_summary(samples, qsign_info=None): """Write project summary information on the provided samples. write out dirs, genome resources, """ work_dir = samples[0][0]["dirs"]["work"] out_file = os.path.join(work_dir, "project-summary.yaml") upload_dir = (os.path.join(work_dir, sample...
python
def write_project_summary(samples, qsign_info=None): """Write project summary information on the provided samples. write out dirs, genome resources, """ work_dir = samples[0][0]["dirs"]["work"] out_file = os.path.join(work_dir, "project-summary.yaml") upload_dir = (os.path.join(work_dir, sample...
[ "def", "write_project_summary", "(", "samples", ",", "qsign_info", "=", "None", ")", ":", "work_dir", "=", "samples", "[", "0", "]", "[", "0", "]", "[", "\"dirs\"", "]", "[", "\"work\"", "]", "out_file", "=", "os", ".", "path", ".", "join", "(", "wor...
Write project summary information on the provided samples. write out dirs, genome resources,
[ "Write", "project", "summary", "information", "on", "the", "provided", "samples", ".", "write", "out", "dirs", "genome", "resources" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L270-L295
224,284
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_merge_metadata
def _merge_metadata(samples): """Merge all metadata into CSV file""" samples = list(utils.flatten(samples)) out_dir = dd.get_work_dir(samples[0]) logger.info("summarize metadata") out_file = os.path.join(out_dir, "metadata.csv") sample_metrics = collections.defaultdict(dict) for s in samples...
python
def _merge_metadata(samples): """Merge all metadata into CSV file""" samples = list(utils.flatten(samples)) out_dir = dd.get_work_dir(samples[0]) logger.info("summarize metadata") out_file = os.path.join(out_dir, "metadata.csv") sample_metrics = collections.defaultdict(dict) for s in samples...
[ "def", "_merge_metadata", "(", "samples", ")", ":", "samples", "=", "list", "(", "utils", ".", "flatten", "(", "samples", ")", ")", "out_dir", "=", "dd", ".", "get_work_dir", "(", "samples", "[", "0", "]", ")", "logger", ".", "info", "(", "\"summarize ...
Merge all metadata into CSV file
[ "Merge", "all", "metadata", "into", "CSV", "file" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L297-L314
224,285
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_other_pipeline_samples
def _other_pipeline_samples(summary_file, cur_samples): """Retrieve samples produced previously by another pipeline in the summary output. """ cur_descriptions = set([s[0]["description"] for s in cur_samples]) out = [] if utils.file_exists(summary_file): with open(summary_file) as in_handle:...
python
def _other_pipeline_samples(summary_file, cur_samples): """Retrieve samples produced previously by another pipeline in the summary output. """ cur_descriptions = set([s[0]["description"] for s in cur_samples]) out = [] if utils.file_exists(summary_file): with open(summary_file) as in_handle:...
[ "def", "_other_pipeline_samples", "(", "summary_file", ",", "cur_samples", ")", ":", "cur_descriptions", "=", "set", "(", "[", "s", "[", "0", "]", "[", "\"description\"", "]", "for", "s", "in", "cur_samples", "]", ")", "out", "=", "[", "]", "if", "utils"...
Retrieve samples produced previously by another pipeline in the summary output.
[ "Retrieve", "samples", "produced", "previously", "by", "another", "pipeline", "in", "the", "summary", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L316-L326
224,286
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_add_researcher_summary
def _add_researcher_summary(samples, summary_yaml): """Generate summary files per researcher if organized via a LIMS. """ by_researcher = collections.defaultdict(list) for data in (x[0] for x in samples): researcher = utils.get_in(data, ("upload", "researcher")) if researcher: ...
python
def _add_researcher_summary(samples, summary_yaml): """Generate summary files per researcher if organized via a LIMS. """ by_researcher = collections.defaultdict(list) for data in (x[0] for x in samples): researcher = utils.get_in(data, ("upload", "researcher")) if researcher: ...
[ "def", "_add_researcher_summary", "(", "samples", ",", "summary_yaml", ")", ":", "by_researcher", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "data", "in", "(", "x", "[", "0", "]", "for", "x", "in", "samples", ")", ":", "researcher", ...
Generate summary files per researcher if organized via a LIMS.
[ "Generate", "summary", "files", "per", "researcher", "if", "organized", "via", "a", "LIMS", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L338-L356
224,287
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
_summary_csv_by_researcher
def _summary_csv_by_researcher(summary_yaml, researcher, descrs, data): """Generate a CSV file with summary information for a researcher on this project. """ out_file = os.path.join(utils.safe_makedir(os.path.join(data["dirs"]["work"], "researcher")), "%s-summary.tsv" % run_info....
python
def _summary_csv_by_researcher(summary_yaml, researcher, descrs, data): """Generate a CSV file with summary information for a researcher on this project. """ out_file = os.path.join(utils.safe_makedir(os.path.join(data["dirs"]["work"], "researcher")), "%s-summary.tsv" % run_info....
[ "def", "_summary_csv_by_researcher", "(", "summary_yaml", ",", "researcher", ",", "descrs", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "data", "[", ...
Generate a CSV file with summary information for a researcher on this project.
[ "Generate", "a", "CSV", "file", "with", "summary", "information", "for", "a", "researcher", "on", "this", "project", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L358-L373
224,288
bcbio/bcbio-nextgen
bcbio/pipeline/qcsummary.py
prep_pdf
def prep_pdf(qc_dir, config): """Create PDF from HTML summary outputs in QC directory. Requires wkhtmltopdf installed: http://www.msweet.org/projects.php?Z1 Thanks to: https://www.biostars.org/p/16991/ Works around issues with CSS conversion on CentOS by adjusting CSS. """ html_file = os.path....
python
def prep_pdf(qc_dir, config): """Create PDF from HTML summary outputs in QC directory. Requires wkhtmltopdf installed: http://www.msweet.org/projects.php?Z1 Thanks to: https://www.biostars.org/p/16991/ Works around issues with CSS conversion on CentOS by adjusting CSS. """ html_file = os.path....
[ "def", "prep_pdf", "(", "qc_dir", ",", "config", ")", ":", "html_file", "=", "os", ".", "path", ".", "join", "(", "qc_dir", ",", "\"fastqc\"", ",", "\"fastqc_report.html\"", ")", "html_fixed", "=", "\"%s-fixed%s\"", "%", "os", ".", "path", ".", "splitext",...
Create PDF from HTML summary outputs in QC directory. Requires wkhtmltopdf installed: http://www.msweet.org/projects.php?Z1 Thanks to: https://www.biostars.org/p/16991/ Works around issues with CSS conversion on CentOS by adjusting CSS.
[ "Create", "PDF", "from", "HTML", "summary", "outputs", "in", "QC", "directory", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/qcsummary.py#L377-L399
224,289
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_run_purecn_dx
def _run_purecn_dx(out, paired): """Extract signatures and mutational burdens from PureCN rds file. """ out_base, out, all_files = _get_purecn_dx_files(paired, out) if not utils.file_uptodate(out["mutation_burden"], out["rds"]): with file_transaction(paired.tumor_data, out_base) as tx_out_base: ...
python
def _run_purecn_dx(out, paired): """Extract signatures and mutational burdens from PureCN rds file. """ out_base, out, all_files = _get_purecn_dx_files(paired, out) if not utils.file_uptodate(out["mutation_burden"], out["rds"]): with file_transaction(paired.tumor_data, out_base) as tx_out_base: ...
[ "def", "_run_purecn_dx", "(", "out", ",", "paired", ")", ":", "out_base", ",", "out", ",", "all_files", "=", "_get_purecn_dx_files", "(", "paired", ",", "out", ")", "if", "not", "utils", ".", "file_uptodate", "(", "out", "[", "\"mutation_burden\"", "]", ",...
Extract signatures and mutational burdens from PureCN rds file.
[ "Extract", "signatures", "and", "mutational", "burdens", "from", "PureCN", "rds", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L49-L62
224,290
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_get_purecn_dx_files
def _get_purecn_dx_files(paired, out): """Retrieve files generated by PureCN_Dx """ out_base = "%s-dx" % utils.splitext_plus(out["rds"])[0] all_files = [] for key, ext in [[("mutation_burden",), "_mutation_burden.csv"], [("plot", "signatures"), "_signatures.pdf"], ...
python
def _get_purecn_dx_files(paired, out): """Retrieve files generated by PureCN_Dx """ out_base = "%s-dx" % utils.splitext_plus(out["rds"])[0] all_files = [] for key, ext in [[("mutation_burden",), "_mutation_burden.csv"], [("plot", "signatures"), "_signatures.pdf"], ...
[ "def", "_get_purecn_dx_files", "(", "paired", ",", "out", ")", ":", "out_base", "=", "\"%s-dx\"", "%", "utils", ".", "splitext_plus", "(", "out", "[", "\"rds\"", "]", ")", "[", "0", "]", "all_files", "=", "[", "]", "for", "key", ",", "ext", "in", "["...
Retrieve files generated by PureCN_Dx
[ "Retrieve", "files", "generated", "by", "PureCN_Dx" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L64-L75
224,291
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_run_purecn
def _run_purecn(paired, work_dir): """Run PureCN.R wrapper with pre-segmented CNVkit or GATK4 inputs. """ segfns = {"cnvkit": _segment_normalized_cnvkit, "gatk-cnv": _segment_normalized_gatk} out_base, out, all_files = _get_purecn_files(paired, work_dir) failed_file = out_base + "-failed.log" cn...
python
def _run_purecn(paired, work_dir): """Run PureCN.R wrapper with pre-segmented CNVkit or GATK4 inputs. """ segfns = {"cnvkit": _segment_normalized_cnvkit, "gatk-cnv": _segment_normalized_gatk} out_base, out, all_files = _get_purecn_files(paired, work_dir) failed_file = out_base + "-failed.log" cn...
[ "def", "_run_purecn", "(", "paired", ",", "work_dir", ")", ":", "segfns", "=", "{", "\"cnvkit\"", ":", "_segment_normalized_cnvkit", ",", "\"gatk-cnv\"", ":", "_segment_normalized_gatk", "}", "out_base", ",", "out", ",", "all_files", "=", "_get_purecn_files", "(",...
Run PureCN.R wrapper with pre-segmented CNVkit or GATK4 inputs.
[ "Run", "PureCN", ".", "R", "wrapper", "with", "pre", "-", "segmented", "CNVkit", "or", "GATK4", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L77-L118
224,292
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_segment_normalized_gatk
def _segment_normalized_gatk(cnr_file, work_dir, paired): """Segmentation of normalized inputs using GATK4, converting into standard input formats. """ work_dir = utils.safe_makedir(os.path.join(work_dir, "gatk-cnv")) seg_file = gatkcnv.model_segments(cnr_file, work_dir, paired)["seg"] std_seg_file ...
python
def _segment_normalized_gatk(cnr_file, work_dir, paired): """Segmentation of normalized inputs using GATK4, converting into standard input formats. """ work_dir = utils.safe_makedir(os.path.join(work_dir, "gatk-cnv")) seg_file = gatkcnv.model_segments(cnr_file, work_dir, paired)["seg"] std_seg_file ...
[ "def", "_segment_normalized_gatk", "(", "cnr_file", ",", "work_dir", ",", "paired", ")", ":", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"gatk-cnv\"", ")", ")", "seg_file", "=", "gatkcnv", "....
Segmentation of normalized inputs using GATK4, converting into standard input formats.
[ "Segmentation", "of", "normalized", "inputs", "using", "GATK4", "converting", "into", "standard", "input", "formats", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L126-L151
224,293
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_segment_normalized_cnvkit
def _segment_normalized_cnvkit(cnr_file, work_dir, paired): """Segmentation of normalized inputs using CNVkit. """ cnvkit_base = os.path.join(utils.safe_makedir(os.path.join(work_dir, "cnvkit")), dd.get_sample_name(paired.tumor_data)) cnr_file = chromhacks.bed_to_standard...
python
def _segment_normalized_cnvkit(cnr_file, work_dir, paired): """Segmentation of normalized inputs using CNVkit. """ cnvkit_base = os.path.join(utils.safe_makedir(os.path.join(work_dir, "cnvkit")), dd.get_sample_name(paired.tumor_data)) cnr_file = chromhacks.bed_to_standard...
[ "def", "_segment_normalized_cnvkit", "(", "cnr_file", ",", "work_dir", ",", "paired", ")", ":", "cnvkit_base", "=", "os", ".", "path", ".", "join", "(", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"cnvkit\"", ...
Segmentation of normalized inputs using CNVkit.
[ "Segmentation", "of", "normalized", "inputs", "using", "CNVkit", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L153-L163
224,294
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_remove_overlaps
def _remove_overlaps(in_file, out_dir, data): """Remove regions that overlap with next region, these result in issues with PureCN. """ out_file = os.path.join(out_dir, "%s-nooverlaps%s" % utils.splitext_plus(os.path.basename(in_file))) if not utils.file_uptodate(out_file, in_file): with file_tra...
python
def _remove_overlaps(in_file, out_dir, data): """Remove regions that overlap with next region, these result in issues with PureCN. """ out_file = os.path.join(out_dir, "%s-nooverlaps%s" % utils.splitext_plus(os.path.basename(in_file))) if not utils.file_uptodate(out_file, in_file): with file_tra...
[ "def", "_remove_overlaps", "(", "in_file", ",", "out_dir", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "out_dir", ",", "\"%s-nooverlaps%s\"", "%", "utils", ".", "splitext_plus", "(", "os", ".", "path", ".", "basename", "(...
Remove regions that overlap with next region, these result in issues with PureCN.
[ "Remove", "regions", "that", "overlap", "with", "next", "region", "these", "result", "in", "issues", "with", "PureCN", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L165-L185
224,295
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_get_purecn_files
def _get_purecn_files(paired, work_dir, require_exist=False): """Retrieve organized structure of PureCN output files. """ out_base = os.path.join(work_dir, "%s-purecn" % (dd.get_sample_name(paired.tumor_data))) out = {"plot": {}} all_files = [] for plot in ["chromosomes", "local_optima", "segmen...
python
def _get_purecn_files(paired, work_dir, require_exist=False): """Retrieve organized structure of PureCN output files. """ out_base = os.path.join(work_dir, "%s-purecn" % (dd.get_sample_name(paired.tumor_data))) out = {"plot": {}} all_files = [] for plot in ["chromosomes", "local_optima", "segmen...
[ "def", "_get_purecn_files", "(", "paired", ",", "work_dir", ",", "require_exist", "=", "False", ")", ":", "out_base", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"%s-purecn\"", "%", "(", "dd", ".", "get_sample_name", "(", "paired", ".", ...
Retrieve organized structure of PureCN output files.
[ "Retrieve", "organized", "structure", "of", "PureCN", "output", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L187-L208
224,296
bcbio/bcbio-nextgen
bcbio/structural/purecn.py
_loh_to_vcf
def _loh_to_vcf(cur): """Convert LOH output into standardized VCF. """ cn = int(float(cur["C"])) minor_cn = int(float(cur["M"])) if cur["type"].find("LOH"): svtype = "LOH" elif cn > 2: svtype = "DUP" elif cn < 1: svtype = "DEL" else: svtype = None if s...
python
def _loh_to_vcf(cur): """Convert LOH output into standardized VCF. """ cn = int(float(cur["C"])) minor_cn = int(float(cur["M"])) if cur["type"].find("LOH"): svtype = "LOH" elif cn > 2: svtype = "DUP" elif cn < 1: svtype = "DEL" else: svtype = None if s...
[ "def", "_loh_to_vcf", "(", "cur", ")", ":", "cn", "=", "int", "(", "float", "(", "cur", "[", "\"C\"", "]", ")", ")", "minor_cn", "=", "int", "(", "float", "(", "cur", "[", "\"M\"", "]", ")", ")", "if", "cur", "[", "\"type\"", "]", ".", "find", ...
Convert LOH output into standardized VCF.
[ "Convert", "LOH", "output", "into", "standardized", "VCF", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purecn.py#L219-L237
224,297
bcbio/bcbio-nextgen
scripts/utils/collect_metrics_to_csv.py
_generate_metrics
def _generate_metrics(bam_fname, config_file, ref_file, bait_file, target_file): """Run Picard commands to generate metrics files when missing. """ with open(config_file) as in_handle: config = yaml.safe_load(in_handle) broad_runner = broad.runner_from_config(config) ba...
python
def _generate_metrics(bam_fname, config_file, ref_file, bait_file, target_file): """Run Picard commands to generate metrics files when missing. """ with open(config_file) as in_handle: config = yaml.safe_load(in_handle) broad_runner = broad.runner_from_config(config) ba...
[ "def", "_generate_metrics", "(", "bam_fname", ",", "config_file", ",", "ref_file", ",", "bait_file", ",", "target_file", ")", ":", "with", "open", "(", "config_file", ")", "as", "in_handle", ":", "config", "=", "yaml", ".", "safe_load", "(", "in_handle", ")"...
Run Picard commands to generate metrics files when missing.
[ "Run", "Picard", "commands", "to", "generate", "metrics", "files", "when", "missing", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/collect_metrics_to_csv.py#L135-L155
224,298
bcbio/bcbio-nextgen
bcbio/structural/gatkcnv.py
run
def run(items, background=None): """Detect copy number variations from batched set of samples using GATK4 CNV calling. TODO: implement germline calling with DetermineGermlineContigPloidy and GermlineCNVCaller """ if not background: background = [] paired = vcfutils.get_paired(items + background) ...
python
def run(items, background=None): """Detect copy number variations from batched set of samples using GATK4 CNV calling. TODO: implement germline calling with DetermineGermlineContigPloidy and GermlineCNVCaller """ if not background: background = [] paired = vcfutils.get_paired(items + background) ...
[ "def", "run", "(", "items", ",", "background", "=", "None", ")", ":", "if", "not", "background", ":", "background", "=", "[", "]", "paired", "=", "vcfutils", ".", "get_paired", "(", "items", "+", "background", ")", "if", "paired", ":", "out", "=", "_...
Detect copy number variations from batched set of samples using GATK4 CNV calling. TODO: implement germline calling with DetermineGermlineContigPloidy and GermlineCNVCaller
[ "Detect", "copy", "number", "variations", "from", "batched", "set", "of", "samples", "using", "GATK4", "CNV", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L19-L32
224,299
bcbio/bcbio-nextgen
bcbio/structural/gatkcnv.py
_run_paired
def _run_paired(paired): """Run somatic variant calling pipeline. """ from bcbio.structural import titancna work_dir = _sv_workdir(paired.tumor_data) seg_files = model_segments(tz.get_in(["depth", "bins", "normalized"], paired.tumor_data), work_dir, paired) call_fi...
python
def _run_paired(paired): """Run somatic variant calling pipeline. """ from bcbio.structural import titancna work_dir = _sv_workdir(paired.tumor_data) seg_files = model_segments(tz.get_in(["depth", "bins", "normalized"], paired.tumor_data), work_dir, paired) call_fi...
[ "def", "_run_paired", "(", "paired", ")", ":", "from", "bcbio", ".", "structural", "import", "titancna", "work_dir", "=", "_sv_workdir", "(", "paired", ".", "tumor_data", ")", "seg_files", "=", "model_segments", "(", "tz", ".", "get_in", "(", "[", "\"depth\"...
Run somatic variant calling pipeline.
[ "Run", "somatic", "variant", "calling", "pipeline", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/gatkcnv.py#L34-L54