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,500 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | BlobHandle._chunk_iter | def _chunk_iter(self):
"""Iterator over the blob file."""
for chunk_offset in self._chunk_offsets():
yield self._download_chunk(chunk_offset=chunk_offset,
chunk_size=self._chunk_size) | python | def _chunk_iter(self):
"""Iterator over the blob file."""
for chunk_offset in self._chunk_offsets():
yield self._download_chunk(chunk_offset=chunk_offset,
chunk_size=self._chunk_size) | [
"def",
"_chunk_iter",
"(",
"self",
")",
":",
"for",
"chunk_offset",
"in",
"self",
".",
"_chunk_offsets",
"(",
")",
":",
"yield",
"self",
".",
"_download_chunk",
"(",
"chunk_offset",
"=",
"chunk_offset",
",",
"chunk_size",
"=",
"self",
".",
"_chunk_size",
")"... | Iterator over the blob file. | [
"Iterator",
"over",
"the",
"blob",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L172-L176 |
223,501 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.parse_remote | def parse_remote(cls, filename):
"""Parses a remote filename into bucket and key information.
Handles S3 with optional region name specified in key:
BUCKETNAME@REGIONNAME/KEY
"""
parts = filename.split("//")[-1].split("/", 1)
bucket, key = parts if len(parts) == 2 el... | python | def parse_remote(cls, filename):
"""Parses a remote filename into bucket and key information.
Handles S3 with optional region name specified in key:
BUCKETNAME@REGIONNAME/KEY
"""
parts = filename.split("//")[-1].split("/", 1)
bucket, key = parts if len(parts) == 2 el... | [
"def",
"parse_remote",
"(",
"cls",
",",
"filename",
")",
":",
"parts",
"=",
"filename",
".",
"split",
"(",
"\"//\"",
")",
"[",
"-",
"1",
"]",
".",
"split",
"(",
"\"/\"",
",",
"1",
")",
"bucket",
",",
"key",
"=",
"parts",
"if",
"len",
"(",
"parts"... | Parses a remote filename into bucket and key information.
Handles S3 with optional region name specified in key:
BUCKETNAME@REGIONNAME/KEY | [
"Parses",
"a",
"remote",
"filename",
"into",
"bucket",
"and",
"key",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L281-L294 |
223,502 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3._cl_aws_cli | def _cl_aws_cli(cls, file_info, region):
"""Command line required for download using the standard AWS
command line interface.
"""
s3file = cls._S3_FILE % {"bucket": file_info.bucket,
"key": file_info.key,
"region": ""}
... | python | def _cl_aws_cli(cls, file_info, region):
"""Command line required for download using the standard AWS
command line interface.
"""
s3file = cls._S3_FILE % {"bucket": file_info.bucket,
"key": file_info.key,
"region": ""}
... | [
"def",
"_cl_aws_cli",
"(",
"cls",
",",
"file_info",
",",
"region",
")",
":",
"s3file",
"=",
"cls",
".",
"_S3_FILE",
"%",
"{",
"\"bucket\"",
":",
"file_info",
".",
"bucket",
",",
"\"key\"",
":",
"file_info",
".",
"key",
",",
"\"region\"",
":",
"\"\"",
"... | Command line required for download using the standard AWS
command line interface. | [
"Command",
"line",
"required",
"for",
"download",
"using",
"the",
"standard",
"AWS",
"command",
"line",
"interface",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L297-L306 |
223,503 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3._cl_gof3r | def _cl_gof3r(file_info, region):
"""Command line required for download using gof3r."""
command = ["gof3r", "get", "--no-md5",
"-k", file_info.key,
"-b", file_info.bucket]
if region != "us-east-1":
command += ["--endpoint=s3-%s.amazonaws.com" % r... | python | def _cl_gof3r(file_info, region):
"""Command line required for download using gof3r."""
command = ["gof3r", "get", "--no-md5",
"-k", file_info.key,
"-b", file_info.bucket]
if region != "us-east-1":
command += ["--endpoint=s3-%s.amazonaws.com" % r... | [
"def",
"_cl_gof3r",
"(",
"file_info",
",",
"region",
")",
":",
"command",
"=",
"[",
"\"gof3r\"",
",",
"\"get\"",
",",
"\"--no-md5\"",
",",
"\"-k\"",
",",
"file_info",
".",
"key",
",",
"\"-b\"",
",",
"file_info",
".",
"bucket",
"]",
"if",
"region",
"!=",
... | Command line required for download using gof3r. | [
"Command",
"line",
"required",
"for",
"download",
"using",
"gof3r",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L309-L316 |
223,504 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.get_region | def get_region(cls, resource=None):
"""Retrieve region from standard environmental variables
or file name.
More information of the following link: http://goo.gl/Vb9Jky
"""
if resource:
resource_info = cls.parse_remote(resource)
if resource_info.region:
... | python | def get_region(cls, resource=None):
"""Retrieve region from standard environmental variables
or file name.
More information of the following link: http://goo.gl/Vb9Jky
"""
if resource:
resource_info = cls.parse_remote(resource)
if resource_info.region:
... | [
"def",
"get_region",
"(",
"cls",
",",
"resource",
"=",
"None",
")",
":",
"if",
"resource",
":",
"resource_info",
"=",
"cls",
".",
"parse_remote",
"(",
"resource",
")",
"if",
"resource_info",
".",
"region",
":",
"return",
"resource_info",
".",
"region",
"re... | Retrieve region from standard environmental variables
or file name.
More information of the following link: http://goo.gl/Vb9Jky | [
"Retrieve",
"region",
"from",
"standard",
"environmental",
"variables",
"or",
"file",
"name",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L338-L349 |
223,505 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.connect | def connect(cls, resource):
"""Connect to this Region's endpoint.
Returns a connection object pointing to the endpoint associated
to the received resource.
"""
import boto
return boto.s3.connect_to_region(cls.get_region(resource)) | python | def connect(cls, resource):
"""Connect to this Region's endpoint.
Returns a connection object pointing to the endpoint associated
to the received resource.
"""
import boto
return boto.s3.connect_to_region(cls.get_region(resource)) | [
"def",
"connect",
"(",
"cls",
",",
"resource",
")",
":",
"import",
"boto",
"return",
"boto",
".",
"s3",
".",
"connect_to_region",
"(",
"cls",
".",
"get_region",
"(",
"resource",
")",
")"
] | Connect to this Region's endpoint.
Returns a connection object pointing to the endpoint associated
to the received resource. | [
"Connect",
"to",
"this",
"Region",
"s",
"endpoint",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L362-L369 |
223,506 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AmazonS3.open | def open(cls, filename):
"""Return a handle like object for streaming from S3."""
import boto
file_info = cls.parse_remote(filename)
connection = cls.connect(filename)
try:
s3_bucket = connection.get_bucket(file_info.bucket)
except boto.exception.S3ResponseErr... | python | def open(cls, filename):
"""Return a handle like object for streaming from S3."""
import boto
file_info = cls.parse_remote(filename)
connection = cls.connect(filename)
try:
s3_bucket = connection.get_bucket(file_info.bucket)
except boto.exception.S3ResponseErr... | [
"def",
"open",
"(",
"cls",
",",
"filename",
")",
":",
"import",
"boto",
"file_info",
"=",
"cls",
".",
"parse_remote",
"(",
"filename",
")",
"connection",
"=",
"cls",
".",
"connect",
"(",
"filename",
")",
"try",
":",
"s3_bucket",
"=",
"connection",
".",
... | Return a handle like object for streaming from S3. | [
"Return",
"a",
"handle",
"like",
"object",
"for",
"streaming",
"from",
"S3",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L434-L453 |
223,507 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AzureBlob.parse_remote | def parse_remote(cls, filename):
"""Parses a remote filename into blob information."""
blob_file = cls._URL_FORMAT.search(filename)
return cls._REMOTE_FILE("blob",
storage=blob_file.group("storage"),
container=blob_file.group("conta... | python | def parse_remote(cls, filename):
"""Parses a remote filename into blob information."""
blob_file = cls._URL_FORMAT.search(filename)
return cls._REMOTE_FILE("blob",
storage=blob_file.group("storage"),
container=blob_file.group("conta... | [
"def",
"parse_remote",
"(",
"cls",
",",
"filename",
")",
":",
"blob_file",
"=",
"cls",
".",
"_URL_FORMAT",
".",
"search",
"(",
"filename",
")",
"return",
"cls",
".",
"_REMOTE_FILE",
"(",
"\"blob\"",
",",
"storage",
"=",
"blob_file",
".",
"group",
"(",
"\... | Parses a remote filename into blob information. | [
"Parses",
"a",
"remote",
"filename",
"into",
"blob",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L479-L485 |
223,508 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AzureBlob.connect | def connect(cls, resource):
"""Returns a connection object pointing to the endpoint
associated to the received resource.
"""
from azure import storage as azure_storage
file_info = cls.parse_remote(resource)
return azure_storage.BlobService(file_info.storage) | python | def connect(cls, resource):
"""Returns a connection object pointing to the endpoint
associated to the received resource.
"""
from azure import storage as azure_storage
file_info = cls.parse_remote(resource)
return azure_storage.BlobService(file_info.storage) | [
"def",
"connect",
"(",
"cls",
",",
"resource",
")",
":",
"from",
"azure",
"import",
"storage",
"as",
"azure_storage",
"file_info",
"=",
"cls",
".",
"parse_remote",
"(",
"resource",
")",
"return",
"azure_storage",
".",
"BlobService",
"(",
"file_info",
".",
"s... | Returns a connection object pointing to the endpoint
associated to the received resource. | [
"Returns",
"a",
"connection",
"object",
"pointing",
"to",
"the",
"endpoint",
"associated",
"to",
"the",
"received",
"resource",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L488-L494 |
223,509 | bcbio/bcbio-nextgen | bcbio/distributed/objectstore.py | AzureBlob.open | def open(cls, filename):
"""Provide a handle-like object for streaming."""
file_info = cls.parse_remote(filename)
blob_service = cls.connect(filename)
return BlobHandle(blob_service=blob_service,
container=file_info.container,
blob=file... | python | def open(cls, filename):
"""Provide a handle-like object for streaming."""
file_info = cls.parse_remote(filename)
blob_service = cls.connect(filename)
return BlobHandle(blob_service=blob_service,
container=file_info.container,
blob=file... | [
"def",
"open",
"(",
"cls",
",",
"filename",
")",
":",
"file_info",
"=",
"cls",
".",
"parse_remote",
"(",
"filename",
")",
"blob_service",
"=",
"cls",
".",
"connect",
"(",
"filename",
")",
"return",
"BlobHandle",
"(",
"blob_service",
"=",
"blob_service",
",... | Provide a handle-like object for streaming. | [
"Provide",
"a",
"handle",
"-",
"like",
"object",
"for",
"streaming",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L538-L545 |
223,510 | bcbio/bcbio-nextgen | bcbio/bam/cram.py | compress | def compress(in_bam, data):
"""Compress a BAM file to CRAM, providing indexed CRAM file.
Does 8 bin compression of quality score and read name removal
using bamUtils squeeze if `cram` specified:
http://genome.sph.umich.edu/wiki/BamUtil:_squeeze
Otherwise does `cram-lossless` which only converts t... | python | def compress(in_bam, data):
"""Compress a BAM file to CRAM, providing indexed CRAM file.
Does 8 bin compression of quality score and read name removal
using bamUtils squeeze if `cram` specified:
http://genome.sph.umich.edu/wiki/BamUtil:_squeeze
Otherwise does `cram-lossless` which only converts t... | [
"def",
"compress",
"(",
"in_bam",
",",
"data",
")",
":",
"out_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"archive\"",
")",
")",
"out_file",
"=",
"os",
".",
... | Compress a BAM file to CRAM, providing indexed CRAM file.
Does 8 bin compression of quality score and read name removal
using bamUtils squeeze if `cram` specified:
http://genome.sph.umich.edu/wiki/BamUtil:_squeeze
Otherwise does `cram-lossless` which only converts to CRAM. | [
"Compress",
"a",
"BAM",
"file",
"to",
"CRAM",
"providing",
"indexed",
"CRAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/cram.py#L14-L52 |
223,511 | bcbio/bcbio-nextgen | bcbio/bam/cram.py | index | def index(in_cram, config):
"""Ensure CRAM file has a .crai index file.
"""
out_file = in_cram + ".crai"
if not utils.file_uptodate(out_file, in_cram):
with file_transaction(config, in_cram + ".crai") as tx_out_file:
tx_in_file = os.path.splitext(tx_out_file)[0]
utils.sym... | python | def index(in_cram, config):
"""Ensure CRAM file has a .crai index file.
"""
out_file = in_cram + ".crai"
if not utils.file_uptodate(out_file, in_cram):
with file_transaction(config, in_cram + ".crai") as tx_out_file:
tx_in_file = os.path.splitext(tx_out_file)[0]
utils.sym... | [
"def",
"index",
"(",
"in_cram",
",",
"config",
")",
":",
"out_file",
"=",
"in_cram",
"+",
"\".crai\"",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"in_cram",
")",
":",
"with",
"file_transaction",
"(",
"config",
",",
"in_cram",
"+",
... | Ensure CRAM file has a .crai index file. | [
"Ensure",
"CRAM",
"file",
"has",
"a",
".",
"crai",
"index",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/cram.py#L54-L64 |
223,512 | bcbio/bcbio-nextgen | bcbio/bam/cram.py | to_bam | def to_bam(in_file, out_file, data):
"""Convert CRAM file into BAM.
"""
if not utils.file_uptodate(out_file, in_file):
with file_transaction(data, out_file) as tx_out_file:
cmd = ["samtools", "view", "-O", "BAM", "-o", tx_out_file, in_file]
do.run(cmd, "Convert CRAM to BAM")
... | python | def to_bam(in_file, out_file, data):
"""Convert CRAM file into BAM.
"""
if not utils.file_uptodate(out_file, in_file):
with file_transaction(data, out_file) as tx_out_file:
cmd = ["samtools", "view", "-O", "BAM", "-o", tx_out_file, in_file]
do.run(cmd, "Convert CRAM to BAM")
... | [
"def",
"to_bam",
"(",
"in_file",
",",
"out_file",
",",
"data",
")",
":",
"if",
"not",
"utils",
".",
"file_uptodate",
"(",
"out_file",
",",
"in_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"cmd"... | Convert CRAM file into BAM. | [
"Convert",
"CRAM",
"file",
"into",
"BAM",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/cram.py#L66-L74 |
223,513 | bcbio/bcbio-nextgen | bcbio/distributed/prun.py | start | def start(parallel, items, config, dirs=None, name=None, multiplier=1,
max_multicore=None):
"""Start a parallel cluster or machines to be used for running remote
functions.
Returns a function used to process, in parallel items with a given function.
Allows sharing of a single cluster across ... | python | def start(parallel, items, config, dirs=None, name=None, multiplier=1,
max_multicore=None):
"""Start a parallel cluster or machines to be used for running remote
functions.
Returns a function used to process, in parallel items with a given function.
Allows sharing of a single cluster across ... | [
"def",
"start",
"(",
"parallel",
",",
"items",
",",
"config",
",",
"dirs",
"=",
"None",
",",
"name",
"=",
"None",
",",
"multiplier",
"=",
"1",
",",
"max_multicore",
"=",
"None",
")",
":",
"if",
"name",
":",
"checkpoint_dir",
"=",
"utils",
".",
"safe_... | Start a parallel cluster or machines to be used for running remote
functions.
Returns a function used to process, in parallel items with a given function.
Allows sharing of a single cluster across multiple functions with
identical resource requirements. Uses local execution for non-distributed
clu... | [
"Start",
"a",
"parallel",
"cluster",
"or",
"machines",
"to",
"be",
"used",
"for",
"running",
"remote",
"functions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/prun.py#L12-L69 |
223,514 | bcbio/bcbio-nextgen | scripts/utils/broad_redo_analysis.py | recalibrate_quality | def recalibrate_quality(bam_file, sam_ref, dbsnp_file, picard_dir):
"""Recalibrate alignments with GATK and provide pdf summary.
"""
cl = ["picard_gatk_recalibrate.py", picard_dir, sam_ref, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl)
out_file = glob.glob("%s*... | python | def recalibrate_quality(bam_file, sam_ref, dbsnp_file, picard_dir):
"""Recalibrate alignments with GATK and provide pdf summary.
"""
cl = ["picard_gatk_recalibrate.py", picard_dir, sam_ref, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl)
out_file = glob.glob("%s*... | [
"def",
"recalibrate_quality",
"(",
"bam_file",
",",
"sam_ref",
",",
"dbsnp_file",
",",
"picard_dir",
")",
":",
"cl",
"=",
"[",
"\"picard_gatk_recalibrate.py\"",
",",
"picard_dir",
",",
"sam_ref",
",",
"bam_file",
"]",
"if",
"dbsnp_file",
":",
"cl",
".",
"appen... | Recalibrate alignments with GATK and provide pdf summary. | [
"Recalibrate",
"alignments",
"with",
"GATK",
"and",
"provide",
"pdf",
"summary",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/broad_redo_analysis.py#L98-L106 |
223,515 | bcbio/bcbio-nextgen | scripts/utils/broad_redo_analysis.py | run_genotyper | def run_genotyper(bam_file, ref_file, dbsnp_file, config_file):
"""Perform SNP genotyping and analysis using GATK.
"""
cl = ["gatk_genotyper.py", config_file, ref_file, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl) | python | def run_genotyper(bam_file, ref_file, dbsnp_file, config_file):
"""Perform SNP genotyping and analysis using GATK.
"""
cl = ["gatk_genotyper.py", config_file, ref_file, bam_file]
if dbsnp_file:
cl.append(dbsnp_file)
subprocess.check_call(cl) | [
"def",
"run_genotyper",
"(",
"bam_file",
",",
"ref_file",
",",
"dbsnp_file",
",",
"config_file",
")",
":",
"cl",
"=",
"[",
"\"gatk_genotyper.py\"",
",",
"config_file",
",",
"ref_file",
",",
"bam_file",
"]",
"if",
"dbsnp_file",
":",
"cl",
".",
"append",
"(",
... | Perform SNP genotyping and analysis using GATK. | [
"Perform",
"SNP",
"genotyping",
"and",
"analysis",
"using",
"GATK",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/broad_redo_analysis.py#L108-L114 |
223,516 | bcbio/bcbio-nextgen | bcbio/structural/battenberg.py | _do_run | def _do_run(paired):
"""Perform Battenberg caling with the paired dataset.
This purposely does not use a temporary directory for the output
since Battenberg does smart restarts.
"""
work_dir = _sv_workdir(paired.tumor_data)
out = _get_battenberg_out(paired, work_dir)
ignore_file = os.path.j... | python | def _do_run(paired):
"""Perform Battenberg caling with the paired dataset.
This purposely does not use a temporary directory for the output
since Battenberg does smart restarts.
"""
work_dir = _sv_workdir(paired.tumor_data)
out = _get_battenberg_out(paired, work_dir)
ignore_file = os.path.j... | [
"def",
"_do_run",
"(",
"paired",
")",
":",
"work_dir",
"=",
"_sv_workdir",
"(",
"paired",
".",
"tumor_data",
")",
"out",
"=",
"_get_battenberg_out",
"(",
"paired",
",",
"work_dir",
")",
"ignore_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
... | Perform Battenberg caling with the paired dataset.
This purposely does not use a temporary directory for the output
since Battenberg does smart restarts. | [
"Perform",
"Battenberg",
"caling",
"with",
"the",
"paired",
"dataset",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/battenberg.py#L40-L77 |
223,517 | bcbio/bcbio-nextgen | bcbio/structural/battenberg.py | _make_ignore_file | def _make_ignore_file(work_dir, ref_file, ignore_file, impute_file):
"""Create input files with chromosomes to ignore and gender loci.
"""
gl_file = os.path.join(work_dir, "gender_loci.txt")
chroms = set([])
with open(impute_file) as in_handle:
for line in in_handle:
chrom = line... | python | def _make_ignore_file(work_dir, ref_file, ignore_file, impute_file):
"""Create input files with chromosomes to ignore and gender loci.
"""
gl_file = os.path.join(work_dir, "gender_loci.txt")
chroms = set([])
with open(impute_file) as in_handle:
for line in in_handle:
chrom = line... | [
"def",
"_make_ignore_file",
"(",
"work_dir",
",",
"ref_file",
",",
"ignore_file",
",",
"impute_file",
")",
":",
"gl_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"gender_loci.txt\"",
")",
"chroms",
"=",
"set",
"(",
"[",
"]",
")",
"w... | Create input files with chromosomes to ignore and gender loci. | [
"Create",
"input",
"files",
"with",
"chromosomes",
"to",
"ignore",
"and",
"gender",
"loci",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/battenberg.py#L79-L101 |
223,518 | bcbio/bcbio-nextgen | bcbio/illumina/transfer.py | copy_flowcell | def copy_flowcell(dname, fastq_dir, sample_cfile, config):
"""Copy required files for processing using rsync, potentially to a remote server.
"""
with utils.chdir(dname):
reports = reduce(operator.add,
[glob.glob("*.xml"),
glob.glob("Data/Intensitie... | python | def copy_flowcell(dname, fastq_dir, sample_cfile, config):
"""Copy required files for processing using rsync, potentially to a remote server.
"""
with utils.chdir(dname):
reports = reduce(operator.add,
[glob.glob("*.xml"),
glob.glob("Data/Intensitie... | [
"def",
"copy_flowcell",
"(",
"dname",
",",
"fastq_dir",
",",
"sample_cfile",
",",
"config",
")",
":",
"with",
"utils",
".",
"chdir",
"(",
"dname",
")",
":",
"reports",
"=",
"reduce",
"(",
"operator",
".",
"add",
",",
"[",
"glob",
".",
"glob",
"(",
"\... | Copy required files for processing using rsync, potentially to a remote server. | [
"Copy",
"required",
"files",
"for",
"processing",
"using",
"rsync",
"potentially",
"to",
"a",
"remote",
"server",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/transfer.py#L12-L46 |
223,519 | bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | _umis_cmd | def _umis_cmd(data):
"""Return umis command line argument, with correct python and locale.
"""
return "%s %s %s" % (utils.locale_export(),
utils.get_program_python("umis"),
config_utils.get_program("umis", data["config"], default="umis")) | python | def _umis_cmd(data):
"""Return umis command line argument, with correct python and locale.
"""
return "%s %s %s" % (utils.locale_export(),
utils.get_program_python("umis"),
config_utils.get_program("umis", data["config"], default="umis")) | [
"def",
"_umis_cmd",
"(",
"data",
")",
":",
"return",
"\"%s %s %s\"",
"%",
"(",
"utils",
".",
"locale_export",
"(",
")",
",",
"utils",
".",
"get_program_python",
"(",
"\"umis\"",
")",
",",
"config_utils",
".",
"get_program",
"(",
"\"umis\"",
",",
"data",
"[... | Return umis command line argument, with correct python and locale. | [
"Return",
"umis",
"command",
"line",
"argument",
"with",
"correct",
"python",
"and",
"locale",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L119-L124 |
223,520 | bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | demultiplex_samples | def demultiplex_samples(data):
"""
demultiplex a fastqtransformed FASTQ file into separate sample barcode files
"""
work_dir = os.path.join(dd.get_work_dir(data), "umis")
sample_dir = os.path.join(work_dir, dd.get_sample_name(data))
demulti_dir = os.path.join(sample_dir, "demultiplexed")
fi... | python | def demultiplex_samples(data):
"""
demultiplex a fastqtransformed FASTQ file into separate sample barcode files
"""
work_dir = os.path.join(dd.get_work_dir(data), "umis")
sample_dir = os.path.join(work_dir, dd.get_sample_name(data))
demulti_dir = os.path.join(sample_dir, "demultiplexed")
fi... | [
"def",
"demultiplex_samples",
"(",
"data",
")",
":",
"work_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",
"get_work_dir",
"(",
"data",
")",
",",
"\"umis\"",
")",
"sample_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"dd... | demultiplex a fastqtransformed FASTQ file into separate sample barcode files | [
"demultiplex",
"a",
"fastqtransformed",
"FASTQ",
"file",
"into",
"separate",
"sample",
"barcode",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L359-L391 |
223,521 | bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | split_demultiplexed_sampledata | def split_demultiplexed_sampledata(data, demultiplexed):
"""
splits demultiplexed samples into separate entries in the global sample
datadict
"""
datadicts = []
samplename = dd.get_sample_name(data)
for fastq in demultiplexed:
barcode = os.path.basename(fastq).split(".")[0]
d... | python | def split_demultiplexed_sampledata(data, demultiplexed):
"""
splits demultiplexed samples into separate entries in the global sample
datadict
"""
datadicts = []
samplename = dd.get_sample_name(data)
for fastq in demultiplexed:
barcode = os.path.basename(fastq).split(".")[0]
d... | [
"def",
"split_demultiplexed_sampledata",
"(",
"data",
",",
"demultiplexed",
")",
":",
"datadicts",
"=",
"[",
"]",
"samplename",
"=",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
"for",
"fastq",
"in",
"demultiplexed",
":",
"barcode",
"=",
"os",
".",
"path"... | splits demultiplexed samples into separate entries in the global sample
datadict | [
"splits",
"demultiplexed",
"samples",
"into",
"separate",
"entries",
"in",
"the",
"global",
"sample",
"datadict"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L393-L409 |
223,522 | bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | is_transformed | def is_transformed(fastq):
"""
check the first 100 reads to see if a FASTQ file has already been transformed
by umis
"""
with open_fastq(fastq) as in_handle:
for line in islice(in_handle, 400):
if "UMI_" in line:
return True
return False | python | def is_transformed(fastq):
"""
check the first 100 reads to see if a FASTQ file has already been transformed
by umis
"""
with open_fastq(fastq) as in_handle:
for line in islice(in_handle, 400):
if "UMI_" in line:
return True
return False | [
"def",
"is_transformed",
"(",
"fastq",
")",
":",
"with",
"open_fastq",
"(",
"fastq",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"islice",
"(",
"in_handle",
",",
"400",
")",
":",
"if",
"\"UMI_\"",
"in",
"line",
":",
"return",
"True",
"return",
"F... | check the first 100 reads to see if a FASTQ file has already been transformed
by umis | [
"check",
"the",
"first",
"100",
"reads",
"to",
"see",
"if",
"a",
"FASTQ",
"file",
"has",
"already",
"been",
"transformed",
"by",
"umis"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L504-L514 |
223,523 | bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | SparseMatrix.read | def read(self, filename, rowprefix=None, colprefix=None, delim=":"):
"""read a sparse matrix, loading row and column name files. if
specified, will add a prefix to the row or column names"""
self.matrix = scipy.io.mmread(filename)
with open(filename + ".rownames") as in_handle:
... | python | def read(self, filename, rowprefix=None, colprefix=None, delim=":"):
"""read a sparse matrix, loading row and column name files. if
specified, will add a prefix to the row or column names"""
self.matrix = scipy.io.mmread(filename)
with open(filename + ".rownames") as in_handle:
... | [
"def",
"read",
"(",
"self",
",",
"filename",
",",
"rowprefix",
"=",
"None",
",",
"colprefix",
"=",
"None",
",",
"delim",
"=",
"\":\"",
")",
":",
"self",
".",
"matrix",
"=",
"scipy",
".",
"io",
".",
"mmread",
"(",
"filename",
")",
"with",
"open",
"(... | read a sparse matrix, loading row and column name files. if
specified, will add a prefix to the row or column names | [
"read",
"a",
"sparse",
"matrix",
"loading",
"row",
"and",
"column",
"name",
"files",
".",
"if",
"specified",
"will",
"add",
"a",
"prefix",
"to",
"the",
"row",
"or",
"column",
"names"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L42-L54 |
223,524 | bcbio/bcbio-nextgen | bcbio/rnaseq/umi.py | SparseMatrix.write | def write(self, filename):
"""read a sparse matrix, loading row and column name files"""
if file_exists(filename):
return filename
out_files = [filename, filename + ".rownames", filename + ".colnames"]
with file_transaction(out_files) as tx_out_files:
with open(tx... | python | def write(self, filename):
"""read a sparse matrix, loading row and column name files"""
if file_exists(filename):
return filename
out_files = [filename, filename + ".rownames", filename + ".colnames"]
with file_transaction(out_files) as tx_out_files:
with open(tx... | [
"def",
"write",
"(",
"self",
",",
"filename",
")",
":",
"if",
"file_exists",
"(",
"filename",
")",
":",
"return",
"filename",
"out_files",
"=",
"[",
"filename",
",",
"filename",
"+",
"\".rownames\"",
",",
"filename",
"+",
"\".colnames\"",
"]",
"with",
"fil... | read a sparse matrix, loading row and column name files | [
"read",
"a",
"sparse",
"matrix",
"loading",
"row",
"and",
"column",
"name",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/umi.py#L56-L66 |
223,525 | bcbio/bcbio-nextgen | bcbio/srna/sample.py | sample_annotation | def sample_annotation(data):
"""
Annotate miRNAs using miRBase database with seqbuster tool
"""
names = data["rgnames"]['sample']
tools = dd.get_expression_caller(data)
work_dir = os.path.join(dd.get_work_dir(data), "mirbase")
out_dir = os.path.join(work_dir, names)
utils.safe_makedir(ou... | python | def sample_annotation(data):
"""
Annotate miRNAs using miRBase database with seqbuster tool
"""
names = data["rgnames"]['sample']
tools = dd.get_expression_caller(data)
work_dir = os.path.join(dd.get_work_dir(data), "mirbase")
out_dir = os.path.join(work_dir, names)
utils.safe_makedir(ou... | [
"def",
"sample_annotation",
"(",
"data",
")",
":",
"names",
"=",
"data",
"[",
"\"rgnames\"",
"]",
"[",
"'sample'",
"]",
"tools",
"=",
"dd",
".",
"get_expression_caller",
"(",
"data",
")",
"work_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dd",
".",... | Annotate miRNAs using miRBase database with seqbuster tool | [
"Annotate",
"miRNAs",
"using",
"miRBase",
"database",
"with",
"seqbuster",
"tool"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L106-L149 |
223,526 | bcbio/bcbio-nextgen | bcbio/srna/sample.py | _prepare_file | def _prepare_file(fn, out_dir):
"""Cut the beginning of the reads to avoid detection of miRNAs"""
atropos = _get_atropos()
cmd = "{atropos} trim --max-reads 500000 -u 22 -se {fn} -o {tx_file}"
out_file = os.path.join(out_dir, append_stem(os.path.basename(fn), "end"))
if file_exists(out_file):
... | python | def _prepare_file(fn, out_dir):
"""Cut the beginning of the reads to avoid detection of miRNAs"""
atropos = _get_atropos()
cmd = "{atropos} trim --max-reads 500000 -u 22 -se {fn} -o {tx_file}"
out_file = os.path.join(out_dir, append_stem(os.path.basename(fn), "end"))
if file_exists(out_file):
... | [
"def",
"_prepare_file",
"(",
"fn",
",",
"out_dir",
")",
":",
"atropos",
"=",
"_get_atropos",
"(",
")",
"cmd",
"=",
"\"{atropos} trim --max-reads 500000 -u 22 -se {fn} -o {tx_file}\"",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"append_st... | Cut the beginning of the reads to avoid detection of miRNAs | [
"Cut",
"the",
"beginning",
"of",
"the",
"reads",
"to",
"avoid",
"detection",
"of",
"miRNAs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L151-L160 |
223,527 | bcbio/bcbio-nextgen | bcbio/srna/sample.py | _collapse | def _collapse(in_file):
"""
Collpase reads into unique sequences with seqcluster
"""
seqcluster = op.join(utils.get_bcbio_bin(), "seqcluster")
out_file = "%s.fastq" % utils.splitext_plus(append_stem(in_file, "_trimmed"))[0]
out_dir = os.path.dirname(in_file)
if file_exists(out_file):
... | python | def _collapse(in_file):
"""
Collpase reads into unique sequences with seqcluster
"""
seqcluster = op.join(utils.get_bcbio_bin(), "seqcluster")
out_file = "%s.fastq" % utils.splitext_plus(append_stem(in_file, "_trimmed"))[0]
out_dir = os.path.dirname(in_file)
if file_exists(out_file):
... | [
"def",
"_collapse",
"(",
"in_file",
")",
":",
"seqcluster",
"=",
"op",
".",
"join",
"(",
"utils",
".",
"get_bcbio_bin",
"(",
")",
",",
"\"seqcluster\"",
")",
"out_file",
"=",
"\"%s.fastq\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"append_stem",
"(",
"in_... | Collpase reads into unique sequences with seqcluster | [
"Collpase",
"reads",
"into",
"unique",
"sequences",
"with",
"seqcluster"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L180-L191 |
223,528 | bcbio/bcbio-nextgen | bcbio/srna/sample.py | _summary | def _summary(in_file):
"""
Calculate size distribution after adapter removal
"""
data = Counter()
out_file = in_file + "_size_stats"
if file_exists(out_file):
return out_file
with open(in_file) as in_handle:
for line in in_handle:
counts = int(line.strip().split("... | python | def _summary(in_file):
"""
Calculate size distribution after adapter removal
"""
data = Counter()
out_file = in_file + "_size_stats"
if file_exists(out_file):
return out_file
with open(in_file) as in_handle:
for line in in_handle:
counts = int(line.strip().split("... | [
"def",
"_summary",
"(",
"in_file",
")",
":",
"data",
"=",
"Counter",
"(",
")",
"out_file",
"=",
"in_file",
"+",
"\"_size_stats\"",
"if",
"file_exists",
"(",
"out_file",
")",
":",
"return",
"out_file",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",... | Calculate size distribution after adapter removal | [
"Calculate",
"size",
"distribution",
"after",
"adapter",
"removal"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L193-L213 |
223,529 | bcbio/bcbio-nextgen | bcbio/srna/sample.py | _mirtop | def _mirtop(input_fn, sps, db, out_dir, config):
"""
Convert to GFF3 standard format
"""
hairpin = os.path.join(db, "hairpin.fa")
gtf = os.path.join(db, "mirbase.gff3")
if not file_exists(hairpin) or not file_exists(gtf):
logger.warning("%s or %s are not installed. Skipping." % (hairpin,... | python | def _mirtop(input_fn, sps, db, out_dir, config):
"""
Convert to GFF3 standard format
"""
hairpin = os.path.join(db, "hairpin.fa")
gtf = os.path.join(db, "mirbase.gff3")
if not file_exists(hairpin) or not file_exists(gtf):
logger.warning("%s or %s are not installed. Skipping." % (hairpin,... | [
"def",
"_mirtop",
"(",
"input_fn",
",",
"sps",
",",
"db",
",",
"out_dir",
",",
"config",
")",
":",
"hairpin",
"=",
"os",
".",
"path",
".",
"join",
"(",
"db",
",",
"\"hairpin.fa\"",
")",
"gtf",
"=",
"os",
".",
"path",
".",
"join",
"(",
"db",
",",
... | Convert to GFF3 standard format | [
"Convert",
"to",
"GFF3",
"standard",
"format"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L254-L281 |
223,530 | bcbio/bcbio-nextgen | bcbio/srna/sample.py | _trna_annotation | def _trna_annotation(data):
"""
use tDRmapper to quantify tRNAs
"""
trna_ref = op.join(dd.get_srna_trna_file(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "trna", name))
in_file = op.basename(data["clean_fastq"])
tdrmapper = os.p... | python | def _trna_annotation(data):
"""
use tDRmapper to quantify tRNAs
"""
trna_ref = op.join(dd.get_srna_trna_file(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "trna", name))
in_file = op.basename(data["clean_fastq"])
tdrmapper = os.p... | [
"def",
"_trna_annotation",
"(",
"data",
")",
":",
"trna_ref",
"=",
"op",
".",
"join",
"(",
"dd",
".",
"get_srna_trna_file",
"(",
"data",
")",
")",
"name",
"=",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
"work_dir",
"=",
"utils",
".",
"safe_makedir",... | use tDRmapper to quantify tRNAs | [
"use",
"tDRmapper",
"to",
"quantify",
"tRNAs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L283-L305 |
223,531 | bcbio/bcbio-nextgen | bcbio/srna/sample.py | _mint_trna_annotation | def _mint_trna_annotation(data):
"""
use MINTmap to quantify tRNAs
"""
trna_lookup = op.join(dd.get_srna_mint_lookup(data))
trna_space = op.join(dd.get_srna_mint_space(data))
trna_other = op.join(dd.get_srna_mint_other(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(... | python | def _mint_trna_annotation(data):
"""
use MINTmap to quantify tRNAs
"""
trna_lookup = op.join(dd.get_srna_mint_lookup(data))
trna_space = op.join(dd.get_srna_mint_space(data))
trna_other = op.join(dd.get_srna_mint_other(data))
name = dd.get_sample_name(data)
work_dir = utils.safe_makedir(... | [
"def",
"_mint_trna_annotation",
"(",
"data",
")",
":",
"trna_lookup",
"=",
"op",
".",
"join",
"(",
"dd",
".",
"get_srna_mint_lookup",
"(",
"data",
")",
")",
"trna_space",
"=",
"op",
".",
"join",
"(",
"dd",
".",
"get_srna_mint_space",
"(",
"data",
")",
")... | use MINTmap to quantify tRNAs | [
"use",
"MINTmap",
"to",
"quantify",
"tRNAs"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/sample.py#L307-L334 |
223,532 | bcbio/bcbio-nextgen | bcbio/bam/fasta.py | sequence_length | def sequence_length(fasta):
"""
return a dict of the lengths of sequences in a fasta file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = {record.id: len(record) for record in sequences}
return records | python | def sequence_length(fasta):
"""
return a dict of the lengths of sequences in a fasta file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = {record.id: len(record) for record in sequences}
return records | [
"def",
"sequence_length",
"(",
"fasta",
")",
":",
"sequences",
"=",
"SeqIO",
".",
"parse",
"(",
"fasta",
",",
"\"fasta\"",
")",
"records",
"=",
"{",
"record",
".",
"id",
":",
"len",
"(",
"record",
")",
"for",
"record",
"in",
"sequences",
"}",
"return",... | return a dict of the lengths of sequences in a fasta file | [
"return",
"a",
"dict",
"of",
"the",
"lengths",
"of",
"sequences",
"in",
"a",
"fasta",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fasta.py#L5-L11 |
223,533 | bcbio/bcbio-nextgen | bcbio/bam/fasta.py | sequence_names | def sequence_names(fasta):
"""
return a list of the sequence IDs in a FASTA file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = [record.id for record in sequences]
return records | python | def sequence_names(fasta):
"""
return a list of the sequence IDs in a FASTA file
"""
sequences = SeqIO.parse(fasta, "fasta")
records = [record.id for record in sequences]
return records | [
"def",
"sequence_names",
"(",
"fasta",
")",
":",
"sequences",
"=",
"SeqIO",
".",
"parse",
"(",
"fasta",
",",
"\"fasta\"",
")",
"records",
"=",
"[",
"record",
".",
"id",
"for",
"record",
"in",
"sequences",
"]",
"return",
"records"
] | return a list of the sequence IDs in a FASTA file | [
"return",
"a",
"list",
"of",
"the",
"sequence",
"IDs",
"in",
"a",
"FASTA",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fasta.py#L13-L19 |
223,534 | bcbio/bcbio-nextgen | bcbio/srna/mirdeep.py | _prepare_inputs | def _prepare_inputs(ma_fn, bam_file, out_dir):
"""
Convert to fastq with counts
"""
fixed_fa = os.path.join(out_dir, "file_reads.fa")
count_name =dict()
with file_transaction(fixed_fa) as out_tx:
with open(out_tx, 'w') as out_handle:
with open(ma_fn) as in_handle:
... | python | def _prepare_inputs(ma_fn, bam_file, out_dir):
"""
Convert to fastq with counts
"""
fixed_fa = os.path.join(out_dir, "file_reads.fa")
count_name =dict()
with file_transaction(fixed_fa) as out_tx:
with open(out_tx, 'w') as out_handle:
with open(ma_fn) as in_handle:
... | [
"def",
"_prepare_inputs",
"(",
"ma_fn",
",",
"bam_file",
",",
"out_dir",
")",
":",
"fixed_fa",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"file_reads.fa\"",
")",
"count_name",
"=",
"dict",
"(",
")",
"with",
"file_transaction",
"(",
"fixed_... | Convert to fastq with counts | [
"Convert",
"to",
"fastq",
"with",
"counts"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirdeep.py#L52-L74 |
223,535 | bcbio/bcbio-nextgen | bcbio/srna/mirdeep.py | _parse_novel | def _parse_novel(csv_file, sps="new"):
"""Create input of novel miRNAs from miRDeep2"""
read = 0
seen = set()
safe_makedir("novel")
with open("novel/hairpin.fa", "w") as fa_handle, open("novel/miRNA.str", "w") as str_handle:
with open(csv_file) as in_handle:
for line in in_handle... | python | def _parse_novel(csv_file, sps="new"):
"""Create input of novel miRNAs from miRDeep2"""
read = 0
seen = set()
safe_makedir("novel")
with open("novel/hairpin.fa", "w") as fa_handle, open("novel/miRNA.str", "w") as str_handle:
with open(csv_file) as in_handle:
for line in in_handle... | [
"def",
"_parse_novel",
"(",
"csv_file",
",",
"sps",
"=",
"\"new\"",
")",
":",
"read",
"=",
"0",
"seen",
"=",
"set",
"(",
")",
"safe_makedir",
"(",
"\"novel\"",
")",
"with",
"open",
"(",
"\"novel/hairpin.fa\"",
",",
"\"w\"",
")",
"as",
"fa_handle",
",",
... | Create input of novel miRNAs from miRDeep2 | [
"Create",
"input",
"of",
"novel",
"miRNAs",
"from",
"miRDeep2"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/srna/mirdeep.py#L76-L105 |
223,536 | bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _run_smoove | def _run_smoove(full_bams, sr_bams, disc_bams, work_dir, items):
"""Run lumpy-sv using smoove.
"""
batch = sshared.get_cur_batch(items)
ext = "-%s-svs" % batch if batch else "-svs"
name = "%s%s" % (dd.get_sample_name(items[0]), ext)
out_file = os.path.join(work_dir, "%s-smoove.genotyped.vcf.gz" ... | python | def _run_smoove(full_bams, sr_bams, disc_bams, work_dir, items):
"""Run lumpy-sv using smoove.
"""
batch = sshared.get_cur_batch(items)
ext = "-%s-svs" % batch if batch else "-svs"
name = "%s%s" % (dd.get_sample_name(items[0]), ext)
out_file = os.path.join(work_dir, "%s-smoove.genotyped.vcf.gz" ... | [
"def",
"_run_smoove",
"(",
"full_bams",
",",
"sr_bams",
",",
"disc_bams",
",",
"work_dir",
",",
"items",
")",
":",
"batch",
"=",
"sshared",
".",
"get_cur_batch",
"(",
"items",
")",
"ext",
"=",
"\"-%s-svs\"",
"%",
"batch",
"if",
"batch",
"else",
"\"-svs\"",... | Run lumpy-sv using smoove. | [
"Run",
"lumpy",
"-",
"sv",
"using",
"smoove",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L28-L71 |
223,537 | bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _filter_by_support | def _filter_by_support(in_file, data):
"""Filter call file based on supporting evidence, adding FILTER annotations to VCF.
Filters based on the following criteria:
- Minimum read support for the call (SU = total support)
- Large calls need split read evidence.
"""
rc_filter = ("FORMAT/SU < ... | python | def _filter_by_support(in_file, data):
"""Filter call file based on supporting evidence, adding FILTER annotations to VCF.
Filters based on the following criteria:
- Minimum read support for the call (SU = total support)
- Large calls need split read evidence.
"""
rc_filter = ("FORMAT/SU < ... | [
"def",
"_filter_by_support",
"(",
"in_file",
",",
"data",
")",
":",
"rc_filter",
"=",
"(",
"\"FORMAT/SU < 4 || \"",
"\"(FORMAT/SR == 0 && FORMAT/SU < 15 && ABS(SVLEN)>50000) || \"",
"\"(FORMAT/SR == 0 && FORMAT/SU < 5 && ABS(SVLEN)<2000) || \"",
"\"(FORMAT/SR == 0 && FORMAT/SU < 15 && AB... | Filter call file based on supporting evidence, adding FILTER annotations to VCF.
Filters based on the following criteria:
- Minimum read support for the call (SU = total support)
- Large calls need split read evidence. | [
"Filter",
"call",
"file",
"based",
"on",
"supporting",
"evidence",
"adding",
"FILTER",
"annotations",
"to",
"VCF",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L104-L116 |
223,538 | bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _filter_by_background | def _filter_by_background(base_name, back_samples, gt_vcfs, data):
"""Filter base samples, marking any also present in the background.
"""
filtname = "InBackground"
filtdoc = "Variant also present in background samples with same genotype"
orig_vcf = gt_vcfs[base_name]
out_file = "%s-backfilter.v... | python | def _filter_by_background(base_name, back_samples, gt_vcfs, data):
"""Filter base samples, marking any also present in the background.
"""
filtname = "InBackground"
filtdoc = "Variant also present in background samples with same genotype"
orig_vcf = gt_vcfs[base_name]
out_file = "%s-backfilter.v... | [
"def",
"_filter_by_background",
"(",
"base_name",
",",
"back_samples",
",",
"gt_vcfs",
",",
"data",
")",
":",
"filtname",
"=",
"\"InBackground\"",
"filtdoc",
"=",
"\"Variant also present in background samples with same genotype\"",
"orig_vcf",
"=",
"gt_vcfs",
"[",
"base_n... | Filter base samples, marking any also present in the background. | [
"Filter",
"base",
"samples",
"marking",
"any",
"also",
"present",
"in",
"the",
"background",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L118-L139 |
223,539 | bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _genotype_in_background | def _genotype_in_background(rec, base_name, back_samples):
"""Check if the genotype in the record of interest is present in the background records.
"""
def passes(rec):
return not rec.FILTER or len(rec.FILTER) == 0
return (passes(rec) and
any(rec.genotype(base_name).gt_alleles == rec... | python | def _genotype_in_background(rec, base_name, back_samples):
"""Check if the genotype in the record of interest is present in the background records.
"""
def passes(rec):
return not rec.FILTER or len(rec.FILTER) == 0
return (passes(rec) and
any(rec.genotype(base_name).gt_alleles == rec... | [
"def",
"_genotype_in_background",
"(",
"rec",
",",
"base_name",
",",
"back_samples",
")",
":",
"def",
"passes",
"(",
"rec",
")",
":",
"return",
"not",
"rec",
".",
"FILTER",
"or",
"len",
"(",
"rec",
".",
"FILTER",
")",
"==",
"0",
"return",
"(",
"passes"... | Check if the genotype in the record of interest is present in the background records. | [
"Check",
"if",
"the",
"genotype",
"in",
"the",
"record",
"of",
"interest",
"is",
"present",
"in",
"the",
"background",
"records",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L141-L148 |
223,540 | bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | run | def run(items):
"""Perform detection of structural variations with lumpy.
"""
paired = vcfutils.get_paired(items)
work_dir = _sv_workdir(paired.tumor_data if paired and paired.tumor_data else items[0])
previous_evidence = {}
full_bams, sr_bams, disc_bams = [], [], []
for data in items:
... | python | def run(items):
"""Perform detection of structural variations with lumpy.
"""
paired = vcfutils.get_paired(items)
work_dir = _sv_workdir(paired.tumor_data if paired and paired.tumor_data else items[0])
previous_evidence = {}
full_bams, sr_bams, disc_bams = [], [], []
for data in items:
... | [
"def",
"run",
"(",
"items",
")",
":",
"paired",
"=",
"vcfutils",
".",
"get_paired",
"(",
"items",
")",
"work_dir",
"=",
"_sv_workdir",
"(",
"paired",
".",
"tumor_data",
"if",
"paired",
"and",
"paired",
".",
"tumor_data",
"else",
"items",
"[",
"0",
"]",
... | Perform detection of structural variations with lumpy. | [
"Perform",
"detection",
"of",
"structural",
"variations",
"with",
"lumpy",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L154-L200 |
223,541 | bcbio/bcbio-nextgen | bcbio/structural/lumpy.py | _bedpes_from_cnv_caller | def _bedpes_from_cnv_caller(data, work_dir):
"""Retrieve BEDPEs deletion and duplications from CNV callers.
Currently integrates with CNVkit.
"""
supported = set(["cnvkit"])
cns_file = None
for sv in data.get("sv", []):
if sv["variantcaller"] in supported and "cns" in sv and "lumpy_usec... | python | def _bedpes_from_cnv_caller(data, work_dir):
"""Retrieve BEDPEs deletion and duplications from CNV callers.
Currently integrates with CNVkit.
"""
supported = set(["cnvkit"])
cns_file = None
for sv in data.get("sv", []):
if sv["variantcaller"] in supported and "cns" in sv and "lumpy_usec... | [
"def",
"_bedpes_from_cnv_caller",
"(",
"data",
",",
"work_dir",
")",
":",
"supported",
"=",
"set",
"(",
"[",
"\"cnvkit\"",
"]",
")",
"cns_file",
"=",
"None",
"for",
"sv",
"in",
"data",
".",
"get",
"(",
"\"sv\"",
",",
"[",
"]",
")",
":",
"if",
"sv",
... | Retrieve BEDPEs deletion and duplications from CNV callers.
Currently integrates with CNVkit. | [
"Retrieve",
"BEDPEs",
"deletion",
"and",
"duplications",
"from",
"CNV",
"callers",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/lumpy.py#L202-L229 |
223,542 | bcbio/bcbio-nextgen | bcbio/setpath.py | _prepend | def _prepend(original, to_prepend):
"""Prepend paths in a string representing a list of paths to another.
original and to_prepend are expected to be strings representing
os.pathsep-separated lists of filepaths.
If to_prepend is None, original is returned.
The list of paths represented in the retu... | python | def _prepend(original, to_prepend):
"""Prepend paths in a string representing a list of paths to another.
original and to_prepend are expected to be strings representing
os.pathsep-separated lists of filepaths.
If to_prepend is None, original is returned.
The list of paths represented in the retu... | [
"def",
"_prepend",
"(",
"original",
",",
"to_prepend",
")",
":",
"if",
"to_prepend",
"is",
"None",
":",
"return",
"original",
"sep",
"=",
"os",
".",
"pathsep",
"def",
"split_path_value",
"(",
"path_value",
")",
":",
"return",
"[",
"]",
"if",
"path_value",
... | Prepend paths in a string representing a list of paths to another.
original and to_prepend are expected to be strings representing
os.pathsep-separated lists of filepaths.
If to_prepend is None, original is returned.
The list of paths represented in the returned value consists of the first of
occ... | [
"Prepend",
"paths",
"in",
"a",
"string",
"representing",
"a",
"list",
"of",
"paths",
"to",
"another",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/setpath.py#L10-L48 |
223,543 | bcbio/bcbio-nextgen | bcbio/setpath.py | remove_bcbiopath | def remove_bcbiopath():
"""Remove bcbio internal path from first element in PATH.
Useful when we need to access remote programs, like Java 7 for older
installations.
"""
to_remove = os.environ.get("BCBIOPATH", utils.get_bcbio_bin()) + ":"
if os.environ["PATH"].startswith(to_remove):
os.... | python | def remove_bcbiopath():
"""Remove bcbio internal path from first element in PATH.
Useful when we need to access remote programs, like Java 7 for older
installations.
"""
to_remove = os.environ.get("BCBIOPATH", utils.get_bcbio_bin()) + ":"
if os.environ["PATH"].startswith(to_remove):
os.... | [
"def",
"remove_bcbiopath",
"(",
")",
":",
"to_remove",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"BCBIOPATH\"",
",",
"utils",
".",
"get_bcbio_bin",
"(",
")",
")",
"+",
"\":\"",
"if",
"os",
".",
"environ",
"[",
"\"PATH\"",
"]",
".",
"startswith",
"(... | Remove bcbio internal path from first element in PATH.
Useful when we need to access remote programs, like Java 7 for older
installations. | [
"Remove",
"bcbio",
"internal",
"path",
"from",
"first",
"element",
"in",
"PATH",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/setpath.py#L64-L72 |
223,544 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | calculate_sv_bins | def calculate_sv_bins(*items):
"""Determine bin sizes and regions to use for samples.
Unified approach to prepare regional bins for coverage calculations across
multiple CNV callers. Splits into target and antitarget regions allowing
callers to take advantage of both. Provides consistent target/anti-ta... | python | def calculate_sv_bins(*items):
"""Determine bin sizes and regions to use for samples.
Unified approach to prepare regional bins for coverage calculations across
multiple CNV callers. Splits into target and antitarget regions allowing
callers to take advantage of both. Provides consistent target/anti-ta... | [
"def",
"calculate_sv_bins",
"(",
"*",
"items",
")",
":",
"calcfns",
"=",
"{",
"\"cnvkit\"",
":",
"_calculate_sv_bins_cnvkit",
",",
"\"gatk-cnv\"",
":",
"_calculate_sv_bins_gatk",
"}",
"from",
"bcbio",
".",
"structural",
"import",
"cnvkit",
"items",
"=",
"[",
"ut... | Determine bin sizes and regions to use for samples.
Unified approach to prepare regional bins for coverage calculations across
multiple CNV callers. Splits into target and antitarget regions allowing
callers to take advantage of both. Provides consistent target/anti-target
bin sizes across batches.
... | [
"Determine",
"bin",
"sizes",
"and",
"regions",
"to",
"use",
"for",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L27-L59 |
223,545 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | _calculate_sv_bins_gatk | def _calculate_sv_bins_gatk(data, cnv_group, size_calc_fn):
"""Calculate structural variant bins using GATK4 CNV callers region or even intervals approach.
"""
if dd.get_background_cnv_reference(data, "gatk-cnv"):
target_bed = gatkcnv.pon_to_bed(dd.get_background_cnv_reference(data, "gatk-cnv"), cnv... | python | def _calculate_sv_bins_gatk(data, cnv_group, size_calc_fn):
"""Calculate structural variant bins using GATK4 CNV callers region or even intervals approach.
"""
if dd.get_background_cnv_reference(data, "gatk-cnv"):
target_bed = gatkcnv.pon_to_bed(dd.get_background_cnv_reference(data, "gatk-cnv"), cnv... | [
"def",
"_calculate_sv_bins_gatk",
"(",
"data",
",",
"cnv_group",
",",
"size_calc_fn",
")",
":",
"if",
"dd",
".",
"get_background_cnv_reference",
"(",
"data",
",",
"\"gatk-cnv\"",
")",
":",
"target_bed",
"=",
"gatkcnv",
".",
"pon_to_bed",
"(",
"dd",
".",
"get_b... | Calculate structural variant bins using GATK4 CNV callers region or even intervals approach. | [
"Calculate",
"structural",
"variant",
"bins",
"using",
"GATK4",
"CNV",
"callers",
"region",
"or",
"even",
"intervals",
"approach",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L61-L69 |
223,546 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | calculate_sv_coverage | def calculate_sv_coverage(data):
"""Calculate coverage within bins for downstream CNV calling.
Creates corrected cnr files with log2 ratios and depths.
"""
calcfns = {"cnvkit": _calculate_sv_coverage_cnvkit, "gatk-cnv": _calculate_sv_coverage_gatk}
from bcbio.structural import cnvkit
data = uti... | python | def calculate_sv_coverage(data):
"""Calculate coverage within bins for downstream CNV calling.
Creates corrected cnr files with log2 ratios and depths.
"""
calcfns = {"cnvkit": _calculate_sv_coverage_cnvkit, "gatk-cnv": _calculate_sv_coverage_gatk}
from bcbio.structural import cnvkit
data = uti... | [
"def",
"calculate_sv_coverage",
"(",
"data",
")",
":",
"calcfns",
"=",
"{",
"\"cnvkit\"",
":",
"_calculate_sv_coverage_cnvkit",
",",
"\"gatk-cnv\"",
":",
"_calculate_sv_coverage_gatk",
"}",
"from",
"bcbio",
".",
"structural",
"import",
"cnvkit",
"data",
"=",
"utils"... | Calculate coverage within bins for downstream CNV calling.
Creates corrected cnr files with log2 ratios and depths. | [
"Calculate",
"coverage",
"within",
"bins",
"for",
"downstream",
"CNV",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L168-L193 |
223,547 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | _calculate_sv_coverage_gatk | def _calculate_sv_coverage_gatk(data, work_dir):
"""Calculate coverage in defined regions using GATK tools
TODO: This does double calculations to get GATK4 compatible HDF read counts
and then depth and gene annotations. Both are needed for creating heterogeneity inputs.
Ideally replace with a single mo... | python | def _calculate_sv_coverage_gatk(data, work_dir):
"""Calculate coverage in defined regions using GATK tools
TODO: This does double calculations to get GATK4 compatible HDF read counts
and then depth and gene annotations. Both are needed for creating heterogeneity inputs.
Ideally replace with a single mo... | [
"def",
"_calculate_sv_coverage_gatk",
"(",
"data",
",",
"work_dir",
")",
":",
"from",
"bcbio",
".",
"variation",
"import",
"coverage",
"from",
"bcbio",
".",
"structural",
"import",
"annotate",
"# GATK compatible",
"target_file",
"=",
"gatkcnv",
".",
"collect_read_co... | Calculate coverage in defined regions using GATK tools
TODO: This does double calculations to get GATK4 compatible HDF read counts
and then depth and gene annotations. Both are needed for creating heterogeneity inputs.
Ideally replace with a single mosdepth coverage calculation, and creat GATK4 TSV format:... | [
"Calculate",
"coverage",
"in",
"defined",
"regions",
"using",
"GATK",
"tools"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L195-L213 |
223,548 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | _calculate_sv_coverage_cnvkit | def _calculate_sv_coverage_cnvkit(data, work_dir):
"""Calculate coverage in an CNVkit ready format using mosdepth.
"""
from bcbio.variation import coverage
from bcbio.structural import annotate
out_target_file = os.path.join(work_dir, "%s-target-coverage.cnn" % dd.get_sample_name(data))
out_anti... | python | def _calculate_sv_coverage_cnvkit(data, work_dir):
"""Calculate coverage in an CNVkit ready format using mosdepth.
"""
from bcbio.variation import coverage
from bcbio.structural import annotate
out_target_file = os.path.join(work_dir, "%s-target-coverage.cnn" % dd.get_sample_name(data))
out_anti... | [
"def",
"_calculate_sv_coverage_cnvkit",
"(",
"data",
",",
"work_dir",
")",
":",
"from",
"bcbio",
".",
"variation",
"import",
"coverage",
"from",
"bcbio",
".",
"structural",
"import",
"annotate",
"out_target_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"wor... | Calculate coverage in an CNVkit ready format using mosdepth. | [
"Calculate",
"coverage",
"in",
"an",
"CNVkit",
"ready",
"format",
"using",
"mosdepth",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L215-L229 |
223,549 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | normalize_sv_coverage | def normalize_sv_coverage(*items):
"""Normalize CNV coverage, providing flexible point for multiple methods.
"""
calcfns = {"cnvkit": _normalize_sv_coverage_cnvkit, "gatk-cnv": _normalize_sv_coverage_gatk}
from bcbio.structural import cnvkit
from bcbio.structural import shared as sshared
items =... | python | def normalize_sv_coverage(*items):
"""Normalize CNV coverage, providing flexible point for multiple methods.
"""
calcfns = {"cnvkit": _normalize_sv_coverage_cnvkit, "gatk-cnv": _normalize_sv_coverage_gatk}
from bcbio.structural import cnvkit
from bcbio.structural import shared as sshared
items =... | [
"def",
"normalize_sv_coverage",
"(",
"*",
"items",
")",
":",
"calcfns",
"=",
"{",
"\"cnvkit\"",
":",
"_normalize_sv_coverage_cnvkit",
",",
"\"gatk-cnv\"",
":",
"_normalize_sv_coverage_gatk",
"}",
"from",
"bcbio",
".",
"structural",
"import",
"cnvkit",
"from",
"bcbio... | Normalize CNV coverage, providing flexible point for multiple methods. | [
"Normalize",
"CNV",
"coverage",
"providing",
"flexible",
"point",
"for",
"multiple",
"methods",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L256-L283 |
223,550 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | _normalize_sv_coverage_gatk | def _normalize_sv_coverage_gatk(group_id, inputs, backgrounds, work_dir, back_files, out_files):
"""Normalize CNV coverage using panel of normals with GATK's de-noise approaches.
"""
input_backs = set(filter(lambda x: x is not None,
[dd.get_background_cnv_reference(d, "gatk-cnv"... | python | def _normalize_sv_coverage_gatk(group_id, inputs, backgrounds, work_dir, back_files, out_files):
"""Normalize CNV coverage using panel of normals with GATK's de-noise approaches.
"""
input_backs = set(filter(lambda x: x is not None,
[dd.get_background_cnv_reference(d, "gatk-cnv"... | [
"def",
"_normalize_sv_coverage_gatk",
"(",
"group_id",
",",
"inputs",
",",
"backgrounds",
",",
"work_dir",
",",
"back_files",
",",
"out_files",
")",
":",
"input_backs",
"=",
"set",
"(",
"filter",
"(",
"lambda",
"x",
":",
"x",
"is",
"not",
"None",
",",
"[",... | Normalize CNV coverage using panel of normals with GATK's de-noise approaches. | [
"Normalize",
"CNV",
"coverage",
"using",
"panel",
"of",
"normals",
"with",
"GATK",
"s",
"de",
"-",
"noise",
"approaches",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L285-L303 |
223,551 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | _normalize_sv_coverage_cnvkit | def _normalize_sv_coverage_cnvkit(group_id, inputs, backgrounds, work_dir, back_files, out_files):
"""Normalize CNV coverage depths by GC, repeats and background using CNVkit
- reference: calculates reference backgrounds from normals and pools
including GC and repeat information
- fix: Uses backgroun... | python | def _normalize_sv_coverage_cnvkit(group_id, inputs, backgrounds, work_dir, back_files, out_files):
"""Normalize CNV coverage depths by GC, repeats and background using CNVkit
- reference: calculates reference backgrounds from normals and pools
including GC and repeat information
- fix: Uses backgroun... | [
"def",
"_normalize_sv_coverage_cnvkit",
"(",
"group_id",
",",
"inputs",
",",
"backgrounds",
",",
"work_dir",
",",
"back_files",
",",
"out_files",
")",
":",
"from",
"bcbio",
".",
"structural",
"import",
"cnvkit",
"cnns",
"=",
"reduce",
"(",
"operator",
".",
"ad... | Normalize CNV coverage depths by GC, repeats and background using CNVkit
- reference: calculates reference backgrounds from normals and pools
including GC and repeat information
- fix: Uses background to normalize coverage estimations
http://cnvkit.readthedocs.io/en/stable/pipeline.html#fix | [
"Normalize",
"CNV",
"coverage",
"depths",
"by",
"GC",
"repeats",
"and",
"background",
"using",
"CNVkit"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L305-L342 |
223,552 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | get_base_cnv_regions | def get_base_cnv_regions(data, work_dir, genome_default="transcripts1e4", include_gene_names=True):
"""Retrieve set of target regions for CNV analysis.
Subsets to extended transcript regions for WGS experiments to avoid
long runtimes.
"""
cov_interval = dd.get_coverage_interval(data)
base_regio... | python | def get_base_cnv_regions(data, work_dir, genome_default="transcripts1e4", include_gene_names=True):
"""Retrieve set of target regions for CNV analysis.
Subsets to extended transcript regions for WGS experiments to avoid
long runtimes.
"""
cov_interval = dd.get_coverage_interval(data)
base_regio... | [
"def",
"get_base_cnv_regions",
"(",
"data",
",",
"work_dir",
",",
"genome_default",
"=",
"\"transcripts1e4\"",
",",
"include_gene_names",
"=",
"True",
")",
":",
"cov_interval",
"=",
"dd",
".",
"get_coverage_interval",
"(",
"data",
")",
"base_regions",
"=",
"get_sv... | Retrieve set of target regions for CNV analysis.
Subsets to extended transcript regions for WGS experiments to avoid
long runtimes. | [
"Retrieve",
"set",
"of",
"target",
"regions",
"for",
"CNV",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L346-L364 |
223,553 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | remove_exclude_regions | def remove_exclude_regions(orig_bed, base_file, items, remove_entire_feature=False):
"""Remove centromere and short end regions from an existing BED file of regions to target.
"""
from bcbio.structural import shared as sshared
out_bed = os.path.join("%s-noexclude.bed" % (utils.splitext_plus(base_file)[0... | python | def remove_exclude_regions(orig_bed, base_file, items, remove_entire_feature=False):
"""Remove centromere and short end regions from an existing BED file of regions to target.
"""
from bcbio.structural import shared as sshared
out_bed = os.path.join("%s-noexclude.bed" % (utils.splitext_plus(base_file)[0... | [
"def",
"remove_exclude_regions",
"(",
"orig_bed",
",",
"base_file",
",",
"items",
",",
"remove_entire_feature",
"=",
"False",
")",
":",
"from",
"bcbio",
".",
"structural",
"import",
"shared",
"as",
"sshared",
"out_bed",
"=",
"os",
".",
"path",
".",
"join",
"... | Remove centromere and short end regions from an existing BED file of regions to target. | [
"Remove",
"centromere",
"and",
"short",
"end",
"regions",
"from",
"an",
"existing",
"BED",
"file",
"of",
"regions",
"to",
"target",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L366-L379 |
223,554 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | get_sv_bed | def get_sv_bed(data, method=None, out_dir=None, include_gene_names=True):
"""Retrieve a BED file of regions for SV and heterogeneity calling using the provided method.
method choices:
- exons: Raw BED file of exon regions
- transcripts: Full collapsed regions with the min and max of each transcript... | python | def get_sv_bed(data, method=None, out_dir=None, include_gene_names=True):
"""Retrieve a BED file of regions for SV and heterogeneity calling using the provided method.
method choices:
- exons: Raw BED file of exon regions
- transcripts: Full collapsed regions with the min and max of each transcript... | [
"def",
"get_sv_bed",
"(",
"data",
",",
"method",
"=",
"None",
",",
"out_dir",
"=",
"None",
",",
"include_gene_names",
"=",
"True",
")",
":",
"if",
"method",
"is",
"None",
":",
"method",
"=",
"(",
"tz",
".",
"get_in",
"(",
"[",
"\"config\"",
",",
"\"a... | Retrieve a BED file of regions for SV and heterogeneity calling using the provided method.
method choices:
- exons: Raw BED file of exon regions
- transcripts: Full collapsed regions with the min and max of each transcript.
- transcriptsXXXX: Collapsed regions around transcripts with a window siz... | [
"Retrieve",
"a",
"BED",
"file",
"of",
"regions",
"for",
"SV",
"and",
"heterogeneity",
"calling",
"using",
"the",
"provided",
"method",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L381-L406 |
223,555 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | _group_coords | def _group_coords(rs):
"""Organize coordinate regions into groups for each transcript.
Avoids collapsing very large introns or repetitive genes spread across
the chromosome by limiting the intron size to 100kb for creating a single transcript
"""
max_intron_size = 1e5
coords = []
for r in r... | python | def _group_coords(rs):
"""Organize coordinate regions into groups for each transcript.
Avoids collapsing very large introns or repetitive genes spread across
the chromosome by limiting the intron size to 100kb for creating a single transcript
"""
max_intron_size = 1e5
coords = []
for r in r... | [
"def",
"_group_coords",
"(",
"rs",
")",
":",
"max_intron_size",
"=",
"1e5",
"coords",
"=",
"[",
"]",
"for",
"r",
"in",
"rs",
":",
"coords",
".",
"append",
"(",
"r",
".",
"start",
")",
"coords",
".",
"append",
"(",
"r",
".",
"end",
")",
"coord_group... | Organize coordinate regions into groups for each transcript.
Avoids collapsing very large introns or repetitive genes spread across
the chromosome by limiting the intron size to 100kb for creating a single transcript | [
"Organize",
"coordinate",
"regions",
"into",
"groups",
"for",
"each",
"transcript",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L445-L466 |
223,556 | bcbio/bcbio-nextgen | bcbio/structural/regions.py | MemoizedSizes._calc_sizes | def _calc_sizes(self, cnv_file, items):
"""Retrieve target and antitarget bin sizes based on depth.
Similar to CNVkit's do_autobin but tries to have a standard set of
ranges (50bp intervals for target and 10kb intervals for antitarget).
"""
bp_per_bin = 100000 # same target as ... | python | def _calc_sizes(self, cnv_file, items):
"""Retrieve target and antitarget bin sizes based on depth.
Similar to CNVkit's do_autobin but tries to have a standard set of
ranges (50bp intervals for target and 10kb intervals for antitarget).
"""
bp_per_bin = 100000 # same target as ... | [
"def",
"_calc_sizes",
"(",
"self",
",",
"cnv_file",
",",
"items",
")",
":",
"bp_per_bin",
"=",
"100000",
"# same target as CNVkit",
"range_map",
"=",
"{",
"\"target\"",
":",
"(",
"100",
",",
"250",
")",
",",
"\"antitarget\"",
":",
"(",
"10000",
",",
"10000... | Retrieve target and antitarget bin sizes based on depth.
Similar to CNVkit's do_autobin but tries to have a standard set of
ranges (50bp intervals for target and 10kb intervals for antitarget). | [
"Retrieve",
"target",
"and",
"antitarget",
"bin",
"sizes",
"based",
"on",
"depth",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L98-L141 |
223,557 | bcbio/bcbio-nextgen | bcbio/hmmer/search.py | phmmer | def phmmer(**kwargs):
"""Search a protein sequence against a HMMER sequence database.
Arguments:
seq - The sequence to search -- a Fasta string.
seqdb -- Sequence database to search against.
range -- A string range of results to return (ie. 1,10 for the first ten)
output -- The output f... | python | def phmmer(**kwargs):
"""Search a protein sequence against a HMMER sequence database.
Arguments:
seq - The sequence to search -- a Fasta string.
seqdb -- Sequence database to search against.
range -- A string range of results to return (ie. 1,10 for the first ten)
output -- The output f... | [
"def",
"phmmer",
"(",
"*",
"*",
"kwargs",
")",
":",
"logging",
".",
"debug",
"(",
"kwargs",
")",
"args",
"=",
"{",
"'seq'",
":",
"kwargs",
".",
"get",
"(",
"'seq'",
")",
",",
"'seqdb'",
":",
"kwargs",
".",
"get",
"(",
"'seqdb'",
")",
"}",
"args2"... | Search a protein sequence against a HMMER sequence database.
Arguments:
seq - The sequence to search -- a Fasta string.
seqdb -- Sequence database to search against.
range -- A string range of results to return (ie. 1,10 for the first ten)
output -- The output format (defaults to JSON). | [
"Search",
"a",
"protein",
"sequence",
"against",
"a",
"HMMER",
"sequence",
"database",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/hmmer/search.py#L40-L54 |
223,558 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | scrnaseq_concatenate_metadata | def scrnaseq_concatenate_metadata(samples):
"""
Create file same dimension than mtx.colnames
with metadata and sample name to help in the
creation of the SC object.
"""
barcodes = {}
counts = ""
metadata = {}
has_sample_barcodes = False
for sample in dd.sample_data_iterator(samp... | python | def scrnaseq_concatenate_metadata(samples):
"""
Create file same dimension than mtx.colnames
with metadata and sample name to help in the
creation of the SC object.
"""
barcodes = {}
counts = ""
metadata = {}
has_sample_barcodes = False
for sample in dd.sample_data_iterator(samp... | [
"def",
"scrnaseq_concatenate_metadata",
"(",
"samples",
")",
":",
"barcodes",
"=",
"{",
"}",
"counts",
"=",
"\"\"",
"metadata",
"=",
"{",
"}",
"has_sample_barcodes",
"=",
"False",
"for",
"sample",
"in",
"dd",
".",
"sample_data_iterator",
"(",
"samples",
")",
... | Create file same dimension than mtx.colnames
with metadata and sample name to help in the
creation of the SC object. | [
"Create",
"file",
"same",
"dimension",
"than",
"mtx",
".",
"colnames",
"with",
"metadata",
"and",
"sample",
"name",
"to",
"help",
"in",
"the",
"creation",
"of",
"the",
"SC",
"object",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L47-L90 |
223,559 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | rnaseq_variant_calling | def rnaseq_variant_calling(samples, run_parallel):
"""
run RNA-seq variant calling using GATK
"""
samples = run_parallel("run_rnaseq_variant_calling", samples)
variantcaller = dd.get_variantcaller(to_single_data(samples[0]))
if variantcaller and ("gatk-haplotype" in variantcaller):
out =... | python | def rnaseq_variant_calling(samples, run_parallel):
"""
run RNA-seq variant calling using GATK
"""
samples = run_parallel("run_rnaseq_variant_calling", samples)
variantcaller = dd.get_variantcaller(to_single_data(samples[0]))
if variantcaller and ("gatk-haplotype" in variantcaller):
out =... | [
"def",
"rnaseq_variant_calling",
"(",
"samples",
",",
"run_parallel",
")",
":",
"samples",
"=",
"run_parallel",
"(",
"\"run_rnaseq_variant_calling\"",
",",
"samples",
")",
"variantcaller",
"=",
"dd",
".",
"get_variantcaller",
"(",
"to_single_data",
"(",
"samples",
"... | run RNA-seq variant calling using GATK | [
"run",
"RNA",
"-",
"seq",
"variant",
"calling",
"using",
"GATK"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L92-L115 |
223,560 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | run_rnaseq_variant_calling | def run_rnaseq_variant_calling(data):
"""
run RNA-seq variant calling, variation file is stored in `vrn_file`
in the datadict
"""
variantcaller = dd.get_variantcaller(data)
if isinstance(variantcaller, list) and len(variantcaller) > 1:
logger.error("Only one variantcaller can be run for ... | python | def run_rnaseq_variant_calling(data):
"""
run RNA-seq variant calling, variation file is stored in `vrn_file`
in the datadict
"""
variantcaller = dd.get_variantcaller(data)
if isinstance(variantcaller, list) and len(variantcaller) > 1:
logger.error("Only one variantcaller can be run for ... | [
"def",
"run_rnaseq_variant_calling",
"(",
"data",
")",
":",
"variantcaller",
"=",
"dd",
".",
"get_variantcaller",
"(",
"data",
")",
"if",
"isinstance",
"(",
"variantcaller",
",",
"list",
")",
"and",
"len",
"(",
"variantcaller",
")",
">",
"1",
":",
"logger",
... | run RNA-seq variant calling, variation file is stored in `vrn_file`
in the datadict | [
"run",
"RNA",
"-",
"seq",
"variant",
"calling",
"variation",
"file",
"is",
"stored",
"in",
"vrn_file",
"in",
"the",
"datadict"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L117-L136 |
223,561 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | run_rnaseq_ann_filter | def run_rnaseq_ann_filter(data):
"""Run RNA-seq annotation and filtering.
"""
data = to_single_data(data)
if dd.get_vrn_file(data):
eff_file = effects.add_to_vcf(dd.get_vrn_file(data), data)[0]
if eff_file:
data = dd.set_vrn_file(data, eff_file)
ann_file = population.... | python | def run_rnaseq_ann_filter(data):
"""Run RNA-seq annotation and filtering.
"""
data = to_single_data(data)
if dd.get_vrn_file(data):
eff_file = effects.add_to_vcf(dd.get_vrn_file(data), data)[0]
if eff_file:
data = dd.set_vrn_file(data, eff_file)
ann_file = population.... | [
"def",
"run_rnaseq_ann_filter",
"(",
"data",
")",
":",
"data",
"=",
"to_single_data",
"(",
"data",
")",
"if",
"dd",
".",
"get_vrn_file",
"(",
"data",
")",
":",
"eff_file",
"=",
"effects",
".",
"add_to_vcf",
"(",
"dd",
".",
"get_vrn_file",
"(",
"data",
")... | Run RNA-seq annotation and filtering. | [
"Run",
"RNA",
"-",
"seq",
"annotation",
"and",
"filtering",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L138-L157 |
223,562 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | quantitate | def quantitate(data):
"""CWL target for quantitation.
XXX Needs to be split and parallelized by expression caller, with merging
of multiple calls.
"""
data = to_single_data(to_single_data(data))
data = generate_transcript_counts(data)[0][0]
data["quant"] = {}
if "sailfish" in dd.get_exp... | python | def quantitate(data):
"""CWL target for quantitation.
XXX Needs to be split and parallelized by expression caller, with merging
of multiple calls.
"""
data = to_single_data(to_single_data(data))
data = generate_transcript_counts(data)[0][0]
data["quant"] = {}
if "sailfish" in dd.get_exp... | [
"def",
"quantitate",
"(",
"data",
")",
":",
"data",
"=",
"to_single_data",
"(",
"to_single_data",
"(",
"data",
")",
")",
"data",
"=",
"generate_transcript_counts",
"(",
"data",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"data",
"[",
"\"quant\"",
"]",
"=",
"{",... | CWL target for quantitation.
XXX Needs to be split and parallelized by expression caller, with merging
of multiple calls. | [
"CWL",
"target",
"for",
"quantitation",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L159-L184 |
223,563 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | quantitate_expression_parallel | def quantitate_expression_parallel(samples, run_parallel):
"""
quantitate expression, all programs run here should be multithreaded to
take advantage of the threaded run_parallel environment
"""
data = samples[0][0]
samples = run_parallel("generate_transcript_counts", samples)
if "cufflinks"... | python | def quantitate_expression_parallel(samples, run_parallel):
"""
quantitate expression, all programs run here should be multithreaded to
take advantage of the threaded run_parallel environment
"""
data = samples[0][0]
samples = run_parallel("generate_transcript_counts", samples)
if "cufflinks"... | [
"def",
"quantitate_expression_parallel",
"(",
"samples",
",",
"run_parallel",
")",
":",
"data",
"=",
"samples",
"[",
"0",
"]",
"[",
"0",
"]",
"samples",
"=",
"run_parallel",
"(",
"\"generate_transcript_counts\"",
",",
"samples",
")",
"if",
"\"cufflinks\"",
"in",... | quantitate expression, all programs run here should be multithreaded to
take advantage of the threaded run_parallel environment | [
"quantitate",
"expression",
"all",
"programs",
"run",
"here",
"should",
"be",
"multithreaded",
"to",
"take",
"advantage",
"of",
"the",
"threaded",
"run_parallel",
"environment"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L186-L210 |
223,564 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | quantitate_expression_noparallel | def quantitate_expression_noparallel(samples, run_parallel):
"""
run transcript quantitation for algorithms that don't run in parallel
"""
data = samples[0][0]
if "express" in dd.get_expression_caller(data):
samples = run_parallel("run_express", samples)
if "dexseq" in dd.get_expression_... | python | def quantitate_expression_noparallel(samples, run_parallel):
"""
run transcript quantitation for algorithms that don't run in parallel
"""
data = samples[0][0]
if "express" in dd.get_expression_caller(data):
samples = run_parallel("run_express", samples)
if "dexseq" in dd.get_expression_... | [
"def",
"quantitate_expression_noparallel",
"(",
"samples",
",",
"run_parallel",
")",
":",
"data",
"=",
"samples",
"[",
"0",
"]",
"[",
"0",
"]",
"if",
"\"express\"",
"in",
"dd",
".",
"get_expression_caller",
"(",
"data",
")",
":",
"samples",
"=",
"run_paralle... | run transcript quantitation for algorithms that don't run in parallel | [
"run",
"transcript",
"quantitation",
"for",
"algorithms",
"that",
"don",
"t",
"run",
"in",
"parallel"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L236-L245 |
223,565 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | generate_transcript_counts | def generate_transcript_counts(data):
"""Generate counts per transcript and per exon from an alignment"""
data["count_file"] = featureCounts.count(data)
if dd.get_fusion_mode(data, False) and not dd.get_fusion_caller(data):
oncofuse_file = oncofuse.run(data)
if oncofuse_file:
da... | python | def generate_transcript_counts(data):
"""Generate counts per transcript and per exon from an alignment"""
data["count_file"] = featureCounts.count(data)
if dd.get_fusion_mode(data, False) and not dd.get_fusion_caller(data):
oncofuse_file = oncofuse.run(data)
if oncofuse_file:
da... | [
"def",
"generate_transcript_counts",
"(",
"data",
")",
":",
"data",
"[",
"\"count_file\"",
"]",
"=",
"featureCounts",
".",
"count",
"(",
"data",
")",
"if",
"dd",
".",
"get_fusion_mode",
"(",
"data",
",",
"False",
")",
"and",
"not",
"dd",
".",
"get_fusion_c... | Generate counts per transcript and per exon from an alignment | [
"Generate",
"counts",
"per",
"transcript",
"and",
"per",
"exon",
"from",
"an",
"alignment"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L247-L278 |
223,566 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | run_dexseq | def run_dexseq(data):
"""Quantitate exon-level counts with DEXSeq"""
if dd.get_dexseq_gff(data, None):
data = dexseq.bcbio_run(data)
return [[data]] | python | def run_dexseq(data):
"""Quantitate exon-level counts with DEXSeq"""
if dd.get_dexseq_gff(data, None):
data = dexseq.bcbio_run(data)
return [[data]] | [
"def",
"run_dexseq",
"(",
"data",
")",
":",
"if",
"dd",
".",
"get_dexseq_gff",
"(",
"data",
",",
"None",
")",
":",
"data",
"=",
"dexseq",
".",
"bcbio_run",
"(",
"data",
")",
"return",
"[",
"[",
"data",
"]",
"]"
] | Quantitate exon-level counts with DEXSeq | [
"Quantitate",
"exon",
"-",
"level",
"counts",
"with",
"DEXSeq"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L285-L289 |
223,567 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | combine_express | def combine_express(samples, combined):
"""Combine tpm, effective counts and fpkm from express results"""
if not combined:
return None
to_combine = [dd.get_express_counts(x) for x in
dd.sample_data_iterator(samples) if dd.get_express_counts(x)]
gtf_file = dd.get_gtf_file(sample... | python | def combine_express(samples, combined):
"""Combine tpm, effective counts and fpkm from express results"""
if not combined:
return None
to_combine = [dd.get_express_counts(x) for x in
dd.sample_data_iterator(samples) if dd.get_express_counts(x)]
gtf_file = dd.get_gtf_file(sample... | [
"def",
"combine_express",
"(",
"samples",
",",
"combined",
")",
":",
"if",
"not",
"combined",
":",
"return",
"None",
"to_combine",
"=",
"[",
"dd",
".",
"get_express_counts",
"(",
"x",
")",
"for",
"x",
"in",
"dd",
".",
"sample_data_iterator",
"(",
"samples"... | Combine tpm, effective counts and fpkm from express results | [
"Combine",
"tpm",
"effective",
"counts",
"and",
"fpkm",
"from",
"express",
"results"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L296-L319 |
223,568 | bcbio/bcbio-nextgen | bcbio/pipeline/rnaseq.py | run_cufflinks | def run_cufflinks(data):
"""Quantitate transcript expression with Cufflinks"""
if "cufflinks" in dd.get_tools_off(data):
return [[data]]
work_bam = dd.get_work_bam(data)
ref_file = dd.get_sam_ref(data)
out_dir, fpkm_file, fpkm_isoform_file = cufflinks.run(work_bam, ref_file, data)
data =... | python | def run_cufflinks(data):
"""Quantitate transcript expression with Cufflinks"""
if "cufflinks" in dd.get_tools_off(data):
return [[data]]
work_bam = dd.get_work_bam(data)
ref_file = dd.get_sam_ref(data)
out_dir, fpkm_file, fpkm_isoform_file = cufflinks.run(work_bam, ref_file, data)
data =... | [
"def",
"run_cufflinks",
"(",
"data",
")",
":",
"if",
"\"cufflinks\"",
"in",
"dd",
".",
"get_tools_off",
"(",
"data",
")",
":",
"return",
"[",
"[",
"data",
"]",
"]",
"work_bam",
"=",
"dd",
".",
"get_work_bam",
"(",
"data",
")",
"ref_file",
"=",
"dd",
... | Quantitate transcript expression with Cufflinks | [
"Quantitate",
"transcript",
"expression",
"with",
"Cufflinks"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/rnaseq.py#L321-L331 |
223,569 | bcbio/bcbio-nextgen | bcbio/rnaseq/express.py | run | def run(data):
"""Quantitaive isoforms expression by eXpress"""
name = dd.get_sample_name(data)
in_bam = dd.get_transcriptome_bam(data)
config = data['config']
if not in_bam:
logger.info("Transcriptome-mapped BAM file not found, skipping eXpress.")
return data
out_dir = os.path.j... | python | def run(data):
"""Quantitaive isoforms expression by eXpress"""
name = dd.get_sample_name(data)
in_bam = dd.get_transcriptome_bam(data)
config = data['config']
if not in_bam:
logger.info("Transcriptome-mapped BAM file not found, skipping eXpress.")
return data
out_dir = os.path.j... | [
"def",
"run",
"(",
"data",
")",
":",
"name",
"=",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
"in_bam",
"=",
"dd",
".",
"get_transcriptome_bam",
"(",
"data",
")",
"config",
"=",
"data",
"[",
"'config'",
"]",
"if",
"not",
"in_bam",
":",
"logger",
... | Quantitaive isoforms expression by eXpress | [
"Quantitaive",
"isoforms",
"expression",
"by",
"eXpress"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L13-L39 |
223,570 | bcbio/bcbio-nextgen | bcbio/rnaseq/express.py | _get_column | def _get_column(in_file, out_file, column, data=None):
"""Subset one column from a file
"""
with file_transaction(data, out_file) as tx_out_file:
with open(in_file) as in_handle:
with open(tx_out_file, 'w') as out_handle:
for line in in_handle:
cols = ... | python | def _get_column(in_file, out_file, column, data=None):
"""Subset one column from a file
"""
with file_transaction(data, out_file) as tx_out_file:
with open(in_file) as in_handle:
with open(tx_out_file, 'w') as out_handle:
for line in in_handle:
cols = ... | [
"def",
"_get_column",
"(",
"in_file",
",",
"out_file",
",",
"column",
",",
"data",
"=",
"None",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
")",
"as",
"tx_out_file",
":",
"with",
"open",
"(",
"in_file",
")",
"as",
"in_handle",
":"... | Subset one column from a file | [
"Subset",
"one",
"column",
"from",
"a",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L41-L55 |
223,571 | bcbio/bcbio-nextgen | bcbio/rnaseq/express.py | _prepare_bam_file | def _prepare_bam_file(bam_file, tmp_dir, config):
"""
Pipe sort by name cmd in case sort by coordinates
"""
sort_mode = _get_sort_order(bam_file, config)
if sort_mode != "queryname":
bam_file = sort(bam_file, config, "queryname")
return bam_file | python | def _prepare_bam_file(bam_file, tmp_dir, config):
"""
Pipe sort by name cmd in case sort by coordinates
"""
sort_mode = _get_sort_order(bam_file, config)
if sort_mode != "queryname":
bam_file = sort(bam_file, config, "queryname")
return bam_file | [
"def",
"_prepare_bam_file",
"(",
"bam_file",
",",
"tmp_dir",
",",
"config",
")",
":",
"sort_mode",
"=",
"_get_sort_order",
"(",
"bam_file",
",",
"config",
")",
"if",
"sort_mode",
"!=",
"\"queryname\"",
":",
"bam_file",
"=",
"sort",
"(",
"bam_file",
",",
"con... | Pipe sort by name cmd in case sort by coordinates | [
"Pipe",
"sort",
"by",
"name",
"cmd",
"in",
"case",
"sort",
"by",
"coordinates"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L72-L79 |
223,572 | bcbio/bcbio-nextgen | bcbio/rnaseq/express.py | isoform_to_gene_name | def isoform_to_gene_name(gtf_file, out_file, data):
"""
produce a table of isoform -> gene mappings for loading into EBSeq
"""
if not out_file:
out_file = tempfile.NamedTemporaryFile(delete=False).name
if file_exists(out_file):
return out_file
db = gtf.get_gtf_db(gtf_file)
l... | python | def isoform_to_gene_name(gtf_file, out_file, data):
"""
produce a table of isoform -> gene mappings for loading into EBSeq
"""
if not out_file:
out_file = tempfile.NamedTemporaryFile(delete=False).name
if file_exists(out_file):
return out_file
db = gtf.get_gtf_db(gtf_file)
l... | [
"def",
"isoform_to_gene_name",
"(",
"gtf_file",
",",
"out_file",
",",
"data",
")",
":",
"if",
"not",
"out_file",
":",
"out_file",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"delete",
"=",
"False",
")",
".",
"name",
"if",
"file_exists",
"(",
"out_file",... | produce a table of isoform -> gene mappings for loading into EBSeq | [
"produce",
"a",
"table",
"of",
"isoform",
"-",
">",
"gene",
"mappings",
"for",
"loading",
"into",
"EBSeq"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L81-L97 |
223,573 | bcbio/bcbio-nextgen | bcbio/variation/samtools.py | shared_variantcall | def shared_variantcall(call_fn, name, align_bams, ref_file, items,
assoc_files, region=None, out_file=None):
"""Provide base functionality for prepping and indexing for variant calling.
"""
config = items[0]["config"]
if out_file is None:
if vcfutils.is_paired_analysis(ali... | python | def shared_variantcall(call_fn, name, align_bams, ref_file, items,
assoc_files, region=None, out_file=None):
"""Provide base functionality for prepping and indexing for variant calling.
"""
config = items[0]["config"]
if out_file is None:
if vcfutils.is_paired_analysis(ali... | [
"def",
"shared_variantcall",
"(",
"call_fn",
",",
"name",
",",
"align_bams",
",",
"ref_file",
",",
"items",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
... | Provide base functionality for prepping and indexing for variant calling. | [
"Provide",
"base",
"functionality",
"for",
"prepping",
"and",
"indexing",
"for",
"variant",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/samtools.py#L19-L43 |
223,574 | bcbio/bcbio-nextgen | bcbio/variation/samtools.py | run_samtools | def run_samtools(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Detect SNPs and indels with samtools mpileup and bcftools.
"""
return shared_variantcall(_call_variants_samtools, "samtools", align_bams, ref_file,
items, assoc_files, re... | python | def run_samtools(align_bams, items, ref_file, assoc_files, region=None,
out_file=None):
"""Detect SNPs and indels with samtools mpileup and bcftools.
"""
return shared_variantcall(_call_variants_samtools, "samtools", align_bams, ref_file,
items, assoc_files, re... | [
"def",
"run_samtools",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
")",
":",
"return",
"shared_variantcall",
"(",
"_call_variants_samtools",
",",
"\"samtools\"",
",",
"align_bams... | Detect SNPs and indels with samtools mpileup and bcftools. | [
"Detect",
"SNPs",
"and",
"indels",
"with",
"samtools",
"mpileup",
"and",
"bcftools",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/samtools.py#L45-L50 |
223,575 | bcbio/bcbio-nextgen | bcbio/variation/samtools.py | _call_variants_samtools | def _call_variants_samtools(align_bams, ref_file, items, target_regions, tx_out_file):
"""Call variants with samtools in target_regions.
Works around a GATK VCF 4.2 compatibility issue in samtools 1.0
by removing addition 4.2-only isms from VCF header lines.
"""
config = items[0]["config"]
mpil... | python | def _call_variants_samtools(align_bams, ref_file, items, target_regions, tx_out_file):
"""Call variants with samtools in target_regions.
Works around a GATK VCF 4.2 compatibility issue in samtools 1.0
by removing addition 4.2-only isms from VCF header lines.
"""
config = items[0]["config"]
mpil... | [
"def",
"_call_variants_samtools",
"(",
"align_bams",
",",
"ref_file",
",",
"items",
",",
"target_regions",
",",
"tx_out_file",
")",
":",
"config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
"mpileup",
"=",
"prep_mpileup",
"(",
"align_bams",
",",
"r... | Call variants with samtools in target_regions.
Works around a GATK VCF 4.2 compatibility issue in samtools 1.0
by removing addition 4.2-only isms from VCF header lines. | [
"Call",
"variants",
"with",
"samtools",
"in",
"target_regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/samtools.py#L68-L94 |
223,576 | bcbio/bcbio-nextgen | bcbio/pipeline/sra.py | _convert_fastq | def _convert_fastq(srafn, outdir, single=False):
"convert sra to fastq"
cmd = "fastq-dump --split-files --gzip {srafn}"
cmd = "%s %s" % (utils.local_path_export(), cmd)
sraid = os.path.basename(utils.splitext_plus(srafn)[0])
if not srafn:
return None
if not single:
out_file = [os... | python | def _convert_fastq(srafn, outdir, single=False):
"convert sra to fastq"
cmd = "fastq-dump --split-files --gzip {srafn}"
cmd = "%s %s" % (utils.local_path_export(), cmd)
sraid = os.path.basename(utils.splitext_plus(srafn)[0])
if not srafn:
return None
if not single:
out_file = [os... | [
"def",
"_convert_fastq",
"(",
"srafn",
",",
"outdir",
",",
"single",
"=",
"False",
")",
":",
"cmd",
"=",
"\"fastq-dump --split-files --gzip {srafn}\"",
"cmd",
"=",
"\"%s %s\"",
"%",
"(",
"utils",
".",
"local_path_export",
"(",
")",
",",
"cmd",
")",
"sraid",
... | convert sra to fastq | [
"convert",
"sra",
"to",
"fastq"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/sra.py#L119-L136 |
223,577 | bcbio/bcbio-nextgen | bcbio/illumina/machine.py | check_and_postprocess | def check_and_postprocess(args):
"""Check for newly dumped sequencer output, post-processing and transferring.
"""
with open(args.process_config) as in_handle:
config = yaml.safe_load(in_handle)
setup_local_logging(config)
for dname in _find_unprocessed(config):
lane_details = nglims... | python | def check_and_postprocess(args):
"""Check for newly dumped sequencer output, post-processing and transferring.
"""
with open(args.process_config) as in_handle:
config = yaml.safe_load(in_handle)
setup_local_logging(config)
for dname in _find_unprocessed(config):
lane_details = nglims... | [
"def",
"check_and_postprocess",
"(",
"args",
")",
":",
"with",
"open",
"(",
"args",
".",
"process_config",
")",
"as",
"in_handle",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"in_handle",
")",
"setup_local_logging",
"(",
"config",
")",
"for",
"dname",... | Check for newly dumped sequencer output, post-processing and transferring. | [
"Check",
"for",
"newly",
"dumped",
"sequencer",
"output",
"post",
"-",
"processing",
"and",
"transferring",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L22-L40 |
223,578 | bcbio/bcbio-nextgen | bcbio/illumina/machine.py | _tweak_lane | def _tweak_lane(lane_details, dname):
"""Potentially tweak lane information to handle custom processing, reading a lane_config.yaml file.
"""
tweak_config_file = os.path.join(dname, "lane_config.yaml")
if os.path.exists(tweak_config_file):
with open(tweak_config_file) as in_handle:
t... | python | def _tweak_lane(lane_details, dname):
"""Potentially tweak lane information to handle custom processing, reading a lane_config.yaml file.
"""
tweak_config_file = os.path.join(dname, "lane_config.yaml")
if os.path.exists(tweak_config_file):
with open(tweak_config_file) as in_handle:
t... | [
"def",
"_tweak_lane",
"(",
"lane_details",
",",
"dname",
")",
":",
"tweak_config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dname",
",",
"\"lane_config.yaml\"",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"tweak_config_file",
")",
":",
"with",... | Potentially tweak lane information to handle custom processing, reading a lane_config.yaml file. | [
"Potentially",
"tweak",
"lane",
"information",
"to",
"handle",
"custom",
"processing",
"reading",
"a",
"lane_config",
".",
"yaml",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L42-L55 |
223,579 | bcbio/bcbio-nextgen | bcbio/illumina/machine.py | _remap_dirname | def _remap_dirname(local, remote):
"""Remap directory names from local to remote.
"""
def do(x):
return x.replace(local, remote, 1)
return do | python | def _remap_dirname(local, remote):
"""Remap directory names from local to remote.
"""
def do(x):
return x.replace(local, remote, 1)
return do | [
"def",
"_remap_dirname",
"(",
"local",
",",
"remote",
")",
":",
"def",
"do",
"(",
"x",
")",
":",
"return",
"x",
".",
"replace",
"(",
"local",
",",
"remote",
",",
"1",
")",
"return",
"do"
] | Remap directory names from local to remote. | [
"Remap",
"directory",
"names",
"from",
"local",
"to",
"remote",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L57-L62 |
223,580 | bcbio/bcbio-nextgen | bcbio/illumina/machine.py | _find_unprocessed | def _find_unprocessed(config):
"""Find any finished directories that have not been processed.
"""
reported = _read_reported(config["msg_db"])
for dname in _get_directories(config):
if os.path.isdir(dname) and dname not in reported:
if _is_finished_dumping(dname):
yiel... | python | def _find_unprocessed(config):
"""Find any finished directories that have not been processed.
"""
reported = _read_reported(config["msg_db"])
for dname in _get_directories(config):
if os.path.isdir(dname) and dname not in reported:
if _is_finished_dumping(dname):
yiel... | [
"def",
"_find_unprocessed",
"(",
"config",
")",
":",
"reported",
"=",
"_read_reported",
"(",
"config",
"[",
"\"msg_db\"",
"]",
")",
"for",
"dname",
"in",
"_get_directories",
"(",
"config",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dname",
")... | Find any finished directories that have not been processed. | [
"Find",
"any",
"finished",
"directories",
"that",
"have",
"not",
"been",
"processed",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L98-L105 |
223,581 | bcbio/bcbio-nextgen | bcbio/illumina/machine.py | _is_finished_dumping | def _is_finished_dumping(directory):
"""Determine if the sequencing directory has all files.
The final checkpoint file will differ depending if we are a
single or paired end run.
"""
#if _is_finished_dumping_checkpoint(directory):
# return True
# Check final output files; handles both Hi... | python | def _is_finished_dumping(directory):
"""Determine if the sequencing directory has all files.
The final checkpoint file will differ depending if we are a
single or paired end run.
"""
#if _is_finished_dumping_checkpoint(directory):
# return True
# Check final output files; handles both Hi... | [
"def",
"_is_finished_dumping",
"(",
"directory",
")",
":",
"#if _is_finished_dumping_checkpoint(directory):",
"# return True",
"# Check final output files; handles both HiSeq and GAII",
"run_info",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"\"RunInfo.xml\""... | Determine if the sequencing directory has all files.
The final checkpoint file will differ depending if we are a
single or paired end run. | [
"Determine",
"if",
"the",
"sequencing",
"directory",
"has",
"all",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L113-L129 |
223,582 | bcbio/bcbio-nextgen | bcbio/illumina/machine.py | _expected_reads | def _expected_reads(run_info_file):
"""Parse the number of expected reads from the RunInfo.xml file.
"""
reads = []
if os.path.exists(run_info_file):
tree = ElementTree()
tree.parse(run_info_file)
read_elem = tree.find("Run/Reads")
reads = read_elem.findall("Read")
re... | python | def _expected_reads(run_info_file):
"""Parse the number of expected reads from the RunInfo.xml file.
"""
reads = []
if os.path.exists(run_info_file):
tree = ElementTree()
tree.parse(run_info_file)
read_elem = tree.find("Run/Reads")
reads = read_elem.findall("Read")
re... | [
"def",
"_expected_reads",
"(",
"run_info_file",
")",
":",
"reads",
"=",
"[",
"]",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"run_info_file",
")",
":",
"tree",
"=",
"ElementTree",
"(",
")",
"tree",
".",
"parse",
"(",
"run_info_file",
")",
"read_elem",
... | Parse the number of expected reads from the RunInfo.xml file. | [
"Parse",
"the",
"number",
"of",
"expected",
"reads",
"from",
"the",
"RunInfo",
".",
"xml",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L149-L158 |
223,583 | bcbio/bcbio-nextgen | bcbio/illumina/machine.py | _read_reported | def _read_reported(msg_db):
"""Retrieve a list of directories previous reported.
"""
reported = []
if os.path.exists(msg_db):
with open(msg_db) as in_handle:
for line in in_handle:
reported.append(line.strip())
return reported | python | def _read_reported(msg_db):
"""Retrieve a list of directories previous reported.
"""
reported = []
if os.path.exists(msg_db):
with open(msg_db) as in_handle:
for line in in_handle:
reported.append(line.strip())
return reported | [
"def",
"_read_reported",
"(",
"msg_db",
")",
":",
"reported",
"=",
"[",
"]",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"msg_db",
")",
":",
"with",
"open",
"(",
"msg_db",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"in_handle",
":",
"reported... | Retrieve a list of directories previous reported. | [
"Retrieve",
"a",
"list",
"of",
"directories",
"previous",
"reported",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/machine.py#L162-L170 |
223,584 | bcbio/bcbio-nextgen | bcbio/qc/viral.py | get_files | def get_files(data):
"""Retrieve pre-installed viral reference files.
"""
all_files = glob.glob(os.path.normpath(os.path.join(os.path.dirname(dd.get_ref_file(data)),
os.pardir, "viral", "*")))
return sorted(all_files) | python | def get_files(data):
"""Retrieve pre-installed viral reference files.
"""
all_files = glob.glob(os.path.normpath(os.path.join(os.path.dirname(dd.get_ref_file(data)),
os.pardir, "viral", "*")))
return sorted(all_files) | [
"def",
"get_files",
"(",
"data",
")",
":",
"all_files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"dd",
".",
"get_ref_file",
"(",
"data",
"... | Retrieve pre-installed viral reference files. | [
"Retrieve",
"pre",
"-",
"installed",
"viral",
"reference",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/viral.py#L59-L64 |
223,585 | bcbio/bcbio-nextgen | bcbio/rnaseq/variation.py | gatk_splitreads | def gatk_splitreads(data):
"""
use GATK to split reads with Ns in the CIGAR string, hard clipping regions
that end up in introns
"""
broad_runner = broad.runner_from_config(dd.get_config(data))
ref_file = dd.get_ref_file(data)
deduped_bam = dd.get_deduped_bam(data)
base, ext = os.path.sp... | python | def gatk_splitreads(data):
"""
use GATK to split reads with Ns in the CIGAR string, hard clipping regions
that end up in introns
"""
broad_runner = broad.runner_from_config(dd.get_config(data))
ref_file = dd.get_ref_file(data)
deduped_bam = dd.get_deduped_bam(data)
base, ext = os.path.sp... | [
"def",
"gatk_splitreads",
"(",
"data",
")",
":",
"broad_runner",
"=",
"broad",
".",
"runner_from_config",
"(",
"dd",
".",
"get_config",
"(",
"data",
")",
")",
"ref_file",
"=",
"dd",
".",
"get_ref_file",
"(",
"data",
")",
"deduped_bam",
"=",
"dd",
".",
"g... | use GATK to split reads with Ns in the CIGAR string, hard clipping regions
that end up in introns | [
"use",
"GATK",
"to",
"split",
"reads",
"with",
"Ns",
"in",
"the",
"CIGAR",
"string",
"hard",
"clipping",
"regions",
"that",
"end",
"up",
"in",
"introns"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L25-L57 |
223,586 | bcbio/bcbio-nextgen | bcbio/rnaseq/variation.py | _setup_variant_regions | def _setup_variant_regions(data, out_dir):
"""Ensure we have variant regions for calling, using transcript if not present.
Respects noalt_calling by removing additional contigs to improve
speeds.
"""
vr_file = dd.get_variant_regions(data)
if not vr_file:
vr_file = regions.get_sv_bed(dat... | python | def _setup_variant_regions(data, out_dir):
"""Ensure we have variant regions for calling, using transcript if not present.
Respects noalt_calling by removing additional contigs to improve
speeds.
"""
vr_file = dd.get_variant_regions(data)
if not vr_file:
vr_file = regions.get_sv_bed(dat... | [
"def",
"_setup_variant_regions",
"(",
"data",
",",
"out_dir",
")",
":",
"vr_file",
"=",
"dd",
".",
"get_variant_regions",
"(",
"data",
")",
"if",
"not",
"vr_file",
":",
"vr_file",
"=",
"regions",
".",
"get_sv_bed",
"(",
"data",
",",
"\"transcripts\"",
",",
... | Ensure we have variant regions for calling, using transcript if not present.
Respects noalt_calling by removing additional contigs to improve
speeds. | [
"Ensure",
"we",
"have",
"variant",
"regions",
"for",
"calling",
"using",
"transcript",
"if",
"not",
"present",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L59-L80 |
223,587 | bcbio/bcbio-nextgen | bcbio/rnaseq/variation.py | gatk_rnaseq_calling | def gatk_rnaseq_calling(data):
"""Use GATK to perform gVCF variant calling on RNA-seq data
"""
from bcbio.bam import callable
data = utils.deepish_copy(data)
tools_on = dd.get_tools_on(data)
if not tools_on:
tools_on = []
tools_on.append("gvcf")
data = dd.set_tools_on(data, tools... | python | def gatk_rnaseq_calling(data):
"""Use GATK to perform gVCF variant calling on RNA-seq data
"""
from bcbio.bam import callable
data = utils.deepish_copy(data)
tools_on = dd.get_tools_on(data)
if not tools_on:
tools_on = []
tools_on.append("gvcf")
data = dd.set_tools_on(data, tools... | [
"def",
"gatk_rnaseq_calling",
"(",
"data",
")",
":",
"from",
"bcbio",
".",
"bam",
"import",
"callable",
"data",
"=",
"utils",
".",
"deepish_copy",
"(",
"data",
")",
"tools_on",
"=",
"dd",
".",
"get_tools_on",
"(",
"data",
")",
"if",
"not",
"tools_on",
":... | Use GATK to perform gVCF variant calling on RNA-seq data | [
"Use",
"GATK",
"to",
"perform",
"gVCF",
"variant",
"calling",
"on",
"RNA",
"-",
"seq",
"data"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L82-L112 |
223,588 | bcbio/bcbio-nextgen | bcbio/rnaseq/variation.py | filter_junction_variants | def filter_junction_variants(vrn_file, data):
"""
filter out variants within 10 basepairs of a splice junction, these are
very prone to being false positives with RNA-seq data
"""
SJ_BP_MASK = 10
vrn_dir = os.path.dirname(vrn_file)
splicebed = dd.get_junction_bed(data)
if not file_exists... | python | def filter_junction_variants(vrn_file, data):
"""
filter out variants within 10 basepairs of a splice junction, these are
very prone to being false positives with RNA-seq data
"""
SJ_BP_MASK = 10
vrn_dir = os.path.dirname(vrn_file)
splicebed = dd.get_junction_bed(data)
if not file_exists... | [
"def",
"filter_junction_variants",
"(",
"vrn_file",
",",
"data",
")",
":",
"SJ_BP_MASK",
"=",
"10",
"vrn_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"vrn_file",
")",
"splicebed",
"=",
"dd",
".",
"get_junction_bed",
"(",
"data",
")",
"if",
"not",
"... | filter out variants within 10 basepairs of a splice junction, these are
very prone to being false positives with RNA-seq data | [
"filter",
"out",
"variants",
"within",
"10",
"basepairs",
"of",
"a",
"splice",
"junction",
"these",
"are",
"very",
"prone",
"to",
"being",
"false",
"positives",
"with",
"RNA",
"-",
"seq",
"data"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/variation.py#L186-L207 |
223,589 | bcbio/bcbio-nextgen | scripts/bcbio_nextgen_install.py | _clean_args | def _clean_args(sys_argv, args):
"""Remove data directory from arguments to pass to upgrade function.
"""
base = [x for x in sys_argv if
x.startswith("-") or not args.datadir == os.path.abspath(os.path.expanduser(x))]
# Remove installer only options we don't pass on
base = [x for x in ba... | python | def _clean_args(sys_argv, args):
"""Remove data directory from arguments to pass to upgrade function.
"""
base = [x for x in sys_argv if
x.startswith("-") or not args.datadir == os.path.abspath(os.path.expanduser(x))]
# Remove installer only options we don't pass on
base = [x for x in ba... | [
"def",
"_clean_args",
"(",
"sys_argv",
",",
"args",
")",
":",
"base",
"=",
"[",
"x",
"for",
"x",
"in",
"sys_argv",
"if",
"x",
".",
"startswith",
"(",
"\"-\"",
")",
"or",
"not",
"args",
".",
"datadir",
"==",
"os",
".",
"path",
".",
"abspath",
"(",
... | Remove data directory from arguments to pass to upgrade function. | [
"Remove",
"data",
"directory",
"from",
"arguments",
"to",
"pass",
"to",
"upgrade",
"function",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L53-L64 |
223,590 | bcbio/bcbio-nextgen | scripts/bcbio_nextgen_install.py | setup_manifest | def setup_manifest(datadir):
"""Create barebones manifest to be filled in during update
"""
manifest_dir = os.path.join(datadir, "manifest")
if not os.path.exists(manifest_dir):
os.makedirs(manifest_dir) | python | def setup_manifest(datadir):
"""Create barebones manifest to be filled in during update
"""
manifest_dir = os.path.join(datadir, "manifest")
if not os.path.exists(manifest_dir):
os.makedirs(manifest_dir) | [
"def",
"setup_manifest",
"(",
"datadir",
")",
":",
"manifest_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"\"manifest\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"manifest_dir",
")",
":",
"os",
".",
"makedirs",
"(",
... | Create barebones manifest to be filled in during update | [
"Create",
"barebones",
"manifest",
"to",
"be",
"filled",
"in",
"during",
"update"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L139-L144 |
223,591 | bcbio/bcbio-nextgen | scripts/bcbio_nextgen_install.py | write_system_config | def write_system_config(base_url, datadir, tooldir):
"""Write a bcbio_system.yaml configuration file with tool information.
"""
out_file = os.path.join(datadir, "galaxy", os.path.basename(base_url))
if not os.path.exists(os.path.dirname(out_file)):
os.makedirs(os.path.dirname(out_file))
if o... | python | def write_system_config(base_url, datadir, tooldir):
"""Write a bcbio_system.yaml configuration file with tool information.
"""
out_file = os.path.join(datadir, "galaxy", os.path.basename(base_url))
if not os.path.exists(os.path.dirname(out_file)):
os.makedirs(os.path.dirname(out_file))
if o... | [
"def",
"write_system_config",
"(",
"base_url",
",",
"datadir",
",",
"tooldir",
")",
":",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"\"galaxy\"",
",",
"os",
".",
"path",
".",
"basename",
"(",
"base_url",
")",
")",
"if",
"not"... | Write a bcbio_system.yaml configuration file with tool information. | [
"Write",
"a",
"bcbio_system",
".",
"yaml",
"configuration",
"file",
"with",
"tool",
"information",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L146-L183 |
223,592 | bcbio/bcbio-nextgen | scripts/bcbio_nextgen_install.py | check_dependencies | def check_dependencies():
"""Ensure required tools for installation are present.
"""
print("Checking required dependencies")
for dep, msg in [(["git", "--version"], "Git (http://git-scm.com/)"),
(["wget", "--version"], "wget"),
(["bzip2", "-h"], "bzip2")]:
... | python | def check_dependencies():
"""Ensure required tools for installation are present.
"""
print("Checking required dependencies")
for dep, msg in [(["git", "--version"], "Git (http://git-scm.com/)"),
(["wget", "--version"], "wget"),
(["bzip2", "-h"], "bzip2")]:
... | [
"def",
"check_dependencies",
"(",
")",
":",
"print",
"(",
"\"Checking required dependencies\"",
")",
"for",
"dep",
",",
"msg",
"in",
"[",
"(",
"[",
"\"git\"",
",",
"\"--version\"",
"]",
",",
"\"Git (http://git-scm.com/)\"",
")",
",",
"(",
"[",
"\"wget\"",
",",... | Ensure required tools for installation are present. | [
"Ensure",
"required",
"tools",
"for",
"installation",
"are",
"present",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L207-L221 |
223,593 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | process | def process(args):
"""Run the function in args.name given arguments in args.argfile.
"""
# Set environment to standard to use periods for decimals and avoid localization
os.environ["LC_ALL"] = "C"
os.environ["LC"] = "C"
os.environ["LANG"] = "C"
setpath.prepend_bcbiopath()
try:
fn... | python | def process(args):
"""Run the function in args.name given arguments in args.argfile.
"""
# Set environment to standard to use periods for decimals and avoid localization
os.environ["LC_ALL"] = "C"
os.environ["LC"] = "C"
os.environ["LANG"] = "C"
setpath.prepend_bcbiopath()
try:
fn... | [
"def",
"process",
"(",
"args",
")",
":",
"# Set environment to standard to use periods for decimals and avoid localization",
"os",
".",
"environ",
"[",
"\"LC_ALL\"",
"]",
"=",
"\"C\"",
"os",
".",
"environ",
"[",
"\"LC\"",
"]",
"=",
"\"C\"",
"os",
".",
"environ",
"... | Run the function in args.name given arguments in args.argfile. | [
"Run",
"the",
"function",
"in",
"args",
".",
"name",
"given",
"arguments",
"in",
"args",
".",
"argfile",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L23-L71 |
223,594 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _cwlvar_to_wdl | def _cwlvar_to_wdl(var):
"""Convert a CWL output object into a WDL output.
This flattens files and other special CWL outputs that are
plain strings in WDL.
"""
if isinstance(var, (list, tuple)):
return [_cwlvar_to_wdl(x) for x in var]
elif isinstance(var, dict):
assert var.get("... | python | def _cwlvar_to_wdl(var):
"""Convert a CWL output object into a WDL output.
This flattens files and other special CWL outputs that are
plain strings in WDL.
"""
if isinstance(var, (list, tuple)):
return [_cwlvar_to_wdl(x) for x in var]
elif isinstance(var, dict):
assert var.get("... | [
"def",
"_cwlvar_to_wdl",
"(",
"var",
")",
":",
"if",
"isinstance",
"(",
"var",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"_cwlvar_to_wdl",
"(",
"x",
")",
"for",
"x",
"in",
"var",
"]",
"elif",
"isinstance",
"(",
"var",
",",
"dict... | Convert a CWL output object into a WDL output.
This flattens files and other special CWL outputs that are
plain strings in WDL. | [
"Convert",
"a",
"CWL",
"output",
"object",
"into",
"a",
"WDL",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L73-L86 |
223,595 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _write_out_argfile | def _write_out_argfile(argfile, out, fnargs, parallel, out_keys, input_files, work_dir):
"""Write output argfile, preparing a CWL ready JSON or YAML representation of the world.
"""
with open(argfile, "w") as out_handle:
if argfile.endswith(".json"):
record_name, record_attrs = _get_reco... | python | def _write_out_argfile(argfile, out, fnargs, parallel, out_keys, input_files, work_dir):
"""Write output argfile, preparing a CWL ready JSON or YAML representation of the world.
"""
with open(argfile, "w") as out_handle:
if argfile.endswith(".json"):
record_name, record_attrs = _get_reco... | [
"def",
"_write_out_argfile",
"(",
"argfile",
",",
"out",
",",
"fnargs",
",",
"parallel",
",",
"out_keys",
",",
"input_files",
",",
"work_dir",
")",
":",
"with",
"open",
"(",
"argfile",
",",
"\"w\"",
")",
"as",
"out_handle",
":",
"if",
"argfile",
".",
"en... | Write output argfile, preparing a CWL ready JSON or YAML representation of the world. | [
"Write",
"output",
"argfile",
"preparing",
"a",
"CWL",
"ready",
"JSON",
"or",
"YAML",
"representation",
"of",
"the",
"world",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L88-L113 |
223,596 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _get_record_attrs | def _get_record_attrs(out_keys):
"""Check for records, a single key plus output attributes.
"""
if len(out_keys) == 1:
attr = list(out_keys.keys())[0]
if out_keys[attr]:
return attr, out_keys[attr]
return None, None | python | def _get_record_attrs(out_keys):
"""Check for records, a single key plus output attributes.
"""
if len(out_keys) == 1:
attr = list(out_keys.keys())[0]
if out_keys[attr]:
return attr, out_keys[attr]
return None, None | [
"def",
"_get_record_attrs",
"(",
"out_keys",
")",
":",
"if",
"len",
"(",
"out_keys",
")",
"==",
"1",
":",
"attr",
"=",
"list",
"(",
"out_keys",
".",
"keys",
"(",
")",
")",
"[",
"0",
"]",
"if",
"out_keys",
"[",
"attr",
"]",
":",
"return",
"attr",
... | Check for records, a single key plus output attributes. | [
"Check",
"for",
"records",
"a",
"single",
"key",
"plus",
"output",
"attributes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L115-L122 |
223,597 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _add_resources | def _add_resources(data, runtime):
"""Merge input resources with current CWL runtime parameters.
"""
if "config" not in data:
data["config"] = {}
# Convert input resources, which may be a JSON string
resources = data.get("resources", {}) or {}
if isinstance(resources, six.string_types) a... | python | def _add_resources(data, runtime):
"""Merge input resources with current CWL runtime parameters.
"""
if "config" not in data:
data["config"] = {}
# Convert input resources, which may be a JSON string
resources = data.get("resources", {}) or {}
if isinstance(resources, six.string_types) a... | [
"def",
"_add_resources",
"(",
"data",
",",
"runtime",
")",
":",
"if",
"\"config\"",
"not",
"in",
"data",
":",
"data",
"[",
"\"config\"",
"]",
"=",
"{",
"}",
"# Convert input resources, which may be a JSON string",
"resources",
"=",
"data",
".",
"get",
"(",
"\"... | Merge input resources with current CWL runtime parameters. | [
"Merge",
"input",
"resources",
"with",
"current",
"CWL",
"runtime",
"parameters",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L124-L143 |
223,598 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _world_from_cwl | def _world_from_cwl(fn_name, fnargs, work_dir):
"""Reconstitute a bcbio world data object from flattened CWL-compatible inputs.
Converts the flat CWL representation into a nested bcbio world dictionary.
Handles single sample inputs (returning a single world object) and multi-sample
runs (returning a l... | python | def _world_from_cwl(fn_name, fnargs, work_dir):
"""Reconstitute a bcbio world data object from flattened CWL-compatible inputs.
Converts the flat CWL representation into a nested bcbio world dictionary.
Handles single sample inputs (returning a single world object) and multi-sample
runs (returning a l... | [
"def",
"_world_from_cwl",
"(",
"fn_name",
",",
"fnargs",
",",
"work_dir",
")",
":",
"parallel",
"=",
"None",
"output_cwl_keys",
"=",
"None",
"runtime",
"=",
"{",
"}",
"out",
"=",
"[",
"]",
"data",
"=",
"{",
"}",
"passed_keys",
"=",
"[",
"]",
"for",
"... | Reconstitute a bcbio world data object from flattened CWL-compatible inputs.
Converts the flat CWL representation into a nested bcbio world dictionary.
Handles single sample inputs (returning a single world object) and multi-sample
runs (returning a list of individual samples to get processed together). | [
"Reconstitute",
"a",
"bcbio",
"world",
"data",
"object",
"from",
"flattened",
"CWL",
"-",
"compatible",
"inputs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L145-L194 |
223,599 | bcbio/bcbio-nextgen | bcbio/distributed/runfn.py | _parse_output_keys | def _parse_output_keys(val):
"""Parse expected output keys from string, handling records.
"""
out = {}
for k in val.split(","):
# record output
if ":" in k:
name, attrs = k.split(":")
out[name] = attrs.split(";")
else:
out[k] = None
return ... | python | def _parse_output_keys(val):
"""Parse expected output keys from string, handling records.
"""
out = {}
for k in val.split(","):
# record output
if ":" in k:
name, attrs = k.split(":")
out[name] = attrs.split(";")
else:
out[k] = None
return ... | [
"def",
"_parse_output_keys",
"(",
"val",
")",
":",
"out",
"=",
"{",
"}",
"for",
"k",
"in",
"val",
".",
"split",
"(",
"\",\"",
")",
":",
"# record output",
"if",
"\":\"",
"in",
"k",
":",
"name",
",",
"attrs",
"=",
"k",
".",
"split",
"(",
"\":\"",
... | Parse expected output keys from string, handling records. | [
"Parse",
"expected",
"output",
"keys",
"from",
"string",
"handling",
"records",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/runfn.py#L196-L207 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.