id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
223,300 | bcbio/bcbio-nextgen | bcbio/variation/sentieon.py | license_export | def license_export(data):
"""Retrieve export statement for sentieon license server.
"""
resources = config_utils.get_resources("sentieon", data["config"])
server = resources.get("keyfile")
if not server:
server = tz.get_in(["resources", "sentieon", "keyfile"], data)
if not server:
... | python | def license_export(data):
"""Retrieve export statement for sentieon license server.
"""
resources = config_utils.get_resources("sentieon", data["config"])
server = resources.get("keyfile")
if not server:
server = tz.get_in(["resources", "sentieon", "keyfile"], data)
if not server:
... | [
"def",
"license_export",
"(",
"data",
")",
":",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"sentieon\"",
",",
"data",
"[",
"\"config\"",
"]",
")",
"server",
"=",
"resources",
".",
"get",
"(",
"\"keyfile\"",
")",
"if",
"not",
"server",
"... | Retrieve export statement for sentieon license server. | [
"Retrieve",
"export",
"statement",
"for",
"sentieon",
"license",
"server",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/sentieon.py#L25-L44 |
223,301 | bcbio/bcbio-nextgen | bcbio/variation/sentieon.py | _get_interval | def _get_interval(variant_regions, region, out_file, items):
"""Retrieve interval to run analysis in. Handles no targets, BED and regions
region can be a single region or list of multiple regions for multicore calling.
"""
target = shared.subset_variant_regions(variant_regions, region, out_file, items)... | python | def _get_interval(variant_regions, region, out_file, items):
"""Retrieve interval to run analysis in. Handles no targets, BED and regions
region can be a single region or list of multiple regions for multicore calling.
"""
target = shared.subset_variant_regions(variant_regions, region, out_file, items)... | [
"def",
"_get_interval",
"(",
"variant_regions",
",",
"region",
",",
"out_file",
",",
"items",
")",
":",
"target",
"=",
"shared",
".",
"subset_variant_regions",
"(",
"variant_regions",
",",
"region",
",",
"out_file",
",",
"items",
")",
"if",
"target",
":",
"i... | Retrieve interval to run analysis in. Handles no targets, BED and regions
region can be a single region or list of multiple regions for multicore calling. | [
"Retrieve",
"interval",
"to",
"run",
"analysis",
"in",
".",
"Handles",
"no",
"targets",
"BED",
"and",
"regions"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/sentieon.py#L46-L58 |
223,302 | bcbio/bcbio-nextgen | bcbio/variation/sentieon.py | run_tnscope | def run_tnscope(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Call variants with Sentieon's TNscope somatic caller.
"""
if out_file is None:
out_file = "%s-variants.vcf.gz" % utils.splitext_plus(align_bams[0])[0]
if not utils.file_exists(out_file)... | python | def run_tnscope(align_bams, items, ref_file, assoc_files,
region=None, out_file=None):
"""Call variants with Sentieon's TNscope somatic caller.
"""
if out_file is None:
out_file = "%s-variants.vcf.gz" % utils.splitext_plus(align_bams[0])[0]
if not utils.file_exists(out_file)... | [
"def",
"run_tnscope",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"if",
"out_file",
"is",
"None",
":",
"out_file",
"=",
"\"%s-variants.vcf.gz\"",
"%",
"utils",
".... | Call variants with Sentieon's TNscope somatic caller. | [
"Call",
"variants",
"with",
"Sentieon",
"s",
"TNscope",
"somatic",
"caller",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/sentieon.py#L60-L81 |
223,303 | bcbio/bcbio-nextgen | bcbio/variation/sentieon.py | run_gvcftyper | def run_gvcftyper(vrn_files, out_file, region, data):
"""Produce joint called variants from input gVCF files.
"""
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
license = license_export(data)
ref_file = dd.get_ref_file(data)
... | python | def run_gvcftyper(vrn_files, out_file, region, data):
"""Produce joint called variants from input gVCF files.
"""
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
license = license_export(data)
ref_file = dd.get_ref_file(data)
... | [
"def",
"run_gvcftyper",
"(",
"vrn_files",
",",
"out_file",
",",
"region",
",",
"data",
")",
":",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
... | Produce joint called variants from input gVCF files. | [
"Produce",
"joint",
"called",
"variants",
"from",
"input",
"gVCF",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/sentieon.py#L137-L149 |
223,304 | bcbio/bcbio-nextgen | bcbio/variation/sentieon.py | bqsr_table | def bqsr_table(data):
"""Generate recalibration tables as inputs to BQSR.
"""
in_file = dd.get_align_bam(data)
out_file = "%s-recal-table.txt" % utils.splitext_plus(in_file)[0]
if not utils.file_uptodate(out_file, in_file):
with file_transaction(data, out_file) as tx_out_file:
as... | python | def bqsr_table(data):
"""Generate recalibration tables as inputs to BQSR.
"""
in_file = dd.get_align_bam(data)
out_file = "%s-recal-table.txt" % utils.splitext_plus(in_file)[0]
if not utils.file_uptodate(out_file, in_file):
with file_transaction(data, out_file) as tx_out_file:
as... | [
"def",
"bqsr_table",
"(",
"data",
")",
":",
"in_file",
"=",
"dd",
".",
"get_align_bam",
"(",
"data",
")",
"out_file",
"=",
"\"%s-recal-table.txt\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"in_file",
")",
"[",
"0",
"]",
"if",
"not",
"utils",
".",
"file_... | Generate recalibration tables as inputs to BQSR. | [
"Generate",
"recalibration",
"tables",
"as",
"inputs",
"to",
"BQSR",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/sentieon.py#L151-L166 |
223,305 | bcbio/bcbio-nextgen | bcbio/ngsalign/rtg.py | to_sdf | def to_sdf(files, data):
"""Convert a fastq or BAM input into a SDF indexed file.
"""
# BAM
if len(files) == 1 and files[0].endswith(".bam"):
qual = []
format = ["-f", "sam-pe" if bam.is_paired(files[0]) else "sam-se"]
inputs = [files[0]]
# fastq
else:
qual = ["-q... | python | def to_sdf(files, data):
"""Convert a fastq or BAM input into a SDF indexed file.
"""
# BAM
if len(files) == 1 and files[0].endswith(".bam"):
qual = []
format = ["-f", "sam-pe" if bam.is_paired(files[0]) else "sam-se"]
inputs = [files[0]]
# fastq
else:
qual = ["-q... | [
"def",
"to_sdf",
"(",
"files",
",",
"data",
")",
":",
"# BAM",
"if",
"len",
"(",
"files",
")",
"==",
"1",
"and",
"files",
"[",
"0",
"]",
".",
"endswith",
"(",
"\".bam\"",
")",
":",
"qual",
"=",
"[",
"]",
"format",
"=",
"[",
"\"-f\"",
",",
"\"sa... | Convert a fastq or BAM input into a SDF indexed file. | [
"Convert",
"a",
"fastq",
"or",
"BAM",
"input",
"into",
"a",
"SDF",
"indexed",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/rtg.py#L16-L40 |
223,306 | bcbio/bcbio-nextgen | bcbio/ngsalign/rtg.py | to_fastq_apipe_cl | def to_fastq_apipe_cl(sdf_file, start=None, end=None):
"""Return a command lines to provide streaming fastq input.
For paired end, returns a forward and reverse command line. For
single end returns a single command line and None for the pair.
"""
cmd = ["rtg", "sdf2fastq", "--no-gzip", "-o", "-"]
... | python | def to_fastq_apipe_cl(sdf_file, start=None, end=None):
"""Return a command lines to provide streaming fastq input.
For paired end, returns a forward and reverse command line. For
single end returns a single command line and None for the pair.
"""
cmd = ["rtg", "sdf2fastq", "--no-gzip", "-o", "-"]
... | [
"def",
"to_fastq_apipe_cl",
"(",
"sdf_file",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"\"rtg\"",
",",
"\"sdf2fastq\"",
",",
"\"--no-gzip\"",
",",
"\"-o\"",
",",
"\"-\"",
"]",
"if",
"start",
"is",
"not",
"None",
":"... | Return a command lines to provide streaming fastq input.
For paired end, returns a forward and reverse command line. For
single end returns a single command line and None for the pair. | [
"Return",
"a",
"command",
"lines",
"to",
"provide",
"streaming",
"fastq",
"input",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/rtg.py#L82-L100 |
223,307 | bcbio/bcbio-nextgen | bcbio/pipeline/tools.py | get_tabix_cmd | def get_tabix_cmd(config):
"""Retrieve tabix command, handling new bcftools tabix and older tabix.
"""
try:
bcftools = config_utils.get_program("bcftools", config)
# bcftools has terrible error codes and stderr output, swallow those.
bcftools_tabix = subprocess.check_output("{bcftool... | python | def get_tabix_cmd(config):
"""Retrieve tabix command, handling new bcftools tabix and older tabix.
"""
try:
bcftools = config_utils.get_program("bcftools", config)
# bcftools has terrible error codes and stderr output, swallow those.
bcftools_tabix = subprocess.check_output("{bcftool... | [
"def",
"get_tabix_cmd",
"(",
"config",
")",
":",
"try",
":",
"bcftools",
"=",
"config_utils",
".",
"get_program",
"(",
"\"bcftools\"",
",",
"config",
")",
"# bcftools has terrible error codes and stderr output, swallow those.",
"bcftools_tabix",
"=",
"subprocess",
".",
... | Retrieve tabix command, handling new bcftools tabix and older tabix. | [
"Retrieve",
"tabix",
"command",
"handling",
"new",
"bcftools",
"tabix",
"and",
"older",
"tabix",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/tools.py#L10-L24 |
223,308 | bcbio/bcbio-nextgen | bcbio/pipeline/tools.py | get_bgzip_cmd | def get_bgzip_cmd(config, is_retry=False):
"""Retrieve command to use for bgzip, trying to use bgzip parallel threads.
By default, parallel bgzip is enabled in bcbio. If it causes problems
please report them. You can turn parallel bgzip off with `tools_off: [pbgzip]`
"""
num_cores = tz.get_in(["alg... | python | def get_bgzip_cmd(config, is_retry=False):
"""Retrieve command to use for bgzip, trying to use bgzip parallel threads.
By default, parallel bgzip is enabled in bcbio. If it causes problems
please report them. You can turn parallel bgzip off with `tools_off: [pbgzip]`
"""
num_cores = tz.get_in(["alg... | [
"def",
"get_bgzip_cmd",
"(",
"config",
",",
"is_retry",
"=",
"False",
")",
":",
"num_cores",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"algorithm\"",
",",
"\"num_cores\"",
"]",
",",
"config",
",",
"1",
")",
"cmd",
"=",
"config_utils",
".",
"get_program",
"("... | Retrieve command to use for bgzip, trying to use bgzip parallel threads.
By default, parallel bgzip is enabled in bcbio. If it causes problems
please report them. You can turn parallel bgzip off with `tools_off: [pbgzip]` | [
"Retrieve",
"command",
"to",
"use",
"for",
"bgzip",
"trying",
"to",
"use",
"bgzip",
"parallel",
"threads",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/tools.py#L26-L37 |
223,309 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | is_empty | def is_empty(bam_file):
"""Determine if a BAM file is empty
"""
bam_file = objectstore.cl_input(bam_file)
cmd = ("set -o pipefail; "
"samtools view {bam_file} | head -1 | wc -l")
p = subprocess.Popen(cmd.format(**locals()), shell=True,
executable=do.find_bash(),
... | python | def is_empty(bam_file):
"""Determine if a BAM file is empty
"""
bam_file = objectstore.cl_input(bam_file)
cmd = ("set -o pipefail; "
"samtools view {bam_file} | head -1 | wc -l")
p = subprocess.Popen(cmd.format(**locals()), shell=True,
executable=do.find_bash(),
... | [
"def",
"is_empty",
"(",
"bam_file",
")",
":",
"bam_file",
"=",
"objectstore",
".",
"cl_input",
"(",
"bam_file",
")",
"cmd",
"=",
"(",
"\"set -o pipefail; \"",
"\"samtools view {bam_file} | head -1 | wc -l\"",
")",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
... | Determine if a BAM file is empty | [
"Determine",
"if",
"a",
"BAM",
"file",
"is",
"empty"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L24-L41 |
223,310 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | fake_index | def fake_index(in_bam, data):
"""Create a fake index file for namesorted BAMs. bais require by CWL for consistency.
"""
index_file = "%s.bai" % in_bam
if not utils.file_exists(index_file):
with file_transaction(data, index_file) as tx_out_file:
with open(tx_out_file, "w") as out_hand... | python | def fake_index(in_bam, data):
"""Create a fake index file for namesorted BAMs. bais require by CWL for consistency.
"""
index_file = "%s.bai" % in_bam
if not utils.file_exists(index_file):
with file_transaction(data, index_file) as tx_out_file:
with open(tx_out_file, "w") as out_hand... | [
"def",
"fake_index",
"(",
"in_bam",
",",
"data",
")",
":",
"index_file",
"=",
"\"%s.bai\"",
"%",
"in_bam",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"index_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"index_file",
")",
"as",
"tx_out... | Create a fake index file for namesorted BAMs. bais require by CWL for consistency. | [
"Create",
"a",
"fake",
"index",
"file",
"for",
"namesorted",
"BAMs",
".",
"bais",
"require",
"by",
"CWL",
"for",
"consistency",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L67-L75 |
223,311 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | index | def index(in_bam, config, check_timestamp=True):
"""Index a BAM file, skipping if index present.
Centralizes BAM indexing providing ability to switch indexing approaches.
"""
assert is_bam(in_bam), "%s in not a BAM file" % in_bam
index_file = "%s.bai" % in_bam
alt_index_file = "%s.bai" % os.pat... | python | def index(in_bam, config, check_timestamp=True):
"""Index a BAM file, skipping if index present.
Centralizes BAM indexing providing ability to switch indexing approaches.
"""
assert is_bam(in_bam), "%s in not a BAM file" % in_bam
index_file = "%s.bai" % in_bam
alt_index_file = "%s.bai" % os.pat... | [
"def",
"index",
"(",
"in_bam",
",",
"config",
",",
"check_timestamp",
"=",
"True",
")",
":",
"assert",
"is_bam",
"(",
"in_bam",
")",
",",
"\"%s in not a BAM file\"",
"%",
"in_bam",
"index_file",
"=",
"\"%s.bai\"",
"%",
"in_bam",
"alt_index_file",
"=",
"\"%s.ba... | Index a BAM file, skipping if index present.
Centralizes BAM indexing providing ability to switch indexing approaches. | [
"Index",
"a",
"BAM",
"file",
"skipping",
"if",
"index",
"present",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L77-L98 |
223,312 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | remove | def remove(in_bam):
"""
remove bam file and the index if exists
"""
if utils.file_exists(in_bam):
utils.remove_safe(in_bam)
if utils.file_exists(in_bam + ".bai"):
utils.remove_safe(in_bam + ".bai") | python | def remove(in_bam):
"""
remove bam file and the index if exists
"""
if utils.file_exists(in_bam):
utils.remove_safe(in_bam)
if utils.file_exists(in_bam + ".bai"):
utils.remove_safe(in_bam + ".bai") | [
"def",
"remove",
"(",
"in_bam",
")",
":",
"if",
"utils",
".",
"file_exists",
"(",
"in_bam",
")",
":",
"utils",
".",
"remove_safe",
"(",
"in_bam",
")",
"if",
"utils",
".",
"file_exists",
"(",
"in_bam",
"+",
"\".bai\"",
")",
":",
"utils",
".",
"remove_sa... | remove bam file and the index if exists | [
"remove",
"bam",
"file",
"and",
"the",
"index",
"if",
"exists"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L100-L107 |
223,313 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | idxstats | def idxstats(in_bam, data):
"""Return BAM index stats for the given file, using samtools idxstats.
"""
index(in_bam, data["config"], check_timestamp=False)
AlignInfo = collections.namedtuple("AlignInfo", ["contig", "length", "aligned", "unaligned"])
samtools = config_utils.get_program("samtools", da... | python | def idxstats(in_bam, data):
"""Return BAM index stats for the given file, using samtools idxstats.
"""
index(in_bam, data["config"], check_timestamp=False)
AlignInfo = collections.namedtuple("AlignInfo", ["contig", "length", "aligned", "unaligned"])
samtools = config_utils.get_program("samtools", da... | [
"def",
"idxstats",
"(",
"in_bam",
",",
"data",
")",
":",
"index",
"(",
"in_bam",
",",
"data",
"[",
"\"config\"",
"]",
",",
"check_timestamp",
"=",
"False",
")",
"AlignInfo",
"=",
"collections",
".",
"namedtuple",
"(",
"\"AlignInfo\"",
",",
"[",
"\"contig\"... | Return BAM index stats for the given file, using samtools idxstats. | [
"Return",
"BAM",
"index",
"stats",
"for",
"the",
"given",
"file",
"using",
"samtools",
"idxstats",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L109-L121 |
223,314 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | fai_from_bam | def fai_from_bam(ref_file, bam_file, out_file, data):
"""Create a fai index with only contigs in the input BAM file.
"""
contigs = set([x.contig for x in idxstats(bam_file, data)])
if not utils.file_uptodate(out_file, bam_file):
with open(ref.fasta_idx(ref_file, data["config"])) as in_handle:
... | python | def fai_from_bam(ref_file, bam_file, out_file, data):
"""Create a fai index with only contigs in the input BAM file.
"""
contigs = set([x.contig for x in idxstats(bam_file, data)])
if not utils.file_uptodate(out_file, bam_file):
with open(ref.fasta_idx(ref_file, data["config"])) as in_handle:
... | [
"def",
"fai_from_bam",
"(",
"ref_file",
",",
"bam_file",
",",
"out_file",
",",
"data",
")",
":",
"contigs",
"=",
"set",
"(",
"[",
"x",
".",
"contig",
"for",
"x",
"in",
"idxstats",
"(",
"bam_file",
",",
"data",
")",
"]",
")",
"if",
"not",
"utils",
"... | Create a fai index with only contigs in the input BAM file. | [
"Create",
"a",
"fai",
"index",
"with",
"only",
"contigs",
"in",
"the",
"input",
"BAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L123-L134 |
223,315 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | ref_file_from_bam | def ref_file_from_bam(bam_file, data):
"""Subset a fasta input file to only a fraction of input contigs.
"""
new_ref = os.path.join(utils.safe_makedir(os.path.join(dd.get_work_dir(data), "inputs", "ref")),
"%s-subset.fa" % dd.get_genome_build(data))
if not utils.file_exists(ne... | python | def ref_file_from_bam(bam_file, data):
"""Subset a fasta input file to only a fraction of input contigs.
"""
new_ref = os.path.join(utils.safe_makedir(os.path.join(dd.get_work_dir(data), "inputs", "ref")),
"%s-subset.fa" % dd.get_genome_build(data))
if not utils.file_exists(ne... | [
"def",
"ref_file_from_bam",
"(",
"bam_file",
",",
"data",
")",
":",
"new_ref",
"=",
"os",
".",
"path",
".",
"join",
"(",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"inpu... | Subset a fasta input file to only a fraction of input contigs. | [
"Subset",
"a",
"fasta",
"input",
"file",
"to",
"only",
"a",
"fraction",
"of",
"input",
"contigs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L136-L152 |
223,316 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | get_downsample_pct | def get_downsample_pct(in_bam, target_counts, data):
"""Retrieve percentage of file to downsample to get to target counts.
Avoids minimal downsample which is not especially useful for
improving QC times; 90& or more of reads.
"""
total = sum(x.aligned for x in idxstats(in_bam, data))
with pysam... | python | def get_downsample_pct(in_bam, target_counts, data):
"""Retrieve percentage of file to downsample to get to target counts.
Avoids minimal downsample which is not especially useful for
improving QC times; 90& or more of reads.
"""
total = sum(x.aligned for x in idxstats(in_bam, data))
with pysam... | [
"def",
"get_downsample_pct",
"(",
"in_bam",
",",
"target_counts",
",",
"data",
")",
":",
"total",
"=",
"sum",
"(",
"x",
".",
"aligned",
"for",
"x",
"in",
"idxstats",
"(",
"in_bam",
",",
"data",
")",
")",
"with",
"pysam",
".",
"Samfile",
"(",
"in_bam",
... | Retrieve percentage of file to downsample to get to target counts.
Avoids minimal downsample which is not especially useful for
improving QC times; 90& or more of reads. | [
"Retrieve",
"percentage",
"of",
"file",
"to",
"downsample",
"to",
"get",
"to",
"target",
"counts",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L154-L167 |
223,317 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | downsample | def downsample(in_bam, data, target_counts, work_dir=None):
"""Downsample a BAM file to the specified number of target counts.
"""
index(in_bam, data["config"], check_timestamp=False)
ds_pct = get_downsample_pct(in_bam, target_counts, data)
if ds_pct:
out_file = "%s-downsample%s" % os.path.s... | python | def downsample(in_bam, data, target_counts, work_dir=None):
"""Downsample a BAM file to the specified number of target counts.
"""
index(in_bam, data["config"], check_timestamp=False)
ds_pct = get_downsample_pct(in_bam, target_counts, data)
if ds_pct:
out_file = "%s-downsample%s" % os.path.s... | [
"def",
"downsample",
"(",
"in_bam",
",",
"data",
",",
"target_counts",
",",
"work_dir",
"=",
"None",
")",
":",
"index",
"(",
"in_bam",
",",
"data",
"[",
"\"config\"",
"]",
",",
"check_timestamp",
"=",
"False",
")",
"ds_pct",
"=",
"get_downsample_pct",
"(",... | Downsample a BAM file to the specified number of target counts. | [
"Downsample",
"a",
"BAM",
"file",
"to",
"the",
"specified",
"number",
"of",
"target",
"counts",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L177-L194 |
223,318 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | get_maxcov_downsample_cl | def get_maxcov_downsample_cl(data, in_pipe=None):
"""Retrieve command line for max coverage downsampling, fitting into bamsormadup output.
"""
max_cov = _get_maxcov_downsample(data) if dd.get_aligner(data) not in ["snap"] else None
if max_cov:
if in_pipe == "bamsormadup":
prefix = "l... | python | def get_maxcov_downsample_cl(data, in_pipe=None):
"""Retrieve command line for max coverage downsampling, fitting into bamsormadup output.
"""
max_cov = _get_maxcov_downsample(data) if dd.get_aligner(data) not in ["snap"] else None
if max_cov:
if in_pipe == "bamsormadup":
prefix = "l... | [
"def",
"get_maxcov_downsample_cl",
"(",
"data",
",",
"in_pipe",
"=",
"None",
")",
":",
"max_cov",
"=",
"_get_maxcov_downsample",
"(",
"data",
")",
"if",
"dd",
".",
"get_aligner",
"(",
"data",
")",
"not",
"in",
"[",
"\"snap\"",
"]",
"else",
"None",
"if",
... | Retrieve command line for max coverage downsampling, fitting into bamsormadup output. | [
"Retrieve",
"command",
"line",
"for",
"max",
"coverage",
"downsampling",
"fitting",
"into",
"bamsormadup",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L196-L217 |
223,319 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | _get_maxcov_downsample | def _get_maxcov_downsample(data):
"""Calculate maximum coverage downsampling for whole genome samples.
Returns None if we're not doing downsampling.
"""
from bcbio.bam import ref
from bcbio.ngsalign import alignprep, bwa
from bcbio.variation import coverage
fastq_file = data["files"][0]
... | python | def _get_maxcov_downsample(data):
"""Calculate maximum coverage downsampling for whole genome samples.
Returns None if we're not doing downsampling.
"""
from bcbio.bam import ref
from bcbio.ngsalign import alignprep, bwa
from bcbio.variation import coverage
fastq_file = data["files"][0]
... | [
"def",
"_get_maxcov_downsample",
"(",
"data",
")",
":",
"from",
"bcbio",
".",
"bam",
"import",
"ref",
"from",
"bcbio",
".",
"ngsalign",
"import",
"alignprep",
",",
"bwa",
"from",
"bcbio",
".",
"variation",
"import",
"coverage",
"fastq_file",
"=",
"data",
"["... | Calculate maximum coverage downsampling for whole genome samples.
Returns None if we're not doing downsampling. | [
"Calculate",
"maximum",
"coverage",
"downsampling",
"for",
"whole",
"genome",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L219-L250 |
223,320 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | check_header | def check_header(in_bam, rgnames, ref_file, config):
"""Ensure passed in BAM header matches reference file and read groups names.
"""
_check_bam_contigs(in_bam, ref_file, config)
_check_sample(in_bam, rgnames) | python | def check_header(in_bam, rgnames, ref_file, config):
"""Ensure passed in BAM header matches reference file and read groups names.
"""
_check_bam_contigs(in_bam, ref_file, config)
_check_sample(in_bam, rgnames) | [
"def",
"check_header",
"(",
"in_bam",
",",
"rgnames",
",",
"ref_file",
",",
"config",
")",
":",
"_check_bam_contigs",
"(",
"in_bam",
",",
"ref_file",
",",
"config",
")",
"_check_sample",
"(",
"in_bam",
",",
"rgnames",
")"
] | Ensure passed in BAM header matches reference file and read groups names. | [
"Ensure",
"passed",
"in",
"BAM",
"header",
"matches",
"reference",
"file",
"and",
"read",
"groups",
"names",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L253-L257 |
223,321 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | _check_sample | def _check_sample(in_bam, rgnames):
"""Ensure input sample name matches expected run group names.
"""
with pysam.Samfile(in_bam, "rb") as bamfile:
rg = bamfile.header.get("RG", [{}])
msgs = []
warnings = []
if len(rg) > 1:
warnings.append("Multiple read groups found in input BAM.... | python | def _check_sample(in_bam, rgnames):
"""Ensure input sample name matches expected run group names.
"""
with pysam.Samfile(in_bam, "rb") as bamfile:
rg = bamfile.header.get("RG", [{}])
msgs = []
warnings = []
if len(rg) > 1:
warnings.append("Multiple read groups found in input BAM.... | [
"def",
"_check_sample",
"(",
"in_bam",
",",
"rgnames",
")",
":",
"with",
"pysam",
".",
"Samfile",
"(",
"in_bam",
",",
"\"rb\"",
")",
"as",
"bamfile",
":",
"rg",
"=",
"bamfile",
".",
"header",
".",
"get",
"(",
"\"RG\"",
",",
"[",
"{",
"}",
"]",
")",... | Ensure input sample name matches expected run group names. | [
"Ensure",
"input",
"sample",
"name",
"matches",
"expected",
"run",
"group",
"names",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L259-L280 |
223,322 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | _check_bam_contigs | def _check_bam_contigs(in_bam, ref_file, config):
"""Ensure a pre-aligned BAM file matches the expected reference genome.
"""
# GATK allows chromosome M to be in multiple locations, skip checking it
allowed_outoforder = ["chrM", "MT"]
ref_contigs = [c.name for c in ref.file_contigs(ref_file, config)... | python | def _check_bam_contigs(in_bam, ref_file, config):
"""Ensure a pre-aligned BAM file matches the expected reference genome.
"""
# GATK allows chromosome M to be in multiple locations, skip checking it
allowed_outoforder = ["chrM", "MT"]
ref_contigs = [c.name for c in ref.file_contigs(ref_file, config)... | [
"def",
"_check_bam_contigs",
"(",
"in_bam",
",",
"ref_file",
",",
"config",
")",
":",
"# GATK allows chromosome M to be in multiple locations, skip checking it",
"allowed_outoforder",
"=",
"[",
"\"chrM\"",
",",
"\"MT\"",
"]",
"ref_contigs",
"=",
"[",
"c",
".",
"name",
... | Ensure a pre-aligned BAM file matches the expected reference genome. | [
"Ensure",
"a",
"pre",
"-",
"aligned",
"BAM",
"file",
"matches",
"the",
"expected",
"reference",
"genome",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L282-L315 |
223,323 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | sort | def sort(in_bam, config, order="coordinate", out_dir=None):
"""Sort a BAM file, skipping if already present.
"""
assert is_bam(in_bam), "%s in not a BAM file" % in_bam
if bam_already_sorted(in_bam, config, order):
return in_bam
sort_stem = _get_sort_stem(in_bam, order, out_dir)
sort_fil... | python | def sort(in_bam, config, order="coordinate", out_dir=None):
"""Sort a BAM file, skipping if already present.
"""
assert is_bam(in_bam), "%s in not a BAM file" % in_bam
if bam_already_sorted(in_bam, config, order):
return in_bam
sort_stem = _get_sort_stem(in_bam, order, out_dir)
sort_fil... | [
"def",
"sort",
"(",
"in_bam",
",",
"config",
",",
"order",
"=",
"\"coordinate\"",
",",
"out_dir",
"=",
"None",
")",
":",
"assert",
"is_bam",
"(",
"in_bam",
")",
",",
"\"%s in not a BAM file\"",
"%",
"in_bam",
"if",
"bam_already_sorted",
"(",
"in_bam",
",",
... | Sort a BAM file, skipping if already present. | [
"Sort",
"a",
"BAM",
"file",
"skipping",
"if",
"already",
"present",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L406-L431 |
223,324 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | aligner_from_header | def aligner_from_header(in_bam):
"""Identify aligner from the BAM header; handling pre-aligned inputs.
"""
from bcbio.pipeline.alignment import TOOLS
with pysam.Samfile(in_bam, "rb") as bamfile:
for pg in bamfile.header.get("PG", []):
for ka in TOOLS.keys():
if pg.get... | python | def aligner_from_header(in_bam):
"""Identify aligner from the BAM header; handling pre-aligned inputs.
"""
from bcbio.pipeline.alignment import TOOLS
with pysam.Samfile(in_bam, "rb") as bamfile:
for pg in bamfile.header.get("PG", []):
for ka in TOOLS.keys():
if pg.get... | [
"def",
"aligner_from_header",
"(",
"in_bam",
")",
":",
"from",
"bcbio",
".",
"pipeline",
".",
"alignment",
"import",
"TOOLS",
"with",
"pysam",
".",
"Samfile",
"(",
"in_bam",
",",
"\"rb\"",
")",
"as",
"bamfile",
":",
"for",
"pg",
"in",
"bamfile",
".",
"he... | Identify aligner from the BAM header; handling pre-aligned inputs. | [
"Identify",
"aligner",
"from",
"the",
"BAM",
"header",
";",
"handling",
"pre",
"-",
"aligned",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L455-L463 |
223,325 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | sample_name | def sample_name(in_bam):
"""Get sample name from BAM file.
"""
with pysam.AlignmentFile(in_bam, "rb", check_sq=False) as in_pysam:
try:
if "RG" in in_pysam.header:
return in_pysam.header["RG"][0]["SM"]
except ValueError:
return None | python | def sample_name(in_bam):
"""Get sample name from BAM file.
"""
with pysam.AlignmentFile(in_bam, "rb", check_sq=False) as in_pysam:
try:
if "RG" in in_pysam.header:
return in_pysam.header["RG"][0]["SM"]
except ValueError:
return None | [
"def",
"sample_name",
"(",
"in_bam",
")",
":",
"with",
"pysam",
".",
"AlignmentFile",
"(",
"in_bam",
",",
"\"rb\"",
",",
"check_sq",
"=",
"False",
")",
"as",
"in_pysam",
":",
"try",
":",
"if",
"\"RG\"",
"in",
"in_pysam",
".",
"header",
":",
"return",
"... | Get sample name from BAM file. | [
"Get",
"sample",
"name",
"from",
"BAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L465-L473 |
223,326 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | filter_primary | def filter_primary(bam_file, data):
"""Filter reads to primary only BAM.
Removes:
- not primary alignment (0x100) 256
- supplementary alignment (0x800) 2048
"""
stem, ext = os.path.splitext(bam_file)
out_file = stem + ".primary" + ext
if not utils.file_exists(out_file):
with... | python | def filter_primary(bam_file, data):
"""Filter reads to primary only BAM.
Removes:
- not primary alignment (0x100) 256
- supplementary alignment (0x800) 2048
"""
stem, ext = os.path.splitext(bam_file)
out_file = stem + ".primary" + ext
if not utils.file_exists(out_file):
with... | [
"def",
"filter_primary",
"(",
"bam_file",
",",
"data",
")",
":",
"stem",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"bam_file",
")",
"out_file",
"=",
"stem",
"+",
"\".primary\"",
"+",
"ext",
"if",
"not",
"utils",
".",
"file_exists",
"(",... | Filter reads to primary only BAM.
Removes:
- not primary alignment (0x100) 256
- supplementary alignment (0x800) 2048 | [
"Filter",
"reads",
"to",
"primary",
"only",
"BAM",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L496-L511 |
223,327 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | estimate_max_mapq | def estimate_max_mapq(in_bam, nreads=1e6):
"""Guess maximum MAPQ in a BAM file of reads with alignments
"""
with pysam.Samfile(in_bam, "rb") as work_bam:
reads = tz.take(int(nreads), work_bam)
return max([x.mapq for x in reads if not x.is_unmapped]) | python | def estimate_max_mapq(in_bam, nreads=1e6):
"""Guess maximum MAPQ in a BAM file of reads with alignments
"""
with pysam.Samfile(in_bam, "rb") as work_bam:
reads = tz.take(int(nreads), work_bam)
return max([x.mapq for x in reads if not x.is_unmapped]) | [
"def",
"estimate_max_mapq",
"(",
"in_bam",
",",
"nreads",
"=",
"1e6",
")",
":",
"with",
"pysam",
".",
"Samfile",
"(",
"in_bam",
",",
"\"rb\"",
")",
"as",
"work_bam",
":",
"reads",
"=",
"tz",
".",
"take",
"(",
"int",
"(",
"nreads",
")",
",",
"work_bam... | Guess maximum MAPQ in a BAM file of reads with alignments | [
"Guess",
"maximum",
"MAPQ",
"in",
"a",
"BAM",
"file",
"of",
"reads",
"with",
"alignments"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L513-L518 |
223,328 | bcbio/bcbio-nextgen | bcbio/bam/__init__.py | convert_cufflinks_mapq | def convert_cufflinks_mapq(in_bam, out_bam=None):
"""Cufflinks expects the not-valid 255 MAPQ for uniquely mapped reads.
This detects the maximum mapping quality in a BAM file and sets
reads with that quality to be 255
"""
CUFFLINKSMAPQ = 255
if not out_bam:
out_bam = os.path.splitext(in... | python | def convert_cufflinks_mapq(in_bam, out_bam=None):
"""Cufflinks expects the not-valid 255 MAPQ for uniquely mapped reads.
This detects the maximum mapping quality in a BAM file and sets
reads with that quality to be 255
"""
CUFFLINKSMAPQ = 255
if not out_bam:
out_bam = os.path.splitext(in... | [
"def",
"convert_cufflinks_mapq",
"(",
"in_bam",
",",
"out_bam",
"=",
"None",
")",
":",
"CUFFLINKSMAPQ",
"=",
"255",
"if",
"not",
"out_bam",
":",
"out_bam",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"in_bam",
")",
"[",
"0",
"]",
"+",
"\"-cufflinks.bam... | Cufflinks expects the not-valid 255 MAPQ for uniquely mapped reads.
This detects the maximum mapping quality in a BAM file and sets
reads with that quality to be 255 | [
"Cufflinks",
"expects",
"the",
"not",
"-",
"valid",
"255",
"MAPQ",
"for",
"uniquely",
"mapped",
"reads",
".",
"This",
"detects",
"the",
"maximum",
"mapping",
"quality",
"in",
"a",
"BAM",
"file",
"and",
"sets",
"reads",
"with",
"that",
"quality",
"to",
"be"... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/__init__.py#L520-L540 |
223,329 | bcbio/bcbio-nextgen | bcbio/variation/annotation.py | get_gatk_annotations | def get_gatk_annotations(config, include_depth=True, include_baseqranksum=True,
gatk_input=True):
"""Retrieve annotations to use for GATK VariantAnnotator.
If include_depth is false, we'll skip annotating DP. Since GATK downsamples
this will undercount on high depth sequencing and ... | python | def get_gatk_annotations(config, include_depth=True, include_baseqranksum=True,
gatk_input=True):
"""Retrieve annotations to use for GATK VariantAnnotator.
If include_depth is false, we'll skip annotating DP. Since GATK downsamples
this will undercount on high depth sequencing and ... | [
"def",
"get_gatk_annotations",
"(",
"config",
",",
"include_depth",
"=",
"True",
",",
"include_baseqranksum",
"=",
"True",
",",
"gatk_input",
"=",
"True",
")",
":",
"broad_runner",
"=",
"broad",
".",
"runner_from_config",
"(",
"config",
")",
"anns",
"=",
"[",
... | Retrieve annotations to use for GATK VariantAnnotator.
If include_depth is false, we'll skip annotating DP. Since GATK downsamples
this will undercount on high depth sequencing and the standard outputs
from the original callers may be preferable.
BaseQRankSum can cause issues with some MuTect2 and oth... | [
"Retrieve",
"annotations",
"to",
"use",
"for",
"GATK",
"VariantAnnotator",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/annotation.py#L17-L46 |
223,330 | bcbio/bcbio-nextgen | bcbio/variation/annotation.py | finalize_vcf | def finalize_vcf(in_file, variantcaller, items):
"""Perform cleanup and dbSNP annotation of the final VCF.
- Adds contigs to header for bcftools compatibility
- adds sample information for tumor/normal
"""
out_file = "%s-annotated%s" % utils.splitext_plus(in_file)
if not utils.file_uptodate(out... | python | def finalize_vcf(in_file, variantcaller, items):
"""Perform cleanup and dbSNP annotation of the final VCF.
- Adds contigs to header for bcftools compatibility
- adds sample information for tumor/normal
"""
out_file = "%s-annotated%s" % utils.splitext_plus(in_file)
if not utils.file_uptodate(out... | [
"def",
"finalize_vcf",
"(",
"in_file",
",",
"variantcaller",
",",
"items",
")",
":",
"out_file",
"=",
"\"%s-annotated%s\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"in_file",
")",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"in_file",
... | Perform cleanup and dbSNP annotation of the final VCF.
- Adds contigs to header for bcftools compatibility
- adds sample information for tumor/normal | [
"Perform",
"cleanup",
"and",
"dbSNP",
"annotation",
"of",
"the",
"final",
"VCF",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/annotation.py#L48-L69 |
223,331 | bcbio/bcbio-nextgen | bcbio/variation/annotation.py | _add_vcf_header_sample_cl | def _add_vcf_header_sample_cl(in_file, items, base_file):
"""Add phenotype information to a VCF header.
Encode tumor/normal relationships in VCF header.
Could also eventually handle more complicated pedigree information if useful.
"""
paired = vcfutils.get_paired(items)
if paired:
toadd... | python | def _add_vcf_header_sample_cl(in_file, items, base_file):
"""Add phenotype information to a VCF header.
Encode tumor/normal relationships in VCF header.
Could also eventually handle more complicated pedigree information if useful.
"""
paired = vcfutils.get_paired(items)
if paired:
toadd... | [
"def",
"_add_vcf_header_sample_cl",
"(",
"in_file",
",",
"items",
",",
"base_file",
")",
":",
"paired",
"=",
"vcfutils",
".",
"get_paired",
"(",
"items",
")",
"if",
"paired",
":",
"toadd",
"=",
"[",
"\"##SAMPLE=<ID=%s,Genomes=Tumor>\"",
"%",
"paired",
".",
"tu... | Add phenotype information to a VCF header.
Encode tumor/normal relationships in VCF header.
Could also eventually handle more complicated pedigree information if useful. | [
"Add",
"phenotype",
"information",
"to",
"a",
"VCF",
"header",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/annotation.py#L98-L113 |
223,332 | bcbio/bcbio-nextgen | bcbio/variation/annotation.py | _update_header | def _update_header(orig_vcf, base_file, new_lines, chrom_process_fn=None):
"""Fix header with additional lines and remapping of generic sample names.
"""
new_header = "%s-sample_header.txt" % utils.splitext_plus(base_file)[0]
with open(new_header, "w") as out_handle:
chrom_line = None
wi... | python | def _update_header(orig_vcf, base_file, new_lines, chrom_process_fn=None):
"""Fix header with additional lines and remapping of generic sample names.
"""
new_header = "%s-sample_header.txt" % utils.splitext_plus(base_file)[0]
with open(new_header, "w") as out_handle:
chrom_line = None
wi... | [
"def",
"_update_header",
"(",
"orig_vcf",
",",
"base_file",
",",
"new_lines",
",",
"chrom_process_fn",
"=",
"None",
")",
":",
"new_header",
"=",
"\"%s-sample_header.txt\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"base_file",
")",
"[",
"0",
"]",
"with",
"open... | Fix header with additional lines and remapping of generic sample names. | [
"Fix",
"header",
"with",
"additional",
"lines",
"and",
"remapping",
"of",
"generic",
"sample",
"names",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/annotation.py#L115-L134 |
223,333 | bcbio/bcbio-nextgen | bcbio/variation/annotation.py | _add_dbsnp | def _add_dbsnp(orig_file, dbsnp_file, data, out_file=None, post_cl=None):
"""Annotate a VCF file with dbSNP.
vcfanno has flexible matching for NON_REF gVCF positions, matching
at position and REF allele, matching ALT NON_REF as a wildcard.
"""
orig_file = vcfutils.bgzip_and_index(orig_file, data["c... | python | def _add_dbsnp(orig_file, dbsnp_file, data, out_file=None, post_cl=None):
"""Annotate a VCF file with dbSNP.
vcfanno has flexible matching for NON_REF gVCF positions, matching
at position and REF allele, matching ALT NON_REF as a wildcard.
"""
orig_file = vcfutils.bgzip_and_index(orig_file, data["c... | [
"def",
"_add_dbsnp",
"(",
"orig_file",
",",
"dbsnp_file",
",",
"data",
",",
"out_file",
"=",
"None",
",",
"post_cl",
"=",
"None",
")",
":",
"orig_file",
"=",
"vcfutils",
".",
"bgzip_and_index",
"(",
"orig_file",
",",
"data",
"[",
"\"config\"",
"]",
")",
... | Annotate a VCF file with dbSNP.
vcfanno has flexible matching for NON_REF gVCF positions, matching
at position and REF allele, matching ALT NON_REF as a wildcard. | [
"Annotate",
"a",
"VCF",
"file",
"with",
"dbSNP",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/annotation.py#L154-L173 |
223,334 | bcbio/bcbio-nextgen | bcbio/variation/annotation.py | get_context_files | def get_context_files(data):
"""Retrieve pre-installed annotation files for annotating genome context.
"""
ref_file = dd.get_ref_file(data)
all_files = []
for ext in [".bed.gz"]:
all_files += sorted(glob.glob(os.path.normpath(os.path.join(os.path.dirname(ref_file), os.pardir,
... | python | def get_context_files(data):
"""Retrieve pre-installed annotation files for annotating genome context.
"""
ref_file = dd.get_ref_file(data)
all_files = []
for ext in [".bed.gz"]:
all_files += sorted(glob.glob(os.path.normpath(os.path.join(os.path.dirname(ref_file), os.pardir,
... | [
"def",
"get_context_files",
"(",
"data",
")",
":",
"ref_file",
"=",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
"all_files",
"=",
"[",
"]",
"for",
"ext",
"in",
"[",
"\".bed.gz\"",
"]",
":",
"all_files",
"+=",
"sorted",
"(",
"glob",
".",
"glob",
"(",
... | Retrieve pre-installed annotation files for annotating genome context. | [
"Retrieve",
"pre",
"-",
"installed",
"annotation",
"files",
"for",
"annotating",
"genome",
"context",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/annotation.py#L175-L184 |
223,335 | bcbio/bcbio-nextgen | bcbio/variation/annotation.py | add_genome_context | def add_genome_context(orig_file, data):
"""Annotate a file with annotations of genome context using vcfanno.
"""
out_file = "%s-context.vcf.gz" % utils.splitext_plus(orig_file)[0]
if not utils.file_uptodate(out_file, orig_file):
with file_transaction(data, out_file) as tx_out_file:
... | python | def add_genome_context(orig_file, data):
"""Annotate a file with annotations of genome context using vcfanno.
"""
out_file = "%s-context.vcf.gz" % utils.splitext_plus(orig_file)[0]
if not utils.file_uptodate(out_file, orig_file):
with file_transaction(data, out_file) as tx_out_file:
... | [
"def",
"add_genome_context",
"(",
"orig_file",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s-context.vcf.gz\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"orig_file",
")",
"[",
"0",
"]",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"orig_... | Annotate a file with annotations of genome context using vcfanno. | [
"Annotate",
"a",
"file",
"with",
"annotations",
"of",
"genome",
"context",
"using",
"vcfanno",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/annotation.py#L186-L214 |
223,336 | bcbio/bcbio-nextgen | bcbio/illumina/demultiplex.py | _submit_and_wait | def _submit_and_wait(cmd, cores, config, output_dir):
"""Submit command with batch script specified in configuration, wait until finished
"""
batch_script = "submit_bcl2fastq.sh"
if not os.path.exists(batch_script + ".finished"):
if os.path.exists(batch_script + ".failed"):
os.remove... | python | def _submit_and_wait(cmd, cores, config, output_dir):
"""Submit command with batch script specified in configuration, wait until finished
"""
batch_script = "submit_bcl2fastq.sh"
if not os.path.exists(batch_script + ".finished"):
if os.path.exists(batch_script + ".failed"):
os.remove... | [
"def",
"_submit_and_wait",
"(",
"cmd",
",",
"cores",
",",
"config",
",",
"output_dir",
")",
":",
"batch_script",
"=",
"\"submit_bcl2fastq.sh\"",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"batch_script",
"+",
"\".finished\"",
")",
":",
"if",
"os",
... | Submit command with batch script specified in configuration, wait until finished | [
"Submit",
"command",
"with",
"batch",
"script",
"specified",
"in",
"configuration",
"wait",
"until",
"finished"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/demultiplex.py#L32-L51 |
223,337 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _prep_items_from_base | def _prep_items_from_base(base, in_files, metadata, separators, force_single=False):
"""Prepare a set of configuration items for input files.
"""
details = []
in_files = _expand_dirs(in_files, KNOWN_EXTS)
in_files = _expand_wildcards(in_files)
ext_groups = collections.defaultdict(list)
for ... | python | def _prep_items_from_base(base, in_files, metadata, separators, force_single=False):
"""Prepare a set of configuration items for input files.
"""
details = []
in_files = _expand_dirs(in_files, KNOWN_EXTS)
in_files = _expand_wildcards(in_files)
ext_groups = collections.defaultdict(list)
for ... | [
"def",
"_prep_items_from_base",
"(",
"base",
",",
"in_files",
",",
"metadata",
",",
"separators",
",",
"force_single",
"=",
"False",
")",
":",
"details",
"=",
"[",
"]",
"in_files",
"=",
"_expand_dirs",
"(",
"in_files",
",",
"KNOWN_EXTS",
")",
"in_files",
"="... | Prepare a set of configuration items for input files. | [
"Prepare",
"a",
"set",
"of",
"configuration",
"items",
"for",
"input",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L100-L126 |
223,338 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _find_glob_matches | def _find_glob_matches(in_files, metadata):
"""Group files that match by globs for merging, rather than by explicit pairs.
"""
reg_files = copy.deepcopy(in_files)
glob_files = []
for glob_search in [x for x in metadata.keys() if "*" in x]:
cur = []
for fname in in_files:
... | python | def _find_glob_matches(in_files, metadata):
"""Group files that match by globs for merging, rather than by explicit pairs.
"""
reg_files = copy.deepcopy(in_files)
glob_files = []
for glob_search in [x for x in metadata.keys() if "*" in x]:
cur = []
for fname in in_files:
... | [
"def",
"_find_glob_matches",
"(",
"in_files",
",",
"metadata",
")",
":",
"reg_files",
"=",
"copy",
".",
"deepcopy",
"(",
"in_files",
")",
"glob_files",
"=",
"[",
"]",
"for",
"glob_search",
"in",
"[",
"x",
"for",
"x",
"in",
"metadata",
".",
"keys",
"(",
... | Group files that match by globs for merging, rather than by explicit pairs. | [
"Group",
"files",
"that",
"match",
"by",
"globs",
"for",
"merging",
"rather",
"than",
"by",
"explicit",
"pairs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L128-L141 |
223,339 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | name_to_config | def name_to_config(template):
"""Read template file into a dictionary to use as base for all samples.
Handles well-known template names, pulled from GitHub repository and local
files.
"""
if objectstore.is_remote(template):
with objectstore.open_file(template) as in_handle:
conf... | python | def name_to_config(template):
"""Read template file into a dictionary to use as base for all samples.
Handles well-known template names, pulled from GitHub repository and local
files.
"""
if objectstore.is_remote(template):
with objectstore.open_file(template) as in_handle:
conf... | [
"def",
"name_to_config",
"(",
"template",
")",
":",
"if",
"objectstore",
".",
"is_remote",
"(",
"template",
")",
":",
"with",
"objectstore",
".",
"open_file",
"(",
"template",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_h... | Read template file into a dictionary to use as base for all samples.
Handles well-known template names, pulled from GitHub repository and local
files. | [
"Read",
"template",
"file",
"into",
"a",
"dictionary",
"to",
"use",
"as",
"base",
"for",
"all",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L168-L196 |
223,340 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _write_config_file | def _write_config_file(items, global_vars, template, project_name, out_dir,
remotes):
"""Write configuration file, adding required top level attributes.
"""
config_dir = utils.safe_makedir(os.path.join(out_dir, "config"))
out_config_file = os.path.join(config_dir, "%s.yaml" % proj... | python | def _write_config_file(items, global_vars, template, project_name, out_dir,
remotes):
"""Write configuration file, adding required top level attributes.
"""
config_dir = utils.safe_makedir(os.path.join(out_dir, "config"))
out_config_file = os.path.join(config_dir, "%s.yaml" % proj... | [
"def",
"_write_config_file",
"(",
"items",
",",
"global_vars",
",",
"template",
",",
"project_name",
",",
"out_dir",
",",
"remotes",
")",
":",
"config_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"con... | Write configuration file, adding required top level attributes. | [
"Write",
"configuration",
"file",
"adding",
"required",
"top",
"level",
"attributes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L205-L231 |
223,341 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _set_global_vars | def _set_global_vars(metadata):
"""Identify files used multiple times in metadata and replace with global variables
"""
fnames = collections.defaultdict(list)
for sample in metadata.keys():
for k, v in metadata[sample].items():
if isinstance(v, six.string_types) and os.path.isfile(v)... | python | def _set_global_vars(metadata):
"""Identify files used multiple times in metadata and replace with global variables
"""
fnames = collections.defaultdict(list)
for sample in metadata.keys():
for k, v in metadata[sample].items():
if isinstance(v, six.string_types) and os.path.isfile(v)... | [
"def",
"_set_global_vars",
"(",
"metadata",
")",
":",
"fnames",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"sample",
"in",
"metadata",
".",
"keys",
"(",
")",
":",
"for",
"k",
",",
"v",
"in",
"metadata",
"[",
"sample",
"]",
".",
... | Identify files used multiple times in metadata and replace with global variables | [
"Identify",
"files",
"used",
"multiple",
"times",
"in",
"metadata",
"and",
"replace",
"with",
"global",
"variables"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L238-L262 |
223,342 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _clean_string | def _clean_string(v, sinfo):
"""Test for and clean unicode present in template CSVs.
"""
if isinstance(v, (list, tuple)):
return [_clean_string(x, sinfo) for x in v]
else:
assert isinstance(v, six.string_types), v
try:
if hasattr(v, "decode"):
return s... | python | def _clean_string(v, sinfo):
"""Test for and clean unicode present in template CSVs.
"""
if isinstance(v, (list, tuple)):
return [_clean_string(x, sinfo) for x in v]
else:
assert isinstance(v, six.string_types), v
try:
if hasattr(v, "decode"):
return s... | [
"def",
"_clean_string",
"(",
"v",
",",
"sinfo",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"_clean_string",
"(",
"x",
",",
"sinfo",
")",
"for",
"x",
"in",
"v",
"]",
"else",
":",
"assert",... | Test for and clean unicode present in template CSVs. | [
"Test",
"for",
"and",
"clean",
"unicode",
"present",
"in",
"template",
"CSVs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L264-L277 |
223,343 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _parse_metadata | def _parse_metadata(in_handle):
"""Reads metadata from a simple CSV structured input file.
samplename,batch,phenotype
ERR256785,batch1,normal
"""
metadata = {}
reader = csv.reader(in_handle)
while 1:
header = next(reader)
if not header[0].startswith("#"):
break
... | python | def _parse_metadata(in_handle):
"""Reads metadata from a simple CSV structured input file.
samplename,batch,phenotype
ERR256785,batch1,normal
"""
metadata = {}
reader = csv.reader(in_handle)
while 1:
header = next(reader)
if not header[0].startswith("#"):
break
... | [
"def",
"_parse_metadata",
"(",
"in_handle",
")",
":",
"metadata",
"=",
"{",
"}",
"reader",
"=",
"csv",
".",
"reader",
"(",
"in_handle",
")",
"while",
"1",
":",
"header",
"=",
"next",
"(",
"reader",
")",
"if",
"not",
"header",
"[",
"0",
"]",
".",
"s... | Reads metadata from a simple CSV structured input file.
samplename,batch,phenotype
ERR256785,batch1,normal | [
"Reads",
"metadata",
"from",
"a",
"simple",
"CSV",
"structured",
"input",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L279-L308 |
223,344 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _pname_and_metadata | def _pname_and_metadata(in_file):
"""Retrieve metadata and project name from the input metadata CSV file.
Uses the input file name for the project name and for back compatibility,
accepts the project name as an input, providing no metadata.
"""
if os.path.isfile(in_file):
with open(in_file)... | python | def _pname_and_metadata(in_file):
"""Retrieve metadata and project name from the input metadata CSV file.
Uses the input file name for the project name and for back compatibility,
accepts the project name as an input, providing no metadata.
"""
if os.path.isfile(in_file):
with open(in_file)... | [
"def",
"_pname_and_metadata",
"(",
"in_file",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"in_file",
")",
":",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",
":",
"md",
",",
"global_vars",
"=",
"_parse_metadata",
"(",
"in_handle",
")"... | Retrieve metadata and project name from the input metadata CSV file.
Uses the input file name for the project name and for back compatibility,
accepts the project name as an input, providing no metadata. | [
"Retrieve",
"metadata",
"and",
"project",
"name",
"from",
"the",
"input",
"metadata",
"CSV",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L318-L339 |
223,345 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _handle_special_yaml_cases | def _handle_special_yaml_cases(v):
"""Handle values that pass integer, boolean, list or dictionary values.
"""
if "::" in v:
out = {}
for part in v.split("::"):
k_part, v_part = part.split(":")
out[k_part] = v_part.split(";")
v = out
elif ";" in v:
... | python | def _handle_special_yaml_cases(v):
"""Handle values that pass integer, boolean, list or dictionary values.
"""
if "::" in v:
out = {}
for part in v.split("::"):
k_part, v_part = part.split(":")
out[k_part] = v_part.split(";")
v = out
elif ";" in v:
... | [
"def",
"_handle_special_yaml_cases",
"(",
"v",
")",
":",
"if",
"\"::\"",
"in",
"v",
":",
"out",
"=",
"{",
"}",
"for",
"part",
"in",
"v",
".",
"split",
"(",
"\"::\"",
")",
":",
"k_part",
",",
"v_part",
"=",
"part",
".",
"split",
"(",
"\":\"",
")",
... | Handle values that pass integer, boolean, list or dictionary values. | [
"Handle",
"values",
"that",
"pass",
"integer",
"boolean",
"list",
"or",
"dictionary",
"values",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L341-L363 |
223,346 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _add_ped_metadata | def _add_ped_metadata(name, metadata):
"""Add standard PED file attributes into metadata if not present.
http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped
"""
ignore = set(["-9", "undefined", "unknown", "."])
def _ped_mapping(x, valmap):
try:
x = int(x)
except Va... | python | def _add_ped_metadata(name, metadata):
"""Add standard PED file attributes into metadata if not present.
http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped
"""
ignore = set(["-9", "undefined", "unknown", "."])
def _ped_mapping(x, valmap):
try:
x = int(x)
except Va... | [
"def",
"_add_ped_metadata",
"(",
"name",
",",
"metadata",
")",
":",
"ignore",
"=",
"set",
"(",
"[",
"\"-9\"",
",",
"\"undefined\"",
",",
"\"unknown\"",
",",
"\".\"",
"]",
")",
"def",
"_ped_mapping",
"(",
"x",
",",
"valmap",
")",
":",
"try",
":",
"x",
... | Add standard PED file attributes into metadata if not present.
http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped | [
"Add",
"standard",
"PED",
"file",
"attributes",
"into",
"metadata",
"if",
"not",
"present",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L365-L401 |
223,347 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _add_metadata | def _add_metadata(item, metadata, remotes, only_metadata=False):
"""Add metadata information from CSV file to current item.
Retrieves metadata based on 'description' parsed from input CSV file.
Adds to object and handles special keys:
- `description`: A new description for the item. Used to relabel ite... | python | def _add_metadata(item, metadata, remotes, only_metadata=False):
"""Add metadata information from CSV file to current item.
Retrieves metadata based on 'description' parsed from input CSV file.
Adds to object and handles special keys:
- `description`: A new description for the item. Used to relabel ite... | [
"def",
"_add_metadata",
"(",
"item",
",",
"metadata",
",",
"remotes",
",",
"only_metadata",
"=",
"False",
")",
":",
"for",
"check_key",
"in",
"[",
"item",
"[",
"\"description\"",
"]",
"]",
"+",
"_get_file_keys",
"(",
"item",
")",
"+",
"_get_vrn_keys",
"(",... | Add metadata information from CSV file to current item.
Retrieves metadata based on 'description' parsed from input CSV file.
Adds to object and handles special keys:
- `description`: A new description for the item. Used to relabel items
based on the pre-determined description from fastq name or BAM... | [
"Add",
"metadata",
"information",
"from",
"CSV",
"file",
"to",
"current",
"item",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L421-L461 |
223,348 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _retrieve_remote | def _retrieve_remote(fnames):
"""Retrieve remote inputs found in the same bucket as the template or metadata files.
"""
for fname in fnames:
if objectstore.is_remote(fname):
inputs = []
regions = []
remote_base = os.path.dirname(fname)
for rfname in ob... | python | def _retrieve_remote(fnames):
"""Retrieve remote inputs found in the same bucket as the template or metadata files.
"""
for fname in fnames:
if objectstore.is_remote(fname):
inputs = []
regions = []
remote_base = os.path.dirname(fname)
for rfname in ob... | [
"def",
"_retrieve_remote",
"(",
"fnames",
")",
":",
"for",
"fname",
"in",
"fnames",
":",
"if",
"objectstore",
".",
"is_remote",
"(",
"fname",
")",
":",
"inputs",
"=",
"[",
"]",
"regions",
"=",
"[",
"]",
"remote_base",
"=",
"os",
".",
"path",
".",
"di... | Retrieve remote inputs found in the same bucket as the template or metadata files. | [
"Retrieve",
"remote",
"inputs",
"found",
"in",
"the",
"same",
"bucket",
"as",
"the",
"template",
"or",
"metadata",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L477-L493 |
223,349 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _convert_to_relpaths | def _convert_to_relpaths(data, work_dir):
"""Convert absolute paths in the input data to relative paths to the work directory.
"""
work_dir = os.path.abspath(work_dir)
data["files"] = [os.path.relpath(f, work_dir) for f in data["files"]]
for topk in ["metadata", "algorithm"]:
for k, v in dat... | python | def _convert_to_relpaths(data, work_dir):
"""Convert absolute paths in the input data to relative paths to the work directory.
"""
work_dir = os.path.abspath(work_dir)
data["files"] = [os.path.relpath(f, work_dir) for f in data["files"]]
for topk in ["metadata", "algorithm"]:
for k, v in dat... | [
"def",
"_convert_to_relpaths",
"(",
"data",
",",
"work_dir",
")",
":",
"work_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"work_dir",
")",
"data",
"[",
"\"files\"",
"]",
"=",
"[",
"os",
".",
"path",
".",
"relpath",
"(",
"f",
",",
"work_dir",
")... | Convert absolute paths in the input data to relative paths to the work directory. | [
"Convert",
"absolute",
"paths",
"in",
"the",
"input",
"data",
"to",
"relative",
"paths",
"to",
"the",
"work",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L495-L504 |
223,350 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _check_all_metadata_found | def _check_all_metadata_found(metadata, items):
"""Print warning if samples in CSV file are missing in folder"""
for name in metadata:
seen = False
for sample in items:
check_file = sample["files"][0] if sample.get("files") else sample["vrn_file"]
if isinstance(name, (tup... | python | def _check_all_metadata_found(metadata, items):
"""Print warning if samples in CSV file are missing in folder"""
for name in metadata:
seen = False
for sample in items:
check_file = sample["files"][0] if sample.get("files") else sample["vrn_file"]
if isinstance(name, (tup... | [
"def",
"_check_all_metadata_found",
"(",
"metadata",
",",
"items",
")",
":",
"for",
"name",
"in",
"metadata",
":",
"seen",
"=",
"False",
"for",
"sample",
"in",
"items",
":",
"check_file",
"=",
"sample",
"[",
"\"files\"",
"]",
"[",
"0",
"]",
"if",
"sample... | Print warning if samples in CSV file are missing in folder | [
"Print",
"warning",
"if",
"samples",
"in",
"CSV",
"file",
"are",
"missing",
"in",
"folder"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L506-L520 |
223,351 | bcbio/bcbio-nextgen | bcbio/workflow/template.py | _copy_to_configdir | def _copy_to_configdir(items, out_dir, args):
"""Copy configuration files like PED inputs to working config directory.
"""
out = []
for item in items:
ped_file = tz.get_in(["metadata", "ped"], item)
if ped_file and os.path.exists(ped_file):
ped_config_file = os.path.join(out_... | python | def _copy_to_configdir(items, out_dir, args):
"""Copy configuration files like PED inputs to working config directory.
"""
out = []
for item in items:
ped_file = tz.get_in(["metadata", "ped"], item)
if ped_file and os.path.exists(ped_file):
ped_config_file = os.path.join(out_... | [
"def",
"_copy_to_configdir",
"(",
"items",
",",
"out_dir",
",",
"args",
")",
":",
"out",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"ped_file",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"metadata\"",
",",
"\"ped\"",
"]",
",",
"item",
")",
"if",
... | Copy configuration files like PED inputs to working config directory. | [
"Copy",
"configuration",
"files",
"like",
"PED",
"inputs",
"to",
"working",
"config",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L522-L536 |
223,352 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | load_system_config | def load_system_config(config_file=None, work_dir=None, allow_missing=False):
"""Load bcbio_system.yaml configuration file, handling standard defaults.
Looks for configuration file in default location within
final base directory from a standard installation. Handles both standard
installs (galaxy/bcbio... | python | def load_system_config(config_file=None, work_dir=None, allow_missing=False):
"""Load bcbio_system.yaml configuration file, handling standard defaults.
Looks for configuration file in default location within
final base directory from a standard installation. Handles both standard
installs (galaxy/bcbio... | [
"def",
"load_system_config",
"(",
"config_file",
"=",
"None",
",",
"work_dir",
"=",
"None",
",",
"allow_missing",
"=",
"False",
")",
":",
"docker_config",
"=",
"_get_docker_config",
"(",
")",
"if",
"config_file",
"is",
"None",
":",
"config_file",
"=",
"\"bcbio... | Load bcbio_system.yaml configuration file, handling standard defaults.
Looks for configuration file in default location within
final base directory from a standard installation. Handles both standard
installs (galaxy/bcbio_system.yaml) and docker installs (config/bcbio_system.yaml). | [
"Load",
"bcbio_system",
".",
"yaml",
"configuration",
"file",
"handling",
"standard",
"defaults",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L50-L79 |
223,353 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | _merge_system_configs | def _merge_system_configs(host_config, container_config, out_file=None):
"""Create a merged system configuration from external and internal specification.
"""
out = copy.deepcopy(container_config)
for k, v in host_config.items():
if k in set(["galaxy_config"]):
out[k] = v
eli... | python | def _merge_system_configs(host_config, container_config, out_file=None):
"""Create a merged system configuration from external and internal specification.
"""
out = copy.deepcopy(container_config)
for k, v in host_config.items():
if k in set(["galaxy_config"]):
out[k] = v
eli... | [
"def",
"_merge_system_configs",
"(",
"host_config",
",",
"container_config",
",",
"out_file",
"=",
"None",
")",
":",
"out",
"=",
"copy",
".",
"deepcopy",
"(",
"container_config",
")",
"for",
"k",
",",
"v",
"in",
"host_config",
".",
"items",
"(",
")",
":",
... | Create a merged system configuration from external and internal specification. | [
"Create",
"a",
"merged",
"system",
"configuration",
"from",
"external",
"and",
"internal",
"specification",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L84-L110 |
223,354 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | merge_resources | def merge_resources(args):
"""Merge docker local resources and global resource specification in a set of arguments.
Finds the `data` object within passed arguments and updates the resources
from a local docker configuration if present.
"""
docker_config = _get_docker_config()
if not docker_conf... | python | def merge_resources(args):
"""Merge docker local resources and global resource specification in a set of arguments.
Finds the `data` object within passed arguments and updates the resources
from a local docker configuration if present.
"""
docker_config = _get_docker_config()
if not docker_conf... | [
"def",
"merge_resources",
"(",
"args",
")",
":",
"docker_config",
"=",
"_get_docker_config",
"(",
")",
"if",
"not",
"docker_config",
":",
"return",
"args",
"else",
":",
"def",
"_update_resources",
"(",
"config",
")",
":",
"config",
"[",
"\"resources\"",
"]",
... | Merge docker local resources and global resource specification in a set of arguments.
Finds the `data` object within passed arguments and updates the resources
from a local docker configuration if present. | [
"Merge",
"docker",
"local",
"resources",
"and",
"global",
"resource",
"specification",
"in",
"a",
"set",
"of",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L118-L131 |
223,355 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | load_config | def load_config(config_file):
"""Load YAML config file, replacing environmental variables.
"""
with open(config_file) as in_handle:
config = yaml.safe_load(in_handle)
config = _expand_paths(config)
if 'resources' not in config:
config['resources'] = {}
# lowercase resource names,... | python | def load_config(config_file):
"""Load YAML config file, replacing environmental variables.
"""
with open(config_file) as in_handle:
config = yaml.safe_load(in_handle)
config = _expand_paths(config)
if 'resources' not in config:
config['resources'] = {}
# lowercase resource names,... | [
"def",
"load_config",
"(",
"config_file",
")",
":",
"with",
"open",
"(",
"config_file",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_handle",
")",
"config",
"=",
"_expand_paths",
"(",
"config",
")",
"if",
"'resources'",
"n... | Load YAML config file, replacing environmental variables. | [
"Load",
"YAML",
"config",
"file",
"replacing",
"environmental",
"variables",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L133-L147 |
223,356 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_resources | def get_resources(name, config):
"""Retrieve resources for a program, pulling from multiple config sources.
"""
return tz.get_in(["resources", name], config,
tz.get_in(["resources", "default"], config, {})) | python | def get_resources(name, config):
"""Retrieve resources for a program, pulling from multiple config sources.
"""
return tz.get_in(["resources", name], config,
tz.get_in(["resources", "default"], config, {})) | [
"def",
"get_resources",
"(",
"name",
",",
"config",
")",
":",
"return",
"tz",
".",
"get_in",
"(",
"[",
"\"resources\"",
",",
"name",
"]",
",",
"config",
",",
"tz",
".",
"get_in",
"(",
"[",
"\"resources\"",
",",
"\"default\"",
"]",
",",
"config",
",",
... | Retrieve resources for a program, pulling from multiple config sources. | [
"Retrieve",
"resources",
"for",
"a",
"program",
"pulling",
"from",
"multiple",
"config",
"sources",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L165-L169 |
223,357 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_program | def get_program(name, config, ptype="cmd", default=None):
"""Retrieve program information from the configuration.
This handles back compatible location specification in input
YAML. The preferred location for program information is in
`resources` but the older `program` tag is also supported.
"""
... | python | def get_program(name, config, ptype="cmd", default=None):
"""Retrieve program information from the configuration.
This handles back compatible location specification in input
YAML. The preferred location for program information is in
`resources` but the older `program` tag is also supported.
"""
... | [
"def",
"get_program",
"(",
"name",
",",
"config",
",",
"ptype",
"=",
"\"cmd\"",
",",
"default",
"=",
"None",
")",
":",
"# support taking in the data dictionary",
"config",
"=",
"config",
".",
"get",
"(",
"\"config\"",
",",
"config",
")",
"try",
":",
"pconfig... | Retrieve program information from the configuration.
This handles back compatible location specification in input
YAML. The preferred location for program information is in
`resources` but the older `program` tag is also supported. | [
"Retrieve",
"program",
"information",
"from",
"the",
"configuration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L171-L195 |
223,358 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | _get_program_cmd | def _get_program_cmd(name, pconfig, config, default):
"""Retrieve commandline of a program.
"""
if pconfig is None:
return name
elif isinstance(pconfig, six.string_types):
return pconfig
elif "cmd" in pconfig:
return pconfig["cmd"]
elif default is not None:
return... | python | def _get_program_cmd(name, pconfig, config, default):
"""Retrieve commandline of a program.
"""
if pconfig is None:
return name
elif isinstance(pconfig, six.string_types):
return pconfig
elif "cmd" in pconfig:
return pconfig["cmd"]
elif default is not None:
return... | [
"def",
"_get_program_cmd",
"(",
"name",
",",
"pconfig",
",",
"config",
",",
"default",
")",
":",
"if",
"pconfig",
"is",
"None",
":",
"return",
"name",
"elif",
"isinstance",
"(",
"pconfig",
",",
"six",
".",
"string_types",
")",
":",
"return",
"pconfig",
"... | Retrieve commandline of a program. | [
"Retrieve",
"commandline",
"of",
"a",
"program",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L221-L233 |
223,359 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_jar | def get_jar(base_name, dname):
"""Retrieve a jar in the provided directory
"""
jars = glob.glob(os.path.join(expand_path(dname), "%s*.jar" % base_name))
if len(jars) == 1:
return jars[0]
elif len(jars) > 1:
raise ValueError("Found multiple jars for %s in %s. Need single jar: %s" %
... | python | def get_jar(base_name, dname):
"""Retrieve a jar in the provided directory
"""
jars = glob.glob(os.path.join(expand_path(dname), "%s*.jar" % base_name))
if len(jars) == 1:
return jars[0]
elif len(jars) > 1:
raise ValueError("Found multiple jars for %s in %s. Need single jar: %s" %
... | [
"def",
"get_jar",
"(",
"base_name",
",",
"dname",
")",
":",
"jars",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"expand_path",
"(",
"dname",
")",
",",
"\"%s*.jar\"",
"%",
"base_name",
")",
")",
"if",
"len",
"(",
"jars",
")",... | Retrieve a jar in the provided directory | [
"Retrieve",
"a",
"jar",
"in",
"the",
"provided",
"directory"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L247-L259 |
223,360 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_algorithm_config | def get_algorithm_config(xs):
"""Flexibly extract algorithm configuration for a sample from any function arguments.
"""
if isinstance(xs, dict):
xs = [xs]
for x in xs:
if is_std_config_arg(x):
return x["algorithm"]
elif is_nested_config_arg(x):
return x["c... | python | def get_algorithm_config(xs):
"""Flexibly extract algorithm configuration for a sample from any function arguments.
"""
if isinstance(xs, dict):
xs = [xs]
for x in xs:
if is_std_config_arg(x):
return x["algorithm"]
elif is_nested_config_arg(x):
return x["c... | [
"def",
"get_algorithm_config",
"(",
"xs",
")",
":",
"if",
"isinstance",
"(",
"xs",
",",
"dict",
")",
":",
"xs",
"=",
"[",
"xs",
"]",
"for",
"x",
"in",
"xs",
":",
"if",
"is_std_config_arg",
"(",
"x",
")",
":",
"return",
"x",
"[",
"\"algorithm\"",
"]... | Flexibly extract algorithm configuration for a sample from any function arguments. | [
"Flexibly",
"extract",
"algorithm",
"configuration",
"for",
"a",
"sample",
"from",
"any",
"function",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L269-L282 |
223,361 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | get_dataarg | def get_dataarg(args):
"""Retrieve the world 'data' argument from a set of input parameters.
"""
for i, arg in enumerate(args):
if is_nested_config_arg(arg):
return i, arg
elif is_std_config_arg(arg):
return i, {"config": arg}
elif isinstance(arg, (list, tuple... | python | def get_dataarg(args):
"""Retrieve the world 'data' argument from a set of input parameters.
"""
for i, arg in enumerate(args):
if is_nested_config_arg(arg):
return i, arg
elif is_std_config_arg(arg):
return i, {"config": arg}
elif isinstance(arg, (list, tuple... | [
"def",
"get_dataarg",
"(",
"args",
")",
":",
"for",
"i",
",",
"arg",
"in",
"enumerate",
"(",
"args",
")",
":",
"if",
"is_nested_config_arg",
"(",
"arg",
")",
":",
"return",
"i",
",",
"arg",
"elif",
"is_std_config_arg",
"(",
"arg",
")",
":",
"return",
... | Retrieve the world 'data' argument from a set of input parameters. | [
"Retrieve",
"the",
"world",
"data",
"argument",
"from",
"a",
"set",
"of",
"input",
"parameters",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L284-L294 |
223,362 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | add_cores_to_config | def add_cores_to_config(args, cores_per_job, parallel=None):
"""Add information about available cores for a job to configuration.
Ugly hack to update core information in a configuration dictionary.
"""
def _update_cores(config):
config["algorithm"]["num_cores"] = int(cores_per_job)
if pa... | python | def add_cores_to_config(args, cores_per_job, parallel=None):
"""Add information about available cores for a job to configuration.
Ugly hack to update core information in a configuration dictionary.
"""
def _update_cores(config):
config["algorithm"]["num_cores"] = int(cores_per_job)
if pa... | [
"def",
"add_cores_to_config",
"(",
"args",
",",
"cores_per_job",
",",
"parallel",
"=",
"None",
")",
":",
"def",
"_update_cores",
"(",
"config",
")",
":",
"config",
"[",
"\"algorithm\"",
"]",
"[",
"\"num_cores\"",
"]",
"=",
"int",
"(",
"cores_per_job",
")",
... | Add information about available cores for a job to configuration.
Ugly hack to update core information in a configuration dictionary. | [
"Add",
"information",
"about",
"available",
"cores",
"for",
"a",
"job",
"to",
"configuration",
".",
"Ugly",
"hack",
"to",
"update",
"core",
"information",
"in",
"a",
"configuration",
"dictionary",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L296-L306 |
223,363 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | _update_config | def _update_config(args, update_fn, allow_missing=False):
"""Update configuration, nested in argument list, with the provided update function.
"""
new_i = None
for i, arg in enumerate(args):
if (is_std_config_arg(arg) or is_nested_config_arg(arg) or
(isinstance(arg, (list, tuple)) ... | python | def _update_config(args, update_fn, allow_missing=False):
"""Update configuration, nested in argument list, with the provided update function.
"""
new_i = None
for i, arg in enumerate(args):
if (is_std_config_arg(arg) or is_nested_config_arg(arg) or
(isinstance(arg, (list, tuple)) ... | [
"def",
"_update_config",
"(",
"args",
",",
"update_fn",
",",
"allow_missing",
"=",
"False",
")",
":",
"new_i",
"=",
"None",
"for",
"i",
",",
"arg",
"in",
"enumerate",
"(",
"args",
")",
":",
"if",
"(",
"is_std_config_arg",
"(",
"arg",
")",
"or",
"is_nes... | Update configuration, nested in argument list, with the provided update function. | [
"Update",
"configuration",
"nested",
"in",
"argument",
"list",
"with",
"the",
"provided",
"update",
"function",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L308-L336 |
223,364 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | convert_to_bytes | def convert_to_bytes(mem_str):
"""Convert a memory specification, potentially with M or G, into bytes.
"""
if str(mem_str)[-1].upper().endswith("G"):
return int(round(float(mem_str[:-1]) * 1024 * 1024))
elif str(mem_str)[-1].upper().endswith("M"):
return int(round(float(mem_str[:-1]) * 1... | python | def convert_to_bytes(mem_str):
"""Convert a memory specification, potentially with M or G, into bytes.
"""
if str(mem_str)[-1].upper().endswith("G"):
return int(round(float(mem_str[:-1]) * 1024 * 1024))
elif str(mem_str)[-1].upper().endswith("M"):
return int(round(float(mem_str[:-1]) * 1... | [
"def",
"convert_to_bytes",
"(",
"mem_str",
")",
":",
"if",
"str",
"(",
"mem_str",
")",
"[",
"-",
"1",
"]",
".",
"upper",
"(",
")",
".",
"endswith",
"(",
"\"G\"",
")",
":",
"return",
"int",
"(",
"round",
"(",
"float",
"(",
"mem_str",
"[",
":",
"-"... | Convert a memory specification, potentially with M or G, into bytes. | [
"Convert",
"a",
"memory",
"specification",
"potentially",
"with",
"M",
"or",
"G",
"into",
"bytes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L338-L346 |
223,365 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | adjust_memory | def adjust_memory(val, magnitude, direction="increase", out_modifier="", maximum=None):
"""Adjust memory based on number of cores utilized.
"""
modifier = val[-1:]
amount = float(val[:-1])
if direction == "decrease":
new_amount = amount / float(magnitude)
# dealing with a specifier l... | python | def adjust_memory(val, magnitude, direction="increase", out_modifier="", maximum=None):
"""Adjust memory based on number of cores utilized.
"""
modifier = val[-1:]
amount = float(val[:-1])
if direction == "decrease":
new_amount = amount / float(magnitude)
# dealing with a specifier l... | [
"def",
"adjust_memory",
"(",
"val",
",",
"magnitude",
",",
"direction",
"=",
"\"increase\"",
",",
"out_modifier",
"=",
"\"\"",
",",
"maximum",
"=",
"None",
")",
":",
"modifier",
"=",
"val",
"[",
"-",
"1",
":",
"]",
"amount",
"=",
"float",
"(",
"val",
... | Adjust memory based on number of cores utilized. | [
"Adjust",
"memory",
"based",
"on",
"number",
"of",
"cores",
"utilized",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L361-L396 |
223,366 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | adjust_opts | def adjust_opts(in_opts, config):
"""Establish JVM opts, adjusting memory for the context if needed.
This allows using less or more memory for highly parallel or multicore
supporting processes, respectively.
"""
memory_adjust = config["algorithm"].get("memory_adjust", {})
out_opts = []
for ... | python | def adjust_opts(in_opts, config):
"""Establish JVM opts, adjusting memory for the context if needed.
This allows using less or more memory for highly parallel or multicore
supporting processes, respectively.
"""
memory_adjust = config["algorithm"].get("memory_adjust", {})
out_opts = []
for ... | [
"def",
"adjust_opts",
"(",
"in_opts",
",",
"config",
")",
":",
"memory_adjust",
"=",
"config",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"memory_adjust\"",
",",
"{",
"}",
")",
"out_opts",
"=",
"[",
"]",
"for",
"opt",
"in",
"in_opts",
":",
"if",
"op... | Establish JVM opts, adjusting memory for the context if needed.
This allows using less or more memory for highly parallel or multicore
supporting processes, respectively. | [
"Establish",
"JVM",
"opts",
"adjusting",
"memory",
"for",
"the",
"context",
"if",
"needed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L398-L415 |
223,367 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | use_vqsr | def use_vqsr(algs, call_file=None):
"""Processing uses GATK's Variant Quality Score Recalibration.
"""
from bcbio.variation import vcfutils
vqsr_callers = set(["gatk", "gatk-haplotype"])
vqsr_sample_thresh = 50
vqsr_supported = collections.defaultdict(int)
coverage_intervals = set([])
fo... | python | def use_vqsr(algs, call_file=None):
"""Processing uses GATK's Variant Quality Score Recalibration.
"""
from bcbio.variation import vcfutils
vqsr_callers = set(["gatk", "gatk-haplotype"])
vqsr_sample_thresh = 50
vqsr_supported = collections.defaultdict(int)
coverage_intervals = set([])
fo... | [
"def",
"use_vqsr",
"(",
"algs",
",",
"call_file",
"=",
"None",
")",
":",
"from",
"bcbio",
".",
"variation",
"import",
"vcfutils",
"vqsr_callers",
"=",
"set",
"(",
"[",
"\"gatk\"",
",",
"\"gatk-haplotype\"",
"]",
")",
"vqsr_sample_thresh",
"=",
"50",
"vqsr_su... | Processing uses GATK's Variant Quality Score Recalibration. | [
"Processing",
"uses",
"GATK",
"s",
"Variant",
"Quality",
"Score",
"Recalibration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L419-L450 |
223,368 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | use_bcbio_variation_recall | def use_bcbio_variation_recall(algs):
"""Processing uses bcbio-variation-recall. Avoids core requirement if not used.
"""
for alg in algs:
jointcaller = alg.get("jointcaller", [])
if not isinstance(jointcaller, (tuple, list)):
jointcaller = [jointcaller]
for caller in joi... | python | def use_bcbio_variation_recall(algs):
"""Processing uses bcbio-variation-recall. Avoids core requirement if not used.
"""
for alg in algs:
jointcaller = alg.get("jointcaller", [])
if not isinstance(jointcaller, (tuple, list)):
jointcaller = [jointcaller]
for caller in joi... | [
"def",
"use_bcbio_variation_recall",
"(",
"algs",
")",
":",
"for",
"alg",
"in",
"algs",
":",
"jointcaller",
"=",
"alg",
".",
"get",
"(",
"\"jointcaller\"",
",",
"[",
"]",
")",
"if",
"not",
"isinstance",
"(",
"jointcaller",
",",
"(",
"tuple",
",",
"list",... | Processing uses bcbio-variation-recall. Avoids core requirement if not used. | [
"Processing",
"uses",
"bcbio",
"-",
"variation",
"-",
"recall",
".",
"Avoids",
"core",
"requirement",
"if",
"not",
"used",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L457-L467 |
223,369 | bcbio/bcbio-nextgen | bcbio/pipeline/config_utils.py | program_installed | def program_installed(program, data):
"""
returns True if the path to a program can be found
"""
try:
path = get_program(program, data)
except CmdNotFound:
return False
return True | python | def program_installed(program, data):
"""
returns True if the path to a program can be found
"""
try:
path = get_program(program, data)
except CmdNotFound:
return False
return True | [
"def",
"program_installed",
"(",
"program",
",",
"data",
")",
":",
"try",
":",
"path",
"=",
"get_program",
"(",
"program",
",",
"data",
")",
"except",
"CmdNotFound",
":",
"return",
"False",
"return",
"True"
] | returns True if the path to a program can be found | [
"returns",
"True",
"if",
"the",
"path",
"to",
"a",
"program",
"can",
"be",
"found"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/config_utils.py#L480-L488 |
223,370 | bcbio/bcbio-nextgen | bcbio/provenance/versioncheck.py | samtools | def samtools(items):
"""Ensure samtools has parallel processing required for piped analysis.
"""
samtools = config_utils.get_program("samtools", items[0]["config"])
p = subprocess.Popen([samtools, "sort", "-h"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, stderr ... | python | def samtools(items):
"""Ensure samtools has parallel processing required for piped analysis.
"""
samtools = config_utils.get_program("samtools", items[0]["config"])
p = subprocess.Popen([samtools, "sort", "-h"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, stderr ... | [
"def",
"samtools",
"(",
"items",
")",
":",
"samtools",
"=",
"config_utils",
".",
"get_program",
"(",
"\"samtools\"",
",",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
")",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"samtools",
",",
"\"sort\"",
... | Ensure samtools has parallel processing required for piped analysis. | [
"Ensure",
"samtools",
"has",
"parallel",
"processing",
"required",
"for",
"piped",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/versioncheck.py#L11-L25 |
223,371 | bcbio/bcbio-nextgen | bcbio/provenance/versioncheck.py | _needs_java | def _needs_java(data):
"""Check if a caller needs external java for MuTect.
No longer check for older GATK (<3.6) versions because of time cost; this
won't be relevant to most runs so we skip the sanity check.
"""
vc = dd.get_variantcaller(data)
if isinstance(vc, dict):
out = {}
... | python | def _needs_java(data):
"""Check if a caller needs external java for MuTect.
No longer check for older GATK (<3.6) versions because of time cost; this
won't be relevant to most runs so we skip the sanity check.
"""
vc = dd.get_variantcaller(data)
if isinstance(vc, dict):
out = {}
... | [
"def",
"_needs_java",
"(",
"data",
")",
":",
"vc",
"=",
"dd",
".",
"get_variantcaller",
"(",
"data",
")",
"if",
"isinstance",
"(",
"vc",
",",
"dict",
")",
":",
"out",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"vc",
".",
"items",
"(",
")",
":",... | Check if a caller needs external java for MuTect.
No longer check for older GATK (<3.6) versions because of time cost; this
won't be relevant to most runs so we skip the sanity check. | [
"Check",
"if",
"a",
"caller",
"needs",
"external",
"java",
"for",
"MuTect",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/versioncheck.py#L32-L56 |
223,372 | bcbio/bcbio-nextgen | bcbio/provenance/versioncheck.py | java | def java(items):
"""Check for presence of external Java 1.7 for tools that require it.
"""
if any([_needs_java(d) for d in items]):
min_version = "1.7"
max_version = "1.8"
with setpath.orig_paths():
java = utils.which("java")
if not java:
retur... | python | def java(items):
"""Check for presence of external Java 1.7 for tools that require it.
"""
if any([_needs_java(d) for d in items]):
min_version = "1.7"
max_version = "1.8"
with setpath.orig_paths():
java = utils.which("java")
if not java:
retur... | [
"def",
"java",
"(",
"items",
")",
":",
"if",
"any",
"(",
"[",
"_needs_java",
"(",
"d",
")",
"for",
"d",
"in",
"items",
"]",
")",
":",
"min_version",
"=",
"\"1.7\"",
"max_version",
"=",
"\"1.8\"",
"with",
"setpath",
".",
"orig_paths",
"(",
")",
":",
... | Check for presence of external Java 1.7 for tools that require it. | [
"Check",
"for",
"presence",
"of",
"external",
"Java",
"1",
".",
"7",
"for",
"tools",
"that",
"require",
"it",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/versioncheck.py#L58-L84 |
223,373 | bcbio/bcbio-nextgen | bcbio/install.py | upgrade_bcbio | def upgrade_bcbio(args):
"""Perform upgrade of bcbio to latest release, or from GitHub development version.
Handles bcbio, third party tools and data.
"""
print("Upgrading bcbio")
args = add_install_defaults(args)
if args.upgrade in ["stable", "system", "deps", "development"]:
if args.u... | python | def upgrade_bcbio(args):
"""Perform upgrade of bcbio to latest release, or from GitHub development version.
Handles bcbio, third party tools and data.
"""
print("Upgrading bcbio")
args = add_install_defaults(args)
if args.upgrade in ["stable", "system", "deps", "development"]:
if args.u... | [
"def",
"upgrade_bcbio",
"(",
"args",
")",
":",
"print",
"(",
"\"Upgrading bcbio\"",
")",
"args",
"=",
"add_install_defaults",
"(",
"args",
")",
"if",
"args",
".",
"upgrade",
"in",
"[",
"\"stable\"",
",",
"\"system\"",
",",
"\"deps\"",
",",
"\"development\"",
... | Perform upgrade of bcbio to latest release, or from GitHub development version.
Handles bcbio, third party tools and data. | [
"Perform",
"upgrade",
"of",
"bcbio",
"to",
"latest",
"release",
"or",
"from",
"GitHub",
"development",
"version",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L51-L115 |
223,374 | bcbio/bcbio-nextgen | bcbio/install.py | _pip_safe_ssl | def _pip_safe_ssl(cmds, anaconda_dir):
"""Run pip, retrying with conda SSL certificate if global certificate fails.
"""
try:
for cmd in cmds:
subprocess.check_call(cmd)
except subprocess.CalledProcessError:
_set_pip_ssl(anaconda_dir)
for cmd in cmds:
subpr... | python | def _pip_safe_ssl(cmds, anaconda_dir):
"""Run pip, retrying with conda SSL certificate if global certificate fails.
"""
try:
for cmd in cmds:
subprocess.check_call(cmd)
except subprocess.CalledProcessError:
_set_pip_ssl(anaconda_dir)
for cmd in cmds:
subpr... | [
"def",
"_pip_safe_ssl",
"(",
"cmds",
",",
"anaconda_dir",
")",
":",
"try",
":",
"for",
"cmd",
"in",
"cmds",
":",
"subprocess",
".",
"check_call",
"(",
"cmd",
")",
"except",
"subprocess",
".",
"CalledProcessError",
":",
"_set_pip_ssl",
"(",
"anaconda_dir",
")... | Run pip, retrying with conda SSL certificate if global certificate fails. | [
"Run",
"pip",
"retrying",
"with",
"conda",
"SSL",
"certificate",
"if",
"global",
"certificate",
"fails",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L117-L126 |
223,375 | bcbio/bcbio-nextgen | bcbio/install.py | _set_pip_ssl | def _set_pip_ssl(anaconda_dir):
"""Set PIP SSL certificate to installed conda certificate to avoid SSL errors
"""
if anaconda_dir:
cert_file = os.path.join(anaconda_dir, "ssl", "cert.pem")
if os.path.exists(cert_file):
os.environ["PIP_CERT"] = cert_file | python | def _set_pip_ssl(anaconda_dir):
"""Set PIP SSL certificate to installed conda certificate to avoid SSL errors
"""
if anaconda_dir:
cert_file = os.path.join(anaconda_dir, "ssl", "cert.pem")
if os.path.exists(cert_file):
os.environ["PIP_CERT"] = cert_file | [
"def",
"_set_pip_ssl",
"(",
"anaconda_dir",
")",
":",
"if",
"anaconda_dir",
":",
"cert_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"anaconda_dir",
",",
"\"ssl\"",
",",
"\"cert.pem\"",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"cert_file",
")... | Set PIP SSL certificate to installed conda certificate to avoid SSL errors | [
"Set",
"PIP",
"SSL",
"certificate",
"to",
"installed",
"conda",
"certificate",
"to",
"avoid",
"SSL",
"errors"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L128-L134 |
223,376 | bcbio/bcbio-nextgen | bcbio/install.py | _set_matplotlib_default_backend | def _set_matplotlib_default_backend():
"""
matplotlib will try to print to a display if it is available, but don't want
to run it in interactive mode. we tried setting the backend to 'Agg'' before
importing, but it was still resulting in issues. we replace the existing
backend with 'agg' in the defa... | python | def _set_matplotlib_default_backend():
"""
matplotlib will try to print to a display if it is available, but don't want
to run it in interactive mode. we tried setting the backend to 'Agg'' before
importing, but it was still resulting in issues. we replace the existing
backend with 'agg' in the defa... | [
"def",
"_set_matplotlib_default_backend",
"(",
")",
":",
"if",
"_matplotlib_installed",
"(",
")",
":",
"import",
"matplotlib",
"matplotlib",
".",
"use",
"(",
"'Agg'",
",",
"force",
"=",
"True",
")",
"config",
"=",
"matplotlib",
".",
"matplotlib_fname",
"(",
")... | matplotlib will try to print to a display if it is available, but don't want
to run it in interactive mode. we tried setting the backend to 'Agg'' before
importing, but it was still resulting in issues. we replace the existing
backend with 'agg' in the default matplotlibrc. This is a hack until we can
f... | [
"matplotlib",
"will",
"try",
"to",
"print",
"to",
"a",
"display",
"if",
"it",
"is",
"available",
"but",
"don",
"t",
"want",
"to",
"run",
"it",
"in",
"interactive",
"mode",
".",
"we",
"tried",
"setting",
"the",
"backend",
"to",
"Agg",
"before",
"importing... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L136-L155 |
223,377 | bcbio/bcbio-nextgen | bcbio/install.py | _symlink_bcbio | def _symlink_bcbio(args, script="bcbio_nextgen.py", env_name=None, prefix=None):
"""Ensure a bcbio-nextgen script symlink in final tool directory.
"""
if env_name:
bcbio_anaconda = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(sys.executable))),
... | python | def _symlink_bcbio(args, script="bcbio_nextgen.py", env_name=None, prefix=None):
"""Ensure a bcbio-nextgen script symlink in final tool directory.
"""
if env_name:
bcbio_anaconda = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(sys.executable))),
... | [
"def",
"_symlink_bcbio",
"(",
"args",
",",
"script",
"=",
"\"bcbio_nextgen.py\"",
",",
"env_name",
"=",
"None",
",",
"prefix",
"=",
"None",
")",
":",
"if",
"env_name",
":",
"bcbio_anaconda",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
... | Ensure a bcbio-nextgen script symlink in final tool directory. | [
"Ensure",
"a",
"bcbio",
"-",
"nextgen",
"script",
"symlink",
"in",
"final",
"tool",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L164-L181 |
223,378 | bcbio/bcbio-nextgen | bcbio/install.py | _install_container_bcbio_system | def _install_container_bcbio_system(datadir):
"""Install limited bcbio_system.yaml file for setting core and memory usage.
Adds any non-specific programs to the exposed bcbio_system.yaml file, only
when upgrade happening inside a docker container.
"""
base_file = os.path.join(datadir, "config", "bc... | python | def _install_container_bcbio_system(datadir):
"""Install limited bcbio_system.yaml file for setting core and memory usage.
Adds any non-specific programs to the exposed bcbio_system.yaml file, only
when upgrade happening inside a docker container.
"""
base_file = os.path.join(datadir, "config", "bc... | [
"def",
"_install_container_bcbio_system",
"(",
"datadir",
")",
":",
"base_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"\"config\"",
",",
"\"bcbio_system.yaml\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"base_file",
")",
... | Install limited bcbio_system.yaml file for setting core and memory usage.
Adds any non-specific programs to the exposed bcbio_system.yaml file, only
when upgrade happening inside a docker container. | [
"Install",
"limited",
"bcbio_system",
".",
"yaml",
"file",
"for",
"setting",
"core",
"and",
"memory",
"usage",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L183-L211 |
223,379 | bcbio/bcbio-nextgen | bcbio/install.py | _check_for_conda_problems | def _check_for_conda_problems():
"""Identify post-install conda problems and fix.
- libgcc upgrades can remove libquadmath, which moved to libgcc-ng
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
lib_dir = os.path.join(os.path.dirname(conda_bin), os.pardir, "lib")
... | python | def _check_for_conda_problems():
"""Identify post-install conda problems and fix.
- libgcc upgrades can remove libquadmath, which moved to libgcc-ng
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
lib_dir = os.path.join(os.path.dirname(conda_bin), os.pardir, "lib")
... | [
"def",
"_check_for_conda_problems",
"(",
")",
":",
"conda_bin",
"=",
"_get_conda_bin",
"(",
")",
"channels",
"=",
"_get_conda_channels",
"(",
"conda_bin",
")",
"lib_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"co... | Identify post-install conda problems and fix.
- libgcc upgrades can remove libquadmath, which moved to libgcc-ng | [
"Identify",
"post",
"-",
"install",
"conda",
"problems",
"and",
"fix",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L218-L228 |
223,380 | bcbio/bcbio-nextgen | bcbio/install.py | _update_bcbiovm | def _update_bcbiovm():
"""Update or install a local bcbiovm install with tools and dependencies.
"""
print("## CWL support with bcbio-vm")
python_env = "python=3"
conda_bin, env_name = _add_environment("bcbiovm", python_env)
channels = _get_conda_channels(conda_bin)
base_cmd = [conda_bin, "i... | python | def _update_bcbiovm():
"""Update or install a local bcbiovm install with tools and dependencies.
"""
print("## CWL support with bcbio-vm")
python_env = "python=3"
conda_bin, env_name = _add_environment("bcbiovm", python_env)
channels = _get_conda_channels(conda_bin)
base_cmd = [conda_bin, "i... | [
"def",
"_update_bcbiovm",
"(",
")",
":",
"print",
"(",
"\"## CWL support with bcbio-vm\"",
")",
"python_env",
"=",
"\"python=3\"",
"conda_bin",
",",
"env_name",
"=",
"_add_environment",
"(",
"\"bcbiovm\"",
",",
"python_env",
")",
"channels",
"=",
"_get_conda_channels"... | Update or install a local bcbiovm install with tools and dependencies. | [
"Update",
"or",
"install",
"a",
"local",
"bcbiovm",
"install",
"with",
"tools",
"and",
"dependencies",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L230-L240 |
223,381 | bcbio/bcbio-nextgen | bcbio/install.py | _get_conda_channels | def _get_conda_channels(conda_bin):
"""Retrieve default conda channels, checking if they are pre-specified in config.
This allows users to override defaults with specific mirrors in their .condarc
"""
channels = ["bioconda", "conda-forge"]
out = []
config = yaml.safe_load(subprocess.check_outpu... | python | def _get_conda_channels(conda_bin):
"""Retrieve default conda channels, checking if they are pre-specified in config.
This allows users to override defaults with specific mirrors in their .condarc
"""
channels = ["bioconda", "conda-forge"]
out = []
config = yaml.safe_load(subprocess.check_outpu... | [
"def",
"_get_conda_channels",
"(",
"conda_bin",
")",
":",
"channels",
"=",
"[",
"\"bioconda\"",
",",
"\"conda-forge\"",
"]",
"out",
"=",
"[",
"]",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"subprocess",
".",
"check_output",
"(",
"[",
"conda_bin",
",",
... | Retrieve default conda channels, checking if they are pre-specified in config.
This allows users to override defaults with specific mirrors in their .condarc | [
"Retrieve",
"default",
"conda",
"channels",
"checking",
"if",
"they",
"are",
"pre",
"-",
"specified",
"in",
"config",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L255-L271 |
223,382 | bcbio/bcbio-nextgen | bcbio/install.py | _update_conda_packages | def _update_conda_packages():
"""If installed in an anaconda directory, upgrade conda packages.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, ("Could not find anaconda distribution for upgrading bcbio.\n"
"Using python at %s but c... | python | def _update_conda_packages():
"""If installed in an anaconda directory, upgrade conda packages.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, ("Could not find anaconda distribution for upgrading bcbio.\n"
"Using python at %s but c... | [
"def",
"_update_conda_packages",
"(",
")",
":",
"conda_bin",
"=",
"_get_conda_bin",
"(",
")",
"channels",
"=",
"_get_conda_channels",
"(",
"conda_bin",
")",
"assert",
"conda_bin",
",",
"(",
"\"Could not find anaconda distribution for upgrading bcbio.\\n\"",
"\"Using python ... | If installed in an anaconda directory, upgrade conda packages. | [
"If",
"installed",
"in",
"an",
"anaconda",
"directory",
"upgrade",
"conda",
"packages",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L273-L288 |
223,383 | bcbio/bcbio-nextgen | bcbio/install.py | _update_conda_devel | def _update_conda_devel():
"""Update to the latest development conda package.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, "Could not find anaconda distribution for upgrading bcbio"
subprocess.check_call([conda_bin, "install", "--quiet", "--yes"] +... | python | def _update_conda_devel():
"""Update to the latest development conda package.
"""
conda_bin = _get_conda_bin()
channels = _get_conda_channels(conda_bin)
assert conda_bin, "Could not find anaconda distribution for upgrading bcbio"
subprocess.check_call([conda_bin, "install", "--quiet", "--yes"] +... | [
"def",
"_update_conda_devel",
"(",
")",
":",
"conda_bin",
"=",
"_get_conda_bin",
"(",
")",
"channels",
"=",
"_get_conda_channels",
"(",
"conda_bin",
")",
"assert",
"conda_bin",
",",
"\"Could not find anaconda distribution for upgrading bcbio\"",
"subprocess",
".",
"check_... | Update to the latest development conda package. | [
"Update",
"to",
"the",
"latest",
"development",
"conda",
"package",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L290-L298 |
223,384 | bcbio/bcbio-nextgen | bcbio/install.py | get_genome_dir | def get_genome_dir(gid, galaxy_dir, data):
"""Return standard location of genome directories.
"""
if galaxy_dir:
refs = genome.get_refs(gid, None, galaxy_dir, data)
seq_file = tz.get_in(["fasta", "base"], refs)
if seq_file and os.path.exists(seq_file):
return os.path.dirn... | python | def get_genome_dir(gid, galaxy_dir, data):
"""Return standard location of genome directories.
"""
if galaxy_dir:
refs = genome.get_refs(gid, None, galaxy_dir, data)
seq_file = tz.get_in(["fasta", "base"], refs)
if seq_file and os.path.exists(seq_file):
return os.path.dirn... | [
"def",
"get_genome_dir",
"(",
"gid",
",",
"galaxy_dir",
",",
"data",
")",
":",
"if",
"galaxy_dir",
":",
"refs",
"=",
"genome",
".",
"get_refs",
"(",
"gid",
",",
"None",
",",
"galaxy_dir",
",",
"data",
")",
"seq_file",
"=",
"tz",
".",
"get_in",
"(",
"... | Return standard location of genome directories. | [
"Return",
"standard",
"location",
"of",
"genome",
"directories",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L300-L311 |
223,385 | bcbio/bcbio-nextgen | bcbio/install.py | _prepare_cwl_tarballs | def _prepare_cwl_tarballs(data_dir):
"""Create CWL ready tarballs for complex directories.
Avoids need for CWL runners to pass and serialize complex directories
of files, which is inconsistent between runners.
"""
for dbref_dir in filter(os.path.isdir, glob.glob(os.path.join(data_dir, "genomes", "*... | python | def _prepare_cwl_tarballs(data_dir):
"""Create CWL ready tarballs for complex directories.
Avoids need for CWL runners to pass and serialize complex directories
of files, which is inconsistent between runners.
"""
for dbref_dir in filter(os.path.isdir, glob.glob(os.path.join(data_dir, "genomes", "*... | [
"def",
"_prepare_cwl_tarballs",
"(",
"data_dir",
")",
":",
"for",
"dbref_dir",
"in",
"filter",
"(",
"os",
".",
"path",
".",
"isdir",
",",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"genomes\"",
",",
"\"*\"",
",",
... | Create CWL ready tarballs for complex directories.
Avoids need for CWL runners to pass and serialize complex directories
of files, which is inconsistent between runners. | [
"Create",
"CWL",
"ready",
"tarballs",
"for",
"complex",
"directories",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L358-L373 |
223,386 | bcbio/bcbio-nextgen | bcbio/install.py | _upgrade_genome_resources | def _upgrade_genome_resources(galaxy_dir, base_url):
"""Retrieve latest version of genome resource YAML configuration files.
"""
import requests
for dbkey, ref_file in genome.get_builds(galaxy_dir):
# Check for a remote genome resources file
remote_url = base_url % dbkey
requests... | python | def _upgrade_genome_resources(galaxy_dir, base_url):
"""Retrieve latest version of genome resource YAML configuration files.
"""
import requests
for dbkey, ref_file in genome.get_builds(galaxy_dir):
# Check for a remote genome resources file
remote_url = base_url % dbkey
requests... | [
"def",
"_upgrade_genome_resources",
"(",
"galaxy_dir",
",",
"base_url",
")",
":",
"import",
"requests",
"for",
"dbkey",
",",
"ref_file",
"in",
"genome",
".",
"get_builds",
"(",
"galaxy_dir",
")",
":",
"# Check for a remote genome resources file",
"remote_url",
"=",
... | Retrieve latest version of genome resource YAML configuration files. | [
"Retrieve",
"latest",
"version",
"of",
"genome",
"resource",
"YAML",
"configuration",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L375-L398 |
223,387 | bcbio/bcbio-nextgen | bcbio/install.py | _upgrade_snpeff_data | def _upgrade_snpeff_data(galaxy_dir, args, remotes):
"""Install or upgrade snpEff databases, localized to reference directory.
"""
snpeff_version = effects.snpeff_version(args)
if not snpeff_version:
return
for dbkey, ref_file in genome.get_builds(galaxy_dir):
resource_file = os.path... | python | def _upgrade_snpeff_data(galaxy_dir, args, remotes):
"""Install or upgrade snpEff databases, localized to reference directory.
"""
snpeff_version = effects.snpeff_version(args)
if not snpeff_version:
return
for dbkey, ref_file in genome.get_builds(galaxy_dir):
resource_file = os.path... | [
"def",
"_upgrade_snpeff_data",
"(",
"galaxy_dir",
",",
"args",
",",
"remotes",
")",
":",
"snpeff_version",
"=",
"effects",
".",
"snpeff_version",
"(",
"args",
")",
"if",
"not",
"snpeff_version",
":",
"return",
"for",
"dbkey",
",",
"ref_file",
"in",
"genome",
... | Install or upgrade snpEff databases, localized to reference directory. | [
"Install",
"or",
"upgrade",
"snpEff",
"databases",
"localized",
"to",
"reference",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L404-L435 |
223,388 | bcbio/bcbio-nextgen | bcbio/install.py | _is_old_database | def _is_old_database(db_dir, args):
"""Check for old database versions, supported in snpEff 4.1.
"""
snpeff_version = effects.snpeff_version(args)
if LooseVersion(snpeff_version) >= LooseVersion("4.1"):
pred_file = os.path.join(db_dir, "snpEffectPredictor.bin")
if not utils.file_exists(p... | python | def _is_old_database(db_dir, args):
"""Check for old database versions, supported in snpEff 4.1.
"""
snpeff_version = effects.snpeff_version(args)
if LooseVersion(snpeff_version) >= LooseVersion("4.1"):
pred_file = os.path.join(db_dir, "snpEffectPredictor.bin")
if not utils.file_exists(p... | [
"def",
"_is_old_database",
"(",
"db_dir",
",",
"args",
")",
":",
"snpeff_version",
"=",
"effects",
".",
"snpeff_version",
"(",
"args",
")",
"if",
"LooseVersion",
"(",
"snpeff_version",
")",
">=",
"LooseVersion",
"(",
"\"4.1\"",
")",
":",
"pred_file",
"=",
"o... | Check for old database versions, supported in snpEff 4.1. | [
"Check",
"for",
"old",
"database",
"versions",
"supported",
"in",
"snpEff",
"4",
".",
"1",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L437-L450 |
223,389 | bcbio/bcbio-nextgen | bcbio/install.py | _get_biodata | def _get_biodata(base_file, args):
"""Retrieve biodata genome targets customized by install parameters.
"""
with open(base_file) as in_handle:
config = yaml.safe_load(in_handle)
config["install_liftover"] = False
config["genome_indexes"] = args.aligners
ann_groups = config.pop("annotatio... | python | def _get_biodata(base_file, args):
"""Retrieve biodata genome targets customized by install parameters.
"""
with open(base_file) as in_handle:
config = yaml.safe_load(in_handle)
config["install_liftover"] = False
config["genome_indexes"] = args.aligners
ann_groups = config.pop("annotatio... | [
"def",
"_get_biodata",
"(",
"base_file",
",",
"args",
")",
":",
"with",
"open",
"(",
"base_file",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_handle",
")",
"config",
"[",
"\"install_liftover\"",
"]",
"=",
"False",
"config... | Retrieve biodata genome targets customized by install parameters. | [
"Retrieve",
"biodata",
"genome",
"targets",
"customized",
"by",
"install",
"parameters",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L452-L462 |
223,390 | bcbio/bcbio-nextgen | bcbio/install.py | _setup_genome_annotations | def _setup_genome_annotations(g, args, ann_groups):
"""Configure genome annotations to install based on datatarget.
"""
available_anns = g.get("annotations", []) + g.pop("annotations_available", [])
anns = []
for orig_target in args.datatarget:
if orig_target in ann_groups:
targe... | python | def _setup_genome_annotations(g, args, ann_groups):
"""Configure genome annotations to install based on datatarget.
"""
available_anns = g.get("annotations", []) + g.pop("annotations_available", [])
anns = []
for orig_target in args.datatarget:
if orig_target in ann_groups:
targe... | [
"def",
"_setup_genome_annotations",
"(",
"g",
",",
"args",
",",
"ann_groups",
")",
":",
"available_anns",
"=",
"g",
".",
"get",
"(",
"\"annotations\"",
",",
"[",
"]",
")",
"+",
"g",
".",
"pop",
"(",
"\"annotations_available\"",
",",
"[",
"]",
")",
"anns"... | Configure genome annotations to install based on datatarget. | [
"Configure",
"genome",
"annotations",
"to",
"install",
"based",
"on",
"datatarget",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L464-L480 |
223,391 | bcbio/bcbio-nextgen | bcbio/install.py | upgrade_thirdparty_tools | def upgrade_thirdparty_tools(args, remotes):
"""Install and update third party tools used in the pipeline.
Creates a manifest directory with installed programs on the system.
"""
cbl = get_cloudbiolinux(remotes)
if args.toolconf and os.path.exists(args.toolconf):
package_yaml = args.toolcon... | python | def upgrade_thirdparty_tools(args, remotes):
"""Install and update third party tools used in the pipeline.
Creates a manifest directory with installed programs on the system.
"""
cbl = get_cloudbiolinux(remotes)
if args.toolconf and os.path.exists(args.toolconf):
package_yaml = args.toolcon... | [
"def",
"upgrade_thirdparty_tools",
"(",
"args",
",",
"remotes",
")",
":",
"cbl",
"=",
"get_cloudbiolinux",
"(",
"remotes",
")",
"if",
"args",
".",
"toolconf",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"args",
".",
"toolconf",
")",
":",
"package_yaml",
... | Install and update third party tools used in the pipeline.
Creates a manifest directory with installed programs on the system. | [
"Install",
"and",
"update",
"third",
"party",
"tools",
"used",
"in",
"the",
"pipeline",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L482-L503 |
223,392 | bcbio/bcbio-nextgen | bcbio/install.py | _install_toolplus | def _install_toolplus(args):
"""Install additional tools we cannot distribute, updating local manifest.
"""
manifest_dir = os.path.join(_get_data_dir(), "manifest")
toolplus_manifest = os.path.join(manifest_dir, "toolplus-packages.yaml")
system_config = os.path.join(_get_data_dir(), "galaxy", "bcbio... | python | def _install_toolplus(args):
"""Install additional tools we cannot distribute, updating local manifest.
"""
manifest_dir = os.path.join(_get_data_dir(), "manifest")
toolplus_manifest = os.path.join(manifest_dir, "toolplus-packages.yaml")
system_config = os.path.join(_get_data_dir(), "galaxy", "bcbio... | [
"def",
"_install_toolplus",
"(",
"args",
")",
":",
"manifest_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_get_data_dir",
"(",
")",
",",
"\"manifest\"",
")",
"toolplus_manifest",
"=",
"os",
".",
"path",
".",
"join",
"(",
"manifest_dir",
",",
"\"toolplu... | Install additional tools we cannot distribute, updating local manifest. | [
"Install",
"additional",
"tools",
"we",
"cannot",
"distribute",
"updating",
"local",
"manifest",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L505-L522 |
223,393 | bcbio/bcbio-nextgen | bcbio/install.py | _install_gatk_jar | def _install_gatk_jar(name, fname, manifest, system_config, toolplus_dir):
"""Install a jar for GATK or associated tools like MuTect.
"""
if not fname.endswith(".jar"):
raise ValueError("--toolplus argument for %s expects a jar file: %s" % (name, fname))
version = get_gatk_jar_version(name, fnam... | python | def _install_gatk_jar(name, fname, manifest, system_config, toolplus_dir):
"""Install a jar for GATK or associated tools like MuTect.
"""
if not fname.endswith(".jar"):
raise ValueError("--toolplus argument for %s expects a jar file: %s" % (name, fname))
version = get_gatk_jar_version(name, fnam... | [
"def",
"_install_gatk_jar",
"(",
"name",
",",
"fname",
",",
"manifest",
",",
"system_config",
",",
"toolplus_dir",
")",
":",
"if",
"not",
"fname",
".",
"endswith",
"(",
"\".jar\"",
")",
":",
"raise",
"ValueError",
"(",
"\"--toolplus argument for %s expects a jar f... | Install a jar for GATK or associated tools like MuTect. | [
"Install",
"a",
"jar",
"for",
"GATK",
"or",
"associated",
"tools",
"like",
"MuTect",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L532-L541 |
223,394 | bcbio/bcbio-nextgen | bcbio/install.py | _update_manifest | def _update_manifest(manifest_file, name, version):
"""Update the toolplus manifest file with updated name and version
"""
if os.path.exists(manifest_file):
with open(manifest_file) as in_handle:
manifest = yaml.safe_load(in_handle)
else:
manifest = {}
manifest[name] = {"... | python | def _update_manifest(manifest_file, name, version):
"""Update the toolplus manifest file with updated name and version
"""
if os.path.exists(manifest_file):
with open(manifest_file) as in_handle:
manifest = yaml.safe_load(in_handle)
else:
manifest = {}
manifest[name] = {"... | [
"def",
"_update_manifest",
"(",
"manifest_file",
",",
"name",
",",
"version",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"manifest_file",
")",
":",
"with",
"open",
"(",
"manifest_file",
")",
"as",
"in_handle",
":",
"manifest",
"=",
"yaml",
".... | Update the toolplus manifest file with updated name and version | [
"Update",
"the",
"toolplus",
"manifest",
"file",
"with",
"updated",
"name",
"and",
"version"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L543-L553 |
223,395 | bcbio/bcbio-nextgen | bcbio/install.py | _update_system_file | def _update_system_file(system_file, name, new_kvs):
"""Update the bcbio_system.yaml file with new resource information.
"""
if os.path.exists(system_file):
bak_file = system_file + ".bak%s" % datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
shutil.copyfile(system_file, bak_file)
... | python | def _update_system_file(system_file, name, new_kvs):
"""Update the bcbio_system.yaml file with new resource information.
"""
if os.path.exists(system_file):
bak_file = system_file + ".bak%s" % datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
shutil.copyfile(system_file, bak_file)
... | [
"def",
"_update_system_file",
"(",
"system_file",
",",
"name",
",",
"new_kvs",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"system_file",
")",
":",
"bak_file",
"=",
"system_file",
"+",
"\".bak%s\"",
"%",
"datetime",
".",
"datetime",
".",
"now",
... | Update the bcbio_system.yaml file with new resource information. | [
"Update",
"the",
"bcbio_system",
".",
"yaml",
"file",
"with",
"new",
"resource",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L555-L578 |
223,396 | bcbio/bcbio-nextgen | bcbio/install.py | _install_kraken_db | def _install_kraken_db(datadir, args):
"""Install kraken minimal DB in genome folder.
"""
import requests
kraken = os.path.join(datadir, "genomes/kraken")
url = "https://ccb.jhu.edu/software/kraken/dl/minikraken.tgz"
compress = os.path.join(kraken, os.path.basename(url))
base, ext = utils.sp... | python | def _install_kraken_db(datadir, args):
"""Install kraken minimal DB in genome folder.
"""
import requests
kraken = os.path.join(datadir, "genomes/kraken")
url = "https://ccb.jhu.edu/software/kraken/dl/minikraken.tgz"
compress = os.path.join(kraken, os.path.basename(url))
base, ext = utils.sp... | [
"def",
"_install_kraken_db",
"(",
"datadir",
",",
"args",
")",
":",
"import",
"requests",
"kraken",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"\"genomes/kraken\"",
")",
"url",
"=",
"\"https://ccb.jhu.edu/software/kraken/dl/minikraken.tgz\"",
"compres... | Install kraken minimal DB in genome folder. | [
"Install",
"kraken",
"minimal",
"DB",
"in",
"genome",
"folder",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L580-L616 |
223,397 | bcbio/bcbio-nextgen | bcbio/install.py | _get_install_config | def _get_install_config():
"""Return the YAML configuration file used to store upgrade information.
"""
try:
data_dir = _get_data_dir()
except ValueError:
return None
config_dir = utils.safe_makedir(os.path.join(data_dir, "config"))
return os.path.join(config_dir, "install-params... | python | def _get_install_config():
"""Return the YAML configuration file used to store upgrade information.
"""
try:
data_dir = _get_data_dir()
except ValueError:
return None
config_dir = utils.safe_makedir(os.path.join(data_dir, "config"))
return os.path.join(config_dir, "install-params... | [
"def",
"_get_install_config",
"(",
")",
":",
"try",
":",
"data_dir",
"=",
"_get_data_dir",
"(",
")",
"except",
"ValueError",
":",
"return",
"None",
"config_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
... | Return the YAML configuration file used to store upgrade information. | [
"Return",
"the",
"YAML",
"configuration",
"file",
"used",
"to",
"store",
"upgrade",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L620-L628 |
223,398 | bcbio/bcbio-nextgen | bcbio/install.py | save_install_defaults | def save_install_defaults(args):
"""Save installation information to make future upgrades easier.
"""
install_config = _get_install_config()
if install_config is None:
return
if utils.file_exists(install_config):
with open(install_config) as in_handle:
cur_config = yaml.s... | python | def save_install_defaults(args):
"""Save installation information to make future upgrades easier.
"""
install_config = _get_install_config()
if install_config is None:
return
if utils.file_exists(install_config):
with open(install_config) as in_handle:
cur_config = yaml.s... | [
"def",
"save_install_defaults",
"(",
"args",
")",
":",
"install_config",
"=",
"_get_install_config",
"(",
")",
"if",
"install_config",
"is",
"None",
":",
"return",
"if",
"utils",
".",
"file_exists",
"(",
"install_config",
")",
":",
"with",
"open",
"(",
"instal... | Save installation information to make future upgrades easier. | [
"Save",
"installation",
"information",
"to",
"make",
"future",
"upgrades",
"easier",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L630-L659 |
223,399 | bcbio/bcbio-nextgen | bcbio/install.py | add_install_defaults | def add_install_defaults(args):
"""Add any saved installation defaults to the upgrade.
"""
# Ensure we install data if we've specified any secondary installation targets
if len(args.genomes) > 0 or len(args.aligners) > 0 or len(args.datatarget) > 0:
args.install_data = True
install_config = ... | python | def add_install_defaults(args):
"""Add any saved installation defaults to the upgrade.
"""
# Ensure we install data if we've specified any secondary installation targets
if len(args.genomes) > 0 or len(args.aligners) > 0 or len(args.datatarget) > 0:
args.install_data = True
install_config = ... | [
"def",
"add_install_defaults",
"(",
"args",
")",
":",
"# Ensure we install data if we've specified any secondary installation targets",
"if",
"len",
"(",
"args",
".",
"genomes",
")",
">",
"0",
"or",
"len",
"(",
"args",
".",
"aligners",
")",
">",
"0",
"or",
"len",
... | Add any saved installation defaults to the upgrade. | [
"Add",
"any",
"saved",
"installation",
"defaults",
"to",
"the",
"upgrade",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/install.py#L661-L697 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.