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,800 | bcbio/bcbio-nextgen | scripts/utils/hydra_to_vcf.py | _cluster_by | def _cluster_by(end_iter, attr1, attr2, cluster_distance):
"""Cluster breakends by specified attributes.
"""
ClusterInfo = namedtuple("ClusterInfo", ["chroms", "clusters", "lookup"])
chr_clusters = {}
chroms = []
brends_by_id = {}
for brend in end_iter:
if not chr_clusters.has_key(br... | python | def _cluster_by(end_iter, attr1, attr2, cluster_distance):
"""Cluster breakends by specified attributes.
"""
ClusterInfo = namedtuple("ClusterInfo", ["chroms", "clusters", "lookup"])
chr_clusters = {}
chroms = []
brends_by_id = {}
for brend in end_iter:
if not chr_clusters.has_key(br... | [
"def",
"_cluster_by",
"(",
"end_iter",
",",
"attr1",
",",
"attr2",
",",
"cluster_distance",
")",
":",
"ClusterInfo",
"=",
"namedtuple",
"(",
"\"ClusterInfo\"",
",",
"[",
"\"chroms\"",
",",
"\"clusters\"",
",",
"\"lookup\"",
"]",
")",
"chr_clusters",
"=",
"{",
... | Cluster breakends by specified attributes. | [
"Cluster",
"breakends",
"by",
"specified",
"attributes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L216-L231 |
223,801 | bcbio/bcbio-nextgen | scripts/utils/hydra_to_vcf.py | _calculate_cluster_distance | def _calculate_cluster_distance(end_iter):
"""Compute allowed distance for clustering based on end confidence intervals.
"""
out = []
sizes = []
for x in end_iter:
out.append(x)
sizes.append(x.end1 - x.start1)
sizes.append(x.end2 - x.start2)
distance = sum(sizes) // len(s... | python | def _calculate_cluster_distance(end_iter):
"""Compute allowed distance for clustering based on end confidence intervals.
"""
out = []
sizes = []
for x in end_iter:
out.append(x)
sizes.append(x.end1 - x.start1)
sizes.append(x.end2 - x.start2)
distance = sum(sizes) // len(s... | [
"def",
"_calculate_cluster_distance",
"(",
"end_iter",
")",
":",
"out",
"=",
"[",
"]",
"sizes",
"=",
"[",
"]",
"for",
"x",
"in",
"end_iter",
":",
"out",
".",
"append",
"(",
"x",
")",
"sizes",
".",
"append",
"(",
"x",
".",
"end1",
"-",
"x",
".",
"... | Compute allowed distance for clustering based on end confidence intervals. | [
"Compute",
"allowed",
"distance",
"for",
"clustering",
"based",
"on",
"end",
"confidence",
"intervals",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L233-L243 |
223,802 | bcbio/bcbio-nextgen | scripts/utils/hydra_to_vcf.py | group_hydra_breakends | def group_hydra_breakends(end_iter):
"""Group together hydra breakends with overlapping ends.
This provides a way to identify inversions, translocations
and insertions present in hydra break point ends. We cluster together the
endpoints and return together any items with closely oriented pairs.
Thi... | python | def group_hydra_breakends(end_iter):
"""Group together hydra breakends with overlapping ends.
This provides a way to identify inversions, translocations
and insertions present in hydra break point ends. We cluster together the
endpoints and return together any items with closely oriented pairs.
Thi... | [
"def",
"group_hydra_breakends",
"(",
"end_iter",
")",
":",
"cluster_distance",
",",
"all_ends",
"=",
"_calculate_cluster_distance",
"(",
"end_iter",
")",
"first_cluster",
"=",
"_cluster_by",
"(",
"all_ends",
",",
"\"start1\"",
",",
"\"end1\"",
",",
"cluster_distance",... | Group together hydra breakends with overlapping ends.
This provides a way to identify inversions, translocations
and insertions present in hydra break point ends. We cluster together the
endpoints and return together any items with closely oriented pairs.
This helps in describing more complex rearrange... | [
"Group",
"together",
"hydra",
"breakends",
"with",
"overlapping",
"ends",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L245-L264 |
223,803 | bcbio/bcbio-nextgen | scripts/utils/hydra_to_vcf.py | _write_vcf_header | def _write_vcf_header(out_handle):
"""Write VCF header information for Hydra structural variant.
"""
def w(line):
out_handle.write("{0}\n".format(line))
w('##fileformat=VCFv4.1')
w('##INFO=<ID=IMPRECISE,Number=0,Type=Flag,Description="Imprecise structural variation">')
w('##INFO=<ID=END,... | python | def _write_vcf_header(out_handle):
"""Write VCF header information for Hydra structural variant.
"""
def w(line):
out_handle.write("{0}\n".format(line))
w('##fileformat=VCFv4.1')
w('##INFO=<ID=IMPRECISE,Number=0,Type=Flag,Description="Imprecise structural variation">')
w('##INFO=<ID=END,... | [
"def",
"_write_vcf_header",
"(",
"out_handle",
")",
":",
"def",
"w",
"(",
"line",
")",
":",
"out_handle",
".",
"write",
"(",
"\"{0}\\n\"",
".",
"format",
"(",
"line",
")",
")",
"w",
"(",
"'##fileformat=VCFv4.1'",
")",
"w",
"(",
"'##INFO=<ID=IMPRECISE,Number=... | Write VCF header information for Hydra structural variant. | [
"Write",
"VCF",
"header",
"information",
"for",
"Hydra",
"structural",
"variant",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L268-L291 |
223,804 | bcbio/bcbio-nextgen | scripts/utils/hydra_to_vcf.py | _write_vcf_breakend | def _write_vcf_breakend(brend, out_handle):
"""Write out a single VCF line with breakpoint information.
"""
out_handle.write("{0}\n".format("\t".join(str(x) for x in
[brend.chrom, brend.pos + 1, brend.id, brend.ref, brend.alt,
".", "PASS", brend.info]))) | python | def _write_vcf_breakend(brend, out_handle):
"""Write out a single VCF line with breakpoint information.
"""
out_handle.write("{0}\n".format("\t".join(str(x) for x in
[brend.chrom, brend.pos + 1, brend.id, brend.ref, brend.alt,
".", "PASS", brend.info]))) | [
"def",
"_write_vcf_breakend",
"(",
"brend",
",",
"out_handle",
")",
":",
"out_handle",
".",
"write",
"(",
"\"{0}\\n\"",
".",
"format",
"(",
"\"\\t\"",
".",
"join",
"(",
"str",
"(",
"x",
")",
"for",
"x",
"in",
"[",
"brend",
".",
"chrom",
",",
"brend",
... | Write out a single VCF line with breakpoint information. | [
"Write",
"out",
"a",
"single",
"VCF",
"line",
"with",
"breakpoint",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L293-L298 |
223,805 | bcbio/bcbio-nextgen | scripts/utils/hydra_to_vcf.py | _get_vcf_breakends | def _get_vcf_breakends(hydra_file, genome_2bit, options=None):
"""Parse BEDPE input, yielding VCF ready breakends.
"""
if options is None: options = {}
for features in group_hydra_breakends(hydra_parser(hydra_file, options)):
if len(features) == 1 and is_deletion(features[0], options):
... | python | def _get_vcf_breakends(hydra_file, genome_2bit, options=None):
"""Parse BEDPE input, yielding VCF ready breakends.
"""
if options is None: options = {}
for features in group_hydra_breakends(hydra_parser(hydra_file, options)):
if len(features) == 1 and is_deletion(features[0], options):
... | [
"def",
"_get_vcf_breakends",
"(",
"hydra_file",
",",
"genome_2bit",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"for",
"features",
"in",
"group_hydra_breakends",
"(",
"hydra_parser",
"(",
"hydra_file",
... | Parse BEDPE input, yielding VCF ready breakends. | [
"Parse",
"BEDPE",
"input",
"yielding",
"VCF",
"ready",
"breakends",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L300-L319 |
223,806 | bcbio/bcbio-nextgen | scripts/utils/hydra_to_vcf.py | hydra_to_vcf_writer | def hydra_to_vcf_writer(hydra_file, genome_2bit, options, out_handle):
"""Write hydra output as sorted VCF file.
Requires loading the hydra file into memory to perform sorting
on output VCF. Could generalize this to no sorting or by-chromosome
approach if this proves too memory intensive.
"""
_... | python | def hydra_to_vcf_writer(hydra_file, genome_2bit, options, out_handle):
"""Write hydra output as sorted VCF file.
Requires loading the hydra file into memory to perform sorting
on output VCF. Could generalize this to no sorting or by-chromosome
approach if this proves too memory intensive.
"""
_... | [
"def",
"hydra_to_vcf_writer",
"(",
"hydra_file",
",",
"genome_2bit",
",",
"options",
",",
"out_handle",
")",
":",
"_write_vcf_header",
"(",
"out_handle",
")",
"brends",
"=",
"list",
"(",
"_get_vcf_breakends",
"(",
"hydra_file",
",",
"genome_2bit",
",",
"options",
... | Write hydra output as sorted VCF file.
Requires loading the hydra file into memory to perform sorting
on output VCF. Could generalize this to no sorting or by-chromosome
approach if this proves too memory intensive. | [
"Write",
"hydra",
"output",
"as",
"sorted",
"VCF",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L321-L332 |
223,807 | bcbio/bcbio-nextgen | bcbio/rnaseq/kallisto.py | kallisto_table | def kallisto_table(kallisto_dir, index):
"""
convert kallisto output to a count table where the rows are
equivalence classes and the columns are cells
"""
quant_dir = os.path.join(kallisto_dir, "quant")
out_file = os.path.join(quant_dir, "matrix.csv")
if file_exists(out_file):
return... | python | def kallisto_table(kallisto_dir, index):
"""
convert kallisto output to a count table where the rows are
equivalence classes and the columns are cells
"""
quant_dir = os.path.join(kallisto_dir, "quant")
out_file = os.path.join(quant_dir, "matrix.csv")
if file_exists(out_file):
return... | [
"def",
"kallisto_table",
"(",
"kallisto_dir",
",",
"index",
")",
":",
"quant_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"kallisto_dir",
",",
"\"quant\"",
")",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"quant_dir",
",",
"\"matrix.csv\"",
... | convert kallisto output to a count table where the rows are
equivalence classes and the columns are cells | [
"convert",
"kallisto",
"output",
"to",
"a",
"count",
"table",
"where",
"the",
"rows",
"are",
"equivalence",
"classes",
"and",
"the",
"columns",
"are",
"cells"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/kallisto.py#L127-L149 |
223,808 | bcbio/bcbio-nextgen | bcbio/rnaseq/kallisto.py | get_ec_names | def get_ec_names(ecfile, fasta_names):
"""
convert equivalence classes to their set of transcripts
"""
df = pd.read_table(ecfile, header=None, names=["ec", "transcripts"])
transcript_groups = [x.split(",") for x in df["transcripts"]]
transcripts = []
for group in transcript_groups:
t... | python | def get_ec_names(ecfile, fasta_names):
"""
convert equivalence classes to their set of transcripts
"""
df = pd.read_table(ecfile, header=None, names=["ec", "transcripts"])
transcript_groups = [x.split(",") for x in df["transcripts"]]
transcripts = []
for group in transcript_groups:
t... | [
"def",
"get_ec_names",
"(",
"ecfile",
",",
"fasta_names",
")",
":",
"df",
"=",
"pd",
".",
"read_table",
"(",
"ecfile",
",",
"header",
"=",
"None",
",",
"names",
"=",
"[",
"\"ec\"",
",",
"\"transcripts\"",
"]",
")",
"transcript_groups",
"=",
"[",
"x",
"... | convert equivalence classes to their set of transcripts | [
"convert",
"equivalence",
"classes",
"to",
"their",
"set",
"of",
"transcripts"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/kallisto.py#L151-L160 |
223,809 | bcbio/bcbio-nextgen | bcbio/illumina/flowcell.py | parse_dirname | def parse_dirname(fc_dir):
"""Parse the flow cell ID and date from a flow cell directory.
"""
(_, fc_dir) = os.path.split(fc_dir)
parts = fc_dir.split("_")
name = None
date = None
for p in parts:
if p.endswith(("XX", "xx", "XY", "X2")):
name = p
elif len(p) == 6:
... | python | def parse_dirname(fc_dir):
"""Parse the flow cell ID and date from a flow cell directory.
"""
(_, fc_dir) = os.path.split(fc_dir)
parts = fc_dir.split("_")
name = None
date = None
for p in parts:
if p.endswith(("XX", "xx", "XY", "X2")):
name = p
elif len(p) == 6:
... | [
"def",
"parse_dirname",
"(",
"fc_dir",
")",
":",
"(",
"_",
",",
"fc_dir",
")",
"=",
"os",
".",
"path",
".",
"split",
"(",
"fc_dir",
")",
"parts",
"=",
"fc_dir",
".",
"split",
"(",
"\"_\"",
")",
"name",
"=",
"None",
"date",
"=",
"None",
"for",
"p"... | Parse the flow cell ID and date from a flow cell directory. | [
"Parse",
"the",
"flow",
"cell",
"ID",
"and",
"date",
"from",
"a",
"flow",
"cell",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/flowcell.py#L8-L26 |
223,810 | bcbio/bcbio-nextgen | bcbio/illumina/flowcell.py | get_qseq_dir | def get_qseq_dir(fc_dir):
"""Retrieve the qseq directory within Solexa flowcell output.
"""
machine_bc = os.path.join(fc_dir, "Data", "Intensities", "BaseCalls")
if os.path.exists(machine_bc):
return machine_bc
# otherwise assume we are in the qseq directory
# XXX What other cases can we... | python | def get_qseq_dir(fc_dir):
"""Retrieve the qseq directory within Solexa flowcell output.
"""
machine_bc = os.path.join(fc_dir, "Data", "Intensities", "BaseCalls")
if os.path.exists(machine_bc):
return machine_bc
# otherwise assume we are in the qseq directory
# XXX What other cases can we... | [
"def",
"get_qseq_dir",
"(",
"fc_dir",
")",
":",
"machine_bc",
"=",
"os",
".",
"path",
".",
"join",
"(",
"fc_dir",
",",
"\"Data\"",
",",
"\"Intensities\"",
",",
"\"BaseCalls\"",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"machine_bc",
")",
":",
"... | Retrieve the qseq directory within Solexa flowcell output. | [
"Retrieve",
"the",
"qseq",
"directory",
"within",
"Solexa",
"flowcell",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/flowcell.py#L28-L37 |
223,811 | bcbio/bcbio-nextgen | bcbio/illumina/flowcell.py | get_fastq_dir | def get_fastq_dir(fc_dir):
"""Retrieve the fastq directory within Solexa flowcell output.
"""
full_goat_bc = glob.glob(os.path.join(fc_dir, "Data", "*Firecrest*", "Bustard*"))
bustard_bc = glob.glob(os.path.join(fc_dir, "Data", "Intensities", "*Bustard*"))
machine_bc = os.path.join(fc_dir, "Data", "... | python | def get_fastq_dir(fc_dir):
"""Retrieve the fastq directory within Solexa flowcell output.
"""
full_goat_bc = glob.glob(os.path.join(fc_dir, "Data", "*Firecrest*", "Bustard*"))
bustard_bc = glob.glob(os.path.join(fc_dir, "Data", "Intensities", "*Bustard*"))
machine_bc = os.path.join(fc_dir, "Data", "... | [
"def",
"get_fastq_dir",
"(",
"fc_dir",
")",
":",
"full_goat_bc",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"fc_dir",
",",
"\"Data\"",
",",
"\"*Firecrest*\"",
",",
"\"Bustard*\"",
")",
")",
"bustard_bc",
"=",
"glob",
".",
"glob",... | Retrieve the fastq directory within Solexa flowcell output. | [
"Retrieve",
"the",
"fastq",
"directory",
"within",
"Solexa",
"flowcell",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/flowcell.py#L39-L54 |
223,812 | bcbio/bcbio-nextgen | bcbio/illumina/flowcell.py | GalaxySqnLimsApi.run_details | def run_details(self, run):
"""Retrieve sequencing run details as a dictionary.
"""
run_data = dict(run=run)
req = urllib.request.Request("%s/nglims/api_run_details" % self._base_url,
urllib.parse.urlencode(run_data))
response = urllib.request.urlopen(req)
... | python | def run_details(self, run):
"""Retrieve sequencing run details as a dictionary.
"""
run_data = dict(run=run)
req = urllib.request.Request("%s/nglims/api_run_details" % self._base_url,
urllib.parse.urlencode(run_data))
response = urllib.request.urlopen(req)
... | [
"def",
"run_details",
"(",
"self",
",",
"run",
")",
":",
"run_data",
"=",
"dict",
"(",
"run",
"=",
"run",
")",
"req",
"=",
"urllib",
".",
"request",
".",
"Request",
"(",
"\"%s/nglims/api_run_details\"",
"%",
"self",
".",
"_base_url",
",",
"urllib",
".",
... | Retrieve sequencing run details as a dictionary. | [
"Retrieve",
"sequencing",
"run",
"details",
"as",
"a",
"dictionary",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/flowcell.py#L70-L81 |
223,813 | bcbio/bcbio-nextgen | bcbio/ngsalign/mosaik.py | _mosaik_args_from_config | def _mosaik_args_from_config(config):
"""Configurable high level options for mosaik.
"""
multi_mappers = config["algorithm"].get("multiple_mappers", True)
multi_flags = ["-m", "all"] if multi_mappers else ["-m", "unique"]
error_flags = ["-mm", "2"]
num_cores = config["algorithm"].get("num_cores"... | python | def _mosaik_args_from_config(config):
"""Configurable high level options for mosaik.
"""
multi_mappers = config["algorithm"].get("multiple_mappers", True)
multi_flags = ["-m", "all"] if multi_mappers else ["-m", "unique"]
error_flags = ["-mm", "2"]
num_cores = config["algorithm"].get("num_cores"... | [
"def",
"_mosaik_args_from_config",
"(",
"config",
")",
":",
"multi_mappers",
"=",
"config",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"multiple_mappers\"",
",",
"True",
")",
"multi_flags",
"=",
"[",
"\"-m\"",
",",
"\"all\"",
"]",
"if",
"multi_mappers",
"el... | Configurable high level options for mosaik. | [
"Configurable",
"high",
"level",
"options",
"for",
"mosaik",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/mosaik.py#L14-L22 |
223,814 | bcbio/bcbio-nextgen | bcbio/ngsalign/mosaik.py | _convert_fastq | def _convert_fastq(fastq_file, pair_file, rg_name, out_file, config):
"""Convert fastq inputs into internal Mosaik representation.
"""
out_file = "{0}-fq.mkb".format(os.path.splitext(out_file)[0])
if not file_exists(out_file):
with file_transaction(config, out_file) as tx_out_file:
c... | python | def _convert_fastq(fastq_file, pair_file, rg_name, out_file, config):
"""Convert fastq inputs into internal Mosaik representation.
"""
out_file = "{0}-fq.mkb".format(os.path.splitext(out_file)[0])
if not file_exists(out_file):
with file_transaction(config, out_file) as tx_out_file:
c... | [
"def",
"_convert_fastq",
"(",
"fastq_file",
",",
"pair_file",
",",
"rg_name",
",",
"out_file",
",",
"config",
")",
":",
"out_file",
"=",
"\"{0}-fq.mkb\"",
".",
"format",
"(",
"os",
".",
"path",
".",
"splitext",
"(",
"out_file",
")",
"[",
"0",
"]",
")",
... | Convert fastq inputs into internal Mosaik representation. | [
"Convert",
"fastq",
"inputs",
"into",
"internal",
"Mosaik",
"representation",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/mosaik.py#L24-L41 |
223,815 | bcbio/bcbio-nextgen | bcbio/ngsalign/mosaik.py | _get_mosaik_nn_args | def _get_mosaik_nn_args(out_file):
"""Retrieve default neural network files from GitHub to pass to Mosaik.
"""
base_nn_url = "https://raw.github.com/wanpinglee/MOSAIK/master/src/networkFile/"
out = []
for arg, fname in [("-annse", "2.1.26.se.100.005.ann"),
("-annpe", "2.1.26.p... | python | def _get_mosaik_nn_args(out_file):
"""Retrieve default neural network files from GitHub to pass to Mosaik.
"""
base_nn_url = "https://raw.github.com/wanpinglee/MOSAIK/master/src/networkFile/"
out = []
for arg, fname in [("-annse", "2.1.26.se.100.005.ann"),
("-annpe", "2.1.26.p... | [
"def",
"_get_mosaik_nn_args",
"(",
"out_file",
")",
":",
"base_nn_url",
"=",
"\"https://raw.github.com/wanpinglee/MOSAIK/master/src/networkFile/\"",
"out",
"=",
"[",
"]",
"for",
"arg",
",",
"fname",
"in",
"[",
"(",
"\"-annse\"",
",",
"\"2.1.26.se.100.005.ann\"",
")",
... | Retrieve default neural network files from GitHub to pass to Mosaik. | [
"Retrieve",
"default",
"neural",
"network",
"files",
"from",
"GitHub",
"to",
"pass",
"to",
"Mosaik",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/mosaik.py#L43-L54 |
223,816 | bcbio/bcbio-nextgen | bcbio/ngsalign/mosaik.py | align | def align(fastq_file, pair_file, ref_file, names, align_dir, data,
extra_args=None):
"""Alignment with MosaikAligner.
"""
config = data["config"]
rg_name = names.get("rg", None) if names else None
out_file = os.path.join(align_dir, "%s-align.bam" % names["lane"])
if not file_exists(out... | python | def align(fastq_file, pair_file, ref_file, names, align_dir, data,
extra_args=None):
"""Alignment with MosaikAligner.
"""
config = data["config"]
rg_name = names.get("rg", None) if names else None
out_file = os.path.join(align_dir, "%s-align.bam" % names["lane"])
if not file_exists(out... | [
"def",
"align",
"(",
"fastq_file",
",",
"pair_file",
",",
"ref_file",
",",
"names",
",",
"align_dir",
",",
"data",
",",
"extra_args",
"=",
"None",
")",
":",
"config",
"=",
"data",
"[",
"\"config\"",
"]",
"rg_name",
"=",
"names",
".",
"get",
"(",
"\"rg\... | Alignment with MosaikAligner. | [
"Alignment",
"with",
"MosaikAligner",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/mosaik.py#L56-L87 |
223,817 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | get_bcbio_timings | def get_bcbio_timings(path):
"""Fetch timing information from a bcbio log file."""
with open(path, 'r') as file_handle:
steps = {}
for line in file_handle:
matches = re.search(r'^\[([^\]]+)\] ([^:]+: .*)', line)
if not matches:
continue
tstamp... | python | def get_bcbio_timings(path):
"""Fetch timing information from a bcbio log file."""
with open(path, 'r') as file_handle:
steps = {}
for line in file_handle:
matches = re.search(r'^\[([^\]]+)\] ([^:]+: .*)', line)
if not matches:
continue
tstamp... | [
"def",
"get_bcbio_timings",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"file_handle",
":",
"steps",
"=",
"{",
"}",
"for",
"line",
"in",
"file_handle",
":",
"matches",
"=",
"re",
".",
"search",
"(",
"r'^\\[([^\\]]+)\\] ([^:... | Fetch timing information from a bcbio log file. | [
"Fetch",
"timing",
"information",
"from",
"a",
"bcbio",
"log",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L54-L76 |
223,818 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | this_and_prev | def this_and_prev(iterable):
"""Walk an iterable, returning the current and previous items
as a two-tuple."""
try:
item = next(iterable)
while True:
next_item = next(iterable)
yield item, next_item
item = next_item
except StopIteration:
return | python | def this_and_prev(iterable):
"""Walk an iterable, returning the current and previous items
as a two-tuple."""
try:
item = next(iterable)
while True:
next_item = next(iterable)
yield item, next_item
item = next_item
except StopIteration:
return | [
"def",
"this_and_prev",
"(",
"iterable",
")",
":",
"try",
":",
"item",
"=",
"next",
"(",
"iterable",
")",
"while",
"True",
":",
"next_item",
"=",
"next",
"(",
"iterable",
")",
"yield",
"item",
",",
"next_item",
"item",
"=",
"next_item",
"except",
"StopIt... | Walk an iterable, returning the current and previous items
as a two-tuple. | [
"Walk",
"an",
"iterable",
"returning",
"the",
"current",
"and",
"previous",
"items",
"as",
"a",
"two",
"-",
"tuple",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L89-L99 |
223,819 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | remove_outliers | def remove_outliers(series, stddev):
"""Remove the outliers from a series."""
return series[(series - series.mean()).abs() < stddev * series.std()] | python | def remove_outliers(series, stddev):
"""Remove the outliers from a series."""
return series[(series - series.mean()).abs() < stddev * series.std()] | [
"def",
"remove_outliers",
"(",
"series",
",",
"stddev",
")",
":",
"return",
"series",
"[",
"(",
"series",
"-",
"series",
".",
"mean",
"(",
")",
")",
".",
"abs",
"(",
")",
"<",
"stddev",
"*",
"series",
".",
"std",
"(",
")",
"]"
] | Remove the outliers from a series. | [
"Remove",
"the",
"outliers",
"from",
"a",
"series",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L135-L137 |
223,820 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | prep_for_graph | def prep_for_graph(data_frame, series=None, delta_series=None, smoothing=None,
outlier_stddev=None):
"""Prepare a dataframe for graphing by calculating deltas for
series that need them, resampling, and removing outliers.
"""
series = series or []
delta_series = delta_series or []
... | python | def prep_for_graph(data_frame, series=None, delta_series=None, smoothing=None,
outlier_stddev=None):
"""Prepare a dataframe for graphing by calculating deltas for
series that need them, resampling, and removing outliers.
"""
series = series or []
delta_series = delta_series or []
... | [
"def",
"prep_for_graph",
"(",
"data_frame",
",",
"series",
"=",
"None",
",",
"delta_series",
"=",
"None",
",",
"smoothing",
"=",
"None",
",",
"outlier_stddev",
"=",
"None",
")",
":",
"series",
"=",
"series",
"or",
"[",
"]",
"delta_series",
"=",
"delta_seri... | Prepare a dataframe for graphing by calculating deltas for
series that need them, resampling, and removing outliers. | [
"Prepare",
"a",
"dataframe",
"for",
"graphing",
"by",
"calculating",
"deltas",
"for",
"series",
"that",
"need",
"them",
"resampling",
"and",
"removing",
"outliers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L140-L155 |
223,821 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | add_common_plot_features | def add_common_plot_features(plot, steps):
"""Add plot features common to all plots, such as bcbio step
information.
"""
_setup_matplotlib()
plot.yaxis.set_tick_params(labelright=True)
plot.set_xlabel('')
ymax = plot.get_ylim()[1]
ticks = {}
for tstamp, step in steps.items():
... | python | def add_common_plot_features(plot, steps):
"""Add plot features common to all plots, such as bcbio step
information.
"""
_setup_matplotlib()
plot.yaxis.set_tick_params(labelright=True)
plot.set_xlabel('')
ymax = plot.get_ylim()[1]
ticks = {}
for tstamp, step in steps.items():
... | [
"def",
"add_common_plot_features",
"(",
"plot",
",",
"steps",
")",
":",
"_setup_matplotlib",
"(",
")",
"plot",
".",
"yaxis",
".",
"set_tick_params",
"(",
"labelright",
"=",
"True",
")",
"plot",
".",
"set_xlabel",
"(",
"''",
")",
"ymax",
"=",
"plot",
".",
... | Add plot features common to all plots, such as bcbio step
information. | [
"Add",
"plot",
"features",
"common",
"to",
"all",
"plots",
"such",
"as",
"bcbio",
"step",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L158-L183 |
223,822 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | log_time_frame | def log_time_frame(bcbio_log):
"""The bcbio running time frame.
:return: an instance of :class collections.namedtuple:
with the following fields: start and end
"""
output = collections.namedtuple("Time", ["start", "end", "steps"])
bcbio_timings = get_bcbio_timings(bcbio_log)
... | python | def log_time_frame(bcbio_log):
"""The bcbio running time frame.
:return: an instance of :class collections.namedtuple:
with the following fields: start and end
"""
output = collections.namedtuple("Time", ["start", "end", "steps"])
bcbio_timings = get_bcbio_timings(bcbio_log)
... | [
"def",
"log_time_frame",
"(",
"bcbio_log",
")",
":",
"output",
"=",
"collections",
".",
"namedtuple",
"(",
"\"Time\"",
",",
"[",
"\"start\"",
",",
"\"end\"",
",",
"\"steps\"",
"]",
")",
"bcbio_timings",
"=",
"get_bcbio_timings",
"(",
"bcbio_log",
")",
"return"... | The bcbio running time frame.
:return: an instance of :class collections.namedtuple:
with the following fields: start and end | [
"The",
"bcbio",
"running",
"time",
"frame",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L298-L306 |
223,823 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | resource_usage | def resource_usage(bcbio_log, cluster, rawdir, verbose):
"""Generate system statistics from bcbio runs.
Parse the obtained files and put the information in
a :class pandas.DataFrame:.
:param bcbio_log: local path to bcbio log file written by the run
:param cluster:
:param rawdir: direct... | python | def resource_usage(bcbio_log, cluster, rawdir, verbose):
"""Generate system statistics from bcbio runs.
Parse the obtained files and put the information in
a :class pandas.DataFrame:.
:param bcbio_log: local path to bcbio log file written by the run
:param cluster:
:param rawdir: direct... | [
"def",
"resource_usage",
"(",
"bcbio_log",
",",
"cluster",
",",
"rawdir",
",",
"verbose",
")",
":",
"data_frames",
"=",
"{",
"}",
"hardware_info",
"=",
"{",
"}",
"time_frame",
"=",
"log_time_frame",
"(",
"bcbio_log",
")",
"for",
"collectl_file",
"in",
"sorte... | Generate system statistics from bcbio runs.
Parse the obtained files and put the information in
a :class pandas.DataFrame:.
:param bcbio_log: local path to bcbio log file written by the run
:param cluster:
:param rawdir: directory to put raw data files
:param verbose: increase verbo... | [
"Generate",
"system",
"statistics",
"from",
"bcbio",
"runs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L319-L362 |
223,824 | bcbio/bcbio-nextgen | bcbio/graph/graph.py | generate_graphs | def generate_graphs(data_frames, hardware_info, steps, outdir,
verbose=False):
"""Generate all graphs for a bcbio run."""
_setup_matplotlib()
# Hash of hosts containing (data, hardware, steps) tuple
collectl_info = collections.defaultdict(dict)
for host, data_frame in data_frame... | python | def generate_graphs(data_frames, hardware_info, steps, outdir,
verbose=False):
"""Generate all graphs for a bcbio run."""
_setup_matplotlib()
# Hash of hosts containing (data, hardware, steps) tuple
collectl_info = collections.defaultdict(dict)
for host, data_frame in data_frame... | [
"def",
"generate_graphs",
"(",
"data_frames",
",",
"hardware_info",
",",
"steps",
",",
"outdir",
",",
"verbose",
"=",
"False",
")",
":",
"_setup_matplotlib",
"(",
")",
"# Hash of hosts containing (data, hardware, steps) tuple",
"collectl_info",
"=",
"collections",
".",
... | Generate all graphs for a bcbio run. | [
"Generate",
"all",
"graphs",
"for",
"a",
"bcbio",
"run",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/graph/graph.py#L365-L428 |
223,825 | bcbio/bcbio-nextgen | bcbio/variation/ploidy.py | get_ploidy | def get_ploidy(items, region=None):
"""Retrieve ploidy of a region, handling special cases.
"""
chrom = chromosome_special_cases(region[0] if isinstance(region, (list, tuple))
else None)
ploidy = _configured_ploidy(items)
sexes = _configured_genders(items)
if... | python | def get_ploidy(items, region=None):
"""Retrieve ploidy of a region, handling special cases.
"""
chrom = chromosome_special_cases(region[0] if isinstance(region, (list, tuple))
else None)
ploidy = _configured_ploidy(items)
sexes = _configured_genders(items)
if... | [
"def",
"get_ploidy",
"(",
"items",
",",
"region",
"=",
"None",
")",
":",
"chrom",
"=",
"chromosome_special_cases",
"(",
"region",
"[",
"0",
"]",
"if",
"isinstance",
"(",
"region",
",",
"(",
"list",
",",
"tuple",
")",
")",
"else",
"None",
")",
"ploidy",... | Retrieve ploidy of a region, handling special cases. | [
"Retrieve",
"ploidy",
"of",
"a",
"region",
"handling",
"special",
"cases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ploidy.py#L43-L66 |
223,826 | bcbio/bcbio-nextgen | bcbio/variation/ploidy.py | filter_vcf_by_sex | def filter_vcf_by_sex(vcf_file, items):
"""Post-filter a single sample VCF, handling sex chromosomes.
Removes Y chromosomes from batches with all female samples.
"""
out_file = "%s-ploidyfix%s" % utils.splitext_plus(vcf_file)
if not utils.file_exists(out_file):
genders = list(_configured_ge... | python | def filter_vcf_by_sex(vcf_file, items):
"""Post-filter a single sample VCF, handling sex chromosomes.
Removes Y chromosomes from batches with all female samples.
"""
out_file = "%s-ploidyfix%s" % utils.splitext_plus(vcf_file)
if not utils.file_exists(out_file):
genders = list(_configured_ge... | [
"def",
"filter_vcf_by_sex",
"(",
"vcf_file",
",",
"items",
")",
":",
"out_file",
"=",
"\"%s-ploidyfix%s\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"vcf_file",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"genders",
"=",
"list",... | Post-filter a single sample VCF, handling sex chromosomes.
Removes Y chromosomes from batches with all female samples. | [
"Post",
"-",
"filter",
"a",
"single",
"sample",
"VCF",
"handling",
"sex",
"chromosomes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/ploidy.py#L68-L94 |
223,827 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | variant_filtration | def variant_filtration(call_file, ref_file, vrn_files, data, items):
"""Filter variant calls using Variant Quality Score Recalibration.
Newer GATK with Haplotype calling has combined SNP/indel filtering.
"""
caller = data["config"]["algorithm"].get("variantcaller")
if "gvcf" not in dd.get_tools_on(... | python | def variant_filtration(call_file, ref_file, vrn_files, data, items):
"""Filter variant calls using Variant Quality Score Recalibration.
Newer GATK with Haplotype calling has combined SNP/indel filtering.
"""
caller = data["config"]["algorithm"].get("variantcaller")
if "gvcf" not in dd.get_tools_on(... | [
"def",
"variant_filtration",
"(",
"call_file",
",",
"ref_file",
",",
"vrn_files",
",",
"data",
",",
"items",
")",
":",
"caller",
"=",
"data",
"[",
"\"config\"",
"]",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"variantcaller\"",
")",
"if",
"\"gvcf\"",
"n... | Filter variant calls using Variant Quality Score Recalibration.
Newer GATK with Haplotype calling has combined SNP/indel filtering. | [
"Filter",
"variant",
"calls",
"using",
"Variant",
"Quality",
"Score",
"Recalibration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L23-L45 |
223,828 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | _split_by_ready_regions | def _split_by_ready_regions(ext, file_key, dir_ext_fn):
"""Organize splits based on regions generated by parallel_prep_region.
Sort splits so largest regions analyzed first, avoiding potentially lagging runs
at end.
"""
def _sort_by_size(region_w_bams):
region, _ = region_w_bams
_, ... | python | def _split_by_ready_regions(ext, file_key, dir_ext_fn):
"""Organize splits based on regions generated by parallel_prep_region.
Sort splits so largest regions analyzed first, avoiding potentially lagging runs
at end.
"""
def _sort_by_size(region_w_bams):
region, _ = region_w_bams
_, ... | [
"def",
"_split_by_ready_regions",
"(",
"ext",
",",
"file_key",
",",
"dir_ext_fn",
")",
":",
"def",
"_sort_by_size",
"(",
"region_w_bams",
")",
":",
"region",
",",
"_",
"=",
"region_w_bams",
"_",
",",
"start",
",",
"end",
"=",
"region",
"return",
"end",
"-"... | Organize splits based on regions generated by parallel_prep_region.
Sort splits so largest regions analyzed first, avoiding potentially lagging runs
at end. | [
"Organize",
"splits",
"based",
"on",
"regions",
"generated",
"by",
"parallel_prep_region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L116-L154 |
223,829 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | _collapse_by_bam_variantcaller | def _collapse_by_bam_variantcaller(samples):
"""Collapse regions to a single representative by BAM input, variant caller and batch.
"""
by_bam = collections.OrderedDict()
for data in (x[0] for x in samples):
work_bam = utils.get_in(data, ("combine", "work_bam", "out"), data.get("align_bam"))
... | python | def _collapse_by_bam_variantcaller(samples):
"""Collapse regions to a single representative by BAM input, variant caller and batch.
"""
by_bam = collections.OrderedDict()
for data in (x[0] for x in samples):
work_bam = utils.get_in(data, ("combine", "work_bam", "out"), data.get("align_bam"))
... | [
"def",
"_collapse_by_bam_variantcaller",
"(",
"samples",
")",
":",
"by_bam",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"for",
"data",
"in",
"(",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"samples",
")",
":",
"work_bam",
"=",
"utils",
".",
"get_in",
... | Collapse regions to a single representative by BAM input, variant caller and batch. | [
"Collapse",
"regions",
"to",
"a",
"single",
"representative",
"by",
"BAM",
"input",
"variant",
"caller",
"and",
"batch",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L156-L178 |
223,830 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | _dup_samples_by_variantcaller | def _dup_samples_by_variantcaller(samples, require_bam=True):
"""Prepare samples by variant callers, duplicating any with multiple callers.
"""
samples = [utils.to_single_data(x) for x in samples]
samples = germline.split_somatic(samples)
to_process = []
extras = []
for data in samples:
... | python | def _dup_samples_by_variantcaller(samples, require_bam=True):
"""Prepare samples by variant callers, duplicating any with multiple callers.
"""
samples = [utils.to_single_data(x) for x in samples]
samples = germline.split_somatic(samples)
to_process = []
extras = []
for data in samples:
... | [
"def",
"_dup_samples_by_variantcaller",
"(",
"samples",
",",
"require_bam",
"=",
"True",
")",
":",
"samples",
"=",
"[",
"utils",
".",
"to_single_data",
"(",
"x",
")",
"for",
"x",
"in",
"samples",
"]",
"samples",
"=",
"germline",
".",
"split_somatic",
"(",
... | Prepare samples by variant callers, duplicating any with multiple callers. | [
"Prepare",
"samples",
"by",
"variant",
"callers",
"duplicating",
"any",
"with",
"multiple",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L180-L197 |
223,831 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | parallel_variantcall_region | def parallel_variantcall_region(samples, run_parallel):
"""Perform variant calling and post-analysis on samples by region.
"""
to_process, extras = _dup_samples_by_variantcaller(samples)
split_fn = _split_by_ready_regions(".vcf.gz", "work_bam", get_variantcaller)
samples = _collapse_by_bam_variantca... | python | def parallel_variantcall_region(samples, run_parallel):
"""Perform variant calling and post-analysis on samples by region.
"""
to_process, extras = _dup_samples_by_variantcaller(samples)
split_fn = _split_by_ready_regions(".vcf.gz", "work_bam", get_variantcaller)
samples = _collapse_by_bam_variantca... | [
"def",
"parallel_variantcall_region",
"(",
"samples",
",",
"run_parallel",
")",
":",
"to_process",
",",
"extras",
"=",
"_dup_samples_by_variantcaller",
"(",
"samples",
")",
"split_fn",
"=",
"_split_by_ready_regions",
"(",
"\".vcf.gz\"",
",",
"\"work_bam\"",
",",
"get_... | Perform variant calling and post-analysis on samples by region. | [
"Perform",
"variant",
"calling",
"and",
"post",
"-",
"analysis",
"on",
"samples",
"by",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L199-L209 |
223,832 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | vc_output_record | def vc_output_record(samples):
"""Prepare output record from variant calling to feed into downstream analysis.
Prep work handles reformatting so we return generated dictionaries.
For any shared keys that are calculated only once for a batch, like variant calls
for the batch, we assign to every sample.... | python | def vc_output_record(samples):
"""Prepare output record from variant calling to feed into downstream analysis.
Prep work handles reformatting so we return generated dictionaries.
For any shared keys that are calculated only once for a batch, like variant calls
for the batch, we assign to every sample.... | [
"def",
"vc_output_record",
"(",
"samples",
")",
":",
"shared_keys",
"=",
"[",
"[",
"\"vrn_file\"",
"]",
",",
"[",
"\"validate\"",
",",
"\"summary\"",
"]",
",",
"[",
"\"validate\"",
",",
"\"tp\"",
"]",
",",
"[",
"\"validate\"",
",",
"\"fp\"",
"]",
",",
"[... | Prepare output record from variant calling to feed into downstream analysis.
Prep work handles reformatting so we return generated dictionaries.
For any shared keys that are calculated only once for a batch, like variant calls
for the batch, we assign to every sample. | [
"Prepare",
"output",
"record",
"from",
"variant",
"calling",
"to",
"feed",
"into",
"downstream",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L212-L236 |
223,833 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | batch_for_variantcall | def batch_for_variantcall(samples):
"""Prepare a set of samples for parallel variant calling.
CWL input target that groups samples into batches and variant callers
for parallel processing.
If doing joint calling, with `tools_on: [gvcf]`, split the sample into
individuals instead of combining into ... | python | def batch_for_variantcall(samples):
"""Prepare a set of samples for parallel variant calling.
CWL input target that groups samples into batches and variant callers
for parallel processing.
If doing joint calling, with `tools_on: [gvcf]`, split the sample into
individuals instead of combining into ... | [
"def",
"batch_for_variantcall",
"(",
"samples",
")",
":",
"sample_order",
"=",
"[",
"dd",
".",
"get_sample_name",
"(",
"utils",
".",
"to_single_data",
"(",
"x",
")",
")",
"for",
"x",
"in",
"samples",
"]",
"to_process",
",",
"extras",
"=",
"_dup_samples_by_va... | Prepare a set of samples for parallel variant calling.
CWL input target that groups samples into batches and variant callers
for parallel processing.
If doing joint calling, with `tools_on: [gvcf]`, split the sample into
individuals instead of combining into a batch. | [
"Prepare",
"a",
"set",
"of",
"samples",
"for",
"parallel",
"variant",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L241-L272 |
223,834 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | _handle_precalled | def _handle_precalled(data):
"""Copy in external pre-called variants fed into analysis.
Symlinks for non-CWL runs where we want to ensure VCF present
in a local directory.
"""
if data.get("vrn_file") and not cwlutils.is_cwl_run(data):
vrn_file = data["vrn_file"]
if isinstance(vrn_fi... | python | def _handle_precalled(data):
"""Copy in external pre-called variants fed into analysis.
Symlinks for non-CWL runs where we want to ensure VCF present
in a local directory.
"""
if data.get("vrn_file") and not cwlutils.is_cwl_run(data):
vrn_file = data["vrn_file"]
if isinstance(vrn_fi... | [
"def",
"_handle_precalled",
"(",
"data",
")",
":",
"if",
"data",
".",
"get",
"(",
"\"vrn_file\"",
")",
"and",
"not",
"cwlutils",
".",
"is_cwl_run",
"(",
"data",
")",
":",
"vrn_file",
"=",
"data",
"[",
"\"vrn_file\"",
"]",
"if",
"isinstance",
"(",
"vrn_fi... | Copy in external pre-called variants fed into analysis.
Symlinks for non-CWL runs where we want to ensure VCF present
in a local directory. | [
"Copy",
"in",
"external",
"pre",
"-",
"called",
"variants",
"fed",
"into",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L274-L291 |
223,835 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | handle_multiple_callers | def handle_multiple_callers(data, key, default=None, require_bam=True):
"""Split samples that potentially require multiple variant calling approaches.
"""
callers = get_variantcaller(data, key, default, require_bam=require_bam)
if isinstance(callers, six.string_types):
return [data]
elif not... | python | def handle_multiple_callers(data, key, default=None, require_bam=True):
"""Split samples that potentially require multiple variant calling approaches.
"""
callers = get_variantcaller(data, key, default, require_bam=require_bam)
if isinstance(callers, six.string_types):
return [data]
elif not... | [
"def",
"handle_multiple_callers",
"(",
"data",
",",
"key",
",",
"default",
"=",
"None",
",",
"require_bam",
"=",
"True",
")",
":",
"callers",
"=",
"get_variantcaller",
"(",
"data",
",",
"key",
",",
"default",
",",
"require_bam",
"=",
"require_bam",
")",
"i... | Split samples that potentially require multiple variant calling approaches. | [
"Split",
"samples",
"that",
"potentially",
"require",
"multiple",
"variant",
"calling",
"approaches",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L293-L322 |
223,836 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | variantcall_sample | def variantcall_sample(data, region=None, align_bams=None, out_file=None):
"""Parallel entry point for doing genotyping of a region of a sample.
"""
if out_file is None or not os.path.exists(out_file) or not os.path.lexists(out_file):
utils.safe_makedir(os.path.dirname(out_file))
ref_file = ... | python | def variantcall_sample(data, region=None, align_bams=None, out_file=None):
"""Parallel entry point for doing genotyping of a region of a sample.
"""
if out_file is None or not os.path.exists(out_file) or not os.path.lexists(out_file):
utils.safe_makedir(os.path.dirname(out_file))
ref_file = ... | [
"def",
"variantcall_sample",
"(",
"data",
",",
"region",
"=",
"None",
",",
"align_bams",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"if",
"out_file",
"is",
"None",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"out_file",
")",
"or",
"... | Parallel entry point for doing genotyping of a region of a sample. | [
"Parallel",
"entry",
"point",
"for",
"doing",
"genotyping",
"of",
"a",
"region",
"of",
"a",
"sample",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L359-L381 |
223,837 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | _get_batch_name | def _get_batch_name(items, skip_jointcheck=False):
"""Retrieve the shared batch name for a group of items.
"""
batch_names = collections.defaultdict(int)
has_joint = any([is_joint(d) for d in items])
for data in items:
if has_joint and not skip_jointcheck:
batches = dd.get_sample... | python | def _get_batch_name(items, skip_jointcheck=False):
"""Retrieve the shared batch name for a group of items.
"""
batch_names = collections.defaultdict(int)
has_joint = any([is_joint(d) for d in items])
for data in items:
if has_joint and not skip_jointcheck:
batches = dd.get_sample... | [
"def",
"_get_batch_name",
"(",
"items",
",",
"skip_jointcheck",
"=",
"False",
")",
":",
"batch_names",
"=",
"collections",
".",
"defaultdict",
"(",
"int",
")",
"has_joint",
"=",
"any",
"(",
"[",
"is_joint",
"(",
"d",
")",
"for",
"d",
"in",
"items",
"]",
... | Retrieve the shared batch name for a group of items. | [
"Retrieve",
"the",
"shared",
"batch",
"name",
"for",
"a",
"group",
"of",
"items",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L410-L424 |
223,838 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | _run_variantcall_batch_multicore | def _run_variantcall_batch_multicore(items, regions, final_file):
"""Run variant calling on a batch of items using multiple cores.
"""
batch_name = _get_batch_name(items)
variantcaller = _get_batch_variantcaller(items)
work_bams = [dd.get_work_bam(d) or dd.get_align_bam(d) for d in items]
def sp... | python | def _run_variantcall_batch_multicore(items, regions, final_file):
"""Run variant calling on a batch of items using multiple cores.
"""
batch_name = _get_batch_name(items)
variantcaller = _get_batch_variantcaller(items)
work_bams = [dd.get_work_bam(d) or dd.get_align_bam(d) for d in items]
def sp... | [
"def",
"_run_variantcall_batch_multicore",
"(",
"items",
",",
"regions",
",",
"final_file",
")",
":",
"batch_name",
"=",
"_get_batch_name",
"(",
"items",
")",
"variantcaller",
"=",
"_get_batch_variantcaller",
"(",
"items",
")",
"work_bams",
"=",
"[",
"dd",
".",
... | Run variant calling on a batch of items using multiple cores. | [
"Run",
"variant",
"calling",
"on",
"a",
"batch",
"of",
"items",
"using",
"multiple",
"cores",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L462-L486 |
223,839 | bcbio/bcbio-nextgen | bcbio/distributed/ipython.py | create | def create(parallel, dirs, config):
"""Create a cluster based on the provided parallel arguments.
Returns an IPython view on the cluster, enabling processing on jobs.
Adds a mincores specification if he have machines with a larger
number of cores to allow jobs to be batched together for shared
mem... | python | def create(parallel, dirs, config):
"""Create a cluster based on the provided parallel arguments.
Returns an IPython view on the cluster, enabling processing on jobs.
Adds a mincores specification if he have machines with a larger
number of cores to allow jobs to be batched together for shared
mem... | [
"def",
"create",
"(",
"parallel",
",",
"dirs",
",",
"config",
")",
":",
"profile_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dirs",
"[",
"\"work\"",
"]",
",",
"get_log_dir",
"(",
"config",
")",
",",
"\"ipython\""... | Create a cluster based on the provided parallel arguments.
Returns an IPython view on the cluster, enabling processing on jobs.
Adds a mincores specification if he have machines with a larger
number of cores to allow jobs to be batched together for shared
memory usage. | [
"Create",
"a",
"cluster",
"based",
"on",
"the",
"provided",
"parallel",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/ipython.py#L33-L65 |
223,840 | bcbio/bcbio-nextgen | bcbio/distributed/ipython.py | per_machine_target_cores | def per_machine_target_cores(cores, num_jobs):
"""Select target cores on larger machines to leave room for batch script and controller.
On resource constrained environments, we want to pack all bcbio submissions onto a specific
number of machines. This gives up some cores to enable sharing cores with the c... | python | def per_machine_target_cores(cores, num_jobs):
"""Select target cores on larger machines to leave room for batch script and controller.
On resource constrained environments, we want to pack all bcbio submissions onto a specific
number of machines. This gives up some cores to enable sharing cores with the c... | [
"def",
"per_machine_target_cores",
"(",
"cores",
",",
"num_jobs",
")",
":",
"if",
"cores",
">=",
"32",
"and",
"num_jobs",
"==",
"1",
":",
"cores",
"=",
"cores",
"-",
"2",
"elif",
"cores",
">=",
"16",
"and",
"num_jobs",
"in",
"[",
"1",
",",
"2",
"]",
... | Select target cores on larger machines to leave room for batch script and controller.
On resource constrained environments, we want to pack all bcbio submissions onto a specific
number of machines. This gives up some cores to enable sharing cores with the controller
and batch script on larger machines. | [
"Select",
"target",
"cores",
"on",
"larger",
"machines",
"to",
"leave",
"room",
"for",
"batch",
"script",
"and",
"controller",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/ipython.py#L67-L78 |
223,841 | bcbio/bcbio-nextgen | bcbio/distributed/ipython.py | _get_common_cores | def _get_common_cores(resources):
"""Retrieve the most common configured number of cores in the input file.
"""
all_cores = []
for vs in resources.values():
cores = vs.get("cores")
if cores:
all_cores.append(int(vs["cores"]))
return collections.Counter(all_cores).most_com... | python | def _get_common_cores(resources):
"""Retrieve the most common configured number of cores in the input file.
"""
all_cores = []
for vs in resources.values():
cores = vs.get("cores")
if cores:
all_cores.append(int(vs["cores"]))
return collections.Counter(all_cores).most_com... | [
"def",
"_get_common_cores",
"(",
"resources",
")",
":",
"all_cores",
"=",
"[",
"]",
"for",
"vs",
"in",
"resources",
".",
"values",
"(",
")",
":",
"cores",
"=",
"vs",
".",
"get",
"(",
"\"cores\"",
")",
"if",
"cores",
":",
"all_cores",
".",
"append",
"... | Retrieve the most common configured number of cores in the input file. | [
"Retrieve",
"the",
"most",
"common",
"configured",
"number",
"of",
"cores",
"in",
"the",
"input",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/ipython.py#L80-L88 |
223,842 | bcbio/bcbio-nextgen | bcbio/distributed/ipython.py | zip_args | def zip_args(args, config=None):
"""Compress arguments using msgpack.
"""
if msgpack:
return [msgpack.packb(x, use_single_float=True, use_bin_type=True) for x in args]
else:
return args | python | def zip_args(args, config=None):
"""Compress arguments using msgpack.
"""
if msgpack:
return [msgpack.packb(x, use_single_float=True, use_bin_type=True) for x in args]
else:
return args | [
"def",
"zip_args",
"(",
"args",
",",
"config",
"=",
"None",
")",
":",
"if",
"msgpack",
":",
"return",
"[",
"msgpack",
".",
"packb",
"(",
"x",
",",
"use_single_float",
"=",
"True",
",",
"use_bin_type",
"=",
"True",
")",
"for",
"x",
"in",
"args",
"]",
... | Compress arguments using msgpack. | [
"Compress",
"arguments",
"using",
"msgpack",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/ipython.py#L103-L109 |
223,843 | bcbio/bcbio-nextgen | bcbio/distributed/ipython.py | runner | def runner(view, parallel, dirs, config):
"""Run a task on an ipython parallel cluster, allowing alternative queue types.
view provides map-style access to an existing Ipython cluster.
"""
def run(fn_name, items):
setpath.prepend_bcbiopath()
out = []
fn, fn_name = (fn_name, fn_n... | python | def runner(view, parallel, dirs, config):
"""Run a task on an ipython parallel cluster, allowing alternative queue types.
view provides map-style access to an existing Ipython cluster.
"""
def run(fn_name, items):
setpath.prepend_bcbiopath()
out = []
fn, fn_name = (fn_name, fn_n... | [
"def",
"runner",
"(",
"view",
",",
"parallel",
",",
"dirs",
",",
"config",
")",
":",
"def",
"run",
"(",
"fn_name",
",",
"items",
")",
":",
"setpath",
".",
"prepend_bcbiopath",
"(",
")",
"out",
"=",
"[",
"]",
"fn",
",",
"fn_name",
"=",
"(",
"fn_name... | Run a task on an ipython parallel cluster, allowing alternative queue types.
view provides map-style access to an existing Ipython cluster. | [
"Run",
"a",
"task",
"on",
"an",
"ipython",
"parallel",
"cluster",
"allowing",
"alternative",
"queue",
"types",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/ipython.py#L119-L141 |
223,844 | bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | peakcall_prepare | def peakcall_prepare(data, run_parallel):
"""Entry point for doing peak calling"""
caller_fns = get_callers()
to_process = []
for sample in data:
mimic = copy.copy(sample[0])
callers = dd.get_peakcaller(sample[0])
if not isinstance(callers, list):
callers = [callers]
... | python | def peakcall_prepare(data, run_parallel):
"""Entry point for doing peak calling"""
caller_fns = get_callers()
to_process = []
for sample in data:
mimic = copy.copy(sample[0])
callers = dd.get_peakcaller(sample[0])
if not isinstance(callers, list):
callers = [callers]
... | [
"def",
"peakcall_prepare",
"(",
"data",
",",
"run_parallel",
")",
":",
"caller_fns",
"=",
"get_callers",
"(",
")",
"to_process",
"=",
"[",
"]",
"for",
"sample",
"in",
"data",
":",
"mimic",
"=",
"copy",
".",
"copy",
"(",
"sample",
"[",
"0",
"]",
")",
... | Entry point for doing peak calling | [
"Entry",
"point",
"for",
"doing",
"peak",
"calling"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L22-L43 |
223,845 | bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | calling | def calling(data):
"""Main function to parallelize peak calling."""
chip_bam = data.get("work_bam")
input_bam = data.get("work_bam_input", None)
caller_fn = get_callers()[data["peak_fn"]]
name = dd.get_sample_name(data)
out_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), data["peak_... | python | def calling(data):
"""Main function to parallelize peak calling."""
chip_bam = data.get("work_bam")
input_bam = data.get("work_bam_input", None)
caller_fn = get_callers()[data["peak_fn"]]
name = dd.get_sample_name(data)
out_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), data["peak_... | [
"def",
"calling",
"(",
"data",
")",
":",
"chip_bam",
"=",
"data",
".",
"get",
"(",
"\"work_bam\"",
")",
"input_bam",
"=",
"data",
".",
"get",
"(",
"\"work_bam_input\"",
",",
"None",
")",
"caller_fn",
"=",
"get_callers",
"(",
")",
"[",
"data",
"[",
"\"p... | Main function to parallelize peak calling. | [
"Main",
"function",
"to",
"parallelize",
"peak",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L45-L59 |
223,846 | bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | _sync | def _sync(original, processed):
"""
Add output to data if run sucessfully.
For now only macs2 is available, so no need
to consider multiple callers.
"""
for original_sample in original:
original_sample[0]["peaks_files"] = {}
for process_sample in processed:
if dd.get_... | python | def _sync(original, processed):
"""
Add output to data if run sucessfully.
For now only macs2 is available, so no need
to consider multiple callers.
"""
for original_sample in original:
original_sample[0]["peaks_files"] = {}
for process_sample in processed:
if dd.get_... | [
"def",
"_sync",
"(",
"original",
",",
"processed",
")",
":",
"for",
"original_sample",
"in",
"original",
":",
"original_sample",
"[",
"0",
"]",
"[",
"\"peaks_files\"",
"]",
"=",
"{",
"}",
"for",
"process_sample",
"in",
"processed",
":",
"if",
"dd",
".",
... | Add output to data if run sucessfully.
For now only macs2 is available, so no need
to consider multiple callers. | [
"Add",
"output",
"to",
"data",
"if",
"run",
"sucessfully",
".",
"For",
"now",
"only",
"macs2",
"is",
"available",
"so",
"no",
"need",
"to",
"consider",
"multiple",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L61-L74 |
223,847 | bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | _check | def _check(sample, data):
"""Get input sample for each chip bam file."""
if dd.get_chip_method(sample).lower() == "atac":
return [sample]
if dd.get_phenotype(sample) == "input":
return None
for origin in data:
if dd.get_batch(sample) in (dd.get_batches(origin[0]) or []) and dd.ge... | python | def _check(sample, data):
"""Get input sample for each chip bam file."""
if dd.get_chip_method(sample).lower() == "atac":
return [sample]
if dd.get_phenotype(sample) == "input":
return None
for origin in data:
if dd.get_batch(sample) in (dd.get_batches(origin[0]) or []) and dd.ge... | [
"def",
"_check",
"(",
"sample",
",",
"data",
")",
":",
"if",
"dd",
".",
"get_chip_method",
"(",
"sample",
")",
".",
"lower",
"(",
")",
"==",
"\"atac\"",
":",
"return",
"[",
"sample",
"]",
"if",
"dd",
".",
"get_phenotype",
"(",
"sample",
")",
"==",
... | Get input sample for each chip bam file. | [
"Get",
"input",
"sample",
"for",
"each",
"chip",
"bam",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L76-L86 |
223,848 | bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | _get_multiplier | def _get_multiplier(samples):
"""Get multiplier to get jobs
only for samples that have input
"""
to_process = 1.0
to_skip = 0
for sample in samples:
if dd.get_phenotype(sample[0]) == "chip":
to_process += 1.0
elif dd.get_chip_method(sample[0]).lower() == "atac":
... | python | def _get_multiplier(samples):
"""Get multiplier to get jobs
only for samples that have input
"""
to_process = 1.0
to_skip = 0
for sample in samples:
if dd.get_phenotype(sample[0]) == "chip":
to_process += 1.0
elif dd.get_chip_method(sample[0]).lower() == "atac":
... | [
"def",
"_get_multiplier",
"(",
"samples",
")",
":",
"to_process",
"=",
"1.0",
"to_skip",
"=",
"0",
"for",
"sample",
"in",
"samples",
":",
"if",
"dd",
".",
"get_phenotype",
"(",
"sample",
"[",
"0",
"]",
")",
"==",
"\"chip\"",
":",
"to_process",
"+=",
"1... | Get multiplier to get jobs
only for samples that have input | [
"Get",
"multiplier",
"to",
"get",
"jobs",
"only",
"for",
"samples",
"that",
"have",
"input"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L88-L104 |
223,849 | bcbio/bcbio-nextgen | bcbio/chipseq/peaks.py | greylisting | def greylisting(data):
"""
Run ChIP-seq greylisting
"""
input_bam = data.get("work_bam_input", None)
if not input_bam:
logger.info("No input BAM file detected, skipping greylisting.")
return None
try:
greylister = config_utils.get_program("chipseq-greylist", data)
exc... | python | def greylisting(data):
"""
Run ChIP-seq greylisting
"""
input_bam = data.get("work_bam_input", None)
if not input_bam:
logger.info("No input BAM file detected, skipping greylisting.")
return None
try:
greylister = config_utils.get_program("chipseq-greylist", data)
exc... | [
"def",
"greylisting",
"(",
"data",
")",
":",
"input_bam",
"=",
"data",
".",
"get",
"(",
"\"work_bam_input\"",
",",
"None",
")",
"if",
"not",
"input_bam",
":",
"logger",
".",
"info",
"(",
"\"No input BAM file detected, skipping greylisting.\"",
")",
"return",
"No... | Run ChIP-seq greylisting | [
"Run",
"ChIP",
"-",
"seq",
"greylisting"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L106-L133 |
223,850 | bcbio/bcbio-nextgen | bcbio/distributed/clargs.py | to_parallel | def to_parallel(args, module="bcbio.distributed"):
"""Convert input arguments into a parallel dictionary for passing to processing.
"""
ptype, cores = _get_cores_and_type(args.numcores,
getattr(args, "paralleltype", None),
args.sc... | python | def to_parallel(args, module="bcbio.distributed"):
"""Convert input arguments into a parallel dictionary for passing to processing.
"""
ptype, cores = _get_cores_and_type(args.numcores,
getattr(args, "paralleltype", None),
args.sc... | [
"def",
"to_parallel",
"(",
"args",
",",
"module",
"=",
"\"bcbio.distributed\"",
")",
":",
"ptype",
",",
"cores",
"=",
"_get_cores_and_type",
"(",
"args",
".",
"numcores",
",",
"getattr",
"(",
"args",
",",
"\"paralleltype\"",
",",
"None",
")",
",",
"args",
... | Convert input arguments into a parallel dictionary for passing to processing. | [
"Convert",
"input",
"arguments",
"into",
"a",
"parallel",
"dictionary",
"for",
"passing",
"to",
"processing",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clargs.py#L4-L18 |
223,851 | bcbio/bcbio-nextgen | bcbio/distributed/clargs.py | _get_cores_and_type | def _get_cores_and_type(numcores, paralleltype, scheduler):
"""Return core and parallelization approach from command line providing sane defaults.
"""
if scheduler is not None:
paralleltype = "ipython"
if paralleltype is None:
paralleltype = "local"
if not numcores or int(numcores) <... | python | def _get_cores_and_type(numcores, paralleltype, scheduler):
"""Return core and parallelization approach from command line providing sane defaults.
"""
if scheduler is not None:
paralleltype = "ipython"
if paralleltype is None:
paralleltype = "local"
if not numcores or int(numcores) <... | [
"def",
"_get_cores_and_type",
"(",
"numcores",
",",
"paralleltype",
",",
"scheduler",
")",
":",
"if",
"scheduler",
"is",
"not",
"None",
":",
"paralleltype",
"=",
"\"ipython\"",
"if",
"paralleltype",
"is",
"None",
":",
"paralleltype",
"=",
"\"local\"",
"if",
"n... | Return core and parallelization approach from command line providing sane defaults. | [
"Return",
"core",
"and",
"parallelization",
"approach",
"from",
"command",
"line",
"providing",
"sane",
"defaults",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/clargs.py#L20-L29 |
223,852 | bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | _fix_mates | def _fix_mates(orig_file, out_file, ref_file, config):
"""Fix problematic unmapped mate pairs in TopHat output.
TopHat 2.0.9 appears to have issues with secondary reads:
https://groups.google.com/forum/#!topic/tuxedo-tools-users/puLfDNbN9bo
This cleans the input file to only keep properly mapped pairs,... | python | def _fix_mates(orig_file, out_file, ref_file, config):
"""Fix problematic unmapped mate pairs in TopHat output.
TopHat 2.0.9 appears to have issues with secondary reads:
https://groups.google.com/forum/#!topic/tuxedo-tools-users/puLfDNbN9bo
This cleans the input file to only keep properly mapped pairs,... | [
"def",
"_fix_mates",
"(",
"orig_file",
",",
"out_file",
",",
"ref_file",
",",
"config",
")",
":",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"config",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"samtools",
... | Fix problematic unmapped mate pairs in TopHat output.
TopHat 2.0.9 appears to have issues with secondary reads:
https://groups.google.com/forum/#!topic/tuxedo-tools-users/puLfDNbN9bo
This cleans the input file to only keep properly mapped pairs,
providing a general fix that will handle correctly mapped... | [
"Fix",
"problematic",
"unmapped",
"mate",
"pairs",
"in",
"TopHat",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L173-L187 |
223,853 | bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | _add_rg | def _add_rg(unmapped_file, config, names):
"""Add the missing RG header."""
picard = broad.runner_from_path("picard", config)
rg_fixed = picard.run_fn("picard_fix_rgs", unmapped_file, names)
return rg_fixed | python | def _add_rg(unmapped_file, config, names):
"""Add the missing RG header."""
picard = broad.runner_from_path("picard", config)
rg_fixed = picard.run_fn("picard_fix_rgs", unmapped_file, names)
return rg_fixed | [
"def",
"_add_rg",
"(",
"unmapped_file",
",",
"config",
",",
"names",
")",
":",
"picard",
"=",
"broad",
".",
"runner_from_path",
"(",
"\"picard\"",
",",
"config",
")",
"rg_fixed",
"=",
"picard",
".",
"run_fn",
"(",
"\"picard_fix_rgs\"",
",",
"unmapped_file",
... | Add the missing RG header. | [
"Add",
"the",
"missing",
"RG",
"header",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L189-L193 |
223,854 | bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | _estimate_paired_innerdist | def _estimate_paired_innerdist(fastq_file, pair_file, ref_file, out_base,
out_dir, data):
"""Use Bowtie to estimate the inner distance of paired reads.
"""
mean, stdev = _bowtie_for_innerdist("100000", fastq_file, pair_file, ref_file,
ou... | python | def _estimate_paired_innerdist(fastq_file, pair_file, ref_file, out_base,
out_dir, data):
"""Use Bowtie to estimate the inner distance of paired reads.
"""
mean, stdev = _bowtie_for_innerdist("100000", fastq_file, pair_file, ref_file,
ou... | [
"def",
"_estimate_paired_innerdist",
"(",
"fastq_file",
",",
"pair_file",
",",
"ref_file",
",",
"out_base",
",",
"out_dir",
",",
"data",
")",
":",
"mean",
",",
"stdev",
"=",
"_bowtie_for_innerdist",
"(",
"\"100000\"",
",",
"fastq_file",
",",
"pair_file",
",",
... | Use Bowtie to estimate the inner distance of paired reads. | [
"Use",
"Bowtie",
"to",
"estimate",
"the",
"inner",
"distance",
"of",
"paired",
"reads",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L230-L243 |
223,855 | bcbio/bcbio-nextgen | bcbio/ngsalign/tophat.py | fix_insert_size | def fix_insert_size(in_bam, config):
"""
Tophat sets PI in the RG to be the inner distance size, but the SAM spec
states should be the insert size. This fixes the RG in the alignment
file generated by Tophat header to match the spec
"""
fixed_file = os.path.splitext(in_bam)[0] + ".pi_fixed.bam"
... | python | def fix_insert_size(in_bam, config):
"""
Tophat sets PI in the RG to be the inner distance size, but the SAM spec
states should be the insert size. This fixes the RG in the alignment
file generated by Tophat header to match the spec
"""
fixed_file = os.path.splitext(in_bam)[0] + ".pi_fixed.bam"
... | [
"def",
"fix_insert_size",
"(",
"in_bam",
",",
"config",
")",
":",
"fixed_file",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"in_bam",
")",
"[",
"0",
"]",
"+",
"\".pi_fixed.bam\"",
"if",
"file_exists",
"(",
"fixed_file",
")",
":",
"return",
"fixed_file",
... | Tophat sets PI in the RG to be the inner distance size, but the SAM spec
states should be the insert size. This fixes the RG in the alignment
file generated by Tophat header to match the spec | [
"Tophat",
"sets",
"PI",
"in",
"the",
"RG",
"to",
"be",
"the",
"inner",
"distance",
"size",
"but",
"the",
"SAM",
"spec",
"states",
"should",
"be",
"the",
"insert",
"size",
".",
"This",
"fixes",
"the",
"RG",
"in",
"the",
"alignment",
"file",
"generated",
... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L344-L369 |
223,856 | bcbio/bcbio-nextgen | bcbio/variation/damage.py | _filter_to_info | def _filter_to_info(in_file, data):
"""Move DKFZ filter information into INFO field.
"""
header = ("""##INFO=<ID=DKFZBias,Number=.,Type=String,"""
"""Description="Bias estimation based on unequal read support from DKFZBiasFilterVariant Depth">\n""")
out_file = "%s-ann.vcf" % utils.splitext... | python | def _filter_to_info(in_file, data):
"""Move DKFZ filter information into INFO field.
"""
header = ("""##INFO=<ID=DKFZBias,Number=.,Type=String,"""
"""Description="Bias estimation based on unequal read support from DKFZBiasFilterVariant Depth">\n""")
out_file = "%s-ann.vcf" % utils.splitext... | [
"def",
"_filter_to_info",
"(",
"in_file",
",",
"data",
")",
":",
"header",
"=",
"(",
"\"\"\"##INFO=<ID=DKFZBias,Number=.,Type=String,\"\"\"",
"\"\"\"Description=\"Bias estimation based on unequal read support from DKFZBiasFilterVariant Depth\">\\n\"\"\"",
")",
"out_file",
"=",
"\"%s-... | Move DKFZ filter information into INFO field. | [
"Move",
"DKFZ",
"filter",
"information",
"into",
"INFO",
"field",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/damage.py#L46-L63 |
223,857 | bcbio/bcbio-nextgen | bcbio/variation/damage.py | _rec_filter_to_info | def _rec_filter_to_info(line):
"""Move a DKFZBias filter to the INFO field, for a record.
"""
parts = line.rstrip().split("\t")
move_filters = {"bSeq": "strand", "bPcr": "damage"}
new_filters = []
bias_info = []
for f in parts[6].split(";"):
if f in move_filters:
bias_inf... | python | def _rec_filter_to_info(line):
"""Move a DKFZBias filter to the INFO field, for a record.
"""
parts = line.rstrip().split("\t")
move_filters = {"bSeq": "strand", "bPcr": "damage"}
new_filters = []
bias_info = []
for f in parts[6].split(";"):
if f in move_filters:
bias_inf... | [
"def",
"_rec_filter_to_info",
"(",
"line",
")",
":",
"parts",
"=",
"line",
".",
"rstrip",
"(",
")",
".",
"split",
"(",
"\"\\t\"",
")",
"move_filters",
"=",
"{",
"\"bSeq\"",
":",
"\"strand\"",
",",
"\"bPcr\"",
":",
"\"damage\"",
"}",
"new_filters",
"=",
"... | Move a DKFZBias filter to the INFO field, for a record. | [
"Move",
"a",
"DKFZBias",
"filter",
"to",
"the",
"INFO",
"field",
"for",
"a",
"record",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/damage.py#L65-L80 |
223,858 | bcbio/bcbio-nextgen | bcbio/variation/damage.py | should_filter | def should_filter(items):
"""Check if we should do damage filtering on somatic calling with low frequency events.
"""
return (vcfutils.get_paired(items) is not None and
any("damage_filter" in dd.get_tools_on(d) for d in items)) | python | def should_filter(items):
"""Check if we should do damage filtering on somatic calling with low frequency events.
"""
return (vcfutils.get_paired(items) is not None and
any("damage_filter" in dd.get_tools_on(d) for d in items)) | [
"def",
"should_filter",
"(",
"items",
")",
":",
"return",
"(",
"vcfutils",
".",
"get_paired",
"(",
"items",
")",
"is",
"not",
"None",
"and",
"any",
"(",
"\"damage_filter\"",
"in",
"dd",
".",
"get_tools_on",
"(",
"d",
")",
"for",
"d",
"in",
"items",
")"... | Check if we should do damage filtering on somatic calling with low frequency events. | [
"Check",
"if",
"we",
"should",
"do",
"damage",
"filtering",
"on",
"somatic",
"calling",
"with",
"low",
"frequency",
"events",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/damage.py#L82-L86 |
223,859 | bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | start_cmd | def start_cmd(cmd, descr, data):
"""Retain details about starting a command, returning a command identifier.
"""
if data and "provenance" in data:
entity_id = tz.get_in(["provenance", "entity"], data) | python | def start_cmd(cmd, descr, data):
"""Retain details about starting a command, returning a command identifier.
"""
if data and "provenance" in data:
entity_id = tz.get_in(["provenance", "entity"], data) | [
"def",
"start_cmd",
"(",
"cmd",
",",
"descr",
",",
"data",
")",
":",
"if",
"data",
"and",
"\"provenance\"",
"in",
"data",
":",
"entity_id",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"provenance\"",
",",
"\"entity\"",
"]",
",",
"data",
")"
] | Retain details about starting a command, returning a command identifier. | [
"Retain",
"details",
"about",
"starting",
"a",
"command",
"returning",
"a",
"command",
"identifier",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L23-L27 |
223,860 | bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | initialize | def initialize(dirs):
"""Initialize the biolite database to load provenance information.
"""
if biolite and dirs.get("work"):
base_dir = utils.safe_makedir(os.path.join(dirs["work"], "provenance"))
p_db = os.path.join(base_dir, "biolite.db")
biolite.config.resources["database"] = p_d... | python | def initialize(dirs):
"""Initialize the biolite database to load provenance information.
"""
if biolite and dirs.get("work"):
base_dir = utils.safe_makedir(os.path.join(dirs["work"], "provenance"))
p_db = os.path.join(base_dir, "biolite.db")
biolite.config.resources["database"] = p_d... | [
"def",
"initialize",
"(",
"dirs",
")",
":",
"if",
"biolite",
"and",
"dirs",
".",
"get",
"(",
"\"work\"",
")",
":",
"base_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dirs",
"[",
"\"work\"",
"]",
",",
"\"provenan... | Initialize the biolite database to load provenance information. | [
"Initialize",
"the",
"biolite",
"database",
"to",
"load",
"provenance",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L34-L41 |
223,861 | bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | track_parallel | def track_parallel(items, sub_type):
"""Create entity identifiers to trace the given items in sub-commands.
Helps handle nesting in parallel program execution:
run id => sub-section id => parallel ids
"""
out = []
for i, args in enumerate(items):
item_i, item = _get_provitem_from_args(... | python | def track_parallel(items, sub_type):
"""Create entity identifiers to trace the given items in sub-commands.
Helps handle nesting in parallel program execution:
run id => sub-section id => parallel ids
"""
out = []
for i, args in enumerate(items):
item_i, item = _get_provitem_from_args(... | [
"def",
"track_parallel",
"(",
"items",
",",
"sub_type",
")",
":",
"out",
"=",
"[",
"]",
"for",
"i",
",",
"args",
"in",
"enumerate",
"(",
"items",
")",
":",
"item_i",
",",
"item",
"=",
"_get_provitem_from_args",
"(",
"args",
")",
"if",
"item",
":",
"s... | Create entity identifiers to trace the given items in sub-commands.
Helps handle nesting in parallel program execution:
run id => sub-section id => parallel ids | [
"Create",
"entity",
"identifiers",
"to",
"trace",
"the",
"given",
"items",
"in",
"sub",
"-",
"commands",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L49-L66 |
223,862 | bcbio/bcbio-nextgen | bcbio/provenance/diagnostics.py | _get_provitem_from_args | def _get_provitem_from_args(xs):
"""Retrieve processed item from list of input arguments.
"""
for i, x in enumerate(xs):
if _has_provenance(x):
return i, x
return -1, None | python | def _get_provitem_from_args(xs):
"""Retrieve processed item from list of input arguments.
"""
for i, x in enumerate(xs):
if _has_provenance(x):
return i, x
return -1, None | [
"def",
"_get_provitem_from_args",
"(",
"xs",
")",
":",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"xs",
")",
":",
"if",
"_has_provenance",
"(",
"x",
")",
":",
"return",
"i",
",",
"x",
"return",
"-",
"1",
",",
"None"
] | Retrieve processed item from list of input arguments. | [
"Retrieve",
"processed",
"item",
"from",
"list",
"of",
"input",
"arguments",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/diagnostics.py#L71-L77 |
223,863 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | handle_vcf_calls | def handle_vcf_calls(vcf_file, data, orig_items):
"""Prioritize VCF calls based on external annotations supplied through GEMINI.
"""
if not _do_prioritize(orig_items):
return vcf_file
else:
ann_vcf = population.run_vcfanno(vcf_file, data)
if ann_vcf:
priority_file = _... | python | def handle_vcf_calls(vcf_file, data, orig_items):
"""Prioritize VCF calls based on external annotations supplied through GEMINI.
"""
if not _do_prioritize(orig_items):
return vcf_file
else:
ann_vcf = population.run_vcfanno(vcf_file, data)
if ann_vcf:
priority_file = _... | [
"def",
"handle_vcf_calls",
"(",
"vcf_file",
",",
"data",
",",
"orig_items",
")",
":",
"if",
"not",
"_do_prioritize",
"(",
"orig_items",
")",
":",
"return",
"vcf_file",
"else",
":",
"ann_vcf",
"=",
"population",
".",
"run_vcfanno",
"(",
"vcf_file",
",",
"data... | Prioritize VCF calls based on external annotations supplied through GEMINI. | [
"Prioritize",
"VCF",
"calls",
"based",
"on",
"external",
"annotations",
"supplied",
"through",
"GEMINI",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L27-L39 |
223,864 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _apply_priority_filter | def _apply_priority_filter(in_file, priority_file, data):
"""Annotate variants with priority information and use to apply filters.
"""
out_file = "%s-priority%s" % utils.splitext_plus(in_file)
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
h... | python | def _apply_priority_filter(in_file, priority_file, data):
"""Annotate variants with priority information and use to apply filters.
"""
out_file = "%s-priority%s" % utils.splitext_plus(in_file)
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
h... | [
"def",
"_apply_priority_filter",
"(",
"in_file",
",",
"priority_file",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s-priority%s\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"in_file",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
... | Annotate variants with priority information and use to apply filters. | [
"Annotate",
"variants",
"with",
"priority",
"information",
"and",
"use",
"to",
"apply",
"filters",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L41-L63 |
223,865 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _prep_priority_filter_vcfanno | def _prep_priority_filter_vcfanno(in_vcf, data):
"""Prepare tabix file with priority filters based on vcfanno annotations.
"""
pops = ['af_adj_exac_afr', 'af_adj_exac_amr', 'af_adj_exac_eas',
'af_adj_exac_fin', 'af_adj_exac_nfe', 'af_adj_exac_oth', 'af_adj_exac_sas',
'af_exac_all', '... | python | def _prep_priority_filter_vcfanno(in_vcf, data):
"""Prepare tabix file with priority filters based on vcfanno annotations.
"""
pops = ['af_adj_exac_afr', 'af_adj_exac_amr', 'af_adj_exac_eas',
'af_adj_exac_fin', 'af_adj_exac_nfe', 'af_adj_exac_oth', 'af_adj_exac_sas',
'af_exac_all', '... | [
"def",
"_prep_priority_filter_vcfanno",
"(",
"in_vcf",
",",
"data",
")",
":",
"pops",
"=",
"[",
"'af_adj_exac_afr'",
",",
"'af_adj_exac_amr'",
",",
"'af_adj_exac_eas'",
",",
"'af_adj_exac_fin'",
",",
"'af_adj_exac_nfe'",
",",
"'af_adj_exac_oth'",
",",
"'af_adj_exac_sas'... | Prepare tabix file with priority filters based on vcfanno annotations. | [
"Prepare",
"tabix",
"file",
"with",
"priority",
"filters",
"based",
"on",
"vcfanno",
"annotations",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L65-L88 |
223,866 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _get_impact_info | def _get_impact_info(vcf_reader):
"""Retrieve impact parsing information from INFO header.
"""
ImpactInfo = collections.namedtuple("ImpactInfo", "header, gclass, id")
KEY_2_CLASS = {
'CSQ': geneimpacts.VEP,
'ANN': geneimpacts.SnpEff,
'BCSQ': geneimpacts.BCFT}
for l in (x.stri... | python | def _get_impact_info(vcf_reader):
"""Retrieve impact parsing information from INFO header.
"""
ImpactInfo = collections.namedtuple("ImpactInfo", "header, gclass, id")
KEY_2_CLASS = {
'CSQ': geneimpacts.VEP,
'ANN': geneimpacts.SnpEff,
'BCSQ': geneimpacts.BCFT}
for l in (x.stri... | [
"def",
"_get_impact_info",
"(",
"vcf_reader",
")",
":",
"ImpactInfo",
"=",
"collections",
".",
"namedtuple",
"(",
"\"ImpactInfo\"",
",",
"\"header, gclass, id\"",
")",
"KEY_2_CLASS",
"=",
"{",
"'CSQ'",
":",
"geneimpacts",
".",
"VEP",
",",
"'ANN'",
":",
"geneimpa... | Retrieve impact parsing information from INFO header. | [
"Retrieve",
"impact",
"parsing",
"information",
"from",
"INFO",
"header",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L90-L104 |
223,867 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _parse_impact_header | def _parse_impact_header(hdr_dict):
"""Parse fields for impact, taken from vcf2db
"""
desc = hdr_dict["Description"]
if hdr_dict["ID"] == "ANN":
parts = [x.strip("\"'") for x in re.split("\s*\|\s*", desc.split(":", 1)[1].strip('" '))]
elif hdr_dict["ID"] == "EFF":
parts = [x.strip(" ... | python | def _parse_impact_header(hdr_dict):
"""Parse fields for impact, taken from vcf2db
"""
desc = hdr_dict["Description"]
if hdr_dict["ID"] == "ANN":
parts = [x.strip("\"'") for x in re.split("\s*\|\s*", desc.split(":", 1)[1].strip('" '))]
elif hdr_dict["ID"] == "EFF":
parts = [x.strip(" ... | [
"def",
"_parse_impact_header",
"(",
"hdr_dict",
")",
":",
"desc",
"=",
"hdr_dict",
"[",
"\"Description\"",
"]",
"if",
"hdr_dict",
"[",
"\"ID\"",
"]",
"==",
"\"ANN\"",
":",
"parts",
"=",
"[",
"x",
".",
"strip",
"(",
"\"\\\"'\"",
")",
"for",
"x",
"in",
"... | Parse fields for impact, taken from vcf2db | [
"Parse",
"fields",
"for",
"impact",
"taken",
"from",
"vcf2db"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L116-L130 |
223,868 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _prepare_vcf_rec | def _prepare_vcf_rec(rec, pops, known, impact_info):
"""Parse a vcfanno output into a dictionary of useful attributes.
"""
out = {}
for k in pops + known:
out[k] = rec.INFO.get(k)
if impact_info:
cur_info = rec.INFO.get(impact_info.id)
if cur_info:
cur_impacts = [... | python | def _prepare_vcf_rec(rec, pops, known, impact_info):
"""Parse a vcfanno output into a dictionary of useful attributes.
"""
out = {}
for k in pops + known:
out[k] = rec.INFO.get(k)
if impact_info:
cur_info = rec.INFO.get(impact_info.id)
if cur_info:
cur_impacts = [... | [
"def",
"_prepare_vcf_rec",
"(",
"rec",
",",
"pops",
",",
"known",
",",
"impact_info",
")",
":",
"out",
"=",
"{",
"}",
"for",
"k",
"in",
"pops",
"+",
"known",
":",
"out",
"[",
"k",
"]",
"=",
"rec",
".",
"INFO",
".",
"get",
"(",
"k",
")",
"if",
... | Parse a vcfanno output into a dictionary of useful attributes. | [
"Parse",
"a",
"vcfanno",
"output",
"into",
"a",
"dictionary",
"of",
"useful",
"attributes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L132-L146 |
223,869 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _calc_priority_filter | def _calc_priority_filter(row, pops):
"""Calculate the priority filter based on external associated data.
- Pass high/medium impact variants not found in population databases
- Pass variants found in COSMIC or Clinvar provided they don't have two
additional reasons to filter (found in multiple extern... | python | def _calc_priority_filter(row, pops):
"""Calculate the priority filter based on external associated data.
- Pass high/medium impact variants not found in population databases
- Pass variants found in COSMIC or Clinvar provided they don't have two
additional reasons to filter (found in multiple extern... | [
"def",
"_calc_priority_filter",
"(",
"row",
",",
"pops",
")",
":",
"filters",
"=",
"[",
"]",
"passes",
"=",
"[",
"]",
"passes",
".",
"extend",
"(",
"_find_known",
"(",
"row",
")",
")",
"filters",
".",
"extend",
"(",
"_known_populations",
"(",
"row",
",... | Calculate the priority filter based on external associated data.
- Pass high/medium impact variants not found in population databases
- Pass variants found in COSMIC or Clinvar provided they don't have two
additional reasons to filter (found in multiple external populations) | [
"Calculate",
"the",
"priority",
"filter",
"based",
"on",
"external",
"associated",
"data",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L148-L161 |
223,870 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _known_populations | def _known_populations(row, pops):
"""Find variants present in substantial frequency in population databases.
"""
cutoff = 0.01
out = set([])
for pop, base in [("esp", "af_esp_all"), ("1000g", "af_1kg_all"),
("exac", "af_exac_all"), ("anypop", "max_aaf_all")]:
for key i... | python | def _known_populations(row, pops):
"""Find variants present in substantial frequency in population databases.
"""
cutoff = 0.01
out = set([])
for pop, base in [("esp", "af_esp_all"), ("1000g", "af_1kg_all"),
("exac", "af_exac_all"), ("anypop", "max_aaf_all")]:
for key i... | [
"def",
"_known_populations",
"(",
"row",
",",
"pops",
")",
":",
"cutoff",
"=",
"0.01",
"out",
"=",
"set",
"(",
"[",
"]",
")",
"for",
"pop",
",",
"base",
"in",
"[",
"(",
"\"esp\"",
",",
"\"af_esp_all\"",
")",
",",
"(",
"\"1000g\"",
",",
"\"af_1kg_all\... | Find variants present in substantial frequency in population databases. | [
"Find",
"variants",
"present",
"in",
"substantial",
"frequency",
"in",
"population",
"databases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L163-L174 |
223,871 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _find_known | def _find_known(row):
"""Find variant present in known pathogenic databases.
"""
out = []
clinvar_no = set(["unknown", "untested", "non-pathogenic", "probable-non-pathogenic",
"uncertain_significance", "uncertain_significance", "not_provided",
"benign", "likel... | python | def _find_known(row):
"""Find variant present in known pathogenic databases.
"""
out = []
clinvar_no = set(["unknown", "untested", "non-pathogenic", "probable-non-pathogenic",
"uncertain_significance", "uncertain_significance", "not_provided",
"benign", "likel... | [
"def",
"_find_known",
"(",
"row",
")",
":",
"out",
"=",
"[",
"]",
"clinvar_no",
"=",
"set",
"(",
"[",
"\"unknown\"",
",",
"\"untested\"",
",",
"\"non-pathogenic\"",
",",
"\"probable-non-pathogenic\"",
",",
"\"uncertain_significance\"",
",",
"\"uncertain_significance... | Find variant present in known pathogenic databases. | [
"Find",
"variant",
"present",
"in",
"known",
"pathogenic",
"databases",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L176-L187 |
223,872 | bcbio/bcbio-nextgen | bcbio/variation/prioritize.py | _do_prioritize | def _do_prioritize(items):
"""Determine if we should perform prioritization.
Currently done on tumor-only input samples and feeding into PureCN
which needs the germline annotations.
"""
if not any("tumoronly-prioritization" in dd.get_tools_off(d) for d in items):
if vcfutils.get_paired_phen... | python | def _do_prioritize(items):
"""Determine if we should perform prioritization.
Currently done on tumor-only input samples and feeding into PureCN
which needs the germline annotations.
"""
if not any("tumoronly-prioritization" in dd.get_tools_off(d) for d in items):
if vcfutils.get_paired_phen... | [
"def",
"_do_prioritize",
"(",
"items",
")",
":",
"if",
"not",
"any",
"(",
"\"tumoronly-prioritization\"",
"in",
"dd",
".",
"get_tools_off",
"(",
"d",
")",
"for",
"d",
"in",
"items",
")",
":",
"if",
"vcfutils",
".",
"get_paired_phenotype",
"(",
"items",
"["... | Determine if we should perform prioritization.
Currently done on tumor-only input samples and feeding into PureCN
which needs the germline annotations. | [
"Determine",
"if",
"we",
"should",
"perform",
"prioritization",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/prioritize.py#L189-L204 |
223,873 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | run_cortex | def run_cortex(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Top level entry to regional de-novo based variant calling with cortex_var.
"""
raise NotImplementedError("Cortex currently out of date and needs reworking.")
if len(align_bams) == 1:
align_bam... | python | def run_cortex(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Top level entry to regional de-novo based variant calling with cortex_var.
"""
raise NotImplementedError("Cortex currently out of date and needs reworking.")
if len(align_bams) == 1:
align_bam... | [
"def",
"run_cortex",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Cortex currently out of date and needs reworking.\"",
")",
"if",
... | Top level entry to regional de-novo based variant calling with cortex_var. | [
"Top",
"level",
"entry",
"to",
"regional",
"de",
"-",
"novo",
"based",
"variant",
"calling",
"with",
"cortex_var",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L28-L62 |
223,874 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _passes_cortex_depth | def _passes_cortex_depth(line, min_depth):
"""Do any genotypes in the cortex_var VCF line passes the minimum depth requirement?
"""
parts = line.split("\t")
cov_index = parts[8].split(":").index("COV")
passes_depth = False
for gt in parts[9:]:
cur_cov = gt.split(":")[cov_index]
c... | python | def _passes_cortex_depth(line, min_depth):
"""Do any genotypes in the cortex_var VCF line passes the minimum depth requirement?
"""
parts = line.split("\t")
cov_index = parts[8].split(":").index("COV")
passes_depth = False
for gt in parts[9:]:
cur_cov = gt.split(":")[cov_index]
c... | [
"def",
"_passes_cortex_depth",
"(",
"line",
",",
"min_depth",
")",
":",
"parts",
"=",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
"cov_index",
"=",
"parts",
"[",
"8",
"]",
".",
"split",
"(",
"\":\"",
")",
".",
"index",
"(",
"\"COV\"",
")",
"passes_depth... | Do any genotypes in the cortex_var VCF line passes the minimum depth requirement? | [
"Do",
"any",
"genotypes",
"in",
"the",
"cortex_var",
"VCF",
"line",
"passes",
"the",
"minimum",
"depth",
"requirement?"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L64-L75 |
223,875 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _select_final_variants | def _select_final_variants(base_vcf, out_vcf, config):
"""Filter input file, removing items with low depth of support.
cortex_var calls are tricky to filter by depth. Count information is in
the COV FORMAT field grouped by alleles, so we need to sum up values and
compare.
"""
min_depth = int(co... | python | def _select_final_variants(base_vcf, out_vcf, config):
"""Filter input file, removing items with low depth of support.
cortex_var calls are tricky to filter by depth. Count information is in
the COV FORMAT field grouped by alleles, so we need to sum up values and
compare.
"""
min_depth = int(co... | [
"def",
"_select_final_variants",
"(",
"base_vcf",
",",
"out_vcf",
",",
"config",
")",
":",
"min_depth",
"=",
"int",
"(",
"config",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"min_depth\"",
",",
"4",
")",
")",
"with",
"file_transaction",
"(",
"out_vcf",
... | Filter input file, removing items with low depth of support.
cortex_var calls are tricky to filter by depth. Count information is in
the COV FORMAT field grouped by alleles, so we need to sum up values and
compare. | [
"Filter",
"input",
"file",
"removing",
"items",
"with",
"low",
"depth",
"of",
"support",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L77-L95 |
223,876 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _combine_variants | def _combine_variants(in_vcfs, out_file, ref_file, config):
"""Combine variant files, writing the header from the first non-empty input.
in_vcfs is a list with each item starting with the chromosome regions,
and ending with the input file.
We sort by these regions to ensure the output file is in the ex... | python | def _combine_variants(in_vcfs, out_file, ref_file, config):
"""Combine variant files, writing the header from the first non-empty input.
in_vcfs is a list with each item starting with the chromosome regions,
and ending with the input file.
We sort by these regions to ensure the output file is in the ex... | [
"def",
"_combine_variants",
"(",
"in_vcfs",
",",
"out_file",
",",
"ref_file",
",",
"config",
")",
":",
"in_vcfs",
".",
"sort",
"(",
")",
"wrote_header",
"=",
"False",
"with",
"open",
"(",
"out_file",
",",
"\"w\"",
")",
"as",
"out_handle",
":",
"for",
"in... | Combine variant files, writing the header from the first non-empty input.
in_vcfs is a list with each item starting with the chromosome regions,
and ending with the input file.
We sort by these regions to ensure the output file is in the expected order. | [
"Combine",
"variant",
"files",
"writing",
"the",
"header",
"from",
"the",
"first",
"non",
"-",
"empty",
"input",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L97-L120 |
223,877 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _remap_cortex_out | def _remap_cortex_out(cortex_out, region, out_file):
"""Remap coordinates in local cortex variant calls to the original global region.
"""
def _remap_vcf_line(line, contig, start):
parts = line.split("\t")
if parts[0] == "" or parts[1] == "":
return None
parts[0] = contig... | python | def _remap_cortex_out(cortex_out, region, out_file):
"""Remap coordinates in local cortex variant calls to the original global region.
"""
def _remap_vcf_line(line, contig, start):
parts = line.split("\t")
if parts[0] == "" or parts[1] == "":
return None
parts[0] = contig... | [
"def",
"_remap_cortex_out",
"(",
"cortex_out",
",",
"region",
",",
"out_file",
")",
":",
"def",
"_remap_vcf_line",
"(",
"line",
",",
"contig",
",",
"start",
")",
":",
"parts",
"=",
"line",
".",
"split",
"(",
"\"\\t\"",
")",
"if",
"parts",
"[",
"0",
"]"... | Remap coordinates in local cortex variant calls to the original global region. | [
"Remap",
"coordinates",
"in",
"local",
"cortex",
"variant",
"calls",
"to",
"the",
"original",
"global",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L159-L188 |
223,878 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _run_cortex | def _run_cortex(fastq, indexes, params, out_base, dirs, config):
"""Run cortex_var run_calls.pl, producing a VCF variant file.
"""
print(out_base)
fastaq_index = "{0}.fastaq_index".format(out_base)
se_fastq_index = "{0}.se_fastq".format(out_base)
pe_fastq_index = "{0}.pe_fastq".format(out_base)
... | python | def _run_cortex(fastq, indexes, params, out_base, dirs, config):
"""Run cortex_var run_calls.pl, producing a VCF variant file.
"""
print(out_base)
fastaq_index = "{0}.fastaq_index".format(out_base)
se_fastq_index = "{0}.se_fastq".format(out_base)
pe_fastq_index = "{0}.pe_fastq".format(out_base)
... | [
"def",
"_run_cortex",
"(",
"fastq",
",",
"indexes",
",",
"params",
",",
"out_base",
",",
"dirs",
",",
"config",
")",
":",
"print",
"(",
"out_base",
")",
"fastaq_index",
"=",
"\"{0}.fastaq_index\"",
".",
"format",
"(",
"out_base",
")",
"se_fastq_index",
"=",
... | Run cortex_var run_calls.pl, producing a VCF variant file. | [
"Run",
"cortex_var",
"run_calls",
".",
"pl",
"producing",
"a",
"VCF",
"variant",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L190-L242 |
223,879 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _index_local_ref | def _index_local_ref(fasta_file, cortex_dir, stampy_dir, kmers):
"""Pre-index a generated local reference sequence with cortex_var and stampy.
"""
base_out = os.path.splitext(fasta_file)[0]
cindexes = []
for kmer in kmers:
out_file = "{0}.k{1}.ctx".format(base_out, kmer)
if not file_... | python | def _index_local_ref(fasta_file, cortex_dir, stampy_dir, kmers):
"""Pre-index a generated local reference sequence with cortex_var and stampy.
"""
base_out = os.path.splitext(fasta_file)[0]
cindexes = []
for kmer in kmers:
out_file = "{0}.k{1}.ctx".format(base_out, kmer)
if not file_... | [
"def",
"_index_local_ref",
"(",
"fasta_file",
",",
"cortex_dir",
",",
"stampy_dir",
",",
"kmers",
")",
":",
"base_out",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"fasta_file",
")",
"[",
"0",
"]",
"cindexes",
"=",
"[",
"]",
"for",
"kmer",
"in",
"kme... | Pre-index a generated local reference sequence with cortex_var and stampy. | [
"Pre",
"-",
"index",
"a",
"generated",
"local",
"reference",
"sequence",
"with",
"cortex_var",
"and",
"stampy",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L255-L280 |
223,880 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _get_local_ref | def _get_local_ref(region, ref_file, out_vcf_base):
"""Retrieve a local FASTA file corresponding to the specified region.
"""
out_file = "{0}.fa".format(out_vcf_base)
if not file_exists(out_file):
with pysam.Fastafile(ref_file) as in_pysam:
contig, start, end = region
seq... | python | def _get_local_ref(region, ref_file, out_vcf_base):
"""Retrieve a local FASTA file corresponding to the specified region.
"""
out_file = "{0}.fa".format(out_vcf_base)
if not file_exists(out_file):
with pysam.Fastafile(ref_file) as in_pysam:
contig, start, end = region
seq... | [
"def",
"_get_local_ref",
"(",
"region",
",",
"ref_file",
",",
"out_vcf_base",
")",
":",
"out_file",
"=",
"\"{0}.fa\"",
".",
"format",
"(",
"out_vcf_base",
")",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"pysam",
".",
"Fastafile",
"(",
"... | Retrieve a local FASTA file corresponding to the specified region. | [
"Retrieve",
"a",
"local",
"FASTA",
"file",
"corresponding",
"to",
"the",
"specified",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L282-L296 |
223,881 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _get_fastq_in_region | def _get_fastq_in_region(region, align_bam, out_base):
"""Retrieve fastq files in region as single end.
Paired end is more complicated since pairs can map off the region, so focus
on local only assembly since we've previously used paired information for mapping.
"""
out_file = "{0}.fastq".format(out... | python | def _get_fastq_in_region(region, align_bam, out_base):
"""Retrieve fastq files in region as single end.
Paired end is more complicated since pairs can map off the region, so focus
on local only assembly since we've previously used paired information for mapping.
"""
out_file = "{0}.fastq".format(out... | [
"def",
"_get_fastq_in_region",
"(",
"region",
",",
"align_bam",
",",
"out_base",
")",
":",
"out_file",
"=",
"\"{0}.fastq\"",
".",
"format",
"(",
"out_base",
")",
"if",
"not",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"pysam",
".",
"Samfile",
"(",
"... | Retrieve fastq files in region as single end.
Paired end is more complicated since pairs can map off the region, so focus
on local only assembly since we've previously used paired information for mapping. | [
"Retrieve",
"fastq",
"files",
"in",
"region",
"as",
"single",
"end",
".",
"Paired",
"end",
"is",
"more",
"complicated",
"since",
"pairs",
"can",
"map",
"off",
"the",
"region",
"so",
"focus",
"on",
"local",
"only",
"assembly",
"since",
"we",
"ve",
"previous... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L298-L317 |
223,882 | bcbio/bcbio-nextgen | bcbio/variation/cortex.py | _count_fastq_reads | def _count_fastq_reads(in_fastq, min_reads):
"""Count the number of fastq reads in a file, stopping after reaching min_reads.
"""
with open(in_fastq) as in_handle:
items = list(itertools.takewhile(lambda i : i <= min_reads,
(i for i, _ in enumerate(FastqGener... | python | def _count_fastq_reads(in_fastq, min_reads):
"""Count the number of fastq reads in a file, stopping after reaching min_reads.
"""
with open(in_fastq) as in_handle:
items = list(itertools.takewhile(lambda i : i <= min_reads,
(i for i, _ in enumerate(FastqGener... | [
"def",
"_count_fastq_reads",
"(",
"in_fastq",
",",
"min_reads",
")",
":",
"with",
"open",
"(",
"in_fastq",
")",
"as",
"in_handle",
":",
"items",
"=",
"list",
"(",
"itertools",
".",
"takewhile",
"(",
"lambda",
"i",
":",
"i",
"<=",
"min_reads",
",",
"(",
... | Count the number of fastq reads in a file, stopping after reaching min_reads. | [
"Count",
"the",
"number",
"of",
"fastq",
"reads",
"in",
"a",
"file",
"stopping",
"after",
"reaching",
"min_reads",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L321-L327 |
223,883 | bcbio/bcbio-nextgen | bcbio/distributed/transaction.py | _move_file_with_sizecheck | def _move_file_with_sizecheck(tx_file, final_file):
"""Move transaction file to final location,
with size checks avoiding failed transfers.
Creates an empty file with '.bcbiotmp' extention in the destination
location, which serves as a flag. If a file like that is present,
it means that... | python | def _move_file_with_sizecheck(tx_file, final_file):
"""Move transaction file to final location,
with size checks avoiding failed transfers.
Creates an empty file with '.bcbiotmp' extention in the destination
location, which serves as a flag. If a file like that is present,
it means that... | [
"def",
"_move_file_with_sizecheck",
"(",
"tx_file",
",",
"final_file",
")",
":",
"#logger.debug(\"Moving %s to %s\" % (tx_file, final_file))",
"tmp_file",
"=",
"final_file",
"+",
"\".bcbiotmp\"",
"open",
"(",
"tmp_file",
",",
"'wb'",
")",
".",
"close",
"(",
")",
"want... | Move transaction file to final location,
with size checks avoiding failed transfers.
Creates an empty file with '.bcbiotmp' extention in the destination
location, which serves as a flag. If a file like that is present,
it means that transaction didn't finish successfully. | [
"Move",
"transaction",
"file",
"to",
"final",
"location",
"with",
"size",
"checks",
"avoiding",
"failed",
"transfers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/transaction.py#L102-L127 |
223,884 | bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _gatk_extract_reads_cl | def _gatk_extract_reads_cl(data, region, prep_params, tmp_dir):
"""Use GATK to extract reads from full BAM file.
"""
args = ["PrintReads",
"-L", region_to_gatk(region),
"-R", dd.get_ref_file(data),
"-I", data["work_bam"]]
# GATK3 back compatibility, need to specify an... | python | def _gatk_extract_reads_cl(data, region, prep_params, tmp_dir):
"""Use GATK to extract reads from full BAM file.
"""
args = ["PrintReads",
"-L", region_to_gatk(region),
"-R", dd.get_ref_file(data),
"-I", data["work_bam"]]
# GATK3 back compatibility, need to specify an... | [
"def",
"_gatk_extract_reads_cl",
"(",
"data",
",",
"region",
",",
"prep_params",
",",
"tmp_dir",
")",
":",
"args",
"=",
"[",
"\"PrintReads\"",
",",
"\"-L\"",
",",
"region_to_gatk",
"(",
"region",
")",
",",
"\"-R\"",
",",
"dd",
".",
"get_ref_file",
"(",
"da... | Use GATK to extract reads from full BAM file. | [
"Use",
"GATK",
"to",
"extract",
"reads",
"from",
"full",
"BAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L23-L34 |
223,885 | bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _piped_input_cl | def _piped_input_cl(data, region, tmp_dir, out_base_file, prep_params):
"""Retrieve the commandline for streaming input into preparation step.
"""
return data["work_bam"], _gatk_extract_reads_cl(data, region, prep_params, tmp_dir) | python | def _piped_input_cl(data, region, tmp_dir, out_base_file, prep_params):
"""Retrieve the commandline for streaming input into preparation step.
"""
return data["work_bam"], _gatk_extract_reads_cl(data, region, prep_params, tmp_dir) | [
"def",
"_piped_input_cl",
"(",
"data",
",",
"region",
",",
"tmp_dir",
",",
"out_base_file",
",",
"prep_params",
")",
":",
"return",
"data",
"[",
"\"work_bam\"",
"]",
",",
"_gatk_extract_reads_cl",
"(",
"data",
",",
"region",
",",
"prep_params",
",",
"tmp_dir",... | Retrieve the commandline for streaming input into preparation step. | [
"Retrieve",
"the",
"commandline",
"for",
"streaming",
"input",
"into",
"preparation",
"step",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L36-L39 |
223,886 | bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _piped_realign_gatk | def _piped_realign_gatk(data, region, cl, out_base_file, tmp_dir, prep_params):
"""Perform realignment with GATK, using input commandline.
GATK requires writing to disk and indexing before realignment.
"""
broad_runner = broad.runner_from_config(data["config"])
pa_bam = "%s-prealign%s" % os.path.spl... | python | def _piped_realign_gatk(data, region, cl, out_base_file, tmp_dir, prep_params):
"""Perform realignment with GATK, using input commandline.
GATK requires writing to disk and indexing before realignment.
"""
broad_runner = broad.runner_from_config(data["config"])
pa_bam = "%s-prealign%s" % os.path.spl... | [
"def",
"_piped_realign_gatk",
"(",
"data",
",",
"region",
",",
"cl",
",",
"out_base_file",
",",
"tmp_dir",
",",
"prep_params",
")",
":",
"broad_runner",
"=",
"broad",
".",
"runner_from_config",
"(",
"data",
"[",
"\"config\"",
"]",
")",
"pa_bam",
"=",
"\"%s-p... | Perform realignment with GATK, using input commandline.
GATK requires writing to disk and indexing before realignment. | [
"Perform",
"realignment",
"with",
"GATK",
"using",
"input",
"commandline",
".",
"GATK",
"requires",
"writing",
"to",
"disk",
"and",
"indexing",
"before",
"realignment",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L41-L58 |
223,887 | bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _get_prep_params | def _get_prep_params(data):
"""Retrieve configuration parameters with defaults for preparing BAM files.
"""
realign_param = dd.get_realign(data)
realign_param = "gatk" if realign_param is True else realign_param
return {"realign": realign_param} | python | def _get_prep_params(data):
"""Retrieve configuration parameters with defaults for preparing BAM files.
"""
realign_param = dd.get_realign(data)
realign_param = "gatk" if realign_param is True else realign_param
return {"realign": realign_param} | [
"def",
"_get_prep_params",
"(",
"data",
")",
":",
"realign_param",
"=",
"dd",
".",
"get_realign",
"(",
"data",
")",
"realign_param",
"=",
"\"gatk\"",
"if",
"realign_param",
"is",
"True",
"else",
"realign_param",
"return",
"{",
"\"realign\"",
":",
"realign_param"... | Retrieve configuration parameters with defaults for preparing BAM files. | [
"Retrieve",
"configuration",
"parameters",
"with",
"defaults",
"for",
"preparing",
"BAM",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L90-L95 |
223,888 | bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | _piped_bamprep_region | def _piped_bamprep_region(data, region, out_file, tmp_dir):
"""Do work of preparing BAM input file on the selected region.
"""
if _need_prep(data):
prep_params = _get_prep_params(data)
_piped_bamprep_region_gatk(data, region, prep_params, out_file, tmp_dir)
else:
raise ValueError... | python | def _piped_bamprep_region(data, region, out_file, tmp_dir):
"""Do work of preparing BAM input file on the selected region.
"""
if _need_prep(data):
prep_params = _get_prep_params(data)
_piped_bamprep_region_gatk(data, region, prep_params, out_file, tmp_dir)
else:
raise ValueError... | [
"def",
"_piped_bamprep_region",
"(",
"data",
",",
"region",
",",
"out_file",
",",
"tmp_dir",
")",
":",
"if",
"_need_prep",
"(",
"data",
")",
":",
"prep_params",
"=",
"_get_prep_params",
"(",
"data",
")",
"_piped_bamprep_region_gatk",
"(",
"data",
",",
"region"... | Do work of preparing BAM input file on the selected region. | [
"Do",
"work",
"of",
"preparing",
"BAM",
"input",
"file",
"on",
"the",
"selected",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L101-L108 |
223,889 | bcbio/bcbio-nextgen | bcbio/variation/bamprep.py | piped_bamprep | def piped_bamprep(data, region=None, out_file=None):
"""Perform full BAM preparation using pipes to avoid intermediate disk IO.
Handles realignment of original BAMs.
"""
data["region"] = region
if not _need_prep(data):
return [data]
else:
utils.safe_makedir(os.path.dirname(out_f... | python | def piped_bamprep(data, region=None, out_file=None):
"""Perform full BAM preparation using pipes to avoid intermediate disk IO.
Handles realignment of original BAMs.
"""
data["region"] = region
if not _need_prep(data):
return [data]
else:
utils.safe_makedir(os.path.dirname(out_f... | [
"def",
"piped_bamprep",
"(",
"data",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"data",
"[",
"\"region\"",
"]",
"=",
"region",
"if",
"not",
"_need_prep",
"(",
"data",
")",
":",
"return",
"[",
"data",
"]",
"else",
":",
"utils"... | Perform full BAM preparation using pipes to avoid intermediate disk IO.
Handles realignment of original BAMs. | [
"Perform",
"full",
"BAM",
"preparation",
"using",
"pipes",
"to",
"avoid",
"intermediate",
"disk",
"IO",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/bamprep.py#L110-L132 |
223,890 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | update_file | def update_file(finfo, sample_info, config):
"""Update file in Galaxy data libraries.
"""
if GalaxyInstance is None:
raise ImportError("Could not import bioblend.galaxy")
if "dir" not in config:
raise ValueError("Galaxy upload requires `dir` parameter in config specifying the "
... | python | def update_file(finfo, sample_info, config):
"""Update file in Galaxy data libraries.
"""
if GalaxyInstance is None:
raise ImportError("Could not import bioblend.galaxy")
if "dir" not in config:
raise ValueError("Galaxy upload requires `dir` parameter in config specifying the "
... | [
"def",
"update_file",
"(",
"finfo",
",",
"sample_info",
",",
"config",
")",
":",
"if",
"GalaxyInstance",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"\"Could not import bioblend.galaxy\"",
")",
"if",
"\"dir\"",
"not",
"in",
"config",
":",
"raise",
"ValueErro... | Update file in Galaxy data libraries. | [
"Update",
"file",
"in",
"Galaxy",
"data",
"libraries",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L28-L39 |
223,891 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _galaxy_tool_copy | def _galaxy_tool_copy(finfo, outputs):
"""Copy information directly to pre-defined outputs from a Galaxy tool.
XXX Needs generalization
"""
tool_map = {"align": "bam", "variants": "vcf.gz"}
for galaxy_key, finfo_type in tool_map.items():
if galaxy_key in outputs and finfo.get("type") == fin... | python | def _galaxy_tool_copy(finfo, outputs):
"""Copy information directly to pre-defined outputs from a Galaxy tool.
XXX Needs generalization
"""
tool_map = {"align": "bam", "variants": "vcf.gz"}
for galaxy_key, finfo_type in tool_map.items():
if galaxy_key in outputs and finfo.get("type") == fin... | [
"def",
"_galaxy_tool_copy",
"(",
"finfo",
",",
"outputs",
")",
":",
"tool_map",
"=",
"{",
"\"align\"",
":",
"\"bam\"",
",",
"\"variants\"",
":",
"\"vcf.gz\"",
"}",
"for",
"galaxy_key",
",",
"finfo_type",
"in",
"tool_map",
".",
"items",
"(",
")",
":",
"if",... | Copy information directly to pre-defined outputs from a Galaxy tool.
XXX Needs generalization | [
"Copy",
"information",
"directly",
"to",
"pre",
"-",
"defined",
"outputs",
"from",
"a",
"Galaxy",
"tool",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L41-L49 |
223,892 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _galaxy_library_upload | def _galaxy_library_upload(finfo, sample_info, config):
"""Upload results to galaxy library.
"""
folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
if finfo.get("type") == "directory":
storage_file = None
... | python | def _galaxy_library_upload(finfo, sample_info, config):
"""Upload results to galaxy library.
"""
folder_name = "%s_%s" % (config["fc_date"], config["fc_name"])
storage_dir = utils.safe_makedir(os.path.join(config["dir"], folder_name))
if finfo.get("type") == "directory":
storage_file = None
... | [
"def",
"_galaxy_library_upload",
"(",
"finfo",
",",
"sample_info",
",",
"config",
")",
":",
"folder_name",
"=",
"\"%s_%s\"",
"%",
"(",
"config",
"[",
"\"fc_date\"",
"]",
",",
"config",
"[",
"\"fc_name\"",
"]",
")",
"storage_dir",
"=",
"utils",
".",
"safe_mak... | Upload results to galaxy library. | [
"Upload",
"results",
"to",
"galaxy",
"library",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L51-L74 |
223,893 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _to_datalibrary_safe | def _to_datalibrary_safe(fname, gi, folder_name, sample_info, config):
"""Upload with retries for intermittent JSON failures.
"""
num_tries = 0
max_tries = 5
while 1:
try:
_to_datalibrary(fname, gi, folder_name, sample_info, config)
break
except (simplejson.sc... | python | def _to_datalibrary_safe(fname, gi, folder_name, sample_info, config):
"""Upload with retries for intermittent JSON failures.
"""
num_tries = 0
max_tries = 5
while 1:
try:
_to_datalibrary(fname, gi, folder_name, sample_info, config)
break
except (simplejson.sc... | [
"def",
"_to_datalibrary_safe",
"(",
"fname",
",",
"gi",
",",
"folder_name",
",",
"sample_info",
",",
"config",
")",
":",
"num_tries",
"=",
"0",
"max_tries",
"=",
"5",
"while",
"1",
":",
"try",
":",
"_to_datalibrary",
"(",
"fname",
",",
"gi",
",",
"folder... | Upload with retries for intermittent JSON failures. | [
"Upload",
"with",
"retries",
"for",
"intermittent",
"JSON",
"failures",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L76-L90 |
223,894 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _to_datalibrary | def _to_datalibrary(fname, gi, folder_name, sample_info, config):
"""Upload a file to a Galaxy data library in a project specific folder.
"""
library = _get_library(gi, sample_info, config)
libitems = gi.libraries.show_library(library.id, contents=True)
folder = _get_folder(gi, folder_name, library,... | python | def _to_datalibrary(fname, gi, folder_name, sample_info, config):
"""Upload a file to a Galaxy data library in a project specific folder.
"""
library = _get_library(gi, sample_info, config)
libitems = gi.libraries.show_library(library.id, contents=True)
folder = _get_folder(gi, folder_name, library,... | [
"def",
"_to_datalibrary",
"(",
"fname",
",",
"gi",
",",
"folder_name",
",",
"sample_info",
",",
"config",
")",
":",
"library",
"=",
"_get_library",
"(",
"gi",
",",
"sample_info",
",",
"config",
")",
"libitems",
"=",
"gi",
".",
"libraries",
".",
"show_libra... | Upload a file to a Galaxy data library in a project specific folder. | [
"Upload",
"a",
"file",
"to",
"a",
"Galaxy",
"data",
"library",
"in",
"a",
"project",
"specific",
"folder",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L92-L98 |
223,895 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _file_to_folder | def _file_to_folder(gi, fname, sample_info, libitems, library, folder):
"""Check if file exists on Galaxy, if not upload to specified folder.
"""
full_name = os.path.join(folder["name"], os.path.basename(fname))
# Handle VCF: Galaxy reports VCF files without the gzip extension
file_type = "vcf_bgzi... | python | def _file_to_folder(gi, fname, sample_info, libitems, library, folder):
"""Check if file exists on Galaxy, if not upload to specified folder.
"""
full_name = os.path.join(folder["name"], os.path.basename(fname))
# Handle VCF: Galaxy reports VCF files without the gzip extension
file_type = "vcf_bgzi... | [
"def",
"_file_to_folder",
"(",
"gi",
",",
"fname",
",",
"sample_info",
",",
"libitems",
",",
"library",
",",
"folder",
")",
":",
"full_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"folder",
"[",
"\"name\"",
"]",
",",
"os",
".",
"path",
".",
"base... | Check if file exists on Galaxy, if not upload to specified folder. | [
"Check",
"if",
"file",
"exists",
"on",
"Galaxy",
"if",
"not",
"upload",
"to",
"specified",
"folder",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L100-L118 |
223,896 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _get_folder | def _get_folder(gi, folder_name, library, libitems):
"""Retrieve or create a folder inside the library with the specified name.
"""
for item in libitems:
if item["type"] == "folder" and item["name"] == "/%s" % folder_name:
return item
return gi.libraries.create_folder(library.id, fol... | python | def _get_folder(gi, folder_name, library, libitems):
"""Retrieve or create a folder inside the library with the specified name.
"""
for item in libitems:
if item["type"] == "folder" and item["name"] == "/%s" % folder_name:
return item
return gi.libraries.create_folder(library.id, fol... | [
"def",
"_get_folder",
"(",
"gi",
",",
"folder_name",
",",
"library",
",",
"libitems",
")",
":",
"for",
"item",
"in",
"libitems",
":",
"if",
"item",
"[",
"\"type\"",
"]",
"==",
"\"folder\"",
"and",
"item",
"[",
"\"name\"",
"]",
"==",
"\"/%s\"",
"%",
"fo... | Retrieve or create a folder inside the library with the specified name. | [
"Retrieve",
"or",
"create",
"a",
"folder",
"inside",
"the",
"library",
"with",
"the",
"specified",
"name",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L120-L126 |
223,897 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _get_library | def _get_library(gi, sample_info, config):
"""Retrieve the appropriate data library for the current user.
"""
galaxy_lib = sample_info.get("galaxy_library",
config.get("galaxy_library"))
role = sample_info.get("galaxy_role",
config.get("galaxy_... | python | def _get_library(gi, sample_info, config):
"""Retrieve the appropriate data library for the current user.
"""
galaxy_lib = sample_info.get("galaxy_library",
config.get("galaxy_library"))
role = sample_info.get("galaxy_role",
config.get("galaxy_... | [
"def",
"_get_library",
"(",
"gi",
",",
"sample_info",
",",
"config",
")",
":",
"galaxy_lib",
"=",
"sample_info",
".",
"get",
"(",
"\"galaxy_library\"",
",",
"config",
".",
"get",
"(",
"\"galaxy_library\"",
")",
")",
"role",
"=",
"sample_info",
".",
"get",
... | Retrieve the appropriate data library for the current user. | [
"Retrieve",
"the",
"appropriate",
"data",
"library",
"for",
"the",
"current",
"user",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L130-L143 |
223,898 | bcbio/bcbio-nextgen | bcbio/upload/galaxy.py | _library_from_nglims | def _library_from_nglims(gi, sample_info, config):
"""Retrieve upload library from nglims specified user libraries.
"""
names = [config.get(x, "").strip() for x in ["lab_association", "researcher"]
if config.get(x)]
for name in names:
for ext in ["sequencing", "lab"]:
ch... | python | def _library_from_nglims(gi, sample_info, config):
"""Retrieve upload library from nglims specified user libraries.
"""
names = [config.get(x, "").strip() for x in ["lab_association", "researcher"]
if config.get(x)]
for name in names:
for ext in ["sequencing", "lab"]:
ch... | [
"def",
"_library_from_nglims",
"(",
"gi",
",",
"sample_info",
",",
"config",
")",
":",
"names",
"=",
"[",
"config",
".",
"get",
"(",
"x",
",",
"\"\"",
")",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"[",
"\"lab_association\"",
",",
"\"researcher\"",
"]"... | Retrieve upload library from nglims specified user libraries. | [
"Retrieve",
"upload",
"library",
"from",
"nglims",
"specified",
"user",
"libraries",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/galaxy.py#L163-L188 |
223,899 | bcbio/bcbio-nextgen | bcbio/rnaseq/ericscript.py | prepare_input_data | def prepare_input_data(config):
""" In case of disambiguation, we want to run fusion calling on
the disambiguated reads, which are in the work_bam file.
As EricScript accepts 2 fastq files as input, we need to convert
the .bam to 2 .fq files.
"""
if not dd.get_disambiguate(config):
retu... | python | def prepare_input_data(config):
""" In case of disambiguation, we want to run fusion calling on
the disambiguated reads, which are in the work_bam file.
As EricScript accepts 2 fastq files as input, we need to convert
the .bam to 2 .fq files.
"""
if not dd.get_disambiguate(config):
retu... | [
"def",
"prepare_input_data",
"(",
"config",
")",
":",
"if",
"not",
"dd",
".",
"get_disambiguate",
"(",
"config",
")",
":",
"return",
"dd",
".",
"get_input_sequence_files",
"(",
"config",
")",
"work_bam",
"=",
"dd",
".",
"get_work_bam",
"(",
"config",
")",
... | In case of disambiguation, we want to run fusion calling on
the disambiguated reads, which are in the work_bam file.
As EricScript accepts 2 fastq files as input, we need to convert
the .bam to 2 .fq files. | [
"In",
"case",
"of",
"disambiguation",
"we",
"want",
"to",
"run",
"fusion",
"calling",
"on",
"the",
"disambiguated",
"reads",
"which",
"are",
"in",
"the",
"work_bam",
"file",
".",
"As",
"EricScript",
"accepts",
"2",
"fastq",
"files",
"as",
"input",
"we",
"n... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/ericscript.py#L32-L47 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.