repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
bcbio/bcbio-nextgen
bcbio/structural/regions.py
calculate_sv_coverage
def calculate_sv_coverage(data): """Calculate coverage within bins for downstream CNV calling. Creates corrected cnr files with log2 ratios and depths. """ calcfns = {"cnvkit": _calculate_sv_coverage_cnvkit, "gatk-cnv": _calculate_sv_coverage_gatk} from bcbio.structural import cnvkit data = uti...
python
def calculate_sv_coverage(data): """Calculate coverage within bins for downstream CNV calling. Creates corrected cnr files with log2 ratios and depths. """ calcfns = {"cnvkit": _calculate_sv_coverage_cnvkit, "gatk-cnv": _calculate_sv_coverage_gatk} from bcbio.structural import cnvkit data = uti...
[ "def", "calculate_sv_coverage", "(", "data", ")", ":", "calcfns", "=", "{", "\"cnvkit\"", ":", "_calculate_sv_coverage_cnvkit", ",", "\"gatk-cnv\"", ":", "_calculate_sv_coverage_gatk", "}", "from", "bcbio", ".", "structural", "import", "cnvkit", "data", "=", "utils"...
Calculate coverage within bins for downstream CNV calling. Creates corrected cnr files with log2 ratios and depths.
[ "Calculate", "coverage", "within", "bins", "for", "downstream", "CNV", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L168-L193
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
_calculate_sv_coverage_gatk
def _calculate_sv_coverage_gatk(data, work_dir): """Calculate coverage in defined regions using GATK tools TODO: This does double calculations to get GATK4 compatible HDF read counts and then depth and gene annotations. Both are needed for creating heterogeneity inputs. Ideally replace with a single mo...
python
def _calculate_sv_coverage_gatk(data, work_dir): """Calculate coverage in defined regions using GATK tools TODO: This does double calculations to get GATK4 compatible HDF read counts and then depth and gene annotations. Both are needed for creating heterogeneity inputs. Ideally replace with a single mo...
[ "def", "_calculate_sv_coverage_gatk", "(", "data", ",", "work_dir", ")", ":", "from", "bcbio", ".", "variation", "import", "coverage", "from", "bcbio", ".", "structural", "import", "annotate", "# GATK compatible", "target_file", "=", "gatkcnv", ".", "collect_read_co...
Calculate coverage in defined regions using GATK tools TODO: This does double calculations to get GATK4 compatible HDF read counts and then depth and gene annotations. Both are needed for creating heterogeneity inputs. Ideally replace with a single mosdepth coverage calculation, and creat GATK4 TSV format:...
[ "Calculate", "coverage", "in", "defined", "regions", "using", "GATK", "tools" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L195-L213
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
_calculate_sv_coverage_cnvkit
def _calculate_sv_coverage_cnvkit(data, work_dir): """Calculate coverage in an CNVkit ready format using mosdepth. """ from bcbio.variation import coverage from bcbio.structural import annotate out_target_file = os.path.join(work_dir, "%s-target-coverage.cnn" % dd.get_sample_name(data)) out_anti...
python
def _calculate_sv_coverage_cnvkit(data, work_dir): """Calculate coverage in an CNVkit ready format using mosdepth. """ from bcbio.variation import coverage from bcbio.structural import annotate out_target_file = os.path.join(work_dir, "%s-target-coverage.cnn" % dd.get_sample_name(data)) out_anti...
[ "def", "_calculate_sv_coverage_cnvkit", "(", "data", ",", "work_dir", ")", ":", "from", "bcbio", ".", "variation", "import", "coverage", "from", "bcbio", ".", "structural", "import", "annotate", "out_target_file", "=", "os", ".", "path", ".", "join", "(", "wor...
Calculate coverage in an CNVkit ready format using mosdepth.
[ "Calculate", "coverage", "in", "an", "CNVkit", "ready", "format", "using", "mosdepth", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L215-L229
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
normalize_sv_coverage
def normalize_sv_coverage(*items): """Normalize CNV coverage, providing flexible point for multiple methods. """ calcfns = {"cnvkit": _normalize_sv_coverage_cnvkit, "gatk-cnv": _normalize_sv_coverage_gatk} from bcbio.structural import cnvkit from bcbio.structural import shared as sshared items =...
python
def normalize_sv_coverage(*items): """Normalize CNV coverage, providing flexible point for multiple methods. """ calcfns = {"cnvkit": _normalize_sv_coverage_cnvkit, "gatk-cnv": _normalize_sv_coverage_gatk} from bcbio.structural import cnvkit from bcbio.structural import shared as sshared items =...
[ "def", "normalize_sv_coverage", "(", "*", "items", ")", ":", "calcfns", "=", "{", "\"cnvkit\"", ":", "_normalize_sv_coverage_cnvkit", ",", "\"gatk-cnv\"", ":", "_normalize_sv_coverage_gatk", "}", "from", "bcbio", ".", "structural", "import", "cnvkit", "from", "bcbio...
Normalize CNV coverage, providing flexible point for multiple methods.
[ "Normalize", "CNV", "coverage", "providing", "flexible", "point", "for", "multiple", "methods", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L256-L283
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
_normalize_sv_coverage_gatk
def _normalize_sv_coverage_gatk(group_id, inputs, backgrounds, work_dir, back_files, out_files): """Normalize CNV coverage using panel of normals with GATK's de-noise approaches. """ input_backs = set(filter(lambda x: x is not None, [dd.get_background_cnv_reference(d, "gatk-cnv"...
python
def _normalize_sv_coverage_gatk(group_id, inputs, backgrounds, work_dir, back_files, out_files): """Normalize CNV coverage using panel of normals with GATK's de-noise approaches. """ input_backs = set(filter(lambda x: x is not None, [dd.get_background_cnv_reference(d, "gatk-cnv"...
[ "def", "_normalize_sv_coverage_gatk", "(", "group_id", ",", "inputs", ",", "backgrounds", ",", "work_dir", ",", "back_files", ",", "out_files", ")", ":", "input_backs", "=", "set", "(", "filter", "(", "lambda", "x", ":", "x", "is", "not", "None", ",", "[",...
Normalize CNV coverage using panel of normals with GATK's de-noise approaches.
[ "Normalize", "CNV", "coverage", "using", "panel", "of", "normals", "with", "GATK", "s", "de", "-", "noise", "approaches", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L285-L303
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
_normalize_sv_coverage_cnvkit
def _normalize_sv_coverage_cnvkit(group_id, inputs, backgrounds, work_dir, back_files, out_files): """Normalize CNV coverage depths by GC, repeats and background using CNVkit - reference: calculates reference backgrounds from normals and pools including GC and repeat information - fix: Uses backgroun...
python
def _normalize_sv_coverage_cnvkit(group_id, inputs, backgrounds, work_dir, back_files, out_files): """Normalize CNV coverage depths by GC, repeats and background using CNVkit - reference: calculates reference backgrounds from normals and pools including GC and repeat information - fix: Uses backgroun...
[ "def", "_normalize_sv_coverage_cnvkit", "(", "group_id", ",", "inputs", ",", "backgrounds", ",", "work_dir", ",", "back_files", ",", "out_files", ")", ":", "from", "bcbio", ".", "structural", "import", "cnvkit", "cnns", "=", "reduce", "(", "operator", ".", "ad...
Normalize CNV coverage depths by GC, repeats and background using CNVkit - reference: calculates reference backgrounds from normals and pools including GC and repeat information - fix: Uses background to normalize coverage estimations http://cnvkit.readthedocs.io/en/stable/pipeline.html#fix
[ "Normalize", "CNV", "coverage", "depths", "by", "GC", "repeats", "and", "background", "using", "CNVkit" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L305-L342
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
get_base_cnv_regions
def get_base_cnv_regions(data, work_dir, genome_default="transcripts1e4", include_gene_names=True): """Retrieve set of target regions for CNV analysis. Subsets to extended transcript regions for WGS experiments to avoid long runtimes. """ cov_interval = dd.get_coverage_interval(data) base_regio...
python
def get_base_cnv_regions(data, work_dir, genome_default="transcripts1e4", include_gene_names=True): """Retrieve set of target regions for CNV analysis. Subsets to extended transcript regions for WGS experiments to avoid long runtimes. """ cov_interval = dd.get_coverage_interval(data) base_regio...
[ "def", "get_base_cnv_regions", "(", "data", ",", "work_dir", ",", "genome_default", "=", "\"transcripts1e4\"", ",", "include_gene_names", "=", "True", ")", ":", "cov_interval", "=", "dd", ".", "get_coverage_interval", "(", "data", ")", "base_regions", "=", "get_sv...
Retrieve set of target regions for CNV analysis. Subsets to extended transcript regions for WGS experiments to avoid long runtimes.
[ "Retrieve", "set", "of", "target", "regions", "for", "CNV", "analysis", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L346-L364
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
remove_exclude_regions
def remove_exclude_regions(orig_bed, base_file, items, remove_entire_feature=False): """Remove centromere and short end regions from an existing BED file of regions to target. """ from bcbio.structural import shared as sshared out_bed = os.path.join("%s-noexclude.bed" % (utils.splitext_plus(base_file)[0...
python
def remove_exclude_regions(orig_bed, base_file, items, remove_entire_feature=False): """Remove centromere and short end regions from an existing BED file of regions to target. """ from bcbio.structural import shared as sshared out_bed = os.path.join("%s-noexclude.bed" % (utils.splitext_plus(base_file)[0...
[ "def", "remove_exclude_regions", "(", "orig_bed", ",", "base_file", ",", "items", ",", "remove_entire_feature", "=", "False", ")", ":", "from", "bcbio", ".", "structural", "import", "shared", "as", "sshared", "out_bed", "=", "os", ".", "path", ".", "join", "...
Remove centromere and short end regions from an existing BED file of regions to target.
[ "Remove", "centromere", "and", "short", "end", "regions", "from", "an", "existing", "BED", "file", "of", "regions", "to", "target", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L366-L379
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
get_sv_bed
def get_sv_bed(data, method=None, out_dir=None, include_gene_names=True): """Retrieve a BED file of regions for SV and heterogeneity calling using the provided method. method choices: - exons: Raw BED file of exon regions - transcripts: Full collapsed regions with the min and max of each transcript...
python
def get_sv_bed(data, method=None, out_dir=None, include_gene_names=True): """Retrieve a BED file of regions for SV and heterogeneity calling using the provided method. method choices: - exons: Raw BED file of exon regions - transcripts: Full collapsed regions with the min and max of each transcript...
[ "def", "get_sv_bed", "(", "data", ",", "method", "=", "None", ",", "out_dir", "=", "None", ",", "include_gene_names", "=", "True", ")", ":", "if", "method", "is", "None", ":", "method", "=", "(", "tz", ".", "get_in", "(", "[", "\"config\"", ",", "\"a...
Retrieve a BED file of regions for SV and heterogeneity calling using the provided method. method choices: - exons: Raw BED file of exon regions - transcripts: Full collapsed regions with the min and max of each transcript. - transcriptsXXXX: Collapsed regions around transcripts with a window siz...
[ "Retrieve", "a", "BED", "file", "of", "regions", "for", "SV", "and", "heterogeneity", "calling", "using", "the", "provided", "method", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L381-L406
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
_group_coords
def _group_coords(rs): """Organize coordinate regions into groups for each transcript. Avoids collapsing very large introns or repetitive genes spread across the chromosome by limiting the intron size to 100kb for creating a single transcript """ max_intron_size = 1e5 coords = [] for r in r...
python
def _group_coords(rs): """Organize coordinate regions into groups for each transcript. Avoids collapsing very large introns or repetitive genes spread across the chromosome by limiting the intron size to 100kb for creating a single transcript """ max_intron_size = 1e5 coords = [] for r in r...
[ "def", "_group_coords", "(", "rs", ")", ":", "max_intron_size", "=", "1e5", "coords", "=", "[", "]", "for", "r", "in", "rs", ":", "coords", ".", "append", "(", "r", ".", "start", ")", "coords", ".", "append", "(", "r", ".", "end", ")", "coord_group...
Organize coordinate regions into groups for each transcript. Avoids collapsing very large introns or repetitive genes spread across the chromosome by limiting the intron size to 100kb for creating a single transcript
[ "Organize", "coordinate", "regions", "into", "groups", "for", "each", "transcript", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L445-L466
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
MemoizedSizes._calc_sizes
def _calc_sizes(self, cnv_file, items): """Retrieve target and antitarget bin sizes based on depth. Similar to CNVkit's do_autobin but tries to have a standard set of ranges (50bp intervals for target and 10kb intervals for antitarget). """ bp_per_bin = 100000 # same target as ...
python
def _calc_sizes(self, cnv_file, items): """Retrieve target and antitarget bin sizes based on depth. Similar to CNVkit's do_autobin but tries to have a standard set of ranges (50bp intervals for target and 10kb intervals for antitarget). """ bp_per_bin = 100000 # same target as ...
[ "def", "_calc_sizes", "(", "self", ",", "cnv_file", ",", "items", ")", ":", "bp_per_bin", "=", "100000", "# same target as CNVkit", "range_map", "=", "{", "\"target\"", ":", "(", "100", ",", "250", ")", ",", "\"antitarget\"", ":", "(", "10000", ",", "10000...
Retrieve target and antitarget bin sizes based on depth. Similar to CNVkit's do_autobin but tries to have a standard set of ranges (50bp intervals for target and 10kb intervals for antitarget).
[ "Retrieve", "target", "and", "antitarget", "bin", "sizes", "based", "on", "depth", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L98-L141
train
bcbio/bcbio-nextgen
bcbio/hmmer/search.py
phmmer
def phmmer(**kwargs): """Search a protein sequence against a HMMER sequence database. Arguments: seq - The sequence to search -- a Fasta string. seqdb -- Sequence database to search against. range -- A string range of results to return (ie. 1,10 for the first ten) output -- The output f...
python
def phmmer(**kwargs): """Search a protein sequence against a HMMER sequence database. Arguments: seq - The sequence to search -- a Fasta string. seqdb -- Sequence database to search against. range -- A string range of results to return (ie. 1,10 for the first ten) output -- The output f...
[ "def", "phmmer", "(", "*", "*", "kwargs", ")", ":", "logging", ".", "debug", "(", "kwargs", ")", "args", "=", "{", "'seq'", ":", "kwargs", ".", "get", "(", "'seq'", ")", ",", "'seqdb'", ":", "kwargs", ".", "get", "(", "'seqdb'", ")", "}", "args2"...
Search a protein sequence against a HMMER sequence database. Arguments: seq - The sequence to search -- a Fasta string. seqdb -- Sequence database to search against. range -- A string range of results to return (ie. 1,10 for the first ten) output -- The output format (defaults to JSON).
[ "Search", "a", "protein", "sequence", "against", "a", "HMMER", "sequence", "database", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/hmmer/search.py#L40-L54
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
scrnaseq_concatenate_metadata
def scrnaseq_concatenate_metadata(samples): """ Create file same dimension than mtx.colnames with metadata and sample name to help in the creation of the SC object. """ barcodes = {} counts = "" metadata = {} has_sample_barcodes = False for sample in dd.sample_data_iterator(samp...
python
def scrnaseq_concatenate_metadata(samples): """ Create file same dimension than mtx.colnames with metadata and sample name to help in the creation of the SC object. """ barcodes = {} counts = "" metadata = {} has_sample_barcodes = False for sample in dd.sample_data_iterator(samp...
[ "def", "scrnaseq_concatenate_metadata", "(", "samples", ")", ":", "barcodes", "=", "{", "}", "counts", "=", "\"\"", "metadata", "=", "{", "}", "has_sample_barcodes", "=", "False", "for", "sample", "in", "dd", ".", "sample_data_iterator", "(", "samples", ")", ...
Create file same dimension than mtx.colnames with metadata and sample name to help in the creation of the SC object.
[ "Create", "file", "same", "dimension", "than", "mtx", ".", "colnames", "with", "metadata", "and", "sample", "name", "to", "help", "in", "the", "creation", "of", "the", "SC", "object", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L47-L90
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
rnaseq_variant_calling
def rnaseq_variant_calling(samples, run_parallel): """ run RNA-seq variant calling using GATK """ samples = run_parallel("run_rnaseq_variant_calling", samples) variantcaller = dd.get_variantcaller(to_single_data(samples[0])) if variantcaller and ("gatk-haplotype" in variantcaller): out =...
python
def rnaseq_variant_calling(samples, run_parallel): """ run RNA-seq variant calling using GATK """ samples = run_parallel("run_rnaseq_variant_calling", samples) variantcaller = dd.get_variantcaller(to_single_data(samples[0])) if variantcaller and ("gatk-haplotype" in variantcaller): out =...
[ "def", "rnaseq_variant_calling", "(", "samples", ",", "run_parallel", ")", ":", "samples", "=", "run_parallel", "(", "\"run_rnaseq_variant_calling\"", ",", "samples", ")", "variantcaller", "=", "dd", ".", "get_variantcaller", "(", "to_single_data", "(", "samples", "...
run RNA-seq variant calling using GATK
[ "run", "RNA", "-", "seq", "variant", "calling", "using", "GATK" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L92-L115
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
run_rnaseq_variant_calling
def run_rnaseq_variant_calling(data): """ run RNA-seq variant calling, variation file is stored in `vrn_file` in the datadict """ variantcaller = dd.get_variantcaller(data) if isinstance(variantcaller, list) and len(variantcaller) > 1: logger.error("Only one variantcaller can be run for ...
python
def run_rnaseq_variant_calling(data): """ run RNA-seq variant calling, variation file is stored in `vrn_file` in the datadict """ variantcaller = dd.get_variantcaller(data) if isinstance(variantcaller, list) and len(variantcaller) > 1: logger.error("Only one variantcaller can be run for ...
[ "def", "run_rnaseq_variant_calling", "(", "data", ")", ":", "variantcaller", "=", "dd", ".", "get_variantcaller", "(", "data", ")", "if", "isinstance", "(", "variantcaller", ",", "list", ")", "and", "len", "(", "variantcaller", ")", ">", "1", ":", "logger", ...
run RNA-seq variant calling, variation file is stored in `vrn_file` in the datadict
[ "run", "RNA", "-", "seq", "variant", "calling", "variation", "file", "is", "stored", "in", "vrn_file", "in", "the", "datadict" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L117-L136
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
run_rnaseq_ann_filter
def run_rnaseq_ann_filter(data): """Run RNA-seq annotation and filtering. """ data = to_single_data(data) if dd.get_vrn_file(data): eff_file = effects.add_to_vcf(dd.get_vrn_file(data), data)[0] if eff_file: data = dd.set_vrn_file(data, eff_file) ann_file = population....
python
def run_rnaseq_ann_filter(data): """Run RNA-seq annotation and filtering. """ data = to_single_data(data) if dd.get_vrn_file(data): eff_file = effects.add_to_vcf(dd.get_vrn_file(data), data)[0] if eff_file: data = dd.set_vrn_file(data, eff_file) ann_file = population....
[ "def", "run_rnaseq_ann_filter", "(", "data", ")", ":", "data", "=", "to_single_data", "(", "data", ")", "if", "dd", ".", "get_vrn_file", "(", "data", ")", ":", "eff_file", "=", "effects", ".", "add_to_vcf", "(", "dd", ".", "get_vrn_file", "(", "data", ")...
Run RNA-seq annotation and filtering.
[ "Run", "RNA", "-", "seq", "annotation", "and", "filtering", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L138-L157
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
quantitate
def quantitate(data): """CWL target for quantitation. XXX Needs to be split and parallelized by expression caller, with merging of multiple calls. """ data = to_single_data(to_single_data(data)) data = generate_transcript_counts(data)[0][0] data["quant"] = {} if "sailfish" in dd.get_exp...
python
def quantitate(data): """CWL target for quantitation. XXX Needs to be split and parallelized by expression caller, with merging of multiple calls. """ data = to_single_data(to_single_data(data)) data = generate_transcript_counts(data)[0][0] data["quant"] = {} if "sailfish" in dd.get_exp...
[ "def", "quantitate", "(", "data", ")", ":", "data", "=", "to_single_data", "(", "to_single_data", "(", "data", ")", ")", "data", "=", "generate_transcript_counts", "(", "data", ")", "[", "0", "]", "[", "0", "]", "data", "[", "\"quant\"", "]", "=", "{",...
CWL target for quantitation. XXX Needs to be split and parallelized by expression caller, with merging of multiple calls.
[ "CWL", "target", "for", "quantitation", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L159-L184
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
quantitate_expression_parallel
def quantitate_expression_parallel(samples, run_parallel): """ quantitate expression, all programs run here should be multithreaded to take advantage of the threaded run_parallel environment """ data = samples[0][0] samples = run_parallel("generate_transcript_counts", samples) if "cufflinks"...
python
def quantitate_expression_parallel(samples, run_parallel): """ quantitate expression, all programs run here should be multithreaded to take advantage of the threaded run_parallel environment """ data = samples[0][0] samples = run_parallel("generate_transcript_counts", samples) if "cufflinks"...
[ "def", "quantitate_expression_parallel", "(", "samples", ",", "run_parallel", ")", ":", "data", "=", "samples", "[", "0", "]", "[", "0", "]", "samples", "=", "run_parallel", "(", "\"generate_transcript_counts\"", ",", "samples", ")", "if", "\"cufflinks\"", "in",...
quantitate expression, all programs run here should be multithreaded to take advantage of the threaded run_parallel environment
[ "quantitate", "expression", "all", "programs", "run", "here", "should", "be", "multithreaded", "to", "take", "advantage", "of", "the", "threaded", "run_parallel", "environment" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L186-L210
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
quantitate_expression_noparallel
def quantitate_expression_noparallel(samples, run_parallel): """ run transcript quantitation for algorithms that don't run in parallel """ data = samples[0][0] if "express" in dd.get_expression_caller(data): samples = run_parallel("run_express", samples) if "dexseq" in dd.get_expression_...
python
def quantitate_expression_noparallel(samples, run_parallel): """ run transcript quantitation for algorithms that don't run in parallel """ data = samples[0][0] if "express" in dd.get_expression_caller(data): samples = run_parallel("run_express", samples) if "dexseq" in dd.get_expression_...
[ "def", "quantitate_expression_noparallel", "(", "samples", ",", "run_parallel", ")", ":", "data", "=", "samples", "[", "0", "]", "[", "0", "]", "if", "\"express\"", "in", "dd", ".", "get_expression_caller", "(", "data", ")", ":", "samples", "=", "run_paralle...
run transcript quantitation for algorithms that don't run in parallel
[ "run", "transcript", "quantitation", "for", "algorithms", "that", "don", "t", "run", "in", "parallel" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L236-L245
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
generate_transcript_counts
def generate_transcript_counts(data): """Generate counts per transcript and per exon from an alignment""" data["count_file"] = featureCounts.count(data) if dd.get_fusion_mode(data, False) and not dd.get_fusion_caller(data): oncofuse_file = oncofuse.run(data) if oncofuse_file: da...
python
def generate_transcript_counts(data): """Generate counts per transcript and per exon from an alignment""" data["count_file"] = featureCounts.count(data) if dd.get_fusion_mode(data, False) and not dd.get_fusion_caller(data): oncofuse_file = oncofuse.run(data) if oncofuse_file: da...
[ "def", "generate_transcript_counts", "(", "data", ")", ":", "data", "[", "\"count_file\"", "]", "=", "featureCounts", ".", "count", "(", "data", ")", "if", "dd", ".", "get_fusion_mode", "(", "data", ",", "False", ")", "and", "not", "dd", ".", "get_fusion_c...
Generate counts per transcript and per exon from an alignment
[ "Generate", "counts", "per", "transcript", "and", "per", "exon", "from", "an", "alignment" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L247-L278
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
run_dexseq
def run_dexseq(data): """Quantitate exon-level counts with DEXSeq""" if dd.get_dexseq_gff(data, None): data = dexseq.bcbio_run(data) return [[data]]
python
def run_dexseq(data): """Quantitate exon-level counts with DEXSeq""" if dd.get_dexseq_gff(data, None): data = dexseq.bcbio_run(data) return [[data]]
[ "def", "run_dexseq", "(", "data", ")", ":", "if", "dd", ".", "get_dexseq_gff", "(", "data", ",", "None", ")", ":", "data", "=", "dexseq", ".", "bcbio_run", "(", "data", ")", "return", "[", "[", "data", "]", "]" ]
Quantitate exon-level counts with DEXSeq
[ "Quantitate", "exon", "-", "level", "counts", "with", "DEXSeq" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L285-L289
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
combine_express
def combine_express(samples, combined): """Combine tpm, effective counts and fpkm from express results""" if not combined: return None to_combine = [dd.get_express_counts(x) for x in dd.sample_data_iterator(samples) if dd.get_express_counts(x)] gtf_file = dd.get_gtf_file(sample...
python
def combine_express(samples, combined): """Combine tpm, effective counts and fpkm from express results""" if not combined: return None to_combine = [dd.get_express_counts(x) for x in dd.sample_data_iterator(samples) if dd.get_express_counts(x)] gtf_file = dd.get_gtf_file(sample...
[ "def", "combine_express", "(", "samples", ",", "combined", ")", ":", "if", "not", "combined", ":", "return", "None", "to_combine", "=", "[", "dd", ".", "get_express_counts", "(", "x", ")", "for", "x", "in", "dd", ".", "sample_data_iterator", "(", "samples"...
Combine tpm, effective counts and fpkm from express results
[ "Combine", "tpm", "effective", "counts", "and", "fpkm", "from", "express", "results" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L296-L319
train
bcbio/bcbio-nextgen
bcbio/pipeline/rnaseq.py
run_cufflinks
def run_cufflinks(data): """Quantitate transcript expression with Cufflinks""" if "cufflinks" in dd.get_tools_off(data): return [[data]] work_bam = dd.get_work_bam(data) ref_file = dd.get_sam_ref(data) out_dir, fpkm_file, fpkm_isoform_file = cufflinks.run(work_bam, ref_file, data) data =...
python
def run_cufflinks(data): """Quantitate transcript expression with Cufflinks""" if "cufflinks" in dd.get_tools_off(data): return [[data]] work_bam = dd.get_work_bam(data) ref_file = dd.get_sam_ref(data) out_dir, fpkm_file, fpkm_isoform_file = cufflinks.run(work_bam, ref_file, data) data =...
[ "def", "run_cufflinks", "(", "data", ")", ":", "if", "\"cufflinks\"", "in", "dd", ".", "get_tools_off", "(", "data", ")", ":", "return", "[", "[", "data", "]", "]", "work_bam", "=", "dd", ".", "get_work_bam", "(", "data", ")", "ref_file", "=", "dd", ...
Quantitate transcript expression with Cufflinks
[ "Quantitate", "transcript", "expression", "with", "Cufflinks" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L321-L331
train
bcbio/bcbio-nextgen
bcbio/rnaseq/express.py
run
def run(data): """Quantitaive isoforms expression by eXpress""" name = dd.get_sample_name(data) in_bam = dd.get_transcriptome_bam(data) config = data['config'] if not in_bam: logger.info("Transcriptome-mapped BAM file not found, skipping eXpress.") return data out_dir = os.path.j...
python
def run(data): """Quantitaive isoforms expression by eXpress""" name = dd.get_sample_name(data) in_bam = dd.get_transcriptome_bam(data) config = data['config'] if not in_bam: logger.info("Transcriptome-mapped BAM file not found, skipping eXpress.") return data out_dir = os.path.j...
[ "def", "run", "(", "data", ")", ":", "name", "=", "dd", ".", "get_sample_name", "(", "data", ")", "in_bam", "=", "dd", ".", "get_transcriptome_bam", "(", "data", ")", "config", "=", "data", "[", "'config'", "]", "if", "not", "in_bam", ":", "logger", ...
Quantitaive isoforms expression by eXpress
[ "Quantitaive", "isoforms", "expression", "by", "eXpress" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L13-L39
train
bcbio/bcbio-nextgen
bcbio/rnaseq/express.py
_get_column
def _get_column(in_file, out_file, column, data=None): """Subset one column from a file """ with file_transaction(data, out_file) as tx_out_file: with open(in_file) as in_handle: with open(tx_out_file, 'w') as out_handle: for line in in_handle: cols = ...
python
def _get_column(in_file, out_file, column, data=None): """Subset one column from a file """ with file_transaction(data, out_file) as tx_out_file: with open(in_file) as in_handle: with open(tx_out_file, 'w') as out_handle: for line in in_handle: cols = ...
[ "def", "_get_column", "(", "in_file", ",", "out_file", ",", "column", ",", "data", "=", "None", ")", ":", "with", "file_transaction", "(", "data", ",", "out_file", ")", "as", "tx_out_file", ":", "with", "open", "(", "in_file", ")", "as", "in_handle", ":"...
Subset one column from a file
[ "Subset", "one", "column", "from", "a", "file" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L41-L55
train
bcbio/bcbio-nextgen
bcbio/rnaseq/express.py
_prepare_bam_file
def _prepare_bam_file(bam_file, tmp_dir, config): """ Pipe sort by name cmd in case sort by coordinates """ sort_mode = _get_sort_order(bam_file, config) if sort_mode != "queryname": bam_file = sort(bam_file, config, "queryname") return bam_file
python
def _prepare_bam_file(bam_file, tmp_dir, config): """ Pipe sort by name cmd in case sort by coordinates """ sort_mode = _get_sort_order(bam_file, config) if sort_mode != "queryname": bam_file = sort(bam_file, config, "queryname") return bam_file
[ "def", "_prepare_bam_file", "(", "bam_file", ",", "tmp_dir", ",", "config", ")", ":", "sort_mode", "=", "_get_sort_order", "(", "bam_file", ",", "config", ")", "if", "sort_mode", "!=", "\"queryname\"", ":", "bam_file", "=", "sort", "(", "bam_file", ",", "con...
Pipe sort by name cmd in case sort by coordinates
[ "Pipe", "sort", "by", "name", "cmd", "in", "case", "sort", "by", "coordinates" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L72-L79
train
bcbio/bcbio-nextgen
bcbio/rnaseq/express.py
isoform_to_gene_name
def isoform_to_gene_name(gtf_file, out_file, data): """ produce a table of isoform -> gene mappings for loading into EBSeq """ if not out_file: out_file = tempfile.NamedTemporaryFile(delete=False).name if file_exists(out_file): return out_file db = gtf.get_gtf_db(gtf_file) l...
python
def isoform_to_gene_name(gtf_file, out_file, data): """ produce a table of isoform -> gene mappings for loading into EBSeq """ if not out_file: out_file = tempfile.NamedTemporaryFile(delete=False).name if file_exists(out_file): return out_file db = gtf.get_gtf_db(gtf_file) l...
[ "def", "isoform_to_gene_name", "(", "gtf_file", ",", "out_file", ",", "data", ")", ":", "if", "not", "out_file", ":", "out_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ")", ".", "name", "if", "file_exists", "(", "out_file",...
produce a table of isoform -> gene mappings for loading into EBSeq
[ "produce", "a", "table", "of", "isoform", "-", ">", "gene", "mappings", "for", "loading", "into", "EBSeq" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L81-L97
train
bcbio/bcbio-nextgen
bcbio/variation/samtools.py
shared_variantcall
def shared_variantcall(call_fn, name, align_bams, ref_file, items, assoc_files, region=None, out_file=None): """Provide base functionality for prepping and indexing for variant calling. """ config = items[0]["config"] if out_file is None: if vcfutils.is_paired_analysis(ali...
python
def shared_variantcall(call_fn, name, align_bams, ref_file, items, assoc_files, region=None, out_file=None): """Provide base functionality for prepping and indexing for variant calling. """ config = items[0]["config"] if out_file is None: if vcfutils.is_paired_analysis(ali...
[ "def", "shared_variantcall", "(", "call_fn", ",", "name", ",", "align_bams", ",", "ref_file", ",", "items", ",", "assoc_files", ",", "region", "=", "None", ",", "out_file", "=", "None", ")", ":", "config", "=", "items", "[", "0", "]", "[", "\"config\"", ...
Provide base functionality for prepping and indexing for variant calling.
[ "Provide", "base", "functionality", "for", "prepping", "and", "indexing", "for", "variant", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/samtools.py#L19-L43
train
bcbio/bcbio-nextgen
bcbio/variation/samtools.py
run_samtools
def run_samtools(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Detect SNPs and indels with samtools mpileup and bcftools. """ return shared_variantcall(_call_variants_samtools, "samtools", align_bams, ref_file, items, assoc_files, re...
python
def run_samtools(align_bams, items, ref_file, assoc_files, region=None, out_file=None): """Detect SNPs and indels with samtools mpileup and bcftools. """ return shared_variantcall(_call_variants_samtools, "samtools", align_bams, ref_file, items, assoc_files, re...
[ "def", "run_samtools", "(", "align_bams", ",", "items", ",", "ref_file", ",", "assoc_files", ",", "region", "=", "None", ",", "out_file", "=", "None", ")", ":", "return", "shared_variantcall", "(", "_call_variants_samtools", ",", "\"samtools\"", ",", "align_bams...
Detect SNPs and indels with samtools mpileup and bcftools.
[ "Detect", "SNPs", "and", "indels", "with", "samtools", "mpileup", "and", "bcftools", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/samtools.py#L45-L50
train
bcbio/bcbio-nextgen
bcbio/variation/samtools.py
_call_variants_samtools
def _call_variants_samtools(align_bams, ref_file, items, target_regions, tx_out_file): """Call variants with samtools in target_regions. Works around a GATK VCF 4.2 compatibility issue in samtools 1.0 by removing addition 4.2-only isms from VCF header lines. """ config = items[0]["config"] mpil...
python
def _call_variants_samtools(align_bams, ref_file, items, target_regions, tx_out_file): """Call variants with samtools in target_regions. Works around a GATK VCF 4.2 compatibility issue in samtools 1.0 by removing addition 4.2-only isms from VCF header lines. """ config = items[0]["config"] mpil...
[ "def", "_call_variants_samtools", "(", "align_bams", ",", "ref_file", ",", "items", ",", "target_regions", ",", "tx_out_file", ")", ":", "config", "=", "items", "[", "0", "]", "[", "\"config\"", "]", "mpileup", "=", "prep_mpileup", "(", "align_bams", ",", "r...
Call variants with samtools in target_regions. Works around a GATK VCF 4.2 compatibility issue in samtools 1.0 by removing addition 4.2-only isms from VCF header lines.
[ "Call", "variants", "with", "samtools", "in", "target_regions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/samtools.py#L68-L94
train
bcbio/bcbio-nextgen
bcbio/pipeline/sra.py
_convert_fastq
def _convert_fastq(srafn, outdir, single=False): "convert sra to fastq" cmd = "fastq-dump --split-files --gzip {srafn}" cmd = "%s %s" % (utils.local_path_export(), cmd) sraid = os.path.basename(utils.splitext_plus(srafn)[0]) if not srafn: return None if not single: out_file = [os...
python
def _convert_fastq(srafn, outdir, single=False): "convert sra to fastq" cmd = "fastq-dump --split-files --gzip {srafn}" cmd = "%s %s" % (utils.local_path_export(), cmd) sraid = os.path.basename(utils.splitext_plus(srafn)[0]) if not srafn: return None if not single: out_file = [os...
[ "def", "_convert_fastq", "(", "srafn", ",", "outdir", ",", "single", "=", "False", ")", ":", "cmd", "=", "\"fastq-dump --split-files --gzip {srafn}\"", "cmd", "=", "\"%s %s\"", "%", "(", "utils", ".", "local_path_export", "(", ")", ",", "cmd", ")", "sraid", ...
convert sra to fastq
[ "convert", "sra", "to", "fastq" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sra.py#L119-L136
train
bcbio/bcbio-nextgen
bcbio/illumina/machine.py
check_and_postprocess
def check_and_postprocess(args): """Check for newly dumped sequencer output, post-processing and transferring. """ with open(args.process_config) as in_handle: config = yaml.safe_load(in_handle) setup_local_logging(config) for dname in _find_unprocessed(config): lane_details = nglims...
python
def check_and_postprocess(args): """Check for newly dumped sequencer output, post-processing and transferring. """ with open(args.process_config) as in_handle: config = yaml.safe_load(in_handle) setup_local_logging(config) for dname in _find_unprocessed(config): lane_details = nglims...
[ "def", "check_and_postprocess", "(", "args", ")", ":", "with", "open", "(", "args", ".", "process_config", ")", "as", "in_handle", ":", "config", "=", "yaml", ".", "safe_load", "(", "in_handle", ")", "setup_local_logging", "(", "config", ")", "for", "dname",...
Check for newly dumped sequencer output, post-processing and transferring.
[ "Check", "for", "newly", "dumped", "sequencer", "output", "post", "-", "processing", "and", "transferring", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L22-L40
train
bcbio/bcbio-nextgen
bcbio/illumina/machine.py
_tweak_lane
def _tweak_lane(lane_details, dname): """Potentially tweak lane information to handle custom processing, reading a lane_config.yaml file. """ tweak_config_file = os.path.join(dname, "lane_config.yaml") if os.path.exists(tweak_config_file): with open(tweak_config_file) as in_handle: t...
python
def _tweak_lane(lane_details, dname): """Potentially tweak lane information to handle custom processing, reading a lane_config.yaml file. """ tweak_config_file = os.path.join(dname, "lane_config.yaml") if os.path.exists(tweak_config_file): with open(tweak_config_file) as in_handle: t...
[ "def", "_tweak_lane", "(", "lane_details", ",", "dname", ")", ":", "tweak_config_file", "=", "os", ".", "path", ".", "join", "(", "dname", ",", "\"lane_config.yaml\"", ")", "if", "os", ".", "path", ".", "exists", "(", "tweak_config_file", ")", ":", "with",...
Potentially tweak lane information to handle custom processing, reading a lane_config.yaml file.
[ "Potentially", "tweak", "lane", "information", "to", "handle", "custom", "processing", "reading", "a", "lane_config", ".", "yaml", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L42-L55
train
bcbio/bcbio-nextgen
bcbio/illumina/machine.py
_remap_dirname
def _remap_dirname(local, remote): """Remap directory names from local to remote. """ def do(x): return x.replace(local, remote, 1) return do
python
def _remap_dirname(local, remote): """Remap directory names from local to remote. """ def do(x): return x.replace(local, remote, 1) return do
[ "def", "_remap_dirname", "(", "local", ",", "remote", ")", ":", "def", "do", "(", "x", ")", ":", "return", "x", ".", "replace", "(", "local", ",", "remote", ",", "1", ")", "return", "do" ]
Remap directory names from local to remote.
[ "Remap", "directory", "names", "from", "local", "to", "remote", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L57-L62
train
bcbio/bcbio-nextgen
bcbio/illumina/machine.py
_find_unprocessed
def _find_unprocessed(config): """Find any finished directories that have not been processed. """ reported = _read_reported(config["msg_db"]) for dname in _get_directories(config): if os.path.isdir(dname) and dname not in reported: if _is_finished_dumping(dname): yiel...
python
def _find_unprocessed(config): """Find any finished directories that have not been processed. """ reported = _read_reported(config["msg_db"]) for dname in _get_directories(config): if os.path.isdir(dname) and dname not in reported: if _is_finished_dumping(dname): yiel...
[ "def", "_find_unprocessed", "(", "config", ")", ":", "reported", "=", "_read_reported", "(", "config", "[", "\"msg_db\"", "]", ")", "for", "dname", "in", "_get_directories", "(", "config", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "dname", ")...
Find any finished directories that have not been processed.
[ "Find", "any", "finished", "directories", "that", "have", "not", "been", "processed", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L98-L105
train
bcbio/bcbio-nextgen
bcbio/illumina/machine.py
_is_finished_dumping
def _is_finished_dumping(directory): """Determine if the sequencing directory has all files. The final checkpoint file will differ depending if we are a single or paired end run. """ #if _is_finished_dumping_checkpoint(directory): # return True # Check final output files; handles both Hi...
python
def _is_finished_dumping(directory): """Determine if the sequencing directory has all files. The final checkpoint file will differ depending if we are a single or paired end run. """ #if _is_finished_dumping_checkpoint(directory): # return True # Check final output files; handles both Hi...
[ "def", "_is_finished_dumping", "(", "directory", ")", ":", "#if _is_finished_dumping_checkpoint(directory):", "# return True", "# Check final output files; handles both HiSeq and GAII", "run_info", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "\"RunInfo.xml\""...
Determine if the sequencing directory has all files. The final checkpoint file will differ depending if we are a single or paired end run.
[ "Determine", "if", "the", "sequencing", "directory", "has", "all", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L113-L129
train
bcbio/bcbio-nextgen
bcbio/illumina/machine.py
_expected_reads
def _expected_reads(run_info_file): """Parse the number of expected reads from the RunInfo.xml file. """ reads = [] if os.path.exists(run_info_file): tree = ElementTree() tree.parse(run_info_file) read_elem = tree.find("Run/Reads") reads = read_elem.findall("Read") re...
python
def _expected_reads(run_info_file): """Parse the number of expected reads from the RunInfo.xml file. """ reads = [] if os.path.exists(run_info_file): tree = ElementTree() tree.parse(run_info_file) read_elem = tree.find("Run/Reads") reads = read_elem.findall("Read") re...
[ "def", "_expected_reads", "(", "run_info_file", ")", ":", "reads", "=", "[", "]", "if", "os", ".", "path", ".", "exists", "(", "run_info_file", ")", ":", "tree", "=", "ElementTree", "(", ")", "tree", ".", "parse", "(", "run_info_file", ")", "read_elem", ...
Parse the number of expected reads from the RunInfo.xml file.
[ "Parse", "the", "number", "of", "expected", "reads", "from", "the", "RunInfo", ".", "xml", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L149-L158
train
bcbio/bcbio-nextgen
bcbio/illumina/machine.py
_read_reported
def _read_reported(msg_db): """Retrieve a list of directories previous reported. """ reported = [] if os.path.exists(msg_db): with open(msg_db) as in_handle: for line in in_handle: reported.append(line.strip()) return reported
python
def _read_reported(msg_db): """Retrieve a list of directories previous reported. """ reported = [] if os.path.exists(msg_db): with open(msg_db) as in_handle: for line in in_handle: reported.append(line.strip()) return reported
[ "def", "_read_reported", "(", "msg_db", ")", ":", "reported", "=", "[", "]", "if", "os", ".", "path", ".", "exists", "(", "msg_db", ")", ":", "with", "open", "(", "msg_db", ")", "as", "in_handle", ":", "for", "line", "in", "in_handle", ":", "reported...
Retrieve a list of directories previous reported.
[ "Retrieve", "a", "list", "of", "directories", "previous", "reported", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L162-L170
train
bcbio/bcbio-nextgen
bcbio/qc/viral.py
get_files
def get_files(data): """Retrieve pre-installed viral reference files. """ all_files = glob.glob(os.path.normpath(os.path.join(os.path.dirname(dd.get_ref_file(data)), os.pardir, "viral", "*"))) return sorted(all_files)
python
def get_files(data): """Retrieve pre-installed viral reference files. """ all_files = glob.glob(os.path.normpath(os.path.join(os.path.dirname(dd.get_ref_file(data)), os.pardir, "viral", "*"))) return sorted(all_files)
[ "def", "get_files", "(", "data", ")", ":", "all_files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "dd", ".", "get_ref_file", "(", "data", "...
Retrieve pre-installed viral reference files.
[ "Retrieve", "pre", "-", "installed", "viral", "reference", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/viral.py#L59-L64
train
bcbio/bcbio-nextgen
bcbio/rnaseq/variation.py
gatk_splitreads
def gatk_splitreads(data): """ use GATK to split reads with Ns in the CIGAR string, hard clipping regions that end up in introns """ broad_runner = broad.runner_from_config(dd.get_config(data)) ref_file = dd.get_ref_file(data) deduped_bam = dd.get_deduped_bam(data) base, ext = os.path.sp...
python
def gatk_splitreads(data): """ use GATK to split reads with Ns in the CIGAR string, hard clipping regions that end up in introns """ broad_runner = broad.runner_from_config(dd.get_config(data)) ref_file = dd.get_ref_file(data) deduped_bam = dd.get_deduped_bam(data) base, ext = os.path.sp...
[ "def", "gatk_splitreads", "(", "data", ")", ":", "broad_runner", "=", "broad", ".", "runner_from_config", "(", "dd", ".", "get_config", "(", "data", ")", ")", "ref_file", "=", "dd", ".", "get_ref_file", "(", "data", ")", "deduped_bam", "=", "dd", ".", "g...
use GATK to split reads with Ns in the CIGAR string, hard clipping regions that end up in introns
[ "use", "GATK", "to", "split", "reads", "with", "Ns", "in", "the", "CIGAR", "string", "hard", "clipping", "regions", "that", "end", "up", "in", "introns" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L25-L57
train
bcbio/bcbio-nextgen
bcbio/rnaseq/variation.py
_setup_variant_regions
def _setup_variant_regions(data, out_dir): """Ensure we have variant regions for calling, using transcript if not present. Respects noalt_calling by removing additional contigs to improve speeds. """ vr_file = dd.get_variant_regions(data) if not vr_file: vr_file = regions.get_sv_bed(dat...
python
def _setup_variant_regions(data, out_dir): """Ensure we have variant regions for calling, using transcript if not present. Respects noalt_calling by removing additional contigs to improve speeds. """ vr_file = dd.get_variant_regions(data) if not vr_file: vr_file = regions.get_sv_bed(dat...
[ "def", "_setup_variant_regions", "(", "data", ",", "out_dir", ")", ":", "vr_file", "=", "dd", ".", "get_variant_regions", "(", "data", ")", "if", "not", "vr_file", ":", "vr_file", "=", "regions", ".", "get_sv_bed", "(", "data", ",", "\"transcripts\"", ",", ...
Ensure we have variant regions for calling, using transcript if not present. Respects noalt_calling by removing additional contigs to improve speeds.
[ "Ensure", "we", "have", "variant", "regions", "for", "calling", "using", "transcript", "if", "not", "present", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L59-L80
train
bcbio/bcbio-nextgen
bcbio/rnaseq/variation.py
gatk_rnaseq_calling
def gatk_rnaseq_calling(data): """Use GATK to perform gVCF variant calling on RNA-seq data """ from bcbio.bam import callable data = utils.deepish_copy(data) tools_on = dd.get_tools_on(data) if not tools_on: tools_on = [] tools_on.append("gvcf") data = dd.set_tools_on(data, tools...
python
def gatk_rnaseq_calling(data): """Use GATK to perform gVCF variant calling on RNA-seq data """ from bcbio.bam import callable data = utils.deepish_copy(data) tools_on = dd.get_tools_on(data) if not tools_on: tools_on = [] tools_on.append("gvcf") data = dd.set_tools_on(data, tools...
[ "def", "gatk_rnaseq_calling", "(", "data", ")", ":", "from", "bcbio", ".", "bam", "import", "callable", "data", "=", "utils", ".", "deepish_copy", "(", "data", ")", "tools_on", "=", "dd", ".", "get_tools_on", "(", "data", ")", "if", "not", "tools_on", ":...
Use GATK to perform gVCF variant calling on RNA-seq data
[ "Use", "GATK", "to", "perform", "gVCF", "variant", "calling", "on", "RNA", "-", "seq", "data" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L82-L112
train
bcbio/bcbio-nextgen
bcbio/rnaseq/variation.py
filter_junction_variants
def filter_junction_variants(vrn_file, data): """ filter out variants within 10 basepairs of a splice junction, these are very prone to being false positives with RNA-seq data """ SJ_BP_MASK = 10 vrn_dir = os.path.dirname(vrn_file) splicebed = dd.get_junction_bed(data) if not file_exists...
python
def filter_junction_variants(vrn_file, data): """ filter out variants within 10 basepairs of a splice junction, these are very prone to being false positives with RNA-seq data """ SJ_BP_MASK = 10 vrn_dir = os.path.dirname(vrn_file) splicebed = dd.get_junction_bed(data) if not file_exists...
[ "def", "filter_junction_variants", "(", "vrn_file", ",", "data", ")", ":", "SJ_BP_MASK", "=", "10", "vrn_dir", "=", "os", ".", "path", ".", "dirname", "(", "vrn_file", ")", "splicebed", "=", "dd", ".", "get_junction_bed", "(", "data", ")", "if", "not", "...
filter out variants within 10 basepairs of a splice junction, these are very prone to being false positives with RNA-seq data
[ "filter", "out", "variants", "within", "10", "basepairs", "of", "a", "splice", "junction", "these", "are", "very", "prone", "to", "being", "false", "positives", "with", "RNA", "-", "seq", "data" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L186-L207
train
bcbio/bcbio-nextgen
scripts/bcbio_nextgen_install.py
_clean_args
def _clean_args(sys_argv, args): """Remove data directory from arguments to pass to upgrade function. """ base = [x for x in sys_argv if x.startswith("-") or not args.datadir == os.path.abspath(os.path.expanduser(x))] # Remove installer only options we don't pass on base = [x for x in ba...
python
def _clean_args(sys_argv, args): """Remove data directory from arguments to pass to upgrade function. """ base = [x for x in sys_argv if x.startswith("-") or not args.datadir == os.path.abspath(os.path.expanduser(x))] # Remove installer only options we don't pass on base = [x for x in ba...
[ "def", "_clean_args", "(", "sys_argv", ",", "args", ")", ":", "base", "=", "[", "x", "for", "x", "in", "sys_argv", "if", "x", ".", "startswith", "(", "\"-\"", ")", "or", "not", "args", ".", "datadir", "==", "os", ".", "path", ".", "abspath", "(", ...
Remove data directory from arguments to pass to upgrade function.
[ "Remove", "data", "directory", "from", "arguments", "to", "pass", "to", "upgrade", "function", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L53-L64
train
bcbio/bcbio-nextgen
scripts/bcbio_nextgen_install.py
setup_manifest
def setup_manifest(datadir): """Create barebones manifest to be filled in during update """ manifest_dir = os.path.join(datadir, "manifest") if not os.path.exists(manifest_dir): os.makedirs(manifest_dir)
python
def setup_manifest(datadir): """Create barebones manifest to be filled in during update """ manifest_dir = os.path.join(datadir, "manifest") if not os.path.exists(manifest_dir): os.makedirs(manifest_dir)
[ "def", "setup_manifest", "(", "datadir", ")", ":", "manifest_dir", "=", "os", ".", "path", ".", "join", "(", "datadir", ",", "\"manifest\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "manifest_dir", ")", ":", "os", ".", "makedirs", "(", ...
Create barebones manifest to be filled in during update
[ "Create", "barebones", "manifest", "to", "be", "filled", "in", "during", "update" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L139-L144
train
bcbio/bcbio-nextgen
scripts/bcbio_nextgen_install.py
write_system_config
def write_system_config(base_url, datadir, tooldir): """Write a bcbio_system.yaml configuration file with tool information. """ out_file = os.path.join(datadir, "galaxy", os.path.basename(base_url)) if not os.path.exists(os.path.dirname(out_file)): os.makedirs(os.path.dirname(out_file)) if o...
python
def write_system_config(base_url, datadir, tooldir): """Write a bcbio_system.yaml configuration file with tool information. """ out_file = os.path.join(datadir, "galaxy", os.path.basename(base_url)) if not os.path.exists(os.path.dirname(out_file)): os.makedirs(os.path.dirname(out_file)) if o...
[ "def", "write_system_config", "(", "base_url", ",", "datadir", ",", "tooldir", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "datadir", ",", "\"galaxy\"", ",", "os", ".", "path", ".", "basename", "(", "base_url", ")", ")", "if", "not"...
Write a bcbio_system.yaml configuration file with tool information.
[ "Write", "a", "bcbio_system", ".", "yaml", "configuration", "file", "with", "tool", "information", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L146-L183
train
bcbio/bcbio-nextgen
scripts/bcbio_nextgen_install.py
check_dependencies
def check_dependencies(): """Ensure required tools for installation are present. """ print("Checking required dependencies") for dep, msg in [(["git", "--version"], "Git (http://git-scm.com/)"), (["wget", "--version"], "wget"), (["bzip2", "-h"], "bzip2")]: ...
python
def check_dependencies(): """Ensure required tools for installation are present. """ print("Checking required dependencies") for dep, msg in [(["git", "--version"], "Git (http://git-scm.com/)"), (["wget", "--version"], "wget"), (["bzip2", "-h"], "bzip2")]: ...
[ "def", "check_dependencies", "(", ")", ":", "print", "(", "\"Checking required dependencies\"", ")", "for", "dep", ",", "msg", "in", "[", "(", "[", "\"git\"", ",", "\"--version\"", "]", ",", "\"Git (http://git-scm.com/)\"", ")", ",", "(", "[", "\"wget\"", ",",...
Ensure required tools for installation are present.
[ "Ensure", "required", "tools", "for", "installation", "are", "present", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L207-L221
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
process
def process(args): """Run the function in args.name given arguments in args.argfile. """ # Set environment to standard to use periods for decimals and avoid localization os.environ["LC_ALL"] = "C" os.environ["LC"] = "C" os.environ["LANG"] = "C" setpath.prepend_bcbiopath() try: fn...
python
def process(args): """Run the function in args.name given arguments in args.argfile. """ # Set environment to standard to use periods for decimals and avoid localization os.environ["LC_ALL"] = "C" os.environ["LC"] = "C" os.environ["LANG"] = "C" setpath.prepend_bcbiopath() try: fn...
[ "def", "process", "(", "args", ")", ":", "# Set environment to standard to use periods for decimals and avoid localization", "os", ".", "environ", "[", "\"LC_ALL\"", "]", "=", "\"C\"", "os", ".", "environ", "[", "\"LC\"", "]", "=", "\"C\"", "os", ".", "environ", "...
Run the function in args.name given arguments in args.argfile.
[ "Run", "the", "function", "in", "args", ".", "name", "given", "arguments", "in", "args", ".", "argfile", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L23-L71
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_cwlvar_to_wdl
def _cwlvar_to_wdl(var): """Convert a CWL output object into a WDL output. This flattens files and other special CWL outputs that are plain strings in WDL. """ if isinstance(var, (list, tuple)): return [_cwlvar_to_wdl(x) for x in var] elif isinstance(var, dict): assert var.get("...
python
def _cwlvar_to_wdl(var): """Convert a CWL output object into a WDL output. This flattens files and other special CWL outputs that are plain strings in WDL. """ if isinstance(var, (list, tuple)): return [_cwlvar_to_wdl(x) for x in var] elif isinstance(var, dict): assert var.get("...
[ "def", "_cwlvar_to_wdl", "(", "var", ")", ":", "if", "isinstance", "(", "var", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "_cwlvar_to_wdl", "(", "x", ")", "for", "x", "in", "var", "]", "elif", "isinstance", "(", "var", ",", "dict...
Convert a CWL output object into a WDL output. This flattens files and other special CWL outputs that are plain strings in WDL.
[ "Convert", "a", "CWL", "output", "object", "into", "a", "WDL", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L73-L86
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_write_out_argfile
def _write_out_argfile(argfile, out, fnargs, parallel, out_keys, input_files, work_dir): """Write output argfile, preparing a CWL ready JSON or YAML representation of the world. """ with open(argfile, "w") as out_handle: if argfile.endswith(".json"): record_name, record_attrs = _get_reco...
python
def _write_out_argfile(argfile, out, fnargs, parallel, out_keys, input_files, work_dir): """Write output argfile, preparing a CWL ready JSON or YAML representation of the world. """ with open(argfile, "w") as out_handle: if argfile.endswith(".json"): record_name, record_attrs = _get_reco...
[ "def", "_write_out_argfile", "(", "argfile", ",", "out", ",", "fnargs", ",", "parallel", ",", "out_keys", ",", "input_files", ",", "work_dir", ")", ":", "with", "open", "(", "argfile", ",", "\"w\"", ")", "as", "out_handle", ":", "if", "argfile", ".", "en...
Write output argfile, preparing a CWL ready JSON or YAML representation of the world.
[ "Write", "output", "argfile", "preparing", "a", "CWL", "ready", "JSON", "or", "YAML", "representation", "of", "the", "world", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L88-L113
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_get_record_attrs
def _get_record_attrs(out_keys): """Check for records, a single key plus output attributes. """ if len(out_keys) == 1: attr = list(out_keys.keys())[0] if out_keys[attr]: return attr, out_keys[attr] return None, None
python
def _get_record_attrs(out_keys): """Check for records, a single key plus output attributes. """ if len(out_keys) == 1: attr = list(out_keys.keys())[0] if out_keys[attr]: return attr, out_keys[attr] return None, None
[ "def", "_get_record_attrs", "(", "out_keys", ")", ":", "if", "len", "(", "out_keys", ")", "==", "1", ":", "attr", "=", "list", "(", "out_keys", ".", "keys", "(", ")", ")", "[", "0", "]", "if", "out_keys", "[", "attr", "]", ":", "return", "attr", ...
Check for records, a single key plus output attributes.
[ "Check", "for", "records", "a", "single", "key", "plus", "output", "attributes", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L115-L122
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_add_resources
def _add_resources(data, runtime): """Merge input resources with current CWL runtime parameters. """ if "config" not in data: data["config"] = {} # Convert input resources, which may be a JSON string resources = data.get("resources", {}) or {} if isinstance(resources, six.string_types) a...
python
def _add_resources(data, runtime): """Merge input resources with current CWL runtime parameters. """ if "config" not in data: data["config"] = {} # Convert input resources, which may be a JSON string resources = data.get("resources", {}) or {} if isinstance(resources, six.string_types) a...
[ "def", "_add_resources", "(", "data", ",", "runtime", ")", ":", "if", "\"config\"", "not", "in", "data", ":", "data", "[", "\"config\"", "]", "=", "{", "}", "# Convert input resources, which may be a JSON string", "resources", "=", "data", ".", "get", "(", "\"...
Merge input resources with current CWL runtime parameters.
[ "Merge", "input", "resources", "with", "current", "CWL", "runtime", "parameters", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L124-L143
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_world_from_cwl
def _world_from_cwl(fn_name, fnargs, work_dir): """Reconstitute a bcbio world data object from flattened CWL-compatible inputs. Converts the flat CWL representation into a nested bcbio world dictionary. Handles single sample inputs (returning a single world object) and multi-sample runs (returning a l...
python
def _world_from_cwl(fn_name, fnargs, work_dir): """Reconstitute a bcbio world data object from flattened CWL-compatible inputs. Converts the flat CWL representation into a nested bcbio world dictionary. Handles single sample inputs (returning a single world object) and multi-sample runs (returning a l...
[ "def", "_world_from_cwl", "(", "fn_name", ",", "fnargs", ",", "work_dir", ")", ":", "parallel", "=", "None", "output_cwl_keys", "=", "None", "runtime", "=", "{", "}", "out", "=", "[", "]", "data", "=", "{", "}", "passed_keys", "=", "[", "]", "for", "...
Reconstitute a bcbio world data object from flattened CWL-compatible inputs. Converts the flat CWL representation into a nested bcbio world dictionary. Handles single sample inputs (returning a single world object) and multi-sample runs (returning a list of individual samples to get processed together).
[ "Reconstitute", "a", "bcbio", "world", "data", "object", "from", "flattened", "CWL", "-", "compatible", "inputs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L145-L194
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_parse_output_keys
def _parse_output_keys(val): """Parse expected output keys from string, handling records. """ out = {} for k in val.split(","): # record output if ":" in k: name, attrs = k.split(":") out[name] = attrs.split(";") else: out[k] = None return ...
python
def _parse_output_keys(val): """Parse expected output keys from string, handling records. """ out = {} for k in val.split(","): # record output if ":" in k: name, attrs = k.split(":") out[name] = attrs.split(";") else: out[k] = None return ...
[ "def", "_parse_output_keys", "(", "val", ")", ":", "out", "=", "{", "}", "for", "k", "in", "val", ".", "split", "(", "\",\"", ")", ":", "# record output", "if", "\":\"", "in", "k", ":", "name", ",", "attrs", "=", "k", ".", "split", "(", "\":\"", ...
Parse expected output keys from string, handling records.
[ "Parse", "expected", "output", "keys", "from", "string", "handling", "records", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L196-L207
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_find_input_files
def _find_input_files(var, out): """Find input files within the given CWL object. """ if isinstance(var, (list, tuple)): for x in var: out = _find_input_files(x, out) elif isinstance(var, dict): if var.get("class") == "File": out.append(var["path"]) ou...
python
def _find_input_files(var, out): """Find input files within the given CWL object. """ if isinstance(var, (list, tuple)): for x in var: out = _find_input_files(x, out) elif isinstance(var, dict): if var.get("class") == "File": out.append(var["path"]) ou...
[ "def", "_find_input_files", "(", "var", ",", "out", ")", ":", "if", "isinstance", "(", "var", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "x", "in", "var", ":", "out", "=", "_find_input_files", "(", "x", ",", "out", ")", "elif", "isinstan...
Find input files within the given CWL object.
[ "Find", "input", "files", "within", "the", "given", "CWL", "object", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L209-L221
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_read_from_cwlinput
def _read_from_cwlinput(in_file, work_dir, runtime, parallel, input_order, output_cwl_keys): """Read data records from a JSON dump of inputs. Avoids command line flattening of records. """ with open(in_file) as in_handle: inputs = json.load(in_handle) items_by_key = {} input_files = [] p...
python
def _read_from_cwlinput(in_file, work_dir, runtime, parallel, input_order, output_cwl_keys): """Read data records from a JSON dump of inputs. Avoids command line flattening of records. """ with open(in_file) as in_handle: inputs = json.load(in_handle) items_by_key = {} input_files = [] p...
[ "def", "_read_from_cwlinput", "(", "in_file", ",", "work_dir", ",", "runtime", ",", "parallel", ",", "input_order", ",", "output_cwl_keys", ")", ":", "with", "open", "(", "in_file", ")", "as", "in_handle", ":", "inputs", "=", "json", ".", "load", "(", "in_...
Read data records from a JSON dump of inputs. Avoids command line flattening of records.
[ "Read", "data", "records", "from", "a", "JSON", "dump", "of", "inputs", ".", "Avoids", "command", "line", "flattening", "of", "records", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L223-L249
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_maybe_nest_bare_single
def _maybe_nest_bare_single(items_by_key, parallel): """Nest single inputs to avoid confusing single items and lists like files. """ if (parallel == "multi-parallel" and (sum([1 for x in items_by_key.values() if not _is_nested_item(x)]) >= sum([1 for x in items_by_key.values() if _is_ne...
python
def _maybe_nest_bare_single(items_by_key, parallel): """Nest single inputs to avoid confusing single items and lists like files. """ if (parallel == "multi-parallel" and (sum([1 for x in items_by_key.values() if not _is_nested_item(x)]) >= sum([1 for x in items_by_key.values() if _is_ne...
[ "def", "_maybe_nest_bare_single", "(", "items_by_key", ",", "parallel", ")", ":", "if", "(", "parallel", "==", "\"multi-parallel\"", "and", "(", "sum", "(", "[", "1", "for", "x", "in", "items_by_key", ".", "values", "(", ")", "if", "not", "_is_nested_item", ...
Nest single inputs to avoid confusing single items and lists like files.
[ "Nest", "single", "inputs", "to", "avoid", "confusing", "single", "items", "and", "lists", "like", "files", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L254-L265
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_check_for_single_nested
def _check_for_single_nested(target, items_by_key, input_order): """Check for single nested inputs that match our target count and unnest. Handles complex var inputs where some have an extra layer of nesting. """ out = utils.deepish_copy(items_by_key) for (k, t) in input_order.items(): if t...
python
def _check_for_single_nested(target, items_by_key, input_order): """Check for single nested inputs that match our target count and unnest. Handles complex var inputs where some have an extra layer of nesting. """ out = utils.deepish_copy(items_by_key) for (k, t) in input_order.items(): if t...
[ "def", "_check_for_single_nested", "(", "target", ",", "items_by_key", ",", "input_order", ")", ":", "out", "=", "utils", ".", "deepish_copy", "(", "items_by_key", ")", "for", "(", "k", ",", "t", ")", "in", "input_order", ".", "items", "(", ")", ":", "if...
Check for single nested inputs that match our target count and unnest. Handles complex var inputs where some have an extra layer of nesting.
[ "Check", "for", "single", "nested", "inputs", "that", "match", "our", "target", "count", "and", "unnest", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L273-L284
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_concat_records
def _concat_records(items_by_key, input_order): """Concatenate records into a single key to avoid merging. Handles heterogeneous records that will then be sorted out in the processing fuction. """ all_records = [] for (k, t) in input_order.items(): if t == "record": all_reco...
python
def _concat_records(items_by_key, input_order): """Concatenate records into a single key to avoid merging. Handles heterogeneous records that will then be sorted out in the processing fuction. """ all_records = [] for (k, t) in input_order.items(): if t == "record": all_reco...
[ "def", "_concat_records", "(", "items_by_key", ",", "input_order", ")", ":", "all_records", "=", "[", "]", "for", "(", "k", ",", "t", ")", "in", "input_order", ".", "items", "(", ")", ":", "if", "t", "==", "\"record\"", ":", "all_records", ".", "append...
Concatenate records into a single key to avoid merging. Handles heterogeneous records that will then be sorted out in the processing fuction.
[ "Concatenate", "records", "into", "a", "single", "key", "to", "avoid", "merging", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L286-L306
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_nest_vars_in_rec
def _nest_vars_in_rec(var_items, rec_items, input_order, items_by_key, parallel): """Nest multiple variable inputs into a single record or list of batch records. Custom CWL implementations extract and merge these. """ num_items = var_items var_items = list(var_items)[0] if rec_items: re...
python
def _nest_vars_in_rec(var_items, rec_items, input_order, items_by_key, parallel): """Nest multiple variable inputs into a single record or list of batch records. Custom CWL implementations extract and merge these. """ num_items = var_items var_items = list(var_items)[0] if rec_items: re...
[ "def", "_nest_vars_in_rec", "(", "var_items", ",", "rec_items", ",", "input_order", ",", "items_by_key", ",", "parallel", ")", ":", "num_items", "=", "var_items", "var_items", "=", "list", "(", "var_items", ")", "[", "0", "]", "if", "rec_items", ":", "rec_it...
Nest multiple variable inputs into a single record or list of batch records. Custom CWL implementations extract and merge these.
[ "Nest", "multiple", "variable", "inputs", "into", "a", "single", "record", "or", "list", "of", "batch", "records", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L364-L380
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_expand_rec_to_vars
def _expand_rec_to_vars(var_items, rec_items, input_order, items_by_key, parallel): """Expand record to apply to number of variants. Alternative approach to _nest_vars_in_rec to combining a single record with multiple variants. """ num_items = var_items var_items = list(var_items)[0] if rec...
python
def _expand_rec_to_vars(var_items, rec_items, input_order, items_by_key, parallel): """Expand record to apply to number of variants. Alternative approach to _nest_vars_in_rec to combining a single record with multiple variants. """ num_items = var_items var_items = list(var_items)[0] if rec...
[ "def", "_expand_rec_to_vars", "(", "var_items", ",", "rec_items", ",", "input_order", ",", "items_by_key", ",", "parallel", ")", ":", "num_items", "=", "var_items", "var_items", "=", "list", "(", "var_items", ")", "[", "0", "]", "if", "rec_items", ":", "for"...
Expand record to apply to number of variants. Alternative approach to _nest_vars_in_rec to combining a single record with multiple variants.
[ "Expand", "record", "to", "apply", "to", "number", "of", "variants", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L382-L397
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_read_cwl_record
def _read_cwl_record(rec): """Read CWL records, handling multiple nesting and batching cases. """ keys = set([]) out = [] if isinstance(rec, dict): is_batched = all([isinstance(v, (list, tuple)) for v in rec.values()]) cur = [{} for _ in range(len(rec.values()[0]) if is_batched else ...
python
def _read_cwl_record(rec): """Read CWL records, handling multiple nesting and batching cases. """ keys = set([]) out = [] if isinstance(rec, dict): is_batched = all([isinstance(v, (list, tuple)) for v in rec.values()]) cur = [{} for _ in range(len(rec.values()[0]) if is_batched else ...
[ "def", "_read_cwl_record", "(", "rec", ")", ":", "keys", "=", "set", "(", "[", "]", ")", "out", "=", "[", "]", "if", "isinstance", "(", "rec", ",", "dict", ")", ":", "is_batched", "=", "all", "(", "[", "isinstance", "(", "v", ",", "(", "list", ...
Read CWL records, handling multiple nesting and batching cases.
[ "Read", "CWL", "records", "handling", "multiple", "nesting", "and", "batching", "cases", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L399-L425
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_finalize_cwl_in
def _finalize_cwl_in(data, work_dir, passed_keys, output_cwl_keys, runtime): """Finalize data object with inputs from CWL. """ data["dirs"] = {"work": work_dir} if not tz.get_in(["config", "algorithm"], data): if "config" not in data: data["config"] = {} data["config"]["algor...
python
def _finalize_cwl_in(data, work_dir, passed_keys, output_cwl_keys, runtime): """Finalize data object with inputs from CWL. """ data["dirs"] = {"work": work_dir} if not tz.get_in(["config", "algorithm"], data): if "config" not in data: data["config"] = {} data["config"]["algor...
[ "def", "_finalize_cwl_in", "(", "data", ",", "work_dir", ",", "passed_keys", ",", "output_cwl_keys", ",", "runtime", ")", ":", "data", "[", "\"dirs\"", "]", "=", "{", "\"work\"", ":", "work_dir", "}", "if", "not", "tz", ".", "get_in", "(", "[", "\"config...
Finalize data object with inputs from CWL.
[ "Finalize", "data", "object", "with", "inputs", "from", "CWL", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L427-L442
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_convert_value
def _convert_value(val): """Handle multiple input type values. """ def _is_number(x, op): try: op(x) return True except ValueError: return False if isinstance(val, (list, tuple)): return [_convert_value(x) for x in val] elif val is None: ...
python
def _convert_value(val): """Handle multiple input type values. """ def _is_number(x, op): try: op(x) return True except ValueError: return False if isinstance(val, (list, tuple)): return [_convert_value(x) for x in val] elif val is None: ...
[ "def", "_convert_value", "(", "val", ")", ":", "def", "_is_number", "(", "x", ",", "op", ")", ":", "try", ":", "op", "(", "x", ")", "return", "True", "except", "ValueError", ":", "return", "False", "if", "isinstance", "(", "val", ",", "(", "list", ...
Handle multiple input type values.
[ "Handle", "multiple", "input", "type", "values", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L444-L472
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_get_output_cwl_keys
def _get_output_cwl_keys(fnargs): """Retrieve output_cwl_keys from potentially nested input arguments. """ for d in utils.flatten(fnargs): if isinstance(d, dict) and d.get("output_cwl_keys"): return d["output_cwl_keys"] raise ValueError("Did not find output_cwl_keys in %s" % (pprint....
python
def _get_output_cwl_keys(fnargs): """Retrieve output_cwl_keys from potentially nested input arguments. """ for d in utils.flatten(fnargs): if isinstance(d, dict) and d.get("output_cwl_keys"): return d["output_cwl_keys"] raise ValueError("Did not find output_cwl_keys in %s" % (pprint....
[ "def", "_get_output_cwl_keys", "(", "fnargs", ")", ":", "for", "d", "in", "utils", ".", "flatten", "(", "fnargs", ")", ":", "if", "isinstance", "(", "d", ",", "dict", ")", "and", "d", ".", "get", "(", "\"output_cwl_keys\"", ")", ":", "return", "d", "...
Retrieve output_cwl_keys from potentially nested input arguments.
[ "Retrieve", "output_cwl_keys", "from", "potentially", "nested", "input", "arguments", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L492-L498
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_combine_cwl_records
def _combine_cwl_records(recs, record_name, parallel): """Provide a list of nexted CWL records keyed by output key. Handles batches, where we return a list of records, and single items where we return one record. """ if parallel not in ["multi-batch", "single-split", "multi-combined", "batch-single...
python
def _combine_cwl_records(recs, record_name, parallel): """Provide a list of nexted CWL records keyed by output key. Handles batches, where we return a list of records, and single items where we return one record. """ if parallel not in ["multi-batch", "single-split", "multi-combined", "batch-single...
[ "def", "_combine_cwl_records", "(", "recs", ",", "record_name", ",", "parallel", ")", ":", "if", "parallel", "not", "in", "[", "\"multi-batch\"", ",", "\"single-split\"", ",", "\"multi-combined\"", ",", "\"batch-single\"", "]", ":", "assert", "len", "(", "recs",...
Provide a list of nexted CWL records keyed by output key. Handles batches, where we return a list of records, and single items where we return one record.
[ "Provide", "a", "list", "of", "nexted", "CWL", "records", "keyed", "by", "output", "key", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L500-L510
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_collapse_to_cwl_record_single
def _collapse_to_cwl_record_single(data, want_attrs, input_files): """Convert a single sample into a CWL record. """ out = {} for key in want_attrs: key_parts = key.split("__") out[key] = _to_cwl(tz.get_in(key_parts, data), input_files) return out
python
def _collapse_to_cwl_record_single(data, want_attrs, input_files): """Convert a single sample into a CWL record. """ out = {} for key in want_attrs: key_parts = key.split("__") out[key] = _to_cwl(tz.get_in(key_parts, data), input_files) return out
[ "def", "_collapse_to_cwl_record_single", "(", "data", ",", "want_attrs", ",", "input_files", ")", ":", "out", "=", "{", "}", "for", "key", "in", "want_attrs", ":", "key_parts", "=", "key", ".", "split", "(", "\"__\"", ")", "out", "[", "key", "]", "=", ...
Convert a single sample into a CWL record.
[ "Convert", "a", "single", "sample", "into", "a", "CWL", "record", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L512-L519
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_nested_cwl_record
def _nested_cwl_record(xs, want_attrs, input_files): """Convert arbitrarily nested samples into a nested list of dictionaries. nests only at the record level, rather than within records. For batching a top level list is all of the batches and sub-lists are samples within the batch. """ if isins...
python
def _nested_cwl_record(xs, want_attrs, input_files): """Convert arbitrarily nested samples into a nested list of dictionaries. nests only at the record level, rather than within records. For batching a top level list is all of the batches and sub-lists are samples within the batch. """ if isins...
[ "def", "_nested_cwl_record", "(", "xs", ",", "want_attrs", ",", "input_files", ")", ":", "if", "isinstance", "(", "xs", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "_nested_cwl_record", "(", "x", ",", "want_attrs", ",", "input_files", "...
Convert arbitrarily nested samples into a nested list of dictionaries. nests only at the record level, rather than within records. For batching a top level list is all of the batches and sub-lists are samples within the batch.
[ "Convert", "arbitrarily", "nested", "samples", "into", "a", "nested", "list", "of", "dictionaries", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L521-L532
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_collapse_to_cwl_record
def _collapse_to_cwl_record(samples, want_attrs, input_files): """Convert nested samples from batches into a CWL record, based on input keys. """ input_keys = sorted(list(set().union(*[d["cwl_keys"] for d in samples])), key=lambda x: (-len(x), tuple(x))) out = {} for key in input_keys: if ke...
python
def _collapse_to_cwl_record(samples, want_attrs, input_files): """Convert nested samples from batches into a CWL record, based on input keys. """ input_keys = sorted(list(set().union(*[d["cwl_keys"] for d in samples])), key=lambda x: (-len(x), tuple(x))) out = {} for key in input_keys: if ke...
[ "def", "_collapse_to_cwl_record", "(", "samples", ",", "want_attrs", ",", "input_files", ")", ":", "input_keys", "=", "sorted", "(", "list", "(", "set", "(", ")", ".", "union", "(", "*", "[", "d", "[", "\"cwl_keys\"", "]", "for", "d", "in", "samples", ...
Convert nested samples from batches into a CWL record, based on input keys.
[ "Convert", "nested", "samples", "from", "batches", "into", "a", "CWL", "record", "based", "on", "input", "keys", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L534-L550
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_file_and_exists
def _file_and_exists(val, input_files): """Check if an input is a file and exists. Checks both locally (staged) and from input files (re-passed but never localized). """ return ((os.path.exists(val) and os.path.isfile(val)) or val in input_files)
python
def _file_and_exists(val, input_files): """Check if an input is a file and exists. Checks both locally (staged) and from input files (re-passed but never localized). """ return ((os.path.exists(val) and os.path.isfile(val)) or val in input_files)
[ "def", "_file_and_exists", "(", "val", ",", "input_files", ")", ":", "return", "(", "(", "os", ".", "path", ".", "exists", "(", "val", ")", "and", "os", ".", "path", ".", "isfile", "(", "val", ")", ")", "or", "val", "in", "input_files", ")" ]
Check if an input is a file and exists. Checks both locally (staged) and from input files (re-passed but never localized).
[ "Check", "if", "an", "input", "is", "a", "file", "and", "exists", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L552-L558
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_to_cwl
def _to_cwl(val, input_files): """Convert a value into CWL formatted JSON, handling files and complex things. """ if isinstance(val, six.string_types): if _file_and_exists(val, input_files): val = {"class": "File", "path": val} secondary = [] for idx in [".bai", "...
python
def _to_cwl(val, input_files): """Convert a value into CWL formatted JSON, handling files and complex things. """ if isinstance(val, six.string_types): if _file_and_exists(val, input_files): val = {"class": "File", "path": val} secondary = [] for idx in [".bai", "...
[ "def", "_to_cwl", "(", "val", ",", "input_files", ")", ":", "if", "isinstance", "(", "val", ",", "six", ".", "string_types", ")", ":", "if", "_file_and_exists", "(", "val", ",", "input_files", ")", ":", "val", "=", "{", "\"class\"", ":", "\"File\"", ",...
Convert a value into CWL formatted JSON, handling files and complex things.
[ "Convert", "a", "value", "into", "CWL", "formatted", "JSON", "handling", "files", "and", "complex", "things", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L560-L603
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_remove_duplicate_files
def _remove_duplicate_files(xs): """Remove files specified multiple times in a list. """ seen = set([]) out = [] for x in xs: if x["path"] not in seen: out.append(x) seen.add(x["path"]) return out
python
def _remove_duplicate_files(xs): """Remove files specified multiple times in a list. """ seen = set([]) out = [] for x in xs: if x["path"] not in seen: out.append(x) seen.add(x["path"]) return out
[ "def", "_remove_duplicate_files", "(", "xs", ")", ":", "seen", "=", "set", "(", "[", "]", ")", "out", "=", "[", "]", "for", "x", "in", "xs", ":", "if", "x", "[", "\"path\"", "]", "not", "in", "seen", ":", "out", ".", "append", "(", "x", ")", ...
Remove files specified multiple times in a list.
[ "Remove", "files", "specified", "multiple", "times", "in", "a", "list", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L605-L614
train
bcbio/bcbio-nextgen
bcbio/distributed/runfn.py
_update_nested
def _update_nested(key, val, data, allow_overwriting=False): """Update the data object, avoiding over-writing with nested dictionaries. """ if isinstance(val, dict): for sub_key, sub_val in val.items(): data = _update_nested(key + [sub_key], sub_val, data, allow_overwriting=allow_overwri...
python
def _update_nested(key, val, data, allow_overwriting=False): """Update the data object, avoiding over-writing with nested dictionaries. """ if isinstance(val, dict): for sub_key, sub_val in val.items(): data = _update_nested(key + [sub_key], sub_val, data, allow_overwriting=allow_overwri...
[ "def", "_update_nested", "(", "key", ",", "val", ",", "data", ",", "allow_overwriting", "=", "False", ")", ":", "if", "isinstance", "(", "val", ",", "dict", ")", ":", "for", "sub_key", ",", "sub_val", "in", "val", ".", "items", "(", ")", ":", "data",...
Update the data object, avoiding over-writing with nested dictionaries.
[ "Update", "the", "data", "object", "avoiding", "over", "-", "writing", "with", "nested", "dictionaries", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L623-L638
train
bcbio/bcbio-nextgen
bcbio/server/main.py
start
def start(args): """Run server with provided command line arguments. """ application = tornado.web.Application([(r"/run", run.get_handler(args)), (r"/status", run.StatusHandler)]) application.runmonitor = RunMonitor() application.listen(args.port) torna...
python
def start(args): """Run server with provided command line arguments. """ application = tornado.web.Application([(r"/run", run.get_handler(args)), (r"/status", run.StatusHandler)]) application.runmonitor = RunMonitor() application.listen(args.port) torna...
[ "def", "start", "(", "args", ")", ":", "application", "=", "tornado", ".", "web", ".", "Application", "(", "[", "(", "r\"/run\"", ",", "run", ".", "get_handler", "(", "args", ")", ")", ",", "(", "r\"/status\"", ",", "run", ".", "StatusHandler", ")", ...
Run server with provided command line arguments.
[ "Run", "server", "with", "provided", "command", "line", "arguments", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/server/main.py#L8-L15
train
bcbio/bcbio-nextgen
bcbio/server/main.py
add_subparser
def add_subparser(subparsers): """Add command line arguments as server subparser. """ parser = subparsers.add_parser("server", help="Run a bcbio-nextgen server allowing remote job execution.") parser.add_argument("-c", "--config", help=("Global YAML configuration file specifying system details." ...
python
def add_subparser(subparsers): """Add command line arguments as server subparser. """ parser = subparsers.add_parser("server", help="Run a bcbio-nextgen server allowing remote job execution.") parser.add_argument("-c", "--config", help=("Global YAML configuration file specifying system details." ...
[ "def", "add_subparser", "(", "subparsers", ")", ":", "parser", "=", "subparsers", ".", "add_parser", "(", "\"server\"", ",", "help", "=", "\"Run a bcbio-nextgen server allowing remote job execution.\"", ")", "parser", ".", "add_argument", "(", "\"-c\"", ",", "\"--conf...
Add command line arguments as server subparser.
[ "Add", "command", "line", "arguments", "as", "server", "subparser", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/server/main.py#L29-L41
train
bcbio/bcbio-nextgen
bcbio/provenance/data.py
write_versions
def write_versions(dirs, items): """Write data versioning for genomes present in the configuration. """ genomes = {} for d in items: genomes[d["genome_build"]] = d.get("reference", {}).get("versions") out_file = _get_out_file(dirs) found_versions = False if genomes and out_file: ...
python
def write_versions(dirs, items): """Write data versioning for genomes present in the configuration. """ genomes = {} for d in items: genomes[d["genome_build"]] = d.get("reference", {}).get("versions") out_file = _get_out_file(dirs) found_versions = False if genomes and out_file: ...
[ "def", "write_versions", "(", "dirs", ",", "items", ")", ":", "genomes", "=", "{", "}", "for", "d", "in", "items", ":", "genomes", "[", "d", "[", "\"genome_build\"", "]", "]", "=", "d", ".", "get", "(", "\"reference\"", ",", "{", "}", ")", ".", "...
Write data versioning for genomes present in the configuration.
[ "Write", "data", "versioning", "for", "genomes", "present", "in", "the", "configuration", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/data.py#L8-L34
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
combine_calls
def combine_calls(*args): """Combine multiple callsets into a final set of merged calls. """ if len(args) == 3: is_cwl = False batch_id, samples, data = args caller_names, vrn_files = _organize_variants(samples, batch_id) else: is_cwl = True samples = [utils.to_si...
python
def combine_calls(*args): """Combine multiple callsets into a final set of merged calls. """ if len(args) == 3: is_cwl = False batch_id, samples, data = args caller_names, vrn_files = _organize_variants(samples, batch_id) else: is_cwl = True samples = [utils.to_si...
[ "def", "combine_calls", "(", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "3", ":", "is_cwl", "=", "False", "batch_id", ",", "samples", ",", "data", "=", "args", "caller_names", ",", "vrn_files", "=", "_organize_variants", "(", "samples", ...
Combine multiple callsets into a final set of merged calls.
[ "Combine", "multiple", "callsets", "into", "a", "final", "set", "of", "merged", "calls", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L57-L110
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
combine_calls_parallel
def combine_calls_parallel(samples, run_parallel): """Combine calls using batched Ensemble approach. """ batch_groups, extras = _group_by_batches(samples, _has_ensemble) out = [] if batch_groups: processed = run_parallel("combine_calls", ((b, xs, xs[0]) for b, xs in batch_groups.items())) ...
python
def combine_calls_parallel(samples, run_parallel): """Combine calls using batched Ensemble approach. """ batch_groups, extras = _group_by_batches(samples, _has_ensemble) out = [] if batch_groups: processed = run_parallel("combine_calls", ((b, xs, xs[0]) for b, xs in batch_groups.items())) ...
[ "def", "combine_calls_parallel", "(", "samples", ",", "run_parallel", ")", ":", "batch_groups", ",", "extras", "=", "_group_by_batches", "(", "samples", ",", "_has_ensemble", ")", "out", "=", "[", "]", "if", "batch_groups", ":", "processed", "=", "run_parallel",...
Combine calls using batched Ensemble approach.
[ "Combine", "calls", "using", "batched", "Ensemble", "approach", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L112-L123
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
_group_by_batches
def _group_by_batches(samples, check_fn): """Group calls by batches, processing families together during ensemble calling. """ batch_groups = collections.defaultdict(list) extras = [] for data in [x[0] for x in samples]: if check_fn(data): batch_groups[multi.get_batch_for_key(dat...
python
def _group_by_batches(samples, check_fn): """Group calls by batches, processing families together during ensemble calling. """ batch_groups = collections.defaultdict(list) extras = [] for data in [x[0] for x in samples]: if check_fn(data): batch_groups[multi.get_batch_for_key(dat...
[ "def", "_group_by_batches", "(", "samples", ",", "check_fn", ")", ":", "batch_groups", "=", "collections", ".", "defaultdict", "(", "list", ")", "extras", "=", "[", "]", "for", "data", "in", "[", "x", "[", "0", "]", "for", "x", "in", "samples", "]", ...
Group calls by batches, processing families together during ensemble calling.
[ "Group", "calls", "by", "batches", "processing", "families", "together", "during", "ensemble", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L133-L143
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
_organize_variants
def _organize_variants(samples, batch_id): """Retrieve variant calls for all samples, merging batched samples into single VCF. """ caller_names = [x["variantcaller"] for x in samples[0]["variants"]] calls = collections.defaultdict(list) for data in samples: for vrn in data["variants"]: ...
python
def _organize_variants(samples, batch_id): """Retrieve variant calls for all samples, merging batched samples into single VCF. """ caller_names = [x["variantcaller"] for x in samples[0]["variants"]] calls = collections.defaultdict(list) for data in samples: for vrn in data["variants"]: ...
[ "def", "_organize_variants", "(", "samples", ",", "batch_id", ")", ":", "caller_names", "=", "[", "x", "[", "\"variantcaller\"", "]", "for", "x", "in", "samples", "[", "0", "]", "[", "\"variants\"", "]", "]", "calls", "=", "collections", ".", "defaultdict"...
Retrieve variant calls for all samples, merging batched samples into single VCF.
[ "Retrieve", "variant", "calls", "for", "all", "samples", "merging", "batched", "samples", "into", "single", "VCF", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L145-L161
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
_handle_somatic_ensemble
def _handle_somatic_ensemble(vrn_file, data): """For somatic ensemble, discard normal samples and filtered variants from vcfs. Only needed for bcbio.variation based ensemble calling. """ if tz.get_in(["metadata", "phenotype"], data, "").lower().startswith("tumor"): vrn_file_temp = vrn_file.repl...
python
def _handle_somatic_ensemble(vrn_file, data): """For somatic ensemble, discard normal samples and filtered variants from vcfs. Only needed for bcbio.variation based ensemble calling. """ if tz.get_in(["metadata", "phenotype"], data, "").lower().startswith("tumor"): vrn_file_temp = vrn_file.repl...
[ "def", "_handle_somatic_ensemble", "(", "vrn_file", ",", "data", ")", ":", "if", "tz", ".", "get_in", "(", "[", "\"metadata\"", ",", "\"phenotype\"", "]", ",", "data", ",", "\"\"", ")", ".", "lower", "(", ")", ".", "startswith", "(", "\"tumor\"", ")", ...
For somatic ensemble, discard normal samples and filtered variants from vcfs. Only needed for bcbio.variation based ensemble calling.
[ "For", "somatic", "ensemble", "discard", "normal", "samples", "and", "filtered", "variants", "from", "vcfs", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L163-L174
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
_run_ensemble
def _run_ensemble(batch_id, vrn_files, config_file, base_dir, ref_file, data): """Run an ensemble call using merging and SVM-based approach in bcbio.variation """ out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf".format(batch_id)) out_bed_file = os.path.join(base_dir, "{0}-callregions.bed".format...
python
def _run_ensemble(batch_id, vrn_files, config_file, base_dir, ref_file, data): """Run an ensemble call using merging and SVM-based approach in bcbio.variation """ out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf".format(batch_id)) out_bed_file = os.path.join(base_dir, "{0}-callregions.bed".format...
[ "def", "_run_ensemble", "(", "batch_id", ",", "vrn_files", ",", "config_file", ",", "base_dir", ",", "ref_file", ",", "data", ")", ":", "out_vcf_file", "=", "os", ".", "path", ".", "join", "(", "base_dir", ",", "\"{0}-ensemble.vcf\"", ".", "format", "(", "...
Run an ensemble call using merging and SVM-based approach in bcbio.variation
[ "Run", "an", "ensemble", "call", "using", "merging", "and", "SVM", "-", "based", "approach", "in", "bcbio", ".", "variation" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L190-L208
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
_write_config_file
def _write_config_file(batch_id, caller_names, base_dir, data): """Write YAML configuration to generate an ensemble set of combined calls. """ config_dir = utils.safe_makedir(os.path.join(base_dir, "config")) config_file = os.path.join(config_dir, "{0}-ensemble.yaml".format(batch_id)) algorithm = da...
python
def _write_config_file(batch_id, caller_names, base_dir, data): """Write YAML configuration to generate an ensemble set of combined calls. """ config_dir = utils.safe_makedir(os.path.join(base_dir, "config")) config_file = os.path.join(config_dir, "{0}-ensemble.yaml".format(batch_id)) algorithm = da...
[ "def", "_write_config_file", "(", "batch_id", ",", "caller_names", ",", "base_dir", ",", "data", ")", ":", "config_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "base_dir", ",", "\"config\"", ")", ")", "config_file", "=...
Write YAML configuration to generate an ensemble set of combined calls.
[ "Write", "YAML", "configuration", "to", "generate", "an", "ensemble", "set", "of", "combined", "calls", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L210-L224
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
_get_num_pass
def _get_num_pass(data, n): """Calculate the number of samples needed to pass ensemble calling. """ numpass = tz.get_in(["config", "algorithm", "ensemble", "numpass"], data) if numpass: return int(numpass) trusted_pct = tz.get_in(["config", "algorithm", "ensemble", "trusted_pct"], data) ...
python
def _get_num_pass(data, n): """Calculate the number of samples needed to pass ensemble calling. """ numpass = tz.get_in(["config", "algorithm", "ensemble", "numpass"], data) if numpass: return int(numpass) trusted_pct = tz.get_in(["config", "algorithm", "ensemble", "trusted_pct"], data) ...
[ "def", "_get_num_pass", "(", "data", ",", "n", ")", ":", "numpass", "=", "tz", ".", "get_in", "(", "[", "\"config\"", ",", "\"algorithm\"", ",", "\"ensemble\"", ",", "\"numpass\"", "]", ",", "data", ")", "if", "numpass", ":", "return", "int", "(", "num...
Calculate the number of samples needed to pass ensemble calling.
[ "Calculate", "the", "number", "of", "samples", "needed", "to", "pass", "ensemble", "calling", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L226-L235
train
bcbio/bcbio-nextgen
bcbio/variation/ensemble.py
_run_ensemble_intersection
def _run_ensemble_intersection(batch_id, vrn_files, callers, base_dir, edata): """Run intersection n out of x based ensemble method using bcbio.variation.recall. """ out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf.gz".format(batch_id)) if not utils.file_exists(out_vcf_file): num_pass = _...
python
def _run_ensemble_intersection(batch_id, vrn_files, callers, base_dir, edata): """Run intersection n out of x based ensemble method using bcbio.variation.recall. """ out_vcf_file = os.path.join(base_dir, "{0}-ensemble.vcf.gz".format(batch_id)) if not utils.file_exists(out_vcf_file): num_pass = _...
[ "def", "_run_ensemble_intersection", "(", "batch_id", ",", "vrn_files", ",", "callers", ",", "base_dir", ",", "edata", ")", ":", "out_vcf_file", "=", "os", ".", "path", ".", "join", "(", "base_dir", ",", "\"{0}-ensemble.vcf.gz\"", ".", "format", "(", "batch_id...
Run intersection n out of x based ensemble method using bcbio.variation.recall.
[ "Run", "intersection", "n", "out", "of", "x", "based", "ensemble", "method", "using", "bcbio", ".", "variation", ".", "recall", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ensemble.py#L237-L263
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
_get_callable_regions
def _get_callable_regions(data): """Retrieve regions to parallelize by from callable regions or chromosomes. """ import pybedtools callable_files = data.get("callable_regions") if callable_files: assert len(callable_files) == 1 regions = [(r.chrom, int(r.start), int(r.stop)) for r in...
python
def _get_callable_regions(data): """Retrieve regions to parallelize by from callable regions or chromosomes. """ import pybedtools callable_files = data.get("callable_regions") if callable_files: assert len(callable_files) == 1 regions = [(r.chrom, int(r.start), int(r.stop)) for r in...
[ "def", "_get_callable_regions", "(", "data", ")", ":", "import", "pybedtools", "callable_files", "=", "data", ".", "get", "(", "\"callable_regions\"", ")", "if", "callable_files", ":", "assert", "len", "(", "callable_files", ")", "==", "1", "regions", "=", "["...
Retrieve regions to parallelize by from callable regions or chromosomes.
[ "Retrieve", "regions", "to", "parallelize", "by", "from", "callable", "regions", "or", "chromosomes", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L75-L92
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
_split_by_callable_region
def _split_by_callable_region(data): """Split by callable or variant regions. We expect joint calling to be deep in numbers of samples per region, so prefer splitting aggressively by regions. """ batch = tz.get_in(("metadata", "batch"), data) jointcaller = tz.get_in(("config", "algorithm", "joi...
python
def _split_by_callable_region(data): """Split by callable or variant regions. We expect joint calling to be deep in numbers of samples per region, so prefer splitting aggressively by regions. """ batch = tz.get_in(("metadata", "batch"), data) jointcaller = tz.get_in(("config", "algorithm", "joi...
[ "def", "_split_by_callable_region", "(", "data", ")", ":", "batch", "=", "tz", ".", "get_in", "(", "(", "\"metadata\"", ",", "\"batch\"", ")", ",", "data", ")", "jointcaller", "=", "tz", ".", "get_in", "(", "(", "\"config\"", ",", "\"algorithm\"", ",", "...
Split by callable or variant regions. We expect joint calling to be deep in numbers of samples per region, so prefer splitting aggressively by regions.
[ "Split", "by", "callable", "or", "variant", "regions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L94-L114
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
_is_jointcaller_compatible
def _is_jointcaller_compatible(data): """Match variant caller inputs to compatible joint callers. """ jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data) variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data) if isinstance(variantcaller, (list, tuple)) and len(va...
python
def _is_jointcaller_compatible(data): """Match variant caller inputs to compatible joint callers. """ jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data) variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data) if isinstance(variantcaller, (list, tuple)) and len(va...
[ "def", "_is_jointcaller_compatible", "(", "data", ")", ":", "jointcaller", "=", "tz", ".", "get_in", "(", "(", "\"config\"", ",", "\"algorithm\"", ",", "\"jointcaller\"", ")", ",", "data", ")", "variantcaller", "=", "tz", ".", "get_in", "(", "(", "\"config\"...
Match variant caller inputs to compatible joint callers.
[ "Match", "variant", "caller", "inputs", "to", "compatible", "joint", "callers", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L116-L123
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
square_off
def square_off(samples, run_parallel): """Perform joint calling at all variants within a batch. """ to_process = [] extras = [] for data in [utils.to_single_data(x) for x in samples]: added = False if tz.get_in(("metadata", "batch"), data): for add in genotype.handle_mult...
python
def square_off(samples, run_parallel): """Perform joint calling at all variants within a batch. """ to_process = [] extras = [] for data in [utils.to_single_data(x) for x in samples]: added = False if tz.get_in(("metadata", "batch"), data): for add in genotype.handle_mult...
[ "def", "square_off", "(", "samples", ",", "run_parallel", ")", ":", "to_process", "=", "[", "]", "extras", "=", "[", "]", "for", "data", "in", "[", "utils", ".", "to_single_data", "(", "x", ")", "for", "x", "in", "samples", "]", ":", "added", "=", ...
Perform joint calling at all variants within a batch.
[ "Perform", "joint", "calling", "at", "all", "variants", "within", "a", "batch", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L125-L143
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
_combine_to_jointcaller
def _combine_to_jointcaller(processed): """Add joint calling information to variants, while collapsing independent regions. """ by_vrn_file = collections.OrderedDict() for data in (x[0] for x in processed): key = (tz.get_in(("config", "algorithm", "jointcaller"), data), data["vrn_file"]) ...
python
def _combine_to_jointcaller(processed): """Add joint calling information to variants, while collapsing independent regions. """ by_vrn_file = collections.OrderedDict() for data in (x[0] for x in processed): key = (tz.get_in(("config", "algorithm", "jointcaller"), data), data["vrn_file"]) ...
[ "def", "_combine_to_jointcaller", "(", "processed", ")", ":", "by_vrn_file", "=", "collections", ".", "OrderedDict", "(", ")", "for", "data", "in", "(", "x", "[", "0", "]", "for", "x", "in", "processed", ")", ":", "key", "=", "(", "tz", ".", "get_in", ...
Add joint calling information to variants, while collapsing independent regions.
[ "Add", "joint", "calling", "information", "to", "variants", "while", "collapsing", "independent", "regions", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L145-L158
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
square_batch_region
def square_batch_region(data, region, bam_files, vrn_files, out_file): """Perform squaring of a batch in a supplied region, with input BAMs """ from bcbio.variation import sentieon, strelka2 if not utils.file_exists(out_file): jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)...
python
def square_batch_region(data, region, bam_files, vrn_files, out_file): """Perform squaring of a batch in a supplied region, with input BAMs """ from bcbio.variation import sentieon, strelka2 if not utils.file_exists(out_file): jointcaller = tz.get_in(("config", "algorithm", "jointcaller"), data)...
[ "def", "square_batch_region", "(", "data", ",", "region", ",", "bam_files", ",", "vrn_files", ",", "out_file", ")", ":", "from", "bcbio", ".", "variation", "import", "sentieon", ",", "strelka2", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")",...
Perform squaring of a batch in a supplied region, with input BAMs
[ "Perform", "squaring", "of", "a", "batch", "in", "a", "supplied", "region", "with", "input", "BAMs" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L172-L194
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
_fix_orig_vcf_refs
def _fix_orig_vcf_refs(data): """Supply references to initial variantcalls if run in addition to batching. """ variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data) if variantcaller: data["vrn_file_orig"] = data["vrn_file"] for i, sub in enumerate(data.get("group_orig", [...
python
def _fix_orig_vcf_refs(data): """Supply references to initial variantcalls if run in addition to batching. """ variantcaller = tz.get_in(("config", "algorithm", "variantcaller"), data) if variantcaller: data["vrn_file_orig"] = data["vrn_file"] for i, sub in enumerate(data.get("group_orig", [...
[ "def", "_fix_orig_vcf_refs", "(", "data", ")", ":", "variantcaller", "=", "tz", ".", "get_in", "(", "(", "\"config\"", ",", "\"algorithm\"", ",", "\"variantcaller\"", ")", ",", "data", ")", "if", "variantcaller", ":", "data", "[", "\"vrn_file_orig\"", "]", "...
Supply references to initial variantcalls if run in addition to batching.
[ "Supply", "references", "to", "initial", "variantcalls", "if", "run", "in", "addition", "to", "batching", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L196-L207
train
bcbio/bcbio-nextgen
bcbio/variation/joint.py
_square_batch_bcbio_variation
def _square_batch_bcbio_variation(data, region, bam_files, vrn_files, out_file, todo="square"): """Run squaring or merging analysis using bcbio.variation.recall. """ ref_file = tz.get_in(("reference", "fasta", "base"), data) cores = tz.get_in(("config", "algorithm", "nu...
python
def _square_batch_bcbio_variation(data, region, bam_files, vrn_files, out_file, todo="square"): """Run squaring or merging analysis using bcbio.variation.recall. """ ref_file = tz.get_in(("reference", "fasta", "base"), data) cores = tz.get_in(("config", "algorithm", "nu...
[ "def", "_square_batch_bcbio_variation", "(", "data", ",", "region", ",", "bam_files", ",", "vrn_files", ",", "out_file", ",", "todo", "=", "\"square\"", ")", ":", "ref_file", "=", "tz", ".", "get_in", "(", "(", "\"reference\"", ",", "\"fasta\"", ",", "\"base...
Run squaring or merging analysis using bcbio.variation.recall.
[ "Run", "squaring", "or", "merging", "analysis", "using", "bcbio", ".", "variation", ".", "recall", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/joint.py#L209-L236
train
bcbio/bcbio-nextgen
bcbio/structural/seq2c.py
run
def run(items): """Normalization and log2 ratio calculation plus CNV calling for full cohort. - Combine coverage of each region for each sample - Prepare read counts for each sample - Normalize coverages in cohort by gene and sample, and calculate log2 ratios - Call amplifications and deletions ...
python
def run(items): """Normalization and log2 ratio calculation plus CNV calling for full cohort. - Combine coverage of each region for each sample - Prepare read counts for each sample - Normalize coverages in cohort by gene and sample, and calculate log2 ratios - Call amplifications and deletions ...
[ "def", "run", "(", "items", ")", ":", "items", "=", "[", "utils", ".", "to_single_data", "(", "x", ")", "for", "x", "in", "items", "]", "work_dir", "=", "_sv_workdir", "(", "items", "[", "0", "]", ")", "input_backs", "=", "list", "(", "set", "(", ...
Normalization and log2 ratio calculation plus CNV calling for full cohort. - Combine coverage of each region for each sample - Prepare read counts for each sample - Normalize coverages in cohort by gene and sample, and calculate log2 ratios - Call amplifications and deletions
[ "Normalization", "and", "log2", "ratio", "calculation", "plus", "CNV", "calling", "for", "full", "cohort", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L41-L65
train
bcbio/bcbio-nextgen
bcbio/structural/seq2c.py
prep_seq2c_bed
def prep_seq2c_bed(data): """Selecting the bed file, cleaning, and properly annotating for Seq2C """ if dd.get_background_cnv_reference(data, "seq2c"): bed_file = _background_to_bed(dd.get_background_cnv_reference(data, "seq2c"), data) else: bed_file = regions.get_sv_bed(data) if bed...
python
def prep_seq2c_bed(data): """Selecting the bed file, cleaning, and properly annotating for Seq2C """ if dd.get_background_cnv_reference(data, "seq2c"): bed_file = _background_to_bed(dd.get_background_cnv_reference(data, "seq2c"), data) else: bed_file = regions.get_sv_bed(data) if bed...
[ "def", "prep_seq2c_bed", "(", "data", ")", ":", "if", "dd", ".", "get_background_cnv_reference", "(", "data", ",", "\"seq2c\"", ")", ":", "bed_file", "=", "_background_to_bed", "(", "dd", ".", "get_background_cnv_reference", "(", "data", ",", "\"seq2c\"", ")", ...
Selecting the bed file, cleaning, and properly annotating for Seq2C
[ "Selecting", "the", "bed", "file", "cleaning", "and", "properly", "annotating", "for", "Seq2C" ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L67-L102
train
bcbio/bcbio-nextgen
bcbio/structural/seq2c.py
_background_to_bed
def _background_to_bed(back_file, data): """Convert a seq2c background file with calls into BED regions for coverage. seq2c background files are a concatenation of mapping and sample_coverages from potentially multiple samples. We use the coverage information from the first sample to translate into BED...
python
def _background_to_bed(back_file, data): """Convert a seq2c background file with calls into BED regions for coverage. seq2c background files are a concatenation of mapping and sample_coverages from potentially multiple samples. We use the coverage information from the first sample to translate into BED...
[ "def", "_background_to_bed", "(", "back_file", ",", "data", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "dd", ".", "get_work_dir", "(", "data", ")", ",", "\"b...
Convert a seq2c background file with calls into BED regions for coverage. seq2c background files are a concatenation of mapping and sample_coverages from potentially multiple samples. We use the coverage information from the first sample to translate into BED.
[ "Convert", "a", "seq2c", "background", "file", "with", "calls", "into", "BED", "regions", "for", "coverage", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L104-L122
train
bcbio/bcbio-nextgen
bcbio/structural/seq2c.py
_get_seq2c_options
def _get_seq2c_options(data): """Get adjustable, through resources, or default options for seq2c. """ cov2lr_possible_opts = ["-F"] defaults = {} ropts = config_utils.get_resources("seq2c", data["config"]).get("options", []) assert len(ropts) % 2 == 0, "Expect even number of options for seq2c" %...
python
def _get_seq2c_options(data): """Get adjustable, through resources, or default options for seq2c. """ cov2lr_possible_opts = ["-F"] defaults = {} ropts = config_utils.get_resources("seq2c", data["config"]).get("options", []) assert len(ropts) % 2 == 0, "Expect even number of options for seq2c" %...
[ "def", "_get_seq2c_options", "(", "data", ")", ":", "cov2lr_possible_opts", "=", "[", "\"-F\"", "]", "defaults", "=", "{", "}", "ropts", "=", "config_utils", ".", "get_resources", "(", "\"seq2c\"", ",", "data", "[", "\"config\"", "]", ")", ".", "get", "(",...
Get adjustable, through resources, or default options for seq2c.
[ "Get", "adjustable", "through", "resources", "or", "default", "options", "for", "seq2c", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L124-L138
train
bcbio/bcbio-nextgen
bcbio/structural/seq2c.py
to_vcf
def to_vcf(in_tsv, data): """Convert seq2c output file into BED output. """ call_convert = {"Amp": "DUP", "Del": "DEL"} out_file = "%s.vcf" % utils.splitext_plus(in_tsv)[0] if not utils.file_uptodate(out_file, in_tsv): with file_transaction(data, out_file) as tx_out_file: with op...
python
def to_vcf(in_tsv, data): """Convert seq2c output file into BED output. """ call_convert = {"Amp": "DUP", "Del": "DEL"} out_file = "%s.vcf" % utils.splitext_plus(in_tsv)[0] if not utils.file_uptodate(out_file, in_tsv): with file_transaction(data, out_file) as tx_out_file: with op...
[ "def", "to_vcf", "(", "in_tsv", ",", "data", ")", ":", "call_convert", "=", "{", "\"Amp\"", ":", "\"DUP\"", ",", "\"Del\"", ":", "\"DEL\"", "}", "out_file", "=", "\"%s.vcf\"", "%", "utils", ".", "splitext_plus", "(", "in_tsv", ")", "[", "0", "]", "if",...
Convert seq2c output file into BED output.
[ "Convert", "seq2c", "output", "file", "into", "BED", "output", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L198-L218
train
bcbio/bcbio-nextgen
bcbio/structural/seq2c.py
_combine_coverages
def _combine_coverages(items, work_dir, input_backs=None): """Combine coverage cnns calculated for individual inputs into single file. Optionally moves over pre-calculated coverage samples from a background file. """ out_file = os.path.join(work_dir, "sample_coverages.txt") if not utils.file_exists...
python
def _combine_coverages(items, work_dir, input_backs=None): """Combine coverage cnns calculated for individual inputs into single file. Optionally moves over pre-calculated coverage samples from a background file. """ out_file = os.path.join(work_dir, "sample_coverages.txt") if not utils.file_exists...
[ "def", "_combine_coverages", "(", "items", ",", "work_dir", ",", "input_backs", "=", "None", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"sample_coverages.txt\"", ")", "if", "not", "utils", ".", "file_exists", "(", "o...
Combine coverage cnns calculated for individual inputs into single file. Optionally moves over pre-calculated coverage samples from a background file.
[ "Combine", "coverage", "cnns", "calculated", "for", "individual", "inputs", "into", "single", "file", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L290-L309
train
bcbio/bcbio-nextgen
bcbio/structural/seq2c.py
_calculate_mapping_reads
def _calculate_mapping_reads(items, work_dir, input_backs=None): """Calculate read counts from samtools idxstats for each sample. Optionally moves over pre-calculated mapping counts from a background file. """ out_file = os.path.join(work_dir, "mapping_reads.txt") if not utils.file_exists(out_file)...
python
def _calculate_mapping_reads(items, work_dir, input_backs=None): """Calculate read counts from samtools idxstats for each sample. Optionally moves over pre-calculated mapping counts from a background file. """ out_file = os.path.join(work_dir, "mapping_reads.txt") if not utils.file_exists(out_file)...
[ "def", "_calculate_mapping_reads", "(", "items", ",", "work_dir", ",", "input_backs", "=", "None", ")", ":", "out_file", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "\"mapping_reads.txt\"", ")", "if", "not", "utils", ".", "file_exists", "(", ...
Calculate read counts from samtools idxstats for each sample. Optionally moves over pre-calculated mapping counts from a background file.
[ "Calculate", "read", "counts", "from", "samtools", "idxstats", "for", "each", "sample", "." ]
6a9348c0054ccd5baffd22f1bb7d0422f6978b20
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/seq2c.py#L311-L335
train