partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | start_batch | This function will administer 5 jobs at a time then recursively call itself until subset is empty | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | def start_batch(job, input_args):
"""
This function will administer 5 jobs at a time then recursively call itself until subset is empty
"""
samples = parse_sra(input_args['sra'])
# for analysis_id in samples:
job.addChildJobFn(download_and_transfer_sample, input_args, samples, cores=1, disk='30'... | def start_batch(job, input_args):
"""
This function will administer 5 jobs at a time then recursively call itself until subset is empty
"""
samples = parse_sra(input_args['sra'])
# for analysis_id in samples:
job.addChildJobFn(download_and_transfer_sample, input_args, samples, cores=1, disk='30'... | [
"This",
"function",
"will",
"administer",
"5",
"jobs",
"at",
"a",
"time",
"then",
"recursively",
"call",
"itself",
"until",
"subset",
"is",
"empty"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L113-L119 | [
"def",
"start_batch",
"(",
"job",
",",
"input_args",
")",
":",
"samples",
"=",
"parse_sra",
"(",
"input_args",
"[",
"'sra'",
"]",
")",
"# for analysis_id in samples:",
"job",
".",
"addChildJobFn",
"(",
"download_and_transfer_sample",
",",
"input_args",
",",
"sampl... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_and_transfer_sample | Downloads a sample from dbGaP via SRAToolKit, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | def download_and_transfer_sample(job, input_args, samples):
"""
Downloads a sample from dbGaP via SRAToolKit, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
if len(samples) > 1:
a... | def download_and_transfer_sample(job, input_args, samples):
"""
Downloads a sample from dbGaP via SRAToolKit, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
if len(samples) > 1:
a... | [
"Downloads",
"a",
"sample",
"from",
"dbGaP",
"via",
"SRAToolKit",
"then",
"uses",
"S3AM",
"to",
"transfer",
"it",
"to",
"S3"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L122-L172 | [
"def",
"download_and_transfer_sample",
"(",
"job",
",",
"input_args",
",",
"samples",
")",
":",
"if",
"len",
"(",
"samples",
")",
">",
"1",
":",
"a",
"=",
"samples",
"[",
"len",
"(",
"samples",
")",
"/",
"2",
":",
"]",
"b",
"=",
"samples",
"[",
":"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | main | Transfer gTEX data from dbGaP (NCBI) to S3 | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | def main():
"""
Transfer gTEX data from dbGaP (NCBI) to S3
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Store inputs from argparse
inputs = {'sra': args.sra,
'dbgap_key': args.dbgap_key... | def main():
"""
Transfer gTEX data from dbGaP (NCBI) to S3
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Store inputs from argparse
inputs = {'sra': args.sra,
'dbgap_key': args.dbgap_key... | [
"Transfer",
"gTEX",
"data",
"from",
"dbGaP",
"(",
"NCBI",
")",
"to",
"S3"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L175-L198 | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | output_file_job | Uploads a file from the FileStore to an output directory on the local filesystem or S3.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str filename: basename for file
:param str file_id: FileStoreID
:param str output_dir: Amazon S3 URL or local path
:param str s3_key_path: (... | src/toil_scripts/gatk_germline/common.py | def output_file_job(job, filename, file_id, output_dir, s3_key_path=None):
"""
Uploads a file from the FileStore to an output directory on the local filesystem or S3.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str filename: basename for file
:param str file_id: FileStore... | def output_file_job(job, filename, file_id, output_dir, s3_key_path=None):
"""
Uploads a file from the FileStore to an output directory on the local filesystem or S3.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str filename: basename for file
:param str file_id: FileStore... | [
"Uploads",
"a",
"file",
"from",
"the",
"FileStore",
"to",
"an",
"output",
"directory",
"on",
"the",
"local",
"filesystem",
"or",
"S3",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/common.py#L10-L32 | [
"def",
"output_file_job",
"(",
"job",
",",
"filename",
",",
"file_id",
",",
"output_dir",
",",
"s3_key_path",
"=",
"None",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Writing {} to {}'",
".",
"format",
"(",
"filename",
",",
"output_dir",
")... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_encrypted_file | Downloads encrypted files from S3 via header injection
input_args: dict Input dictionary defined in main()
name: str Symbolic name associated with file | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def download_encrypted_file(job, input_args, name):
"""
Downloads encrypted files from S3 via header injection
input_args: dict Input dictionary defined in main()
name: str Symbolic name associated with file
"""
work_dir = job.fileStore.getLocalTempDir()
key_path = input_args['... | def download_encrypted_file(job, input_args, name):
"""
Downloads encrypted files from S3 via header injection
input_args: dict Input dictionary defined in main()
name: str Symbolic name associated with file
"""
work_dir = job.fileStore.getLocalTempDir()
key_path = input_args['... | [
"Downloads",
"encrypted",
"files",
"from",
"S3",
"via",
"header",
"injection"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L177-L206 | [
"def",
"download_encrypted_file",
"(",
"job",
",",
"input_args",
",",
"name",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"key_path",
"=",
"input_args",
"[",
"'ssec'",
"]",
"file_path",
"=",
"os",
".",
"path",
".",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_from_url | Simple curl request made for a given url
url: str URL to download | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def download_from_url(job, url):
"""
Simple curl request made for a given url
url: str URL to download
"""
work_dir = job.fileStore.getLocalTempDir()
file_path = os.path.join(work_dir, os.path.basename(url))
if not os.path.exists(file_path):
if url.startswith('s3:'):
... | def download_from_url(job, url):
"""
Simple curl request made for a given url
url: str URL to download
"""
work_dir = job.fileStore.getLocalTempDir()
file_path = os.path.join(work_dir, os.path.basename(url))
if not os.path.exists(file_path):
if url.startswith('s3:'):
... | [
"Simple",
"curl",
"request",
"made",
"for",
"a",
"given",
"url"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L209-L226 | [
"def",
"download_from_url",
"(",
"job",
",",
"url",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"os",
".",
"path",
".",
"basename",
"(",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | docker_call | Makes subprocess call of a command to a docker container.
tool_parameters: list An array of the parameters to be passed to the tool
tool: str Name of the Docker image to be used (e.g. quay.io/ucsc_cgl/samtools)
java_opts: str Optional commands to pass to a java jar execution. (e.g... | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def docker_call(work_dir, tool_parameters, tool, java_opts=None, outfile=None, sudo=False):
"""
Makes subprocess call of a command to a docker container.
tool_parameters: list An array of the parameters to be passed to the tool
tool: str Name of the Docker image to be used (e.g. quay.i... | def docker_call(work_dir, tool_parameters, tool, java_opts=None, outfile=None, sudo=False):
"""
Makes subprocess call of a command to a docker container.
tool_parameters: list An array of the parameters to be passed to the tool
tool: str Name of the Docker image to be used (e.g. quay.i... | [
"Makes",
"subprocess",
"call",
"of",
"a",
"command",
"to",
"a",
"docker",
"container",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L257-L281 | [
"def",
"docker_call",
"(",
"work_dir",
",",
"tool_parameters",
",",
"tool",
",",
"java_opts",
"=",
"None",
",",
"outfile",
"=",
"None",
",",
"sudo",
"=",
"False",
")",
":",
"base_docker_call",
"=",
"'docker run --log-driver=none --rm -v {}:/data'",
".",
"format",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | copy_to_output_dir | A list of files to move from work_dir to output_dir.
work_dir: str Current working directory
output_dir: str Output directory for files to go
uuid: str UUID to "stamp" onto output files
files: list List of files to iterate through | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def copy_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
A list of files to move from work_dir to output_dir.
work_dir: str Current working directory
output_dir: str Output directory for files to go
uuid: str UUID to "stamp" onto output files
files: list ... | def copy_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
A list of files to move from work_dir to output_dir.
work_dir: str Current working directory
output_dir: str Output directory for files to go
uuid: str UUID to "stamp" onto output files
files: list ... | [
"A",
"list",
"of",
"files",
"to",
"move",
"from",
"work_dir",
"to",
"output_dir",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L284-L297 | [
"def",
"copy_to_output_dir",
"(",
"work_dir",
",",
"output_dir",
",",
"uuid",
"=",
"None",
",",
"files",
"=",
"list",
"(",
")",
")",
":",
"for",
"fname",
"in",
"files",
":",
"if",
"uuid",
"is",
"None",
":",
"shutil",
".",
"copy",
"(",
"os",
".",
"p... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | program_checks | Checks that dependency programs are installed.
input_args: dict Dictionary of input arguments (from main()) | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def program_checks(job, input_args):
"""
Checks that dependency programs are installed.
input_args: dict Dictionary of input arguments (from main())
"""
# Program checks
for program in ['curl', 'docker', 'unzip', 'samtools']:
assert which(program), 'Program "{}" must be installed... | def program_checks(job, input_args):
"""
Checks that dependency programs are installed.
input_args: dict Dictionary of input arguments (from main())
"""
# Program checks
for program in ['curl', 'docker', 'unzip', 'samtools']:
assert which(program), 'Program "{}" must be installed... | [
"Checks",
"that",
"dependency",
"programs",
"are",
"installed",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L334-L343 | [
"def",
"program_checks",
"(",
"job",
",",
"input_args",
")",
":",
"# Program checks",
"for",
"program",
"in",
"[",
"'curl'",
",",
"'docker'",
",",
"'unzip'",
",",
"'samtools'",
"]",
":",
"assert",
"which",
"(",
"program",
")",
",",
"'Program \"{}\" must be ins... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_shared_files | Downloads and stores shared inputs files in the FileStore
input_args: dict Dictionary of input arguments (from main()) | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def download_shared_files(job, input_args):
"""
Downloads and stores shared inputs files in the FileStore
input_args: dict Dictionary of input arguments (from main())
"""
shared_files = ['unc.bed', 'hg19.transcripts.fa', 'composite_exons.bed', 'normalize.pl', 'rsem_ref.zip',
... | def download_shared_files(job, input_args):
"""
Downloads and stores shared inputs files in the FileStore
input_args: dict Dictionary of input arguments (from main())
"""
shared_files = ['unc.bed', 'hg19.transcripts.fa', 'composite_exons.bed', 'normalize.pl', 'rsem_ref.zip',
... | [
"Downloads",
"and",
"stores",
"shared",
"inputs",
"files",
"in",
"the",
"FileStore"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L346-L363 | [
"def",
"download_shared_files",
"(",
"job",
",",
"input_args",
")",
":",
"shared_files",
"=",
"[",
"'unc.bed'",
",",
"'hg19.transcripts.fa'",
",",
"'composite_exons.bed'",
",",
"'normalize.pl'",
",",
"'rsem_ref.zip'",
",",
"'ebwt.zip'",
",",
"'chromosomes.zip'",
"]",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | parse_config_file | Launches pipeline for each sample.
shared_ids: dict Dictionary of fileStore IDs
input_args: dict Dictionary of input arguments | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def parse_config_file(job, ids, input_args):
"""
Launches pipeline for each sample.
shared_ids: dict Dictionary of fileStore IDs
input_args: dict Dictionary of input arguments
"""
samples = []
config = input_args['config']
with open(config, 'r') as f:
for line in f... | def parse_config_file(job, ids, input_args):
"""
Launches pipeline for each sample.
shared_ids: dict Dictionary of fileStore IDs
input_args: dict Dictionary of input arguments
"""
samples = []
config = input_args['config']
with open(config, 'r') as f:
for line in f... | [
"Launches",
"pipeline",
"for",
"each",
"sample",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L366-L381 | [
"def",
"parse_config_file",
"(",
"job",
",",
"ids",
",",
"input_args",
")",
":",
"samples",
"=",
"[",
"]",
"config",
"=",
"input_args",
"[",
"'config'",
"]",
"with",
"open",
"(",
"config",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_sample | Defines variables unique to a sample that are used in the rest of the pipelines
ids: dict Dictionary of fileStore IDS
input_args: dict Dictionary of input arguments
sample: tuple Contains uuid and sample_url | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def download_sample(job, ids, input_args, sample):
"""
Defines variables unique to a sample that are used in the rest of the pipelines
ids: dict Dictionary of fileStore IDS
input_args: dict Dictionary of input arguments
sample: tuple Contains uuid and sample_url
"""
if le... | def download_sample(job, ids, input_args, sample):
"""
Defines variables unique to a sample that are used in the rest of the pipelines
ids: dict Dictionary of fileStore IDS
input_args: dict Dictionary of input arguments
sample: tuple Contains uuid and sample_url
"""
if le... | [
"Defines",
"variables",
"unique",
"to",
"a",
"sample",
"that",
"are",
"used",
"in",
"the",
"rest",
"of",
"the",
"pipelines"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L384-L417 | [
"def",
"download_sample",
"(",
"job",
",",
"ids",
",",
"input_args",
",",
"sample",
")",
":",
"if",
"len",
"(",
"sample",
")",
"==",
"2",
":",
"uuid",
",",
"sample_location",
"=",
"sample",
"url1",
",",
"url2",
"=",
"None",
",",
"None",
"else",
":",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | static_dag_launchpoint | Statically define jobs in the pipeline
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def static_dag_launchpoint(job, job_vars):
"""
Statically define jobs in the pipeline
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
if input_args['config_fastq']:
cores = input_args['cpu_count']
a = job.wrapJobFn(mapsplice, job_vars... | def static_dag_launchpoint(job, job_vars):
"""
Statically define jobs in the pipeline
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
if input_args['config_fastq']:
cores = input_args['cpu_count']
a = job.wrapJobFn(mapsplice, job_vars... | [
"Statically",
"define",
"jobs",
"in",
"the",
"pipeline"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L420-L435 | [
"def",
"static_dag_launchpoint",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"if",
"input_args",
"[",
"'config_fastq'",
"]",
":",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"a",
"=",
"job",
".",
"wrapJobFn",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | merge_fastqs | Unzips input sample and concats the Read1 and Read2 groups together.
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def merge_fastqs(job, job_vars):
"""
Unzips input sample and concats the Read1 and Read2 groups together.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
single_end_re... | def merge_fastqs(job, job_vars):
"""
Unzips input sample and concats the Read1 and Read2 groups together.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
single_end_re... | [
"Unzips",
"input",
"sample",
"and",
"concats",
"the",
"Read1",
"and",
"Read2",
"groups",
"together",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L438-L476 | [
"def",
"merge_fastqs",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"single_end_reads",
"=",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | mapsplice | Maps RNA-Seq reads to a reference genome.
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def mapsplice(job, job_vars):
"""
Maps RNA-Seq reads to a reference genome.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['s... | def mapsplice(job, job_vars):
"""
Maps RNA-Seq reads to a reference genome.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['s... | [
"Maps",
"RNA",
"-",
"Seq",
"reads",
"to",
"a",
"reference",
"genome",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L479-L524 | [
"def",
"mapsplice",
"(",
"job",
",",
"job_vars",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | add_read_groups | This function adds read groups to the headers
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def add_read_groups(job, job_vars):
"""
This function adds read groups to the headers
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
alignments = return_input_pat... | def add_read_groups(job, job_vars):
"""
This function adds read groups to the headers
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
alignments = return_input_pat... | [
"This",
"function",
"adds",
"read",
"groups",
"to",
"the",
"headers"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L548-L575 | [
"def",
"add_read_groups",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# I/O",
"alignments",
"=... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | bamsort_and_index | Sorts bam file and produces index file
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def bamsort_and_index(job, job_vars):
"""
Sorts bam file and produces index file
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
rg_alignmen... | def bamsort_and_index(job, job_vars):
"""
Sorts bam file and produces index file
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
rg_alignmen... | [
"Sorts",
"bam",
"file",
"and",
"produces",
"index",
"file"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L578-L604 | [
"def",
"bamsort_and_index",
"(",
"job",
",",
"job_vars",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# ... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | rseq_qc | QC module: contains QC metrics and information about the BAM post alignment
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def rseq_qc(job, job_vars):
"""
QC module: contains QC metrics and information about the BAM post alignment
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args... | def rseq_qc(job, job_vars):
"""
QC module: contains QC metrics and information about the BAM post alignment
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args... | [
"QC",
"module",
":",
"contains",
"QC",
"metrics",
"and",
"information",
"about",
"the",
"BAM",
"post",
"alignment"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L607-L625 | [
"def",
"rseq_qc",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"sudo",
"=",
"input_args",
"[",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | sort_bam_by_reference | Sorts the bam by reference
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def sort_bam_by_reference(job, job_vars):
"""
Sorts the bam by reference
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
# I/O
sorted_bam, sorted_bai = return_input_paths(job, ... | def sort_bam_by_reference(job, job_vars):
"""
Sorts the bam by reference
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
# I/O
sorted_bam, sorted_bai = return_input_paths(job, ... | [
"Sorts",
"the",
"bam",
"by",
"reference"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L628-L663 | [
"def",
"sort_bam_by_reference",
"(",
"job",
",",
"job_vars",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"# I/O",
"sorted_bam",
",",
"sorted_bai",
"=",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | exon_count | Produces exon counts
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def exon_count(job, job_vars):
"""
Produces exon counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args['sudo']
# I/O
sort_by_ref, normalize_pl, co... | def exon_count(job, job_vars):
"""
Produces exon counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args['sudo']
# I/O
sort_by_ref, normalize_pl, co... | [
"Produces",
"exon",
"counts"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L666-L705 | [
"def",
"exon_count",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"sudo",
"=",
"input_args",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | transcriptome | Creates a bam of just the transcriptome
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def transcriptome(job, job_vars):
"""
Creates a bam of just the transcriptome
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
sort_by_ref, bed, hg19_fa = return_in... | def transcriptome(job, job_vars):
"""
Creates a bam of just the transcriptome
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
sort_by_ref, bed, hg19_fa = return_in... | [
"Creates",
"a",
"bam",
"of",
"just",
"the",
"transcriptome"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L708-L734 | [
"def",
"transcriptome",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# I/O",
"sort_by_ref",
","... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | filter_bam | Performs filtering on the transcriptome bam
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def filter_bam(job, job_vars):
"""
Performs filtering on the transcriptome bam
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['sudo']
# I/O
... | def filter_bam(job, job_vars):
"""
Performs filtering on the transcriptome bam
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['sudo']
# I/O
... | [
"Performs",
"filtering",
"on",
"the",
"transcriptome",
"bam"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L737-L762 | [
"def",
"filter_bam",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo",
"=",
"input_args... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | rsem | Runs RSEM to produce counts
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def rsem(job, job_vars):
"""
Runs RSEM to produce counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cpus = input_args['cpu_count']
sudo = input_args['sudo']
single_end_reads = input_args['si... | def rsem(job, job_vars):
"""
Runs RSEM to produce counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cpus = input_args['cpu_count']
sudo = input_args['sudo']
single_end_reads = input_args['si... | [
"Runs",
"RSEM",
"to",
"produce",
"counts"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L765-L800 | [
"def",
"rsem",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cpus",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo",
"=",
"input_args",
"[... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | consolidate_output | Combine the contents of separate zipped outputs into one via streaming
job_vars: tuple Tuple of dictionaries: input_args and ids
output_ids: tuple Nested tuple of all the output fileStore IDs | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def consolidate_output(job, job_vars, output_ids):
"""
Combine the contents of separate zipped outputs into one via streaming
job_vars: tuple Tuple of dictionaries: input_args and ids
output_ids: tuple Nested tuple of all the output fileStore IDs
"""
input_args, ids = job_vars
work_di... | def consolidate_output(job, job_vars, output_ids):
"""
Combine the contents of separate zipped outputs into one via streaming
job_vars: tuple Tuple of dictionaries: input_args and ids
output_ids: tuple Nested tuple of all the output fileStore IDs
"""
input_args, ids = job_vars
work_di... | [
"Combine",
"the",
"contents",
"of",
"separate",
"zipped",
"outputs",
"into",
"one",
"via",
"streaming"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L826-L865 | [
"def",
"consolidate_output",
"(",
"job",
",",
"job_vars",
",",
"output_ids",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"# ... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | upload_output_to_s3 | If s3_dir is specified in arguments, file will be uploaded to S3 using boto.
WARNING: ~/.boto credentials are necessary for this to succeed!
job_vars: tuple Tuple of dictionaries: input_args and ids | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def upload_output_to_s3(job, job_vars):
"""
If s3_dir is specified in arguments, file will be uploaded to S3 using boto.
WARNING: ~/.boto credentials are necessary for this to succeed!
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
import boto
from boto.s3.key import Key
... | def upload_output_to_s3(job, job_vars):
"""
If s3_dir is specified in arguments, file will be uploaded to S3 using boto.
WARNING: ~/.boto credentials are necessary for this to succeed!
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
import boto
from boto.s3.key import Key
... | [
"If",
"s3_dir",
"is",
"specified",
"in",
"arguments",
"file",
"will",
"be",
"uploaded",
"to",
"S3",
"using",
"boto",
".",
"WARNING",
":",
"~",
"/",
".",
"boto",
"credentials",
"are",
"necessary",
"for",
"this",
"to",
"succeed!"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L868-L892 | [
"def",
"upload_output_to_s3",
"(",
"job",
",",
"job_vars",
")",
":",
"import",
"boto",
"from",
"boto",
".",
"s3",
".",
"key",
"import",
"Key",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | upload_bam_to_s3 | Upload bam to S3. Requires S3AM and a ~/.boto config file. | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def upload_bam_to_s3(job, job_vars):
"""
Upload bam to S3. Requires S3AM and a ~/.boto config file.
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
# I/O
job.fileStore.readGlobalFile(ids['alignments.bam'], os.path.join(work_dir, 'alignm... | def upload_bam_to_s3(job, job_vars):
"""
Upload bam to S3. Requires S3AM and a ~/.boto config file.
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
# I/O
job.fileStore.readGlobalFile(ids['alignments.bam'], os.path.join(work_dir, 'alignm... | [
"Upload",
"bam",
"to",
"S3",
".",
"Requires",
"S3AM",
"and",
"a",
"~",
"/",
".",
"boto",
"config",
"file",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L895-L915 | [
"def",
"upload_bam_to_s3",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"# I/O",
"job",
".",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | main | This is a Toil pipeline for the UNC best practice RNA-Seq analysis.
RNA-seq fastqs are combined, aligned, sorted, filtered, and quantified.
Please read the README.md located in the same directory. | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | def main():
"""
This is a Toil pipeline for the UNC best practice RNA-Seq analysis.
RNA-seq fastqs are combined, aligned, sorted, filtered, and quantified.
Please read the README.md located in the same directory.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Run... | def main():
"""
This is a Toil pipeline for the UNC best practice RNA-Seq analysis.
RNA-seq fastqs are combined, aligned, sorted, filtered, and quantified.
Please read the README.md located in the same directory.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Run... | [
"This",
"is",
"a",
"Toil",
"pipeline",
"for",
"the",
"UNC",
"best",
"practice",
"RNA",
"-",
"Seq",
"analysis",
".",
"RNA",
"-",
"seq",
"fastqs",
"are",
"combined",
"aligned",
"sorted",
"filtered",
"and",
"quantified",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L918-L951 | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | remove_file | Remove the given file from hdfs with master at the given IP address
:type masterIP: MasterAddress | src/toil_scripts/adam_pipeline/adam_preprocessing.py | def remove_file(master_ip, filename, spark_on_toil):
"""
Remove the given file from hdfs with master at the given IP address
:type masterIP: MasterAddress
"""
master_ip = master_ip.actual
ssh_call = ['ssh', '-o', 'StrictHostKeyChecking=no', master_ip]
if spark_on_toil:
output = ch... | def remove_file(master_ip, filename, spark_on_toil):
"""
Remove the given file from hdfs with master at the given IP address
:type masterIP: MasterAddress
"""
master_ip = master_ip.actual
ssh_call = ['ssh', '-o', 'StrictHostKeyChecking=no', master_ip]
if spark_on_toil:
output = ch... | [
"Remove",
"the",
"given",
"file",
"from",
"hdfs",
"with",
"master",
"at",
"the",
"given",
"IP",
"address"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L52-L70 | [
"def",
"remove_file",
"(",
"master_ip",
",",
"filename",
",",
"spark_on_toil",
")",
":",
"master_ip",
"=",
"master_ip",
".",
"actual",
"ssh_call",
"=",
"[",
"'ssh'",
",",
"'-o'",
",",
"'StrictHostKeyChecking=no'",
",",
"master_ip",
"]",
"if",
"spark_on_toil",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_data | Downloads input data files from S3.
:type masterIP: MasterAddress | src/toil_scripts/adam_pipeline/adam_preprocessing.py | def download_data(job, master_ip, inputs, known_snps, bam, hdfs_snps, hdfs_bam):
"""
Downloads input data files from S3.
:type masterIP: MasterAddress
"""
log.info("Downloading known sites file %s to %s.", known_snps, hdfs_snps)
call_conductor(job, master_ip, known_snps, hdfs_snps, memory=inpu... | def download_data(job, master_ip, inputs, known_snps, bam, hdfs_snps, hdfs_bam):
"""
Downloads input data files from S3.
:type masterIP: MasterAddress
"""
log.info("Downloading known sites file %s to %s.", known_snps, hdfs_snps)
call_conductor(job, master_ip, known_snps, hdfs_snps, memory=inpu... | [
"Downloads",
"input",
"data",
"files",
"from",
"S3",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L96-L107 | [
"def",
"download_data",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"known_snps",
",",
"bam",
",",
"hdfs_snps",
",",
"hdfs_bam",
")",
":",
"log",
".",
"info",
"(",
"\"Downloading known sites file %s to %s.\"",
",",
"known_snps",
",",
"hdfs_snps",
")",
"c... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | adam_convert | Convert input sam/bam file and known SNPs file into ADAM format | src/toil_scripts/adam_pipeline/adam_preprocessing.py | def adam_convert(job, master_ip, inputs, in_file, in_snps, adam_file, adam_snps, spark_on_toil):
"""
Convert input sam/bam file and known SNPs file into ADAM format
"""
log.info("Converting input BAM to ADAM.")
call_adam(job, master_ip,
["transform", in_file, adam_file],
... | def adam_convert(job, master_ip, inputs, in_file, in_snps, adam_file, adam_snps, spark_on_toil):
"""
Convert input sam/bam file and known SNPs file into ADAM format
"""
log.info("Converting input BAM to ADAM.")
call_adam(job, master_ip,
["transform", in_file, adam_file],
... | [
"Convert",
"input",
"sam",
"/",
"bam",
"file",
"and",
"known",
"SNPs",
"file",
"into",
"ADAM",
"format"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L110-L134 | [
"def",
"adam_convert",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"in_file",
",",
"in_snps",
",",
"adam_file",
",",
"adam_snps",
",",
"spark_on_toil",
")",
":",
"log",
".",
"info",
"(",
"\"Converting input BAM to ADAM.\"",
")",
"call_adam",
"(",
"job",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | adam_transform | Preprocess in_file with known SNPs snp_file:
- mark duplicates
- realign indels
- recalibrate base quality scores | src/toil_scripts/adam_pipeline/adam_preprocessing.py | def adam_transform(job, master_ip, inputs, in_file, snp_file, hdfs_dir, out_file, spark_on_toil):
"""
Preprocess in_file with known SNPs snp_file:
- mark duplicates
- realign indels
- recalibrate base quality scores
"""
log.info("Marking duplicate reads.")
call_adam(job, mas... | def adam_transform(job, master_ip, inputs, in_file, snp_file, hdfs_dir, out_file, spark_on_toil):
"""
Preprocess in_file with known SNPs snp_file:
- mark duplicates
- realign indels
- recalibrate base quality scores
"""
log.info("Marking duplicate reads.")
call_adam(job, mas... | [
"Preprocess",
"in_file",
"with",
"known",
"SNPs",
"snp_file",
":",
"-",
"mark",
"duplicates",
"-",
"realign",
"indels",
"-",
"recalibrate",
"base",
"quality",
"scores"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L137-L197 | [
"def",
"adam_transform",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"in_file",
",",
"snp_file",
",",
"hdfs_dir",
",",
"out_file",
",",
"spark_on_toil",
")",
":",
"log",
".",
"info",
"(",
"\"Marking duplicate reads.\"",
")",
"call_adam",
"(",
"job",
",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | upload_data | Upload file hdfsName from hdfs to s3 | src/toil_scripts/adam_pipeline/adam_preprocessing.py | def upload_data(job, master_ip, inputs, hdfs_name, upload_name, spark_on_toil):
"""
Upload file hdfsName from hdfs to s3
"""
if mock_mode():
truncate_file(master_ip, hdfs_name, spark_on_toil)
log.info("Uploading output BAM %s to %s.", hdfs_name, upload_name)
call_conductor(job, master_... | def upload_data(job, master_ip, inputs, hdfs_name, upload_name, spark_on_toil):
"""
Upload file hdfsName from hdfs to s3
"""
if mock_mode():
truncate_file(master_ip, hdfs_name, spark_on_toil)
log.info("Uploading output BAM %s to %s.", hdfs_name, upload_name)
call_conductor(job, master_... | [
"Upload",
"file",
"hdfsName",
"from",
"hdfs",
"to",
"s3"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L200-L210 | [
"def",
"upload_data",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"hdfs_name",
",",
"upload_name",
",",
"spark_on_toil",
")",
":",
"if",
"mock_mode",
"(",
")",
":",
"truncate_file",
"(",
"master_ip",
",",
"hdfs_name",
",",
"spark_on_toil",
")",
"log",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_run_and_upload | Monolithic job that calls data download, conversion, transform, upload.
Previously, this was not monolithic; change came in due to #126/#134. | src/toil_scripts/adam_pipeline/adam_preprocessing.py | def download_run_and_upload(job, master_ip, inputs, spark_on_toil):
"""
Monolithic job that calls data download, conversion, transform, upload.
Previously, this was not monolithic; change came in due to #126/#134.
"""
master_ip = MasterAddress(master_ip)
bam_name = inputs.sample.split('://')[-1... | def download_run_and_upload(job, master_ip, inputs, spark_on_toil):
"""
Monolithic job that calls data download, conversion, transform, upload.
Previously, this was not monolithic; change came in due to #126/#134.
"""
master_ip = MasterAddress(master_ip)
bam_name = inputs.sample.split('://')[-1... | [
"Monolithic",
"job",
"that",
"calls",
"data",
"download",
"conversion",
"transform",
"upload",
".",
"Previously",
"this",
"was",
"not",
"monolithic",
";",
"change",
"came",
"in",
"due",
"to",
"#126",
"/",
"#134",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L213-L264 | [
"def",
"download_run_and_upload",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"spark_on_toil",
")",
":",
"master_ip",
"=",
"MasterAddress",
"(",
"master_ip",
")",
"bam_name",
"=",
"inputs",
".",
"sample",
".",
"split",
"(",
"'://'",
")",
"[",
"-",
"1... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | static_adam_preprocessing_dag | A Toil job function performing ADAM preprocessing on a single sample | src/toil_scripts/adam_pipeline/adam_preprocessing.py | def static_adam_preprocessing_dag(job, inputs, sample, output_dir, suffix=''):
"""
A Toil job function performing ADAM preprocessing on a single sample
"""
inputs.sample = sample
inputs.output_dir = output_dir
inputs.suffix = suffix
if inputs.master_ip is not None or inputs.run_local:
... | def static_adam_preprocessing_dag(job, inputs, sample, output_dir, suffix=''):
"""
A Toil job function performing ADAM preprocessing on a single sample
"""
inputs.sample = sample
inputs.output_dir = output_dir
inputs.suffix = suffix
if inputs.master_ip is not None or inputs.run_local:
... | [
"A",
"Toil",
"job",
"function",
"performing",
"ADAM",
"preprocessing",
"on",
"a",
"single",
"sample"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L267-L303 | [
"def",
"static_adam_preprocessing_dag",
"(",
"job",
",",
"inputs",
",",
"sample",
",",
"output_dir",
",",
"suffix",
"=",
"''",
")",
":",
"inputs",
".",
"sample",
"=",
"sample",
"inputs",
".",
"output_dir",
"=",
"output_dir",
"inputs",
".",
"suffix",
"=",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | hard_filter_pipeline | Runs GATK Hard Filtering on a Genomic VCF file and uploads the results.
0: Start 0 --> 1 --> 3 --> 5 --> 6
1: Select SNPs | |
2: Select INDELs +-> 2 --> 4 +
3: Apply SNP Filter
4: Apply INDEL Filter
5: Merge SNP and INDEL VCFs
6: Write fi... | src/toil_scripts/gatk_germline/hard_filter.py | def hard_filter_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Hard Filtering on a Genomic VCF file and uploads the results.
0: Start 0 --> 1 --> 3 --> 5 --> 6
1: Select SNPs | |
2: Select INDELs +-> 2 --> 4 +
3: Apply SNP Filter
4: A... | def hard_filter_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Hard Filtering on a Genomic VCF file and uploads the results.
0: Start 0 --> 1 --> 3 --> 5 --> 6
1: Select SNPs | |
2: Select INDELs +-> 2 --> 4 +
3: Apply SNP Filter
4: A... | [
"Runs",
"GATK",
"Hard",
"Filtering",
"on",
"a",
"Genomic",
"VCF",
"file",
"and",
"uploads",
"the",
"results",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/hard_filter.py#L11-L137 | [
"def",
"hard_filter_pipeline",
"(",
"job",
",",
"uuid",
",",
"vcf_id",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running Hard Filter on {}'",
".",
"format",
"(",
"uuid",
")",
")",
"# Get the total size of the genome reference",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_and_transfer_sample | Downloads a sample from CGHub via GeneTorrent, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub | src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py | def download_and_transfer_sample(job, sample, inputs):
"""
Downloads a sample from CGHub via GeneTorrent, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
analysis_id = sample[0]
work_... | def download_and_transfer_sample(job, sample, inputs):
"""
Downloads a sample from CGHub via GeneTorrent, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
analysis_id = sample[0]
work_... | [
"Downloads",
"a",
"sample",
"from",
"CGHub",
"via",
"GeneTorrent",
"then",
"uses",
"S3AM",
"to",
"transfer",
"it",
"to",
"S3"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py#L65-L108 | [
"def",
"download_and_transfer_sample",
"(",
"job",
",",
"sample",
",",
"inputs",
")",
":",
"analysis_id",
"=",
"sample",
"[",
"0",
"]",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"folder_path",
"=",
"os",
".",
"path",
".",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | main | This is a Toil pipeline to transfer TCGA data into an S3 Bucket
Data is pulled down with Genetorrent and transferred to S3 via S3AM. | src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py | def main():
"""
This is a Toil pipeline to transfer TCGA data into an S3 Bucket
Data is pulled down with Genetorrent and transferred to S3 via S3AM.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Stor... | def main():
"""
This is a Toil pipeline to transfer TCGA data into an S3 Bucket
Data is pulled down with Genetorrent and transferred to S3 via S3AM.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Stor... | [
"This",
"is",
"a",
"Toil",
"pipeline",
"to",
"transfer",
"TCGA",
"data",
"into",
"an",
"S3",
"Bucket"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py#L111-L137 | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | validate_ip | Validate a hexidecimal IPv6 ip address.
>>> validate_ip('::')
True
>>> validate_ip('::1')
True
>>> validate_ip('2001:db8:85a3::8a2e:370:7334')
True
>>> validate_ip('2001:db8:85a3:0:0:8a2e:370:7334')
True
>>> validate_ip('2001:0db8:85a3:0000:0000:8a2e:0370:7334')
True
>>> va... | iptools/ipv6.py | def validate_ip(s):
"""Validate a hexidecimal IPv6 ip address.
>>> validate_ip('::')
True
>>> validate_ip('::1')
True
>>> validate_ip('2001:db8:85a3::8a2e:370:7334')
True
>>> validate_ip('2001:db8:85a3:0:0:8a2e:370:7334')
True
>>> validate_ip('2001:0db8:85a3:0000:0000:8a2e:0370... | def validate_ip(s):
"""Validate a hexidecimal IPv6 ip address.
>>> validate_ip('::')
True
>>> validate_ip('::1')
True
>>> validate_ip('2001:db8:85a3::8a2e:370:7334')
True
>>> validate_ip('2001:db8:85a3:0:0:8a2e:370:7334')
True
>>> validate_ip('2001:0db8:85a3:0000:0000:8a2e:0370... | [
"Validate",
"a",
"hexidecimal",
"IPv6",
"ip",
"address",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L157-L209 | [
"def",
"validate_ip",
"(",
"s",
")",
":",
"if",
"_HEX_RE",
".",
"match",
"(",
"s",
")",
":",
"return",
"len",
"(",
"s",
".",
"split",
"(",
"'::'",
")",
")",
"<=",
"2",
"if",
"_DOTTED_QUAD_RE",
".",
"match",
"(",
"s",
")",
":",
"halves",
"=",
"s... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | ip2long | Convert a hexidecimal IPv6 address to a network byte order 128-bit
integer.
>>> ip2long('::') == 0
True
>>> ip2long('::1') == 1
True
>>> expect = 0x20010db885a3000000008a2e03707334
>>> ip2long('2001:db8:85a3::8a2e:370:7334') == expect
True
>>> ip2long('2001:db8:85a3:0:0:8a2e:370:73... | iptools/ipv6.py | def ip2long(ip):
"""Convert a hexidecimal IPv6 address to a network byte order 128-bit
integer.
>>> ip2long('::') == 0
True
>>> ip2long('::1') == 1
True
>>> expect = 0x20010db885a3000000008a2e03707334
>>> ip2long('2001:db8:85a3::8a2e:370:7334') == expect
True
>>> ip2long('2001:... | def ip2long(ip):
"""Convert a hexidecimal IPv6 address to a network byte order 128-bit
integer.
>>> ip2long('::') == 0
True
>>> ip2long('::1') == 1
True
>>> expect = 0x20010db885a3000000008a2e03707334
>>> ip2long('2001:db8:85a3::8a2e:370:7334') == expect
True
>>> ip2long('2001:... | [
"Convert",
"a",
"hexidecimal",
"IPv6",
"address",
"to",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L213-L277 | [
"def",
"ip2long",
"(",
"ip",
")",
":",
"if",
"not",
"validate_ip",
"(",
"ip",
")",
":",
"return",
"None",
"if",
"'.'",
"in",
"ip",
":",
"# convert IPv4 suffix to hex",
"chunks",
"=",
"ip",
".",
"split",
"(",
"':'",
")",
"v4_int",
"=",
"ipv4",
".",
"i... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | long2ip | Convert a network byte order 128-bit integer to a canonical IPv6
address.
>>> long2ip(2130706433)
'::7f00:1'
>>> long2ip(42540766411282592856904266426630537217)
'2001:db8::1:0:0:1'
>>> long2ip(MIN_IP)
'::'
>>> long2ip(MAX_IP)
'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
>>> long2i... | iptools/ipv6.py | def long2ip(l, rfc1924=False):
"""Convert a network byte order 128-bit integer to a canonical IPv6
address.
>>> long2ip(2130706433)
'::7f00:1'
>>> long2ip(42540766411282592856904266426630537217)
'2001:db8::1:0:0:1'
>>> long2ip(MIN_IP)
'::'
>>> long2ip(MAX_IP)
'ffff:ffff:ffff:ff... | def long2ip(l, rfc1924=False):
"""Convert a network byte order 128-bit integer to a canonical IPv6
address.
>>> long2ip(2130706433)
'::7f00:1'
>>> long2ip(42540766411282592856904266426630537217)
'2001:db8::1:0:0:1'
>>> long2ip(MIN_IP)
'::'
>>> long2ip(MAX_IP)
'ffff:ffff:ffff:ff... | [
"Convert",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"to",
"a",
"canonical",
"IPv6",
"address",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L281-L353 | [
"def",
"long2ip",
"(",
"l",
",",
"rfc1924",
"=",
"False",
")",
":",
"if",
"MAX_IP",
"<",
"l",
"or",
"l",
"<",
"MIN_IP",
":",
"raise",
"TypeError",
"(",
"\"expected int between %d and %d inclusive\"",
"%",
"(",
"MIN_IP",
",",
"MAX_IP",
")",
")",
"if",
"rf... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | long2rfc1924 | Convert a network byte order 128-bit integer to an rfc1924 IPv6
address.
>>> long2rfc1924(ip2long('1080::8:800:200C:417A'))
'4)+k&C#VzJ4br>0wv%Yp'
>>> long2rfc1924(ip2long('::'))
'00000000000000000000'
>>> long2rfc1924(MAX_IP)
'=r54lj&NUUO~Hi%c2ym0'
:param l: Network byte order 128-b... | iptools/ipv6.py | def long2rfc1924(l):
"""Convert a network byte order 128-bit integer to an rfc1924 IPv6
address.
>>> long2rfc1924(ip2long('1080::8:800:200C:417A'))
'4)+k&C#VzJ4br>0wv%Yp'
>>> long2rfc1924(ip2long('::'))
'00000000000000000000'
>>> long2rfc1924(MAX_IP)
'=r54lj&NUUO~Hi%c2ym0'
:param... | def long2rfc1924(l):
"""Convert a network byte order 128-bit integer to an rfc1924 IPv6
address.
>>> long2rfc1924(ip2long('1080::8:800:200C:417A'))
'4)+k&C#VzJ4br>0wv%Yp'
>>> long2rfc1924(ip2long('::'))
'00000000000000000000'
>>> long2rfc1924(MAX_IP)
'=r54lj&NUUO~Hi%c2ym0'
:param... | [
"Convert",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"to",
"an",
"rfc1924",
"IPv6",
"address",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L357-L384 | [
"def",
"long2rfc1924",
"(",
"l",
")",
":",
"if",
"MAX_IP",
"<",
"l",
"or",
"l",
"<",
"MIN_IP",
":",
"raise",
"TypeError",
"(",
"\"expected int between %d and %d inclusive\"",
"%",
"(",
"MIN_IP",
",",
"MAX_IP",
")",
")",
"o",
"=",
"[",
"]",
"r",
"=",
"l... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | rfc19242long | Convert an RFC 1924 IPv6 address to a network byte order 128-bit
integer.
>>> expect = 0
>>> rfc19242long('00000000000000000000') == expect
True
>>> expect = 21932261930451111902915077091070067066
>>> rfc19242long('4)+k&C#VzJ4br>0wv%Yp') == expect
True
>>> rfc19242long('pizza') == None... | iptools/ipv6.py | def rfc19242long(s):
"""Convert an RFC 1924 IPv6 address to a network byte order 128-bit
integer.
>>> expect = 0
>>> rfc19242long('00000000000000000000') == expect
True
>>> expect = 21932261930451111902915077091070067066
>>> rfc19242long('4)+k&C#VzJ4br>0wv%Yp') == expect
True
>>> r... | def rfc19242long(s):
"""Convert an RFC 1924 IPv6 address to a network byte order 128-bit
integer.
>>> expect = 0
>>> rfc19242long('00000000000000000000') == expect
True
>>> expect = 21932261930451111902915077091070067066
>>> rfc19242long('4)+k&C#VzJ4br>0wv%Yp') == expect
True
>>> r... | [
"Convert",
"an",
"RFC",
"1924",
"IPv6",
"address",
"to",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L387-L420 | [
"def",
"rfc19242long",
"(",
"s",
")",
":",
"global",
"_RFC1924_REV",
"if",
"not",
"_RFC1924_RE",
".",
"match",
"(",
"s",
")",
":",
"return",
"None",
"if",
"_RFC1924_REV",
"is",
"None",
":",
"_RFC1924_REV",
"=",
"{",
"v",
":",
"k",
"for",
"k",
",",
"v... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | validate_cidr | Validate a CIDR notation ip address.
The string is considered a valid CIDR address if it consists of a valid
IPv6 address in hextet format followed by a forward slash (/) and a bit
mask length (0-128).
>>> validate_cidr('::/128')
True
>>> validate_cidr('::/0')
True
>>> validate_cidr('... | iptools/ipv6.py | def validate_cidr(s):
"""Validate a CIDR notation ip address.
The string is considered a valid CIDR address if it consists of a valid
IPv6 address in hextet format followed by a forward slash (/) and a bit
mask length (0-128).
>>> validate_cidr('::/128')
True
>>> validate_cidr('::/0')
... | def validate_cidr(s):
"""Validate a CIDR notation ip address.
The string is considered a valid CIDR address if it consists of a valid
IPv6 address in hextet format followed by a forward slash (/) and a bit
mask length (0-128).
>>> validate_cidr('::/128')
True
>>> validate_cidr('::/0')
... | [
"Validate",
"a",
"CIDR",
"notation",
"ip",
"address",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L423-L462 | [
"def",
"validate_cidr",
"(",
"s",
")",
":",
"if",
"_CIDR_RE",
".",
"match",
"(",
"s",
")",
":",
"ip",
",",
"mask",
"=",
"s",
".",
"split",
"(",
"'/'",
")",
"if",
"validate_ip",
"(",
"ip",
")",
":",
"if",
"int",
"(",
"mask",
")",
">",
"128",
"... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | cidr2block | Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('2001:db8::/48')
('2001:db8::', '2001:db8:0:ffff:ffff:ffff:ffff:ffff')
>>> cidr2block('::/0')
('::', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
:param cidr: CIDR notation ip a... | iptools/ipv6.py | def cidr2block(cidr):
"""Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('2001:db8::/48')
('2001:db8::', '2001:db8:0:ffff:ffff:ffff:ffff:ffff')
>>> cidr2block('::/0')
('::', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
:p... | def cidr2block(cidr):
"""Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('2001:db8::/48')
('2001:db8::', '2001:db8:0:ffff:ffff:ffff:ffff:ffff')
>>> cidr2block('::/0')
('::', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
:p... | [
"Convert",
"a",
"CIDR",
"notation",
"ip",
"address",
"into",
"a",
"tuple",
"containing",
"the",
"network",
"block",
"start",
"and",
"end",
"addresses",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L466-L496 | [
"def",
"cidr2block",
"(",
"cidr",
")",
":",
"if",
"not",
"validate_cidr",
"(",
"cidr",
")",
":",
"return",
"None",
"ip",
",",
"prefix",
"=",
"cidr",
".",
"split",
"(",
"'/'",
")",
"prefix",
"=",
"int",
"(",
"prefix",
")",
"ip",
"=",
"ip2long",
"(",... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | parse_input_samples | Parses config file to pull sample information.
Stores samples as tuples of (uuid, URL)
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main) | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def parse_input_samples(job, inputs):
"""
Parses config file to pull sample information.
Stores samples as tuples of (uuid, URL)
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
"""
job.fileStore.logToMaster('Parsing ... | def parse_input_samples(job, inputs):
"""
Parses config file to pull sample information.
Stores samples as tuples of (uuid, URL)
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
"""
job.fileStore.logToMaster('Parsing ... | [
"Parses",
"config",
"file",
"to",
"pull",
"sample",
"information",
".",
"Stores",
"samples",
"as",
"tuples",
"of",
"(",
"uuid",
"URL",
")"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L43-L60 | [
"def",
"parse_input_samples",
"(",
"job",
",",
"inputs",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Parsing input samples and batching jobs'",
")",
"samples",
"=",
"[",
"]",
"if",
"inputs",
".",
"config",
":",
"with",
"open",
"(",
"inputs",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_sample | Download the input sample
:param JobFunctionWrappingJob job: passed by Toil automatically
:param tuple sample: Tuple containing (UUID,URL) of a sample
:param Namespace inputs: Stores input arguments (see main) | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def download_sample(job, sample, inputs):
"""
Download the input sample
:param JobFunctionWrappingJob job: passed by Toil automatically
:param tuple sample: Tuple containing (UUID,URL) of a sample
:param Namespace inputs: Stores input arguments (see main)
"""
uuid, url = sample
job.file... | def download_sample(job, sample, inputs):
"""
Download the input sample
:param JobFunctionWrappingJob job: passed by Toil automatically
:param tuple sample: Tuple containing (UUID,URL) of a sample
:param Namespace inputs: Stores input arguments (see main)
"""
uuid, url = sample
job.file... | [
"Download",
"the",
"input",
"sample"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L63-L80 | [
"def",
"download_sample",
"(",
"job",
",",
"sample",
",",
"inputs",
")",
":",
"uuid",
",",
"url",
"=",
"sample",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Downloading sample: {}'",
".",
"format",
"(",
"uuid",
")",
")",
"# Download sample",
"tar_id"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | process_sample | Converts sample.tar(.gz) into two fastq files.
Due to edge conditions... BEWARE: HERE BE DRAGONS
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str tar_id: FileStore ID of sample tar | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def process_sample(job, inputs, tar_id):
"""
Converts sample.tar(.gz) into two fastq files.
Due to edge conditions... BEWARE: HERE BE DRAGONS
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str tar_id: FileStore I... | def process_sample(job, inputs, tar_id):
"""
Converts sample.tar(.gz) into two fastq files.
Due to edge conditions... BEWARE: HERE BE DRAGONS
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str tar_id: FileStore I... | [
"Converts",
"sample",
".",
"tar",
"(",
".",
"gz",
")",
"into",
"two",
"fastq",
"files",
".",
"Due",
"to",
"edge",
"conditions",
"...",
"BEWARE",
":",
"HERE",
"BE",
"DRAGONS"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L83-L129 | [
"def",
"process_sample",
"(",
"job",
",",
"inputs",
",",
"tar_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Processing sample into read pairs: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileS... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | cutadapt | Filters out adapters that may be left in the RNA-seq files
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_id: FileStore ID of read 1 fastq
:param str r2_id: FileStore ID of read 2 fastq | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def cutadapt(job, inputs, r1_id, r2_id):
"""
Filters out adapters that may be left in the RNA-seq files
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_id: FileStore ID of read 1 fastq
:param str r2_id: Fil... | def cutadapt(job, inputs, r1_id, r2_id):
"""
Filters out adapters that may be left in the RNA-seq files
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_id: FileStore ID of read 1 fastq
:param str r2_id: Fil... | [
"Filters",
"out",
"adapters",
"that",
"may",
"be",
"left",
"in",
"the",
"RNA",
"-",
"seq",
"files"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L132-L177 | [
"def",
"cutadapt",
"(",
"job",
",",
"inputs",
",",
"r1_id",
",",
"r2_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running CutAdapt: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileStore",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | star | Performs alignment of fastqs to BAM via STAR
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_cutadapt: FileStore ID of read 1 fastq
:param str r2_cutadapt: FileStore ID of read 2 fastq | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def star(job, inputs, r1_cutadapt, r2_cutadapt):
"""
Performs alignment of fastqs to BAM via STAR
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_cutadapt: FileStore ID of read 1 fastq
:param str r2_cutadap... | def star(job, inputs, r1_cutadapt, r2_cutadapt):
"""
Performs alignment of fastqs to BAM via STAR
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_cutadapt: FileStore ID of read 1 fastq
:param str r2_cutadap... | [
"Performs",
"alignment",
"of",
"fastqs",
"to",
"BAM",
"via",
"STAR"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L180-L232 | [
"def",
"star",
"(",
"job",
",",
"inputs",
",",
"r1_cutadapt",
",",
"r2_cutadapt",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Aligning with STAR: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"f... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | variant_calling_and_qc | Perform variant calling with samtools nad QC with CheckBias
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: FileStore ID of bam index file
:return: FileStore ID of qc... | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def variant_calling_and_qc(job, inputs, bam_id, bai_id):
"""
Perform variant calling with samtools nad QC with CheckBias
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str b... | def variant_calling_and_qc(job, inputs, bam_id, bai_id):
"""
Perform variant calling with samtools nad QC with CheckBias
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str b... | [
"Perform",
"variant",
"calling",
"with",
"samtools",
"nad",
"QC",
"with",
"CheckBias"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L235-L279 | [
"def",
"variant_calling_and_qc",
"(",
"job",
",",
"inputs",
",",
"bam_id",
",",
"bai_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Variant calling and QC: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | spladder | Run SplAdder to detect and quantify alternative splicing events
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: FileStore ID of bam index file
:return: FileStore ID o... | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def spladder(job, inputs, bam_id, bai_id):
"""
Run SplAdder to detect and quantify alternative splicing events
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: Fil... | def spladder(job, inputs, bam_id, bai_id):
"""
Run SplAdder to detect and quantify alternative splicing events
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: Fil... | [
"Run",
"SplAdder",
"to",
"detect",
"and",
"quantify",
"alternative",
"splicing",
"events"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L282-L334 | [
"def",
"spladder",
"(",
"job",
",",
"inputs",
",",
"bam_id",
",",
"bai_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'SplAdder: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileStore",
"."... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | consolidate_output_tarballs | Combine the contents of separate tarballs into one.
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str vcqc_id: FileStore ID of variant calling and QC tarball
:param str spladder_id: FileStore ID of spladder tarball | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def consolidate_output_tarballs(job, inputs, vcqc_id, spladder_id):
"""
Combine the contents of separate tarballs into one.
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str vcqc_id: FileStore ID of variant calling ... | def consolidate_output_tarballs(job, inputs, vcqc_id, spladder_id):
"""
Combine the contents of separate tarballs into one.
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str vcqc_id: FileStore ID of variant calling ... | [
"Combine",
"the",
"contents",
"of",
"separate",
"tarballs",
"into",
"one",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L337-L376 | [
"def",
"consolidate_output_tarballs",
"(",
"job",
",",
"inputs",
",",
"vcqc_id",
",",
"spladder_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Consolidating files and uploading: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | main | This Toil pipeline aligns reads and performs alternative splicing analysis.
Please read the README.md located in the same directory for run instructions. | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | def main():
"""
This Toil pipeline aligns reads and performs alternative splicing analysis.
Please read the README.md located in the same directory for run instructions.
"""
# Define Parser object and add to toil
url_prefix = 'https://s3-us-west-2.amazonaws.com/cgl-pipeline-inputs/'
parser ... | def main():
"""
This Toil pipeline aligns reads and performs alternative splicing analysis.
Please read the README.md located in the same directory for run instructions.
"""
# Define Parser object and add to toil
url_prefix = 'https://s3-us-west-2.amazonaws.com/cgl-pipeline-inputs/'
parser ... | [
"This",
"Toil",
"pipeline",
"aligns",
"reads",
"and",
"performs",
"alternative",
"splicing",
"analysis",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L379-L425 | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"url_prefix",
"=",
"'https://s3-us-west-2.amazonaws.com/cgl-pipeline-inputs/'",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
"__doc__",
",",
"formatter_class",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | validate_ip | Validate a dotted-quad ip address.
The string is considered a valid dotted-quad address if it consists of
one to four octets (0-255) seperated by periods (.).
>>> validate_ip('127.0.0.1')
True
>>> validate_ip('127.0')
True
>>> validate_ip('127.0.0.256')
False
>>> validate_ip(LOCAL... | iptools/ipv4.py | def validate_ip(s):
"""Validate a dotted-quad ip address.
The string is considered a valid dotted-quad address if it consists of
one to four octets (0-255) seperated by periods (.).
>>> validate_ip('127.0.0.1')
True
>>> validate_ip('127.0')
True
>>> validate_ip('127.0.0.256')
Fals... | def validate_ip(s):
"""Validate a dotted-quad ip address.
The string is considered a valid dotted-quad address if it consists of
one to four octets (0-255) seperated by periods (.).
>>> validate_ip('127.0.0.1')
True
>>> validate_ip('127.0')
True
>>> validate_ip('127.0.0.256')
Fals... | [
"Validate",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L190-L222 | [
"def",
"validate_ip",
"(",
"s",
")",
":",
"if",
"_DOTTED_QUAD_RE",
".",
"match",
"(",
"s",
")",
":",
"quads",
"=",
"s",
".",
"split",
"(",
"'.'",
")",
"for",
"q",
"in",
"quads",
":",
"if",
"int",
"(",
"q",
")",
">",
"255",
":",
"return",
"False... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | validate_netmask | Validate that a dotted-quad ip address is a valid netmask.
>>> validate_netmask('0.0.0.0')
True
>>> validate_netmask('128.0.0.0')
True
>>> validate_netmask('255.0.0.0')
True
>>> validate_netmask('255.255.255.255')
True
>>> validate_netmask(BROADCAST)
True
>>> validate_netma... | iptools/ipv4.py | def validate_netmask(s):
"""Validate that a dotted-quad ip address is a valid netmask.
>>> validate_netmask('0.0.0.0')
True
>>> validate_netmask('128.0.0.0')
True
>>> validate_netmask('255.0.0.0')
True
>>> validate_netmask('255.255.255.255')
True
>>> validate_netmask(BROADCAST)... | def validate_netmask(s):
"""Validate that a dotted-quad ip address is a valid netmask.
>>> validate_netmask('0.0.0.0')
True
>>> validate_netmask('128.0.0.0')
True
>>> validate_netmask('255.0.0.0')
True
>>> validate_netmask('255.255.255.255')
True
>>> validate_netmask(BROADCAST)... | [
"Validate",
"that",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"is",
"a",
"valid",
"netmask",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L269-L309 | [
"def",
"validate_netmask",
"(",
"s",
")",
":",
"if",
"validate_ip",
"(",
"s",
")",
":",
"# Convert to binary string, strip '0b' prefix, 0 pad to 32 bits",
"mask",
"=",
"bin",
"(",
"ip2network",
"(",
"s",
")",
")",
"[",
"2",
":",
"]",
".",
"zfill",
"(",
"32",... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | validate_subnet | Validate a dotted-quad ip address including a netmask.
The string is considered a valid dotted-quad address with netmask if it
consists of one to four octets (0-255) seperated by periods (.) followed
by a forward slash (/) and a subnet bitmask which is expressed in
dotted-quad format.
>>> validat... | iptools/ipv4.py | def validate_subnet(s):
"""Validate a dotted-quad ip address including a netmask.
The string is considered a valid dotted-quad address with netmask if it
consists of one to four octets (0-255) seperated by periods (.) followed
by a forward slash (/) and a subnet bitmask which is expressed in
dotted... | def validate_subnet(s):
"""Validate a dotted-quad ip address including a netmask.
The string is considered a valid dotted-quad address with netmask if it
consists of one to four octets (0-255) seperated by periods (.) followed
by a forward slash (/) and a subnet bitmask which is expressed in
dotted... | [
"Validate",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"including",
"a",
"netmask",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L313-L352 | [
"def",
"validate_subnet",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"basestring",
")",
":",
"if",
"'/'",
"in",
"s",
":",
"start",
",",
"mask",
"=",
"s",
".",
"split",
"(",
"'/'",
",",
"2",
")",
"return",
"validate_ip",
"(",
"start",
... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | ip2long | Convert a dotted-quad ip address to a network byte order 32-bit
integer.
>>> ip2long('127.0.0.1')
2130706433
>>> ip2long('127.1')
2130706433
>>> ip2long('127')
2130706432
>>> ip2long('127.0.0.256') is None
True
:param ip: Dotted-quad ip address (eg. '127.0.0.1').
:type ip... | iptools/ipv4.py | def ip2long(ip):
"""Convert a dotted-quad ip address to a network byte order 32-bit
integer.
>>> ip2long('127.0.0.1')
2130706433
>>> ip2long('127.1')
2130706433
>>> ip2long('127')
2130706432
>>> ip2long('127.0.0.256') is None
True
:param ip: Dotted-quad ip address (eg. '1... | def ip2long(ip):
"""Convert a dotted-quad ip address to a network byte order 32-bit
integer.
>>> ip2long('127.0.0.1')
2130706433
>>> ip2long('127.1')
2130706433
>>> ip2long('127')
2130706432
>>> ip2long('127.0.0.256') is None
True
:param ip: Dotted-quad ip address (eg. '1... | [
"Convert",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"to",
"a",
"network",
"byte",
"order",
"32",
"-",
"bit",
"integer",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L356-L389 | [
"def",
"ip2long",
"(",
"ip",
")",
":",
"if",
"not",
"validate_ip",
"(",
"ip",
")",
":",
"return",
"None",
"quads",
"=",
"ip",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"quads",
")",
"==",
"1",
":",
"# only a network quad",
"quads",
"=",
"qua... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | ip2network | Convert a dotted-quad ip to base network number.
This differs from :func:`ip2long` in that partial addresses as treated as
all network instead of network plus host (eg. '127.1' expands to
'127.1.0.0')
:param ip: dotted-quad ip address (eg. ‘127.0.0.1’).
:type ip: str
:returns: Network byte ord... | iptools/ipv4.py | def ip2network(ip):
"""Convert a dotted-quad ip to base network number.
This differs from :func:`ip2long` in that partial addresses as treated as
all network instead of network plus host (eg. '127.1' expands to
'127.1.0.0')
:param ip: dotted-quad ip address (eg. ‘127.0.0.1’).
:type ip: str
... | def ip2network(ip):
"""Convert a dotted-quad ip to base network number.
This differs from :func:`ip2long` in that partial addresses as treated as
all network instead of network plus host (eg. '127.1' expands to
'127.1.0.0')
:param ip: dotted-quad ip address (eg. ‘127.0.0.1’).
:type ip: str
... | [
"Convert",
"a",
"dotted",
"-",
"quad",
"ip",
"to",
"base",
"network",
"number",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L393-L410 | [
"def",
"ip2network",
"(",
"ip",
")",
":",
"if",
"not",
"validate_ip",
"(",
"ip",
")",
":",
"return",
"None",
"quads",
"=",
"ip",
".",
"split",
"(",
"'.'",
")",
"netw",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"4",
")",
":",
"netw",
"=",
"(",
... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | long2ip | Convert a network byte order 32-bit integer to a dotted quad ip
address.
>>> long2ip(2130706433)
'127.0.0.1'
>>> long2ip(MIN_IP)
'0.0.0.0'
>>> long2ip(MAX_IP)
'255.255.255.255'
>>> long2ip(None) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
T... | iptools/ipv4.py | def long2ip(l):
"""Convert a network byte order 32-bit integer to a dotted quad ip
address.
>>> long2ip(2130706433)
'127.0.0.1'
>>> long2ip(MIN_IP)
'0.0.0.0'
>>> long2ip(MAX_IP)
'255.255.255.255'
>>> long2ip(None) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call l... | def long2ip(l):
"""Convert a network byte order 32-bit integer to a dotted quad ip
address.
>>> long2ip(2130706433)
'127.0.0.1'
>>> long2ip(MIN_IP)
'0.0.0.0'
>>> long2ip(MAX_IP)
'255.255.255.255'
>>> long2ip(None) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call l... | [
"Convert",
"a",
"network",
"byte",
"order",
"32",
"-",
"bit",
"integer",
"to",
"a",
"dotted",
"quad",
"ip",
"address",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L414-L452 | [
"def",
"long2ip",
"(",
"l",
")",
":",
"if",
"MAX_IP",
"<",
"l",
"or",
"l",
"<",
"MIN_IP",
":",
"raise",
"TypeError",
"(",
"\"expected int between %d and %d inclusive\"",
"%",
"(",
"MIN_IP",
",",
"MAX_IP",
")",
")",
"return",
"'%d.%d.%d.%d'",
"%",
"(",
"l",... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | cidr2block | Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('127.0.0.1/32')
('127.0.0.1', '127.0.0.1')
>>> cidr2block('127/8')
('127.0.0.0', '127.255.255.255')
>>> cidr2block('127.0.1/16')
('127.0.0.0', '127.0.255.255')
>>> cidr2... | iptools/ipv4.py | def cidr2block(cidr):
"""Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('127.0.0.1/32')
('127.0.0.1', '127.0.0.1')
>>> cidr2block('127/8')
('127.0.0.0', '127.255.255.255')
>>> cidr2block('127.0.1/16')
('127.0.0.0', '... | def cidr2block(cidr):
"""Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('127.0.0.1/32')
('127.0.0.1', '127.0.0.1')
>>> cidr2block('127/8')
('127.0.0.0', '127.255.255.255')
>>> cidr2block('127.0.1/16')
('127.0.0.0', '... | [
"Convert",
"a",
"CIDR",
"notation",
"ip",
"address",
"into",
"a",
"tuple",
"containing",
"the",
"network",
"block",
"start",
"and",
"end",
"addresses",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L514-L547 | [
"def",
"cidr2block",
"(",
"cidr",
")",
":",
"if",
"not",
"validate_cidr",
"(",
"cidr",
")",
":",
"return",
"None",
"ip",
",",
"prefix",
"=",
"cidr",
".",
"split",
"(",
"'/'",
")",
"prefix",
"=",
"int",
"(",
"prefix",
")",
"# convert dotted-quad ip to bas... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | subnet2block | Convert a dotted-quad ip address including a netmask into a tuple
containing the network block start and end addresses.
>>> subnet2block('127.0.0.1/255.255.255.255')
('127.0.0.1', '127.0.0.1')
>>> subnet2block('127/255')
('127.0.0.0', '127.255.255.255')
>>> subnet2block('127.0.1/255.255')
... | iptools/ipv4.py | def subnet2block(subnet):
"""Convert a dotted-quad ip address including a netmask into a tuple
containing the network block start and end addresses.
>>> subnet2block('127.0.0.1/255.255.255.255')
('127.0.0.1', '127.0.0.1')
>>> subnet2block('127/255')
('127.0.0.0', '127.255.255.255')
>>> sub... | def subnet2block(subnet):
"""Convert a dotted-quad ip address including a netmask into a tuple
containing the network block start and end addresses.
>>> subnet2block('127.0.0.1/255.255.255.255')
('127.0.0.1', '127.0.0.1')
>>> subnet2block('127/255')
('127.0.0.0', '127.255.255.255')
>>> sub... | [
"Convert",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"including",
"a",
"netmask",
"into",
"a",
"tuple",
"containing",
"the",
"network",
"block",
"start",
"and",
"end",
"addresses",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L579-L613 | [
"def",
"subnet2block",
"(",
"subnet",
")",
":",
"if",
"not",
"validate_subnet",
"(",
"subnet",
")",
":",
"return",
"None",
"ip",
",",
"netmask",
"=",
"subnet",
".",
"split",
"(",
"'/'",
")",
"prefix",
"=",
"netmask2prefix",
"(",
"netmask",
")",
"# conver... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | _block_from_ip_and_prefix | Create a tuple of (start, end) dotted-quad addresses from the given
ip address and prefix length.
:param ip: Ip address in block
:type ip: long
:param prefix: Prefix size for block
:type prefix: int
:returns: Tuple of block (start, end) | iptools/ipv4.py | def _block_from_ip_and_prefix(ip, prefix):
"""Create a tuple of (start, end) dotted-quad addresses from the given
ip address and prefix length.
:param ip: Ip address in block
:type ip: long
:param prefix: Prefix size for block
:type prefix: int
:returns: Tuple of block (start, end)
"""
... | def _block_from_ip_and_prefix(ip, prefix):
"""Create a tuple of (start, end) dotted-quad addresses from the given
ip address and prefix length.
:param ip: Ip address in block
:type ip: long
:param prefix: Prefix size for block
:type prefix: int
:returns: Tuple of block (start, end)
"""
... | [
"Create",
"a",
"tuple",
"of",
"(",
"start",
"end",
")",
"dotted",
"-",
"quad",
"addresses",
"from",
"the",
"given",
"ip",
"address",
"and",
"prefix",
"length",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L617-L634 | [
"def",
"_block_from_ip_and_prefix",
"(",
"ip",
",",
"prefix",
")",
":",
"# keep left most prefix bits of ip",
"shift",
"=",
"32",
"-",
"prefix",
"block_start",
"=",
"ip",
">>",
"shift",
"<<",
"shift",
"# expand right most 32 - prefix bits to 1",
"mask",
"=",
"(",
"1... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | download_shared_files | Downloads files shared by all samples in the pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param list[list] samples: A nested list of samples containing sample information | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def download_shared_files(job, samples, config):
"""
Downloads files shared by all samples in the pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param list[list] samples: A nested list of sample... | def download_shared_files(job, samples, config):
"""
Downloads files shared by all samples in the pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param list[list] samples: A nested list of sample... | [
"Downloads",
"files",
"shared",
"by",
"all",
"samples",
"in",
"the",
"pipeline"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L29-L43 | [
"def",
"download_shared_files",
"(",
"job",
",",
"samples",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Downloaded shared files'",
")",
"file_names",
"=",
"[",
"'reference'",
",",
"'phase'",
",",
"'mills'",
",",
"'dbsnp'",
",",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | reference_preprocessing | Spawn the jobs that create index and dict file for reference
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param list[list] samples: A nested list of samples containing sample information | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def reference_preprocessing(job, samples, config):
"""
Spawn the jobs that create index and dict file for reference
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param list[list] samples: A nested list ... | def reference_preprocessing(job, samples, config):
"""
Spawn the jobs that create index and dict file for reference
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param list[list] samples: A nested list ... | [
"Spawn",
"the",
"jobs",
"that",
"create",
"index",
"and",
"dict",
"file",
"for",
"reference"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L46-L57 | [
"def",
"reference_preprocessing",
"(",
"job",
",",
"samples",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Processed reference files'",
")",
"config",
".",
"fai",
"=",
"job",
".",
"addChildJobFn",
"(",
"run_samtools_faidx",
",",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_sample | Download sample and store sample specific attributes
:param JobFunctionWrappingJob job: passed automatically by Toil
:param list sample: Contains uuid, normal URL, and tumor URL
:param Namespace config: Argparse Namespace object containing argument inputs | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def download_sample(job, sample, config):
"""
Download sample and store sample specific attributes
:param JobFunctionWrappingJob job: passed automatically by Toil
:param list sample: Contains uuid, normal URL, and tumor URL
:param Namespace config: Argparse Namespace object containing argument inpu... | def download_sample(job, sample, config):
"""
Download sample and store sample specific attributes
:param JobFunctionWrappingJob job: passed automatically by Toil
:param list sample: Contains uuid, normal URL, and tumor URL
:param Namespace config: Argparse Namespace object containing argument inpu... | [
"Download",
"sample",
"and",
"store",
"sample",
"specific",
"attributes"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L60-L82 | [
"def",
"download_sample",
"(",
"job",
",",
"sample",
",",
"config",
")",
":",
"# Create copy of config that is sample specific",
"config",
"=",
"argparse",
".",
"Namespace",
"(",
"*",
"*",
"vars",
"(",
"config",
")",
")",
"uuid",
",",
"normal_url",
",",
"tumor... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | index_bams | Convenience job for handling bam indexing to make the workflow declaration cleaner
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def index_bams(job, config):
"""
Convenience job for handling bam indexing to make the workflow declaration cleaner
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
"""
job.fileStore.logToMaster('Indexe... | def index_bams(job, config):
"""
Convenience job for handling bam indexing to make the workflow declaration cleaner
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
"""
job.fileStore.logToMaster('Indexe... | [
"Convenience",
"job",
"for",
"handling",
"bam",
"indexing",
"to",
"make",
"the",
"workflow",
"declaration",
"cleaner"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L85-L96 | [
"def",
"index_bams",
"(",
"job",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Indexed sample BAMS: '",
"+",
"config",
".",
"uuid",
")",
"disk",
"=",
"'1G'",
"if",
"config",
".",
"ci_test",
"else",
"'20G'",
"config",
".",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | preprocessing_declaration | Declare jobs related to preprocessing
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def preprocessing_declaration(job, config):
"""
Declare jobs related to preprocessing
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
"""
if config.preprocessing:
job.fileStore.logToMaster('Ran... | def preprocessing_declaration(job, config):
"""
Declare jobs related to preprocessing
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
"""
if config.preprocessing:
job.fileStore.logToMaster('Ran... | [
"Declare",
"jobs",
"related",
"to",
"preprocessing"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L99-L123 | [
"def",
"preprocessing_declaration",
"(",
"job",
",",
"config",
")",
":",
"if",
"config",
".",
"preprocessing",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Ran preprocessing: '",
"+",
"config",
".",
"uuid",
")",
"disk",
"=",
"'1G'",
"if",
"config... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | static_workflow_declaration | Statically declare workflow so sections can be modularly repurposed
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param str normal_bam: Normal BAM FileStoreID
:param str normal_bai: Normal BAM index FileSto... | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def static_workflow_declaration(job, config, normal_bam, normal_bai, tumor_bam, tumor_bai):
"""
Statically declare workflow so sections can be modularly repurposed
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inpu... | def static_workflow_declaration(job, config, normal_bam, normal_bai, tumor_bam, tumor_bai):
"""
Statically declare workflow so sections can be modularly repurposed
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inpu... | [
"Statically",
"declare",
"workflow",
"so",
"sections",
"can",
"be",
"modularly",
"repurposed"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L126-L155 | [
"def",
"static_workflow_declaration",
"(",
"job",
",",
"config",
",",
"normal_bam",
",",
"normal_bai",
",",
"tumor_bam",
",",
"tumor_bai",
")",
":",
"# Mutation and indel tool wiring",
"memory",
"=",
"'1G'",
"if",
"config",
".",
"ci_test",
"else",
"'10G'",
"disk",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | consolidate_output | Combine the contents of separate tarball outputs into one via streaming
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param str mutect: MuTect tarball FileStoreID
:param str pindel: Pindel tarball FileStore... | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def consolidate_output(job, config, mutect, pindel, muse):
"""
Combine the contents of separate tarball outputs into one via streaming
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param str mutect: MuT... | def consolidate_output(job, config, mutect, pindel, muse):
"""
Combine the contents of separate tarball outputs into one via streaming
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs
:param str mutect: MuT... | [
"Combine",
"the",
"contents",
"of",
"separate",
"tarball",
"outputs",
"into",
"one",
"via",
"streaming"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L158-L198 | [
"def",
"consolidate_output",
"(",
"job",
",",
"config",
",",
"mutect",
",",
"pindel",
",",
"muse",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"mutect_tar",
",",
"pindel_tar",
",",
"muse_tar",
"=",
"None",
",",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | parse_manifest | Parses samples, specified in either a manifest or listed with --samples
:param str path_to_manifest: Path to configuration file
:return: Samples and their attributes as defined in the manifest
:rtype: list[list] | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def parse_manifest(path_to_manifest):
"""
Parses samples, specified in either a manifest or listed with --samples
:param str path_to_manifest: Path to configuration file
:return: Samples and their attributes as defined in the manifest
:rtype: list[list]
"""
samples = []
with open(path_t... | def parse_manifest(path_to_manifest):
"""
Parses samples, specified in either a manifest or listed with --samples
:param str path_to_manifest: Path to configuration file
:return: Samples and their attributes as defined in the manifest
:rtype: list[list]
"""
samples = []
with open(path_t... | [
"Parses",
"samples",
"specified",
"in",
"either",
"a",
"manifest",
"or",
"listed",
"with",
"--",
"samples"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L201-L220 | [
"def",
"parse_manifest",
"(",
"path_to_manifest",
")",
":",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"path_to_manifest",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"if",
"not",
"line",
".",
"issp... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | main | Computational Genomics Lab, Genomics Institute, UC Santa Cruz
Toil exome pipeline
Perform variant / indel analysis given a pair of tumor/normal BAM files.
Samples are optionally preprocessed (indel realignment and base quality score recalibration)
The output of this pipeline is a tarball containing res... | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | def main():
"""
Computational Genomics Lab, Genomics Institute, UC Santa Cruz
Toil exome pipeline
Perform variant / indel analysis given a pair of tumor/normal BAM files.
Samples are optionally preprocessed (indel realignment and base quality score recalibration)
The output of this pipeline is ... | def main():
"""
Computational Genomics Lab, Genomics Institute, UC Santa Cruz
Toil exome pipeline
Perform variant / indel analysis given a pair of tumor/normal BAM files.
Samples are optionally preprocessed (indel realignment and base quality score recalibration)
The output of this pipeline is ... | [
"Computational",
"Genomics",
"Lab",
"Genomics",
"Institute",
"UC",
"Santa",
"Cruz",
"Toil",
"exome",
"pipeline"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L303-L424 | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
"__doc__",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
")",
"subparsers",
"=",
"parser",
".",
"add_subparsers",
"(",... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_reference_files | Downloads shared files that are used by all samples for alignment, or generates them if they were not provided.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace inputs: Input arguments (see main)
:param list[list[str, list[str, str]]] samples: Samples in the format [UUID, [U... | src/toil_scripts/bwa_alignment/bwa_alignment.py | def download_reference_files(job, inputs, samples):
"""
Downloads shared files that are used by all samples for alignment, or generates them if they were not provided.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace inputs: Input arguments (see main)
:param list[lis... | def download_reference_files(job, inputs, samples):
"""
Downloads shared files that are used by all samples for alignment, or generates them if they were not provided.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace inputs: Input arguments (see main)
:param list[lis... | [
"Downloads",
"shared",
"files",
"that",
"are",
"used",
"by",
"all",
"samples",
"for",
"alignment",
"or",
"generates",
"them",
"if",
"they",
"were",
"not",
"provided",
"."
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L21-L58 | [
"def",
"download_reference_files",
"(",
"job",
",",
"inputs",
",",
"samples",
")",
":",
"# Create dictionary to store FileStoreIDs of shared input files",
"shared_ids",
"=",
"{",
"}",
"urls",
"=",
"[",
"(",
"'amb'",
",",
"inputs",
".",
"amb",
")",
",",
"(",
"'an... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | download_sample_and_align | Downloads the sample and runs BWA-kit
:param JobFunctionWrappingJob job: Passed by Toil automatically
:param tuple(str, list) sample: UUID and URLS for sample
:param Namespace inputs: Contains input arguments
:param dict ids: FileStore IDs for shared inputs | src/toil_scripts/bwa_alignment/bwa_alignment.py | def download_sample_and_align(job, sample, inputs, ids):
"""
Downloads the sample and runs BWA-kit
:param JobFunctionWrappingJob job: Passed by Toil automatically
:param tuple(str, list) sample: UUID and URLS for sample
:param Namespace inputs: Contains input arguments
:param dict ids: FileStor... | def download_sample_and_align(job, sample, inputs, ids):
"""
Downloads the sample and runs BWA-kit
:param JobFunctionWrappingJob job: Passed by Toil automatically
:param tuple(str, list) sample: UUID and URLS for sample
:param Namespace inputs: Contains input arguments
:param dict ids: FileStor... | [
"Downloads",
"the",
"sample",
"and",
"runs",
"BWA",
"-",
"kit"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L61-L96 | [
"def",
"download_sample_and_align",
"(",
"job",
",",
"sample",
",",
"inputs",
",",
"ids",
")",
":",
"uuid",
",",
"urls",
"=",
"sample",
"r1_url",
",",
"r2_url",
"=",
"urls",
"if",
"len",
"(",
"urls",
")",
"==",
"2",
"else",
"(",
"urls",
"[",
"0",
"... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | parse_manifest | Parse manifest file
:param str manifest_path: Path to manifest file
:return: samples
:rtype: list[str, list] | src/toil_scripts/bwa_alignment/bwa_alignment.py | def parse_manifest(manifest_path):
"""
Parse manifest file
:param str manifest_path: Path to manifest file
:return: samples
:rtype: list[str, list]
"""
samples = []
with open(manifest_path, 'r') as f:
for line in f:
if not line.isspace() and not line.startswith('#'):... | def parse_manifest(manifest_path):
"""
Parse manifest file
:param str manifest_path: Path to manifest file
:return: samples
:rtype: list[str, list]
"""
samples = []
with open(manifest_path, 'r') as f:
for line in f:
if not line.isspace() and not line.startswith('#'):... | [
"Parse",
"manifest",
"file"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L192-L212 | [
"def",
"parse_manifest",
"(",
"manifest_path",
")",
":",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"manifest_path",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"not",
"line",
".",
"isspace",
"(",
")",
"and",
"not",
"l... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | main | Computational Genomics Lab, Genomics Institute, UC Santa Cruz
Toil BWA pipeline
Alignment of fastq reads via BWA-kit
General usage:
1. Type "toil-bwa generate" to create an editable manifest and config in the current working directory.
2. Parameterize the pipeline by editing the config.
3. Fil... | src/toil_scripts/bwa_alignment/bwa_alignment.py | def main():
"""
Computational Genomics Lab, Genomics Institute, UC Santa Cruz
Toil BWA pipeline
Alignment of fastq reads via BWA-kit
General usage:
1. Type "toil-bwa generate" to create an editable manifest and config in the current working directory.
2. Parameterize the pipeline by editin... | def main():
"""
Computational Genomics Lab, Genomics Institute, UC Santa Cruz
Toil BWA pipeline
Alignment of fastq reads via BWA-kit
General usage:
1. Type "toil-bwa generate" to create an editable manifest and config in the current working directory.
2. Parameterize the pipeline by editin... | [
"Computational",
"Genomics",
"Lab",
"Genomics",
"Institute",
"UC",
"Santa",
"Cruz",
"Toil",
"BWA",
"pipeline"
] | BD2KGenomics/toil-scripts | python | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L215-L292 | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to Toil",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
"__doc__",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
")",
"subparsers",
"=",
... | f878d863defcdccaabb7fe06f991451b7a198fb7 |
train | _address2long | Convert an address string to a long. | iptools/__init__.py | def _address2long(address):
"""
Convert an address string to a long.
"""
parsed = ipv4.ip2long(address)
if parsed is None:
parsed = ipv6.ip2long(address)
return parsed | def _address2long(address):
"""
Convert an address string to a long.
"""
parsed = ipv4.ip2long(address)
if parsed is None:
parsed = ipv6.ip2long(address)
return parsed | [
"Convert",
"an",
"address",
"string",
"to",
"a",
"long",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/__init__.py#L58-L65 | [
"def",
"_address2long",
"(",
"address",
")",
":",
"parsed",
"=",
"ipv4",
".",
"ip2long",
"(",
"address",
")",
"if",
"parsed",
"is",
"None",
":",
"parsed",
"=",
"ipv6",
".",
"ip2long",
"(",
"address",
")",
"return",
"parsed"
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | IpRange.index | Return the 0-based position of `item` in this IpRange.
>>> r = IpRange('127.0.0.1', '127.255.255.255')
>>> r.index('127.0.0.1')
0
>>> r.index('127.255.255.255')
16777214
>>> r.index('10.0.0.1')
Traceback (most recent call last):
...
ValueErro... | iptools/__init__.py | def index(self, item):
"""
Return the 0-based position of `item` in this IpRange.
>>> r = IpRange('127.0.0.1', '127.255.255.255')
>>> r.index('127.0.0.1')
0
>>> r.index('127.255.255.255')
16777214
>>> r.index('10.0.0.1')
Traceback (most recent ca... | def index(self, item):
"""
Return the 0-based position of `item` in this IpRange.
>>> r = IpRange('127.0.0.1', '127.255.255.255')
>>> r.index('127.0.0.1')
0
>>> r.index('127.255.255.255')
16777214
>>> r.index('10.0.0.1')
Traceback (most recent ca... | [
"Return",
"the",
"0",
"-",
"based",
"position",
"of",
"item",
"in",
"this",
"IpRange",
"."
] | bd808/python-iptools | python | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/__init__.py#L259-L283 | [
"def",
"index",
"(",
"self",
",",
"item",
")",
":",
"item",
"=",
"self",
".",
"_cast",
"(",
"item",
")",
"offset",
"=",
"item",
"-",
"self",
".",
"startIp",
"if",
"offset",
">=",
"0",
"and",
"offset",
"<",
"self",
".",
"_len",
":",
"return",
"off... | 5d3fae0056297540355bb7c6c112703cfaa4b6ce |
train | _detach_process | Detach daemon process.
Forks the current process into a parent and a detached child. The
child process resides in its own process group, has no controlling
terminal attached and is cleaned up by the init process.
Returns ``True`` for the parent and ``False`` for the child. | src/service/__init__.py | def _detach_process():
"""
Detach daemon process.
Forks the current process into a parent and a detached child. The
child process resides in its own process group, has no controlling
terminal attached and is cleaned up by the init process.
Returns ``True`` for the parent and ``False`` for the ... | def _detach_process():
"""
Detach daemon process.
Forks the current process into a parent and a detached child. The
child process resides in its own process group, has no controlling
terminal attached and is cleaned up by the init process.
Returns ``True`` for the parent and ``False`` for the ... | [
"Detach",
"daemon",
"process",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L49-L78 | [
"def",
"_detach_process",
"(",
")",
":",
"# To detach from our process group we need to call ``setsid``. We",
"# can only do that if we aren't a process group leader. Therefore",
"# we fork once, which makes sure that the new child process is not",
"# a process group leader.",
"pid",
"=",
"os"... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | _block | Block until a predicate becomes true.
``predicate`` is a function taking no arguments. The call to
``_block`` blocks until ``predicate`` returns a true value. This
is done by polling ``predicate``.
``timeout`` is either ``True`` (block indefinitely) or a timeout
in seconds.
The return value i... | src/service/__init__.py | def _block(predicate, timeout):
"""
Block until a predicate becomes true.
``predicate`` is a function taking no arguments. The call to
``_block`` blocks until ``predicate`` returns a true value. This
is done by polling ``predicate``.
``timeout`` is either ``True`` (block indefinitely) or a tim... | def _block(predicate, timeout):
"""
Block until a predicate becomes true.
``predicate`` is a function taking no arguments. The call to
``_block`` blocks until ``predicate`` returns a true value. This
is done by polling ``predicate``.
``timeout`` is either ``True`` (block indefinitely) or a tim... | [
"Block",
"until",
"a",
"predicate",
"becomes",
"true",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L143-L163 | [
"def",
"_block",
"(",
"predicate",
",",
"timeout",
")",
":",
"if",
"timeout",
":",
"if",
"timeout",
"is",
"True",
":",
"timeout",
"=",
"float",
"(",
"'Inf'",
")",
"timeout",
"=",
"time",
".",
"time",
"(",
")",
"+",
"timeout",
"while",
"not",
"predica... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | _PIDFile.read_pid | Return the PID of the process owning the lock.
Returns ``None`` if no lock is present. | src/service/__init__.py | def read_pid(self):
"""
Return the PID of the process owning the lock.
Returns ``None`` if no lock is present.
"""
try:
with open(self._path, 'r') as f:
s = f.read().strip()
if not s:
return None
ret... | def read_pid(self):
"""
Return the PID of the process owning the lock.
Returns ``None`` if no lock is present.
"""
try:
with open(self._path, 'r') as f:
s = f.read().strip()
if not s:
return None
ret... | [
"Return",
"the",
"PID",
"of",
"the",
"process",
"owning",
"the",
"lock",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L109-L124 | [
"def",
"read_pid",
"(",
"self",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_path",
",",
"'r'",
")",
"as",
"f",
":",
"s",
"=",
"f",
".",
"read",
"(",
")",
".",
"strip",
"(",
")",
"if",
"not",
"s",
":",
"return",
"None",
"return",... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | Service._get_logger_file_handles | Find the file handles used by our logger's handlers. | src/service/__init__.py | def _get_logger_file_handles(self):
"""
Find the file handles used by our logger's handlers.
"""
handles = []
for handler in self.logger.handlers:
# The following code works for logging's SysLogHandler,
# StreamHandler, SocketHandler, and their subclasses.... | def _get_logger_file_handles(self):
"""
Find the file handles used by our logger's handlers.
"""
handles = []
for handler in self.logger.handlers:
# The following code works for logging's SysLogHandler,
# StreamHandler, SocketHandler, and their subclasses.... | [
"Find",
"the",
"file",
"handles",
"used",
"by",
"our",
"logger",
"s",
"handlers",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L221-L237 | [
"def",
"_get_logger_file_handles",
"(",
"self",
")",
":",
"handles",
"=",
"[",
"]",
"for",
"handler",
"in",
"self",
".",
"logger",
".",
"handlers",
":",
"# The following code works for logging's SysLogHandler,",
"# StreamHandler, SocketHandler, and their subclasses.",
"for"... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | Service.is_running | Check if the daemon is running. | src/service/__init__.py | def is_running(self):
"""
Check if the daemon is running.
"""
pid = self.get_pid()
if pid is None:
return False
# The PID file may still exist even if the daemon isn't running,
# for example if it has crashed.
try:
os.kill(pid, 0)
... | def is_running(self):
"""
Check if the daemon is running.
"""
pid = self.get_pid()
if pid is None:
return False
# The PID file may still exist even if the daemon isn't running,
# for example if it has crashed.
try:
os.kill(pid, 0)
... | [
"Check",
"if",
"the",
"daemon",
"is",
"running",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L239-L259 | [
"def",
"is_running",
"(",
"self",
")",
":",
"pid",
"=",
"self",
".",
"get_pid",
"(",
")",
"if",
"pid",
"is",
"None",
":",
"return",
"False",
"# The PID file may still exist even if the daemon isn't running,",
"# for example if it has crashed.",
"try",
":",
"os",
"."... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | Service._get_signal_event | Get the event for a signal.
Checks if the signal has been enabled and raises a
``ValueError`` if not. | src/service/__init__.py | def _get_signal_event(self, s):
'''
Get the event for a signal.
Checks if the signal has been enabled and raises a
``ValueError`` if not.
'''
try:
return self._signal_events[int(s)]
except KeyError:
raise ValueError('Signal {} has not been... | def _get_signal_event(self, s):
'''
Get the event for a signal.
Checks if the signal has been enabled and raises a
``ValueError`` if not.
'''
try:
return self._signal_events[int(s)]
except KeyError:
raise ValueError('Signal {} has not been... | [
"Get",
"the",
"event",
"for",
"a",
"signal",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L267-L277 | [
"def",
"_get_signal_event",
"(",
"self",
",",
"s",
")",
":",
"try",
":",
"return",
"self",
".",
"_signal_events",
"[",
"int",
"(",
"s",
")",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"'Signal {} has not been enabled'",
".",
"format",
"(",
... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | Service.send_signal | Send a signal to the daemon process.
The signal must have been enabled using the ``signals``
parameter of :py:meth:`Service.__init__`. Otherwise, a
``ValueError`` is raised. | src/service/__init__.py | def send_signal(self, s):
"""
Send a signal to the daemon process.
The signal must have been enabled using the ``signals``
parameter of :py:meth:`Service.__init__`. Otherwise, a
``ValueError`` is raised.
"""
self._get_signal_event(s) # Check if signal has been e... | def send_signal(self, s):
"""
Send a signal to the daemon process.
The signal must have been enabled using the ``signals``
parameter of :py:meth:`Service.__init__`. Otherwise, a
``ValueError`` is raised.
"""
self._get_signal_event(s) # Check if signal has been e... | [
"Send",
"a",
"signal",
"to",
"the",
"daemon",
"process",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L279-L291 | [
"def",
"send_signal",
"(",
"self",
",",
"s",
")",
":",
"self",
".",
"_get_signal_event",
"(",
"s",
")",
"# Check if signal has been enabled",
"pid",
"=",
"self",
".",
"get_pid",
"(",
")",
"if",
"not",
"pid",
":",
"raise",
"ValueError",
"(",
"'Daemon is not r... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | Service.stop | Tell the daemon process to stop.
Sends the SIGTERM signal to the daemon process, requesting it
to terminate.
If ``block`` is true then the call blocks until the daemon
process has exited. This may take some time since the daemon
process will complete its on-going backup activit... | src/service/__init__.py | def stop(self, block=False):
"""
Tell the daemon process to stop.
Sends the SIGTERM signal to the daemon process, requesting it
to terminate.
If ``block`` is true then the call blocks until the daemon
process has exited. This may take some time since the daemon
... | def stop(self, block=False):
"""
Tell the daemon process to stop.
Sends the SIGTERM signal to the daemon process, requesting it
to terminate.
If ``block`` is true then the call blocks until the daemon
process has exited. This may take some time since the daemon
... | [
"Tell",
"the",
"daemon",
"process",
"to",
"stop",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L381-L401 | [
"def",
"stop",
"(",
"self",
",",
"block",
"=",
"False",
")",
":",
"self",
".",
"send_signal",
"(",
"signal",
".",
"SIGTERM",
")",
"return",
"_block",
"(",
"lambda",
":",
"not",
"self",
".",
"is_running",
"(",
")",
",",
"block",
")"
] | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | Service.kill | Kill the daemon process.
Sends the SIGKILL signal to the daemon process, killing it. You
probably want to try :py:meth:`stop` first.
If ``block`` is true then the call blocks until the daemon
process has exited. ``block`` can either be ``True`` (in which
case it blocks indefini... | src/service/__init__.py | def kill(self, block=False):
"""
Kill the daemon process.
Sends the SIGKILL signal to the daemon process, killing it. You
probably want to try :py:meth:`stop` first.
If ``block`` is true then the call blocks until the daemon
process has exited. ``block`` can either be `... | def kill(self, block=False):
"""
Kill the daemon process.
Sends the SIGKILL signal to the daemon process, killing it. You
probably want to try :py:meth:`stop` first.
If ``block`` is true then the call blocks until the daemon
process has exited. ``block`` can either be `... | [
"Kill",
"the",
"daemon",
"process",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L403-L437 | [
"def",
"kill",
"(",
"self",
",",
"block",
"=",
"False",
")",
":",
"pid",
"=",
"self",
".",
"get_pid",
"(",
")",
"if",
"not",
"pid",
":",
"raise",
"ValueError",
"(",
"'Daemon is not running.'",
")",
"try",
":",
"os",
".",
"kill",
"(",
"pid",
",",
"s... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | Service.start | Start the daemon process.
The daemon process is started in the background and the calling
process returns.
Once the daemon process is initialized it calls the
:py:meth:`run` method.
If ``block`` is true then the call blocks until the daemon
process has started. ``block... | src/service/__init__.py | def start(self, block=False):
"""
Start the daemon process.
The daemon process is started in the background and the calling
process returns.
Once the daemon process is initialized it calls the
:py:meth:`run` method.
If ``block`` is true then the call blocks unt... | def start(self, block=False):
"""
Start the daemon process.
The daemon process is started in the background and the calling
process returns.
Once the daemon process is initialized it calls the
:py:meth:`run` method.
If ``block`` is true then the call blocks unt... | [
"Start",
"the",
"daemon",
"process",
"."
] | torfsen/service | python | https://github.com/torfsen/service/blob/d0dd824fce9237825c1943b30cd14f7b0f5957a6/src/service/__init__.py#L439-L544 | [
"def",
"start",
"(",
"self",
",",
"block",
"=",
"False",
")",
":",
"pid",
"=",
"self",
".",
"get_pid",
"(",
")",
"if",
"pid",
":",
"raise",
"ValueError",
"(",
"'Daemon is already running at PID %d.'",
"%",
"pid",
")",
"# The default is to place the PID file into... | d0dd824fce9237825c1943b30cd14f7b0f5957a6 |
train | create | Create a new environment
Usage:
datacats create [-bin] [--interactive] [-s NAME] [--address=IP] [--syslog]
[--ckan=CKAN_VERSION] [--no-datapusher] [--site-url SITE_URL]
[--no-init-db] ENVIRONMENT_DIR [PORT]
Options:
--address=IP Address to listen on (Linux-only)
--... | datacats/cli/create.py | def create(opts):
"""Create a new environment
Usage:
datacats create [-bin] [--interactive] [-s NAME] [--address=IP] [--syslog]
[--ckan=CKAN_VERSION] [--no-datapusher] [--site-url SITE_URL]
[--no-init-db] ENVIRONMENT_DIR [PORT]
Options:
--address=IP Address to li... | def create(opts):
"""Create a new environment
Usage:
datacats create [-bin] [--interactive] [-s NAME] [--address=IP] [--syslog]
[--ckan=CKAN_VERSION] [--no-datapusher] [--site-url SITE_URL]
[--no-init-db] ENVIRONMENT_DIR [PORT]
Options:
--address=IP Address to li... | [
"Create",
"a",
"new",
"environment"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/create.py#L23-L63 | [
"def",
"create",
"(",
"opts",
")",
":",
"if",
"opts",
"[",
"'--address'",
"]",
"and",
"is_boot2docker",
"(",
")",
":",
"raise",
"DatacatsError",
"(",
"'Cannot specify address on boot2docker.'",
")",
"return",
"create_environment",
"(",
"environment_dir",
"=",
"opt... | e4bae503efa997660fb3f34fe166699569653157 |
train | reset | Resets a site to the default state. This will re-initialize the
database and recreate the administrator account.
Usage:
datacats reset [-iyn] [-s NAME] [ENVIRONMENT]
Options:
-i --interactive Don't detach from the web container
-s --site=NAME The site to reset [default: primary]
-y --yes ... | datacats/cli/create.py | def reset(environment, opts):
"""Resets a site to the default state. This will re-initialize the
database and recreate the administrator account.
Usage:
datacats reset [-iyn] [-s NAME] [ENVIRONMENT]
Options:
-i --interactive Don't detach from the web container
-s --site=NAME The site to rese... | def reset(environment, opts):
"""Resets a site to the default state. This will re-initialize the
database and recreate the administrator account.
Usage:
datacats reset [-iyn] [-s NAME] [ENVIRONMENT]
Options:
-i --interactive Don't detach from the web container
-s --site=NAME The site to rese... | [
"Resets",
"a",
"site",
"to",
"the",
"default",
"state",
".",
"This",
"will",
"re",
"-",
"initialize",
"the",
"database",
"and",
"recreate",
"the",
"administrator",
"account",
"."
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/create.py#L122-L157 | [
"def",
"reset",
"(",
"environment",
",",
"opts",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"opts",
"[",
"'--yes'",
"]",
":",
"y_or_n_prompt",
"(",
"'Reset will remove all data related to the '",
"'site {} and recreate the database'",
".",
"format",
"(",
... | e4bae503efa997660fb3f34fe166699569653157 |
train | init | Initialize a purged environment or copied environment directory
Usage:
datacats init [-in] [--syslog] [-s NAME] [--address=IP] [--interactive]
[--site-url SITE_URL] [ENVIRONMENT_DIR [PORT]] [--no-init-db]
Options:
--address=IP Address to listen on (Linux-only)
--interactive ... | datacats/cli/create.py | def init(opts, no_install=False, quiet=False):
"""Initialize a purged environment or copied environment directory
Usage:
datacats init [-in] [--syslog] [-s NAME] [--address=IP] [--interactive]
[--site-url SITE_URL] [ENVIRONMENT_DIR [PORT]] [--no-init-db]
Options:
--address=IP Addres... | def init(opts, no_install=False, quiet=False):
"""Initialize a purged environment or copied environment directory
Usage:
datacats init [-in] [--syslog] [-s NAME] [--address=IP] [--interactive]
[--site-url SITE_URL] [ENVIRONMENT_DIR [PORT]] [--no-init-db]
Options:
--address=IP Addres... | [
"Initialize",
"a",
"purged",
"environment",
"or",
"copied",
"environment",
"directory"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/create.py#L160-L237 | [
"def",
"init",
"(",
"opts",
",",
"no_install",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"if",
"opts",
"[",
"'--address'",
"]",
"and",
"is_boot2docker",
"(",
")",
":",
"raise",
"DatacatsError",
"(",
"'Cannot specify address on boot2docker.'",
")",
... | e4bae503efa997660fb3f34fe166699569653157 |
train | finish_init | Common parts of create and init: Install, init db, start site, sysadmin | datacats/cli/create.py | def finish_init(environment, start_web, create_sysadmin, log_syslog=False,
do_install=True, quiet=False, site_url=None, interactive=False,
init_db=True):
"""
Common parts of create and init: Install, init db, start site, sysadmin
"""
if not init_db:
start_web = Fa... | def finish_init(environment, start_web, create_sysadmin, log_syslog=False,
do_install=True, quiet=False, site_url=None, interactive=False,
init_db=True):
"""
Common parts of create and init: Install, init db, start site, sysadmin
"""
if not init_db:
start_web = Fa... | [
"Common",
"parts",
"of",
"create",
"and",
"init",
":",
"Install",
"init",
"db",
"start",
"site",
"sysadmin"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/cli/create.py#L240-L283 | [
"def",
"finish_init",
"(",
"environment",
",",
"start_web",
",",
"create_sysadmin",
",",
"log_syslog",
"=",
"False",
",",
"do_install",
"=",
"True",
",",
"quiet",
"=",
"False",
",",
"site_url",
"=",
"None",
",",
"interactive",
"=",
"False",
",",
"init_db",
... | e4bae503efa997660fb3f34fe166699569653157 |
train | UserProfile.save | Save profile settings into user profile directory | datacats/userprofile.py | def save(self):
"""
Save profile settings into user profile directory
"""
config = self.profiledir + '/config'
if not isdir(self.profiledir):
makedirs(self.profiledir)
cp = SafeConfigParser()
cp.add_section('ssh')
cp.set('ssh', 'private_key',... | def save(self):
"""
Save profile settings into user profile directory
"""
config = self.profiledir + '/config'
if not isdir(self.profiledir):
makedirs(self.profiledir)
cp = SafeConfigParser()
cp.add_section('ssh')
cp.set('ssh', 'private_key',... | [
"Save",
"profile",
"settings",
"into",
"user",
"profile",
"directory"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/userprofile.py#L60-L75 | [
"def",
"save",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"profiledir",
"+",
"'/config'",
"if",
"not",
"isdir",
"(",
"self",
".",
"profiledir",
")",
":",
"makedirs",
"(",
"self",
".",
"profiledir",
")",
"cp",
"=",
"SafeConfigParser",
"(",
")",
... | e4bae503efa997660fb3f34fe166699569653157 |
train | UserProfile.generate_ssh_key | Generate a new ssh private and public key | datacats/userprofile.py | def generate_ssh_key(self):
"""
Generate a new ssh private and public key
"""
web_command(
command=["ssh-keygen", "-q", "-t", "rsa", "-N", "", "-C",
"datacats generated {0}@{1}".format(
getuser(), gethostname()),
... | def generate_ssh_key(self):
"""
Generate a new ssh private and public key
"""
web_command(
command=["ssh-keygen", "-q", "-t", "rsa", "-N", "", "-C",
"datacats generated {0}@{1}".format(
getuser(), gethostname()),
... | [
"Generate",
"a",
"new",
"ssh",
"private",
"and",
"public",
"key"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/userprofile.py#L77-L87 | [
"def",
"generate_ssh_key",
"(",
"self",
")",
":",
"web_command",
"(",
"command",
"=",
"[",
"\"ssh-keygen\"",
",",
"\"-q\"",
",",
"\"-t\"",
",",
"\"rsa\"",
",",
"\"-N\"",
",",
"\"\"",
",",
"\"-C\"",
",",
"\"datacats generated {0}@{1}\"",
".",
"format",
"(",
"... | e4bae503efa997660fb3f34fe166699569653157 |
train | UserProfile.create | Sends "create project" command to the remote server | datacats/userprofile.py | def create(self, environment, target_name):
"""
Sends "create project" command to the remote server
"""
remote_server_command(
["ssh", environment.deploy_target, "create", target_name],
environment, self,
clean_up=True,
) | def create(self, environment, target_name):
"""
Sends "create project" command to the remote server
"""
remote_server_command(
["ssh", environment.deploy_target, "create", target_name],
environment, self,
clean_up=True,
) | [
"Sends",
"create",
"project",
"command",
"to",
"the",
"remote",
"server"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/userprofile.py#L127-L135 | [
"def",
"create",
"(",
"self",
",",
"environment",
",",
"target_name",
")",
":",
"remote_server_command",
"(",
"[",
"\"ssh\"",
",",
"environment",
".",
"deploy_target",
",",
"\"create\"",
",",
"target_name",
"]",
",",
"environment",
",",
"self",
",",
"clean_up"... | e4bae503efa997660fb3f34fe166699569653157 |
train | UserProfile.admin_password | Return True if password was set successfully | datacats/userprofile.py | def admin_password(self, environment, target_name, password):
"""
Return True if password was set successfully
"""
try:
remote_server_command(
["ssh", environment.deploy_target,
"admin_password", target_name, password],
envi... | def admin_password(self, environment, target_name, password):
"""
Return True if password was set successfully
"""
try:
remote_server_command(
["ssh", environment.deploy_target,
"admin_password", target_name, password],
envi... | [
"Return",
"True",
"if",
"password",
"was",
"set",
"successfully"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/userprofile.py#L137-L150 | [
"def",
"admin_password",
"(",
"self",
",",
"environment",
",",
"target_name",
",",
"password",
")",
":",
"try",
":",
"remote_server_command",
"(",
"[",
"\"ssh\"",
",",
"environment",
".",
"deploy_target",
",",
"\"admin_password\"",
",",
"target_name",
",",
"pass... | e4bae503efa997660fb3f34fe166699569653157 |
train | UserProfile.deploy | Return True if deployment was successful | datacats/userprofile.py | def deploy(self, environment, target_name, stream_output=None):
"""
Return True if deployment was successful
"""
try:
remote_server_command(
[
"rsync", "-lrv", "--safe-links", "--munge-links",
"--delete", "--inplace", "-... | def deploy(self, environment, target_name, stream_output=None):
"""
Return True if deployment was successful
"""
try:
remote_server_command(
[
"rsync", "-lrv", "--safe-links", "--munge-links",
"--delete", "--inplace", "-... | [
"Return",
"True",
"if",
"deployment",
"was",
"successful"
] | datacats/datacats | python | https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/userprofile.py#L152-L195 | [
"def",
"deploy",
"(",
"self",
",",
"environment",
",",
"target_name",
",",
"stream_output",
"=",
"None",
")",
":",
"try",
":",
"remote_server_command",
"(",
"[",
"\"rsync\"",
",",
"\"-lrv\"",
",",
"\"--safe-links\"",
",",
"\"--munge-links\"",
",",
"\"--delete\""... | e4bae503efa997660fb3f34fe166699569653157 |
train | num_batches | Compute the number of mini-batches required to cover a data set of
size `n` using batches of size `batch_size`.
Parameters
----------
n: int
the number of samples in the data set
batch_size: int
the mini-batch size
Returns
-------
int: the number of batches required | batchup/sampling.py | def num_batches(n, batch_size):
"""Compute the number of mini-batches required to cover a data set of
size `n` using batches of size `batch_size`.
Parameters
----------
n: int
the number of samples in the data set
batch_size: int
the mini-batch size
Returns
-------
... | def num_batches(n, batch_size):
"""Compute the number of mini-batches required to cover a data set of
size `n` using batches of size `batch_size`.
Parameters
----------
n: int
the number of samples in the data set
batch_size: int
the mini-batch size
Returns
-------
... | [
"Compute",
"the",
"number",
"of",
"mini",
"-",
"batches",
"required",
"to",
"cover",
"a",
"data",
"set",
"of",
"size",
"n",
"using",
"batches",
"of",
"size",
"batch_size",
"."
] | Britefury/batchup | python | https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L10-L28 | [
"def",
"num_batches",
"(",
"n",
",",
"batch_size",
")",
":",
"b",
"=",
"n",
"//",
"batch_size",
"if",
"n",
"%",
"batch_size",
">",
"0",
":",
"b",
"+=",
"1",
"return",
"b"
] | 3fc2304e629f813c05f9e7a85a18acef3581a536 |
train | StandardSampler.num_indices_generated | Get the number of indices that would be generated by this
sampler.
Returns
-------
int, `np.inf` or `None`.
An int if the number of samples is known, `np.inf` if it is
infinite or `None` if the number of samples is unknown. | batchup/sampling.py | def num_indices_generated(self):
"""
Get the number of indices that would be generated by this
sampler.
Returns
-------
int, `np.inf` or `None`.
An int if the number of samples is known, `np.inf` if it is
infinite or `None` if the number of sample... | def num_indices_generated(self):
"""
Get the number of indices that would be generated by this
sampler.
Returns
-------
int, `np.inf` or `None`.
An int if the number of samples is known, `np.inf` if it is
infinite or `None` if the number of sample... | [
"Get",
"the",
"number",
"of",
"indices",
"that",
"would",
"be",
"generated",
"by",
"this",
"sampler",
"."
] | Britefury/batchup | python | https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L137-L151 | [
"def",
"num_indices_generated",
"(",
"self",
")",
":",
"if",
"self",
".",
"repeats",
"==",
"-",
"1",
":",
"return",
"np",
".",
"inf",
"else",
":",
"return",
"self",
".",
"length",
"*",
"self",
".",
"repeats"
] | 3fc2304e629f813c05f9e7a85a18acef3581a536 |
train | StandardSampler.in_order_indices_batch_iterator | Create an iterator that generates in-order mini-batches of sample
indices. The batches will have `batch_size` elements, with the
exception of the final batch which will have less if there are not
enough samples left to fill it.
The generated mini-batches indices take the form of 1D NumP... | batchup/sampling.py | def in_order_indices_batch_iterator(self, batch_size):
"""
Create an iterator that generates in-order mini-batches of sample
indices. The batches will have `batch_size` elements, with the
exception of the final batch which will have less if there are not
enough samples left to fi... | def in_order_indices_batch_iterator(self, batch_size):
"""
Create an iterator that generates in-order mini-batches of sample
indices. The batches will have `batch_size` elements, with the
exception of the final batch which will have less if there are not
enough samples left to fi... | [
"Create",
"an",
"iterator",
"that",
"generates",
"in",
"-",
"order",
"mini",
"-",
"batches",
"of",
"sample",
"indices",
".",
"The",
"batches",
"will",
"have",
"batch_size",
"elements",
"with",
"the",
"exception",
"of",
"the",
"final",
"batch",
"which",
"will... | Britefury/batchup | python | https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L153-L225 | [
"def",
"in_order_indices_batch_iterator",
"(",
"self",
",",
"batch_size",
")",
":",
"if",
"self",
".",
"repeats",
"==",
"1",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"self",
".",
"length",
",",
"batch_size",
")",
":",
"yield",
"np",
".",
"arange"... | 3fc2304e629f813c05f9e7a85a18acef3581a536 |
train | StandardSampler.shuffled_indices_batch_iterator | Create an iterator that generates randomly shuffled mini-batches of
sample indices. The batches will have `batch_size` elements, with the
exception of the final batch which will have less if there are not
enough samples left to fill it.
The generated mini-batches indices take the form o... | batchup/sampling.py | def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
"""
Create an iterator that generates randomly shuffled mini-batches of
sample indices. The batches will have `batch_size` elements, with the
exception of the final batch which will have less if there are not
eno... | def shuffled_indices_batch_iterator(self, batch_size, shuffle_rng):
"""
Create an iterator that generates randomly shuffled mini-batches of
sample indices. The batches will have `batch_size` elements, with the
exception of the final batch which will have less if there are not
eno... | [
"Create",
"an",
"iterator",
"that",
"generates",
"randomly",
"shuffled",
"mini",
"-",
"batches",
"of",
"sample",
"indices",
".",
"The",
"batches",
"will",
"have",
"batch_size",
"elements",
"with",
"the",
"exception",
"of",
"the",
"final",
"batch",
"which",
"wi... | Britefury/batchup | python | https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/sampling.py#L227-L287 | [
"def",
"shuffled_indices_batch_iterator",
"(",
"self",
",",
"batch_size",
",",
"shuffle_rng",
")",
":",
"if",
"self",
".",
"repeats",
"==",
"1",
":",
"indices",
"=",
"shuffle_rng",
".",
"permutation",
"(",
"self",
".",
"length",
")",
"for",
"i",
"in",
"ran... | 3fc2304e629f813c05f9e7a85a18acef3581a536 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.