repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | genotype_and_filter | def genotype_and_filter(job, gvcfs, config):
"""
Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file
to the config output directory.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCF... | python | def genotype_and_filter(job, gvcfs, config):
"""
Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file
to the config output directory.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCF... | [
"def",
"genotype_and_filter",
"(",
"job",
",",
"gvcfs",
",",
"config",
")",
":",
"# Get the total size of the genome reference",
"genome_ref_size",
"=",
"config",
".",
"genome_fasta",
".",
"size",
"+",
"config",
".",
"genome_fai",
".",
"size",
"+",
"config",
".",
... | Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file
to the config output directory.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID}
:param Namespace config: I... | [
"Genotypes",
"one",
"or",
"more",
"GVCF",
"files",
"and",
"runs",
"either",
"the",
"VQSR",
"or",
"hard",
"filtering",
"pipeline",
".",
"Uploads",
"the",
"genotyped",
"VCF",
"file",
"to",
"the",
"config",
"output",
"directory",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L265-L333 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | annotate_vcfs | def annotate_vcfs(job, vcfs, config):
"""
Runs Oncotator for a group of VCF files. Each sample is annotated individually.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID}
:param Namespace config: Input ... | python | def annotate_vcfs(job, vcfs, config):
"""
Runs Oncotator for a group of VCF files. Each sample is annotated individually.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID}
:param Namespace config: Input ... | [
"def",
"annotate_vcfs",
"(",
"job",
",",
"vcfs",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running Oncotator on the following samples:\\n%s'",
"%",
"'\\n'",
".",
"join",
"(",
"vcfs",
".",
"keys",
"(",
")",
")",
")",
"for",
... | Runs Oncotator for a group of VCF files. Each sample is annotated individually.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID}
:param Namespace config: Input parameters and shared FileStoreIDs
Require... | [
"Runs",
"Oncotator",
"for",
"a",
"group",
"of",
"VCF",
"files",
".",
"Each",
"sample",
"is",
"annotated",
"individually",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L336-L373 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | parse_manifest | def parse_manifest(path_to_manifest):
"""
Parses manifest file for Toil Germline Pipeline
:param str path_to_manifest: Path to sample manifest file
:return: List of GermlineSample namedtuples
:rtype: list[GermlineSample]
"""
bam_re = r"^(?P<uuid>\S+)\s(?P<url>\S+[bsc][r]?am)"
fq_re = r"... | python | def parse_manifest(path_to_manifest):
"""
Parses manifest file for Toil Germline Pipeline
:param str path_to_manifest: Path to sample manifest file
:return: List of GermlineSample namedtuples
:rtype: list[GermlineSample]
"""
bam_re = r"^(?P<uuid>\S+)\s(?P<url>\S+[bsc][r]?am)"
fq_re = r"... | [
"def",
"parse_manifest",
"(",
"path_to_manifest",
")",
":",
"bam_re",
"=",
"r\"^(?P<uuid>\\S+)\\s(?P<url>\\S+[bsc][r]?am)\"",
"fq_re",
"=",
"r\"^(?P<uuid>\\S+)\\s(?P<url>\\S+)\\s(?P<paired_url>\\S+)?\\s?(?P<rg_line>@RG\\S+)\"",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"pa... | Parses manifest file for Toil Germline Pipeline
:param str path_to_manifest: Path to sample manifest file
:return: List of GermlineSample namedtuples
:rtype: list[GermlineSample] | [
"Parses",
"manifest",
"file",
"for",
"Toil",
"Germline",
"Pipeline"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L379-L416 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | download_shared_files | def download_shared_files(job, config):
"""
Downloads shared reference files for Toil Germline pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options
:return: Updated config with shared fileStoreIDS
:rtype: Namespace
... | python | def download_shared_files(job, config):
"""
Downloads shared reference files for Toil Germline pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options
:return: Updated config with shared fileStoreIDS
:rtype: Namespace
... | [
"def",
"download_shared_files",
"(",
"job",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Downloading shared reference files'",
")",
"shared_files",
"=",
"{",
"'genome_fasta'",
",",
"'genome_fai'",
",",
"'genome_dict'",
"}",
"nonessent... | Downloads shared reference files for Toil Germline pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options
:return: Updated config with shared fileStoreIDS
:rtype: Namespace | [
"Downloads",
"shared",
"reference",
"files",
"for",
"Toil",
"Germline",
"pipeline"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L419-L456 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | reference_preprocessing | def reference_preprocessing(job, config):
"""
Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options and shared files.
... | python | def reference_preprocessing(job, config):
"""
Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options and shared files.
... | [
"def",
"reference_preprocessing",
"(",
"job",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Preparing Reference Files'",
")",
"genome_id",
"=",
"config",
".",
"genome_fasta",
"if",
"getattr",
"(",
"config",
",",
"'genome_fai'",
","... | Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options and shared files.
Requires FileStoreID for genome fasta f... | [
"Creates",
"a",
"genome",
"fasta",
"index",
"and",
"sequence",
"dictionary",
"file",
"if",
"not",
"already",
"present",
"in",
"the",
"pipeline",
"config",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L459-L480 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | prepare_bam | def prepare_bam(job, uuid, url, config, paired_url=None, rg_line=None):
"""
Prepares BAM file for Toil germline pipeline.
Steps in pipeline
0: Download and align BAM or FASTQ sample
1: Sort BAM
2: Index BAM
3: Run GATK preprocessing pipeline (Optional)
- Uploads preprocessed BAM to ... | python | def prepare_bam(job, uuid, url, config, paired_url=None, rg_line=None):
"""
Prepares BAM file for Toil germline pipeline.
Steps in pipeline
0: Download and align BAM or FASTQ sample
1: Sort BAM
2: Index BAM
3: Run GATK preprocessing pipeline (Optional)
- Uploads preprocessed BAM to ... | [
"def",
"prepare_bam",
"(",
"job",
",",
"uuid",
",",
"url",
",",
"config",
",",
"paired_url",
"=",
"None",
",",
"rg_line",
"=",
"None",
")",
":",
"# 0: Align FASTQ or realign BAM",
"if",
"config",
".",
"run_bwa",
":",
"get_bam",
"=",
"job",
".",
"wrapJobFn"... | Prepares BAM file for Toil germline pipeline.
Steps in pipeline
0: Download and align BAM or FASTQ sample
1: Sort BAM
2: Index BAM
3: Run GATK preprocessing pipeline (Optional)
- Uploads preprocessed BAM to output directory
:param JobFunctionWrappingJob job: passed automatically by Toi... | [
"Prepares",
"BAM",
"file",
"for",
"Toil",
"germline",
"pipeline",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L483-L592 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | setup_and_run_bwakit | def setup_and_run_bwakit(job, uuid, url, rg_line, config, paired_url=None):
"""
Downloads and runs bwakit for BAM or FASTQ files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str uuid: Unique sample identifier
:param str url: FASTQ or BAM file URL. BAM alignment URL must ha... | python | def setup_and_run_bwakit(job, uuid, url, rg_line, config, paired_url=None):
"""
Downloads and runs bwakit for BAM or FASTQ files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str uuid: Unique sample identifier
:param str url: FASTQ or BAM file URL. BAM alignment URL must ha... | [
"def",
"setup_and_run_bwakit",
"(",
"job",
",",
"uuid",
",",
"url",
",",
"rg_line",
",",
"config",
",",
"paired_url",
"=",
"None",
")",
":",
"bwa_config",
"=",
"deepcopy",
"(",
"config",
")",
"bwa_config",
".",
"uuid",
"=",
"uuid",
"bwa_config",
".",
"rg... | Downloads and runs bwakit for BAM or FASTQ files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str uuid: Unique sample identifier
:param str url: FASTQ or BAM file URL. BAM alignment URL must have .bam extension.
:param Namespace config: Input parameters and shared FileStoreIDs... | [
"Downloads",
"and",
"runs",
"bwakit",
"for",
"BAM",
"or",
"FASTQ",
"files"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L595-L680 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | gatk_haplotype_caller | def gatk_haplotype_caller(job,
bam, bai,
ref, fai, ref_dict,
annotations=None,
emit_threshold=10.0, call_threshold=30.0,
unsafe_mode=False,
hc_output=None):
"""... | python | def gatk_haplotype_caller(job,
bam, bai,
ref, fai, ref_dict,
annotations=None,
emit_threshold=10.0, call_threshold=30.0,
unsafe_mode=False,
hc_output=None):
"""... | [
"def",
"gatk_haplotype_caller",
"(",
"job",
",",
"bam",
",",
"bai",
",",
"ref",
",",
"fai",
",",
"ref_dict",
",",
"annotations",
"=",
"None",
",",
"emit_threshold",
"=",
"10.0",
",",
"call_threshold",
"=",
"30.0",
",",
"unsafe_mode",
"=",
"False",
",",
"... | Uses GATK HaplotypeCaller to identify SNPs and INDELs. Outputs variants in a Genomic VCF file.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileStoreID for BAM index file
:param str ref: FileStoreID for reference genome fasta f... | [
"Uses",
"GATK",
"HaplotypeCaller",
"to",
"identify",
"SNPs",
"and",
"INDELs",
".",
"Outputs",
"variants",
"in",
"a",
"Genomic",
"VCF",
"file",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L683-L749 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | main | def main():
"""
GATK germline pipeline with variant filtering and annotation.
"""
# Define Parser object and add to jobTree
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
# Generate subparsers
subparsers = parser.add_subparsers(dest='com... | python | def main():
"""
GATK germline pipeline with variant filtering and annotation.
"""
# Define Parser object and add to jobTree
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
# Generate subparsers
subparsers = parser.add_subparsers(dest='com... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to jobTree",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
")",
"# Generate subparsers",
"subparse... | GATK germline pipeline with variant filtering and annotation. | [
"GATK",
"germline",
"pipeline",
"with",
"variant",
"filtering",
"and",
"annotation",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L752-L894 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_gatk_pipeline/align_and_call.py | sample_loop | def sample_loop(job, uuid_list, inputs):
"""
Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each
"""
for uuid_rg in uuid_list:
uuid_items = uuid_rg.split(',')
uuid = uuid_items[0]
rg_line = None
if len(uuid_items) > 1:
rg_line = uuid_items[1]
job... | python | def sample_loop(job, uuid_list, inputs):
"""
Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each
"""
for uuid_rg in uuid_list:
uuid_items = uuid_rg.split(',')
uuid = uuid_items[0]
rg_line = None
if len(uuid_items) > 1:
rg_line = uuid_items[1]
job... | [
"def",
"sample_loop",
"(",
"job",
",",
"uuid_list",
",",
"inputs",
")",
":",
"for",
"uuid_rg",
"in",
"uuid_list",
":",
"uuid_items",
"=",
"uuid_rg",
".",
"split",
"(",
"','",
")",
"uuid",
"=",
"uuid_items",
"[",
"0",
"]",
"rg_line",
"=",
"None",
"if",
... | Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each | [
"Loops",
"over",
"the",
"sample_ids",
"(",
"uuids",
")",
"in",
"the",
"manifest",
"creating",
"child",
"jobs",
"to",
"process",
"each"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L135-L148 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_gatk_pipeline/align_and_call.py | static_dag | def static_dag(job, uuid, rg_line, inputs):
"""
Prefer this here as it allows us to pull the job functions from other jobs
without rewrapping the job functions back together.
bwa_inputs: Input arguments to be passed to BWA.
adam_inputs: Input arguments to be passed to ADAM.
gatk_preprocess_inpu... | python | def static_dag(job, uuid, rg_line, inputs):
"""
Prefer this here as it allows us to pull the job functions from other jobs
without rewrapping the job functions back together.
bwa_inputs: Input arguments to be passed to BWA.
adam_inputs: Input arguments to be passed to ADAM.
gatk_preprocess_inpu... | [
"def",
"static_dag",
"(",
"job",
",",
"uuid",
",",
"rg_line",
",",
"inputs",
")",
":",
"# get work directory",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"inputs",
".",
"cpu_count",
"=",
"cpu_count",
"(",
")",
"inputs",
"."... | Prefer this here as it allows us to pull the job functions from other jobs
without rewrapping the job functions back together.
bwa_inputs: Input arguments to be passed to BWA.
adam_inputs: Input arguments to be passed to ADAM.
gatk_preprocess_inputs: Input arguments to be passed to GATK preprocessing.
... | [
"Prefer",
"this",
"here",
"as",
"it",
"allows",
"us",
"to",
"pull",
"the",
"job",
"functions",
"from",
"other",
"jobs",
"without",
"rewrapping",
"the",
"job",
"functions",
"back",
"together",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L151-L266 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_gatk_pipeline/align_and_call.py | main | def main():
"""
This is a Toil pipeline used to perform alignment of fastqs.
"""
# Define Parser object and add to Toil
if mock_mode():
usage_msg = 'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline ' \
'will run in mock mode. To disable mock ... | python | def main():
"""
This is a Toil pipeline used to perform alignment of fastqs.
"""
# Define Parser object and add to Toil
if mock_mode():
usage_msg = 'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline ' \
'will run in mock mode. To disable mock ... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to Toil",
"if",
"mock_mode",
"(",
")",
":",
"usage_msg",
"=",
"'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline '",
"'will run in mock mode. To disable mock mode, set TOIL_SCRIPTS_MOCK_MODE=0'",
... | This is a Toil pipeline used to perform alignment of fastqs. | [
"This",
"is",
"a",
"Toil",
"pipeline",
"used",
"to",
"perform",
"alignment",
"of",
"fastqs",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L388-L458 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | generate_unique_key | def generate_unique_key(master_key_path, url):
"""
Input1: Path to the BD2K Master Key (for S3 Encryption)
Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam)
Returns: 32-byte unique key generated for that URL
"""
with open(master... | python | def generate_unique_key(master_key_path, url):
"""
Input1: Path to the BD2K Master Key (for S3 Encryption)
Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam)
Returns: 32-byte unique key generated for that URL
"""
with open(master... | [
"def",
"generate_unique_key",
"(",
"master_key_path",
",",
"url",
")",
":",
"with",
"open",
"(",
"master_key_path",
",",
"'r'",
")",
"as",
"f",
":",
"master_key",
"=",
"f",
".",
"read",
"(",
")",
"assert",
"len",
"(",
"master_key",
")",
"==",
"32",
","... | Input1: Path to the BD2K Master Key (for S3 Encryption)
Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam)
Returns: 32-byte unique key generated for that URL | [
"Input1",
":",
"Path",
"to",
"the",
"BD2K",
"Master",
"Key",
"(",
"for",
"S3",
"Encryption",
")",
"Input2",
":",
"S3",
"URL",
"(",
"e",
".",
"g",
".",
"https",
":",
"//",
"s3",
"-",
"us",
"-",
"west",
"-",
"2",
".",
"amazonaws",
".",
"com",
"/"... | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L49-L62 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | download_encrypted_file | def download_encrypted_file(work_dir, url, key_path, name):
"""
Downloads encrypted file from S3
Input1: Working directory
Input2: S3 URL to be downloaded
Input3: Path to key necessary for decryption
Input4: name of file to be downloaded
"""
file_path = os.path.join(work_dir, name)
... | python | def download_encrypted_file(work_dir, url, key_path, name):
"""
Downloads encrypted file from S3
Input1: Working directory
Input2: S3 URL to be downloaded
Input3: Path to key necessary for decryption
Input4: name of file to be downloaded
"""
file_path = os.path.join(work_dir, name)
... | [
"def",
"download_encrypted_file",
"(",
"work_dir",
",",
"url",
",",
"key_path",
",",
"name",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"name",
")",
"key",
"=",
"generate_unique_key",
"(",
"key_path",
",",
"url",
")... | Downloads encrypted file from S3
Input1: Working directory
Input2: S3 URL to be downloaded
Input3: Path to key necessary for decryption
Input4: name of file to be downloaded | [
"Downloads",
"encrypted",
"file",
"from",
"S3"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L65-L85 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | return_input_paths | def return_input_paths(job, work_dir, ids, *args):
"""
Returns the paths of files from the FileStore
Input1: Toil job instance
Input2: Working directory
Input3: jobstore id dictionary
Input4: names of files to be returned from the jobstore
Returns: path(s) to the file(s) requested -- unpac... | python | def return_input_paths(job, work_dir, ids, *args):
"""
Returns the paths of files from the FileStore
Input1: Toil job instance
Input2: Working directory
Input3: jobstore id dictionary
Input4: names of files to be returned from the jobstore
Returns: path(s) to the file(s) requested -- unpac... | [
"def",
"return_input_paths",
"(",
"job",
",",
"work_dir",
",",
"ids",
",",
"*",
"args",
")",
":",
"paths",
"=",
"OrderedDict",
"(",
")",
"for",
"name",
"in",
"args",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
... | Returns the paths of files from the FileStore
Input1: Toil job instance
Input2: Working directory
Input3: jobstore id dictionary
Input4: names of files to be returned from the jobstore
Returns: path(s) to the file(s) requested -- unpack these! | [
"Returns",
"the",
"paths",
"of",
"files",
"from",
"the",
"FileStore"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L111-L132 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | move_to_output_dir | def move_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
Moves files from work_dir to output_dir
Input1: Working directory
Input2: Output directory
Input3: UUID to be preprended onto file name
Input4: list of file names to be moved from working dir to output dir
"""
fo... | python | def move_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
Moves files from work_dir to output_dir
Input1: Working directory
Input2: Output directory
Input3: UUID to be preprended onto file name
Input4: list of file names to be moved from working dir to output dir
"""
fo... | [
"def",
"move_to_output_dir",
"(",
"work_dir",
",",
"output_dir",
",",
"uuid",
"=",
"None",
",",
"files",
"=",
"list",
"(",
")",
")",
":",
"for",
"fname",
"in",
"files",
":",
"if",
"uuid",
"is",
"None",
":",
"shutil",
".",
"move",
"(",
"os",
".",
"p... | Moves files from work_dir to output_dir
Input1: Working directory
Input2: Output directory
Input3: UUID to be preprended onto file name
Input4: list of file names to be moved from working dir to output dir | [
"Moves",
"files",
"from",
"work_dir",
"to",
"output_dir"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L135-L148 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | batch_start | def batch_start(job, input_args):
"""
Downloads shared files that are used by all samples for alignment and places them in the jobstore.
"""
shared_files = ['ref.fa', 'ref.fa.amb', 'ref.fa.ann', 'ref.fa.bwt', 'ref.fa.pac', 'ref.fa.sa', 'ref.fa.fai']
shared_ids = {}
for fname in shared_files:
... | python | def batch_start(job, input_args):
"""
Downloads shared files that are used by all samples for alignment and places them in the jobstore.
"""
shared_files = ['ref.fa', 'ref.fa.amb', 'ref.fa.ann', 'ref.fa.bwt', 'ref.fa.pac', 'ref.fa.sa', 'ref.fa.fai']
shared_ids = {}
for fname in shared_files:
... | [
"def",
"batch_start",
"(",
"job",
",",
"input_args",
")",
":",
"shared_files",
"=",
"[",
"'ref.fa'",
",",
"'ref.fa.amb'",
",",
"'ref.fa.ann'",
",",
"'ref.fa.bwt'",
",",
"'ref.fa.pac'",
",",
"'ref.fa.sa'",
",",
"'ref.fa.fai'",
"]",
"shared_ids",
"=",
"{",
"}",
... | Downloads shared files that are used by all samples for alignment and places them in the jobstore. | [
"Downloads",
"shared",
"files",
"that",
"are",
"used",
"by",
"all",
"samples",
"for",
"alignment",
"and",
"places",
"them",
"in",
"the",
"jobstore",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L152-L161 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | spawn_batch_jobs | def spawn_batch_jobs(job, shared_ids, input_args):
"""
Spawns an alignment job for every sample in the input configuration file
"""
samples = []
config = input_args['config']
with open(config, 'r') as f_in:
for line in f_in:
line = line.strip().split(',')
uuid = l... | python | def spawn_batch_jobs(job, shared_ids, input_args):
"""
Spawns an alignment job for every sample in the input configuration file
"""
samples = []
config = input_args['config']
with open(config, 'r') as f_in:
for line in f_in:
line = line.strip().split(',')
uuid = l... | [
"def",
"spawn_batch_jobs",
"(",
"job",
",",
"shared_ids",
",",
"input_args",
")",
":",
"samples",
"=",
"[",
"]",
"config",
"=",
"input_args",
"[",
"'config'",
"]",
"with",
"open",
"(",
"config",
",",
"'r'",
")",
"as",
"f_in",
":",
"for",
"line",
"in",
... | Spawns an alignment job for every sample in the input configuration file | [
"Spawns",
"an",
"alignment",
"job",
"for",
"every",
"sample",
"in",
"the",
"input",
"configuration",
"file"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L164-L177 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | alignment | def alignment(job, ids, input_args, sample):
"""
Runs BWA and then Bamsort on the supplied fastqs for this sample
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sa... | python | def alignment(job, ids, input_args, sample):
"""
Runs BWA and then Bamsort on the supplied fastqs for this sample
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sa... | [
"def",
"alignment",
"(",
"job",
",",
"ids",
",",
"input_args",
",",
"sample",
")",
":",
"uuid",
",",
"urls",
"=",
"sample",
"# ids['bam'] = job.fileStore.getEmptyFileStoreID()",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"output_... | Runs BWA and then Bamsort on the supplied fastqs for this sample
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample | [
"Runs",
"BWA",
"and",
"then",
"Bamsort",
"on",
"the",
"supplied",
"fastqs",
"for",
"this",
"sample"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L180-L238 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | upload_bam_to_s3 | def upload_bam_to_s3(job, ids, input_args, sample):
"""
Uploads output BAM from sample to S3
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sample
key_path = i... | python | def upload_bam_to_s3(job, ids, input_args, sample):
"""
Uploads output BAM from sample to S3
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sample
key_path = i... | [
"def",
"upload_bam_to_s3",
"(",
"job",
",",
"ids",
",",
"input_args",
",",
"sample",
")",
":",
"uuid",
",",
"urls",
"=",
"sample",
"key_path",
"=",
"input_args",
"[",
"'ssec'",
"]",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
"... | Uploads output BAM from sample to S3
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample | [
"Uploads",
"output",
"BAM",
"from",
"sample",
"to",
"S3"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L241-L272 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/vqsr.py | vqsr_pipeline | def vqsr_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Variant Quality Score Recalibration.
0: Start 0 --> 1 --> 3 --> 4 --> 5
1: Recalibrate SNPs | |
2: Recalibrate INDELS +-> 2 -+
3: Apply SNP Recalibration
4: Apply INDEL ... | python | def vqsr_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Variant Quality Score Recalibration.
0: Start 0 --> 1 --> 3 --> 4 --> 5
1: Recalibrate SNPs | |
2: Recalibrate INDELS +-> 2 -+
3: Apply SNP Recalibration
4: Apply INDEL ... | [
"def",
"vqsr_pipeline",
"(",
"job",
",",
"uuid",
",",
"vcf_id",
",",
"config",
")",
":",
"# Get the total size of the genome reference",
"genome_ref_size",
"=",
"config",
".",
"genome_fasta",
".",
"size",
"+",
"config",
".",
"genome_fai",
".",
"size",
"+",
"conf... | Runs GATK Variant Quality Score Recalibration.
0: Start 0 --> 1 --> 3 --> 4 --> 5
1: Recalibrate SNPs | |
2: Recalibrate INDELS +-> 2 -+
3: Apply SNP Recalibration
4: Apply INDEL Recalibration
5: Write VCF to output directory
:p... | [
"Runs",
"GATK",
"Variant",
"Quality",
"Score",
"Recalibration",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/vqsr.py#L12-L162 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/vqsr.py | get_short_annotations | def get_short_annotations(annotations):
"""
Converts full GATK annotation name to the shortened version
:param annotations:
:return:
"""
# Annotations need to match VCF header
short_name = {'QualByDepth': 'QD',
'FisherStrand': 'FS',
'StrandOddsRatio': 'SOR... | python | def get_short_annotations(annotations):
"""
Converts full GATK annotation name to the shortened version
:param annotations:
:return:
"""
# Annotations need to match VCF header
short_name = {'QualByDepth': 'QD',
'FisherStrand': 'FS',
'StrandOddsRatio': 'SOR... | [
"def",
"get_short_annotations",
"(",
"annotations",
")",
":",
"# Annotations need to match VCF header",
"short_name",
"=",
"{",
"'QualByDepth'",
":",
"'QD'",
",",
"'FisherStrand'",
":",
"'FS'",
",",
"'StrandOddsRatio'",
":",
"'SOR'",
",",
"'ReadPosRankSumTest'",
":",
... | Converts full GATK annotation name to the shortened version
:param annotations:
:return: | [
"Converts",
"full",
"GATK",
"annotation",
"name",
"to",
"the",
"shortened",
"version",
":",
"param",
"annotations",
":",
":",
"return",
":"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/vqsr.py#L165-L185 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | parse_sra | def parse_sra(path_to_config):
"""
Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ]
Returns duplicate of ids to follow UUID/URL standard.
"""
samples = []
with open(path_to_config, 'r') as f:
for line in f.readlines():
if not line.iss... | python | def parse_sra(path_to_config):
"""
Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ]
Returns duplicate of ids to follow UUID/URL standard.
"""
samples = []
with open(path_to_config, 'r') as f:
for line in f.readlines():
if not line.iss... | [
"def",
"parse_sra",
"(",
"path_to_config",
")",
":",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"path_to_config",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"if",
"not",
"line",
".",
"isspace",
"... | Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ]
Returns duplicate of ids to follow UUID/URL standard. | [
"Parses",
"genetorrent",
"config",
"file",
".",
"Returns",
"list",
"of",
"samples",
":",
"[",
"[",
"id1",
"id1",
"]",
"[",
"id2",
"id2",
"]",
"...",
"]",
"Returns",
"duplicate",
"of",
"ids",
"to",
"follow",
"UUID",
"/",
"URL",
"standard",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L82-L92 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | tarball_files | def tarball_files(work_dir, tar_name, uuid=None, files=None):
"""
Tars a group of files together into a tarball
work_dir: str Current Working Directory
tar_name: str Name of tarball
uuid: str UUID to stamp files with
files: str(s) List of filenames to place in the ta... | python | def tarball_files(work_dir, tar_name, uuid=None, files=None):
"""
Tars a group of files together into a tarball
work_dir: str Current Working Directory
tar_name: str Name of tarball
uuid: str UUID to stamp files with
files: str(s) List of filenames to place in the ta... | [
"def",
"tarball_files",
"(",
"work_dir",
",",
"tar_name",
",",
"uuid",
"=",
"None",
",",
"files",
"=",
"None",
")",
":",
"with",
"tarfile",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"tar_name",
")",
",",
"'w:gz'",
")",
... | Tars a group of files together into a tarball
work_dir: str Current Working Directory
tar_name: str Name of tarball
uuid: str UUID to stamp files with
files: str(s) List of filenames to place in the tarball from working directory | [
"Tars",
"a",
"group",
"of",
"files",
"together",
"into",
"a",
"tarball"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L95-L109 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | start_batch | 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'... | python | 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",
")",
":",
"samples",
"=",
"parse_sra",
"(",
"input_args",
"[",
"'sra'",
"]",
")",
"# for analysis_id in samples:",
"job",
".",
"addChildJobFn",
"(",
"download_and_transfer_sample",
",",
"input_args",
",",
"sampl... | This function will administer 5 jobs at a time then recursively call itself until subset is empty | [
"This",
"function",
"will",
"administer",
"5",
"jobs",
"at",
"a",
"time",
"then",
"recursively",
"call",
"itself",
"until",
"subset",
"is",
"empty"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L113-L119 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | download_and_transfer_sample | 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... | python | 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",
")",
":",
"if",
"len",
"(",
"samples",
")",
">",
"1",
":",
"a",
"=",
"samples",
"[",
"len",
"(",
"samples",
")",
"/",
"2",
":",
"]",
"b",
"=",
"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 | [
"Downloads",
"a",
"sample",
"from",
"dbGaP",
"via",
"SRAToolKit",
"then",
"uses",
"S3AM",
"to",
"transfer",
"it",
"to",
"S3"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L122-L172 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | main | 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... | python | 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",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | Transfer gTEX data from dbGaP (NCBI) to S3 | [
"Transfer",
"gTEX",
"data",
"from",
"dbGaP",
"(",
"NCBI",
")",
"to",
"S3"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L175-L198 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/common.py | output_file_job | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Writing {} to {}'",
".",
"format",
"(",
"filename",
",",
"output_dir",
")... | 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: (... | [
"Uploads",
"a",
"file",
"from",
"the",
"FileStore",
"to",
"an",
"output",
"directory",
"on",
"the",
"local",
"filesystem",
"or",
"S3",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/common.py#L10-L32 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_encrypted_file | 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['... | python | 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",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"key_path",
"=",
"input_args",
"[",
"'ssec'",
"]",
"file_path",
"=",
"os",
".",
"path",
".",... | Downloads encrypted files from S3 via header injection
input_args: dict Input dictionary defined in main()
name: str Symbolic name associated with file | [
"Downloads",
"encrypted",
"files",
"from",
"S3",
"via",
"header",
"injection"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L177-L206 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_from_url | 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:'):
... | python | 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",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"os",
".",
"path",
".",
"basename",
"(",
... | Simple curl request made for a given url
url: str URL to download | [
"Simple",
"curl",
"request",
"made",
"for",
"a",
"given",
"url"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L209-L226 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | docker_call | 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... | python | 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",
")",
":",
"base_docker_call",
"=",
"'docker run --log-driver=none --rm -v {}:/data'",
".",
"format",
... | 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... | [
"Makes",
"subprocess",
"call",
"of",
"a",
"command",
"to",
"a",
"docker",
"container",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L257-L281 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | copy_to_output_dir | 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 ... | python | 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",
"(",
")",
")",
":",
"for",
"fname",
"in",
"files",
":",
"if",
"uuid",
"is",
"None",
":",
"shutil",
".",
"copy",
"(",
"os",
".",
"p... | 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 | [
"A",
"list",
"of",
"files",
"to",
"move",
"from",
"work_dir",
"to",
"output_dir",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L284-L297 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | program_checks | 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... | python | 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",
")",
":",
"# Program checks",
"for",
"program",
"in",
"[",
"'curl'",
",",
"'docker'",
",",
"'unzip'",
",",
"'samtools'",
"]",
":",
"assert",
"which",
"(",
"program",
")",
",",
"'Program \"{}\" must be ins... | Checks that dependency programs are installed.
input_args: dict Dictionary of input arguments (from main()) | [
"Checks",
"that",
"dependency",
"programs",
"are",
"installed",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L334-L343 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_shared_files | 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',
... | python | 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",
")",
":",
"shared_files",
"=",
"[",
"'unc.bed'",
",",
"'hg19.transcripts.fa'",
",",
"'composite_exons.bed'",
",",
"'normalize.pl'",
",",
"'rsem_ref.zip'",
",",
"'ebwt.zip'",
",",
"'chromosomes.zip'",
"]",
... | Downloads and stores shared inputs files in the FileStore
input_args: dict Dictionary of input arguments (from main()) | [
"Downloads",
"and",
"stores",
"shared",
"inputs",
"files",
"in",
"the",
"FileStore"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L346-L363 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | parse_config_file | 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... | python | 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",
")",
":",
"samples",
"=",
"[",
"]",
"config",
"=",
"input_args",
"[",
"'config'",
"]",
"with",
"open",
"(",
"config",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
... | Launches pipeline for each sample.
shared_ids: dict Dictionary of fileStore IDs
input_args: dict Dictionary of input arguments | [
"Launches",
"pipeline",
"for",
"each",
"sample",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L366-L381 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_sample | 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... | python | 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",
")",
":",
"if",
"len",
"(",
"sample",
")",
"==",
"2",
":",
"uuid",
",",
"sample_location",
"=",
"sample",
"url1",
",",
"url2",
"=",
"None",
",",
"None",
"else",
":",
... | 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 | [
"Defines",
"variables",
"unique",
"to",
"a",
"sample",
"that",
"are",
"used",
"in",
"the",
"rest",
"of",
"the",
"pipelines"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L384-L417 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | static_dag_launchpoint | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"if",
"input_args",
"[",
"'config_fastq'",
"]",
":",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"a",
"=",
"job",
".",
"wrapJobFn",
... | Statically define jobs in the pipeline
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Statically",
"define",
"jobs",
"in",
"the",
"pipeline"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L420-L435 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | merge_fastqs | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"single_end_reads",
"=",... | Unzips input sample and concats the Read1 and Read2 groups together.
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Unzips",
"input",
"sample",
"and",
"concats",
"the",
"Read1",
"and",
"Read2",
"groups",
"together",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L438-L476 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | mapsplice | 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... | python | 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",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo... | Maps RNA-Seq reads to a reference genome.
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Maps",
"RNA",
"-",
"Seq",
"reads",
"to",
"a",
"reference",
"genome",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L479-L524 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | add_read_groups | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# I/O",
"alignments",
"=... | This function adds read groups to the headers
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"This",
"function",
"adds",
"read",
"groups",
"to",
"the",
"headers"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L548-L575 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | bamsort_and_index | 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... | python | 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",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# ... | Sorts bam file and produces index file
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Sorts",
"bam",
"file",
"and",
"produces",
"index",
"file"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L578-L604 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | rseq_qc | 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... | python | 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",
")",
":",
"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
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"QC",
"module",
":",
"contains",
"QC",
"metrics",
"and",
"information",
"about",
"the",
"BAM",
"post",
"alignment"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L607-L625 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | sort_bam_by_reference | 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, ... | python | 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",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"# I/O",
"sorted_bam",
",",
"sorted_bai",
"=",
"... | Sorts the bam by reference
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Sorts",
"the",
"bam",
"by",
"reference"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L628-L663 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | exon_count | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"sudo",
"=",
"input_args",
"... | Produces exon counts
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Produces",
"exon",
"counts"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L666-L705 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | transcriptome | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# I/O",
"sort_by_ref",
","... | Creates a bam of just the transcriptome
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Creates",
"a",
"bam",
"of",
"just",
"the",
"transcriptome"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L708-L734 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | filter_bam | 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
... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo",
"=",
"input_args... | Performs filtering on the transcriptome bam
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Performs",
"filtering",
"on",
"the",
"transcriptome",
"bam"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L737-L762 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | rsem | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cpus",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo",
"=",
"input_args",
"[... | Runs RSEM to produce counts
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Runs",
"RSEM",
"to",
"produce",
"counts"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L765-L800 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | consolidate_output | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"# ... | 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 | [
"Combine",
"the",
"contents",
"of",
"separate",
"zipped",
"outputs",
"into",
"one",
"via",
"streaming"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L826-L865 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | upload_output_to_s3 | 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
... | python | 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",
")",
":",
"import",
"boto",
"from",
"boto",
".",
"s3",
".",
"key",
"import",
"Key",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",... | 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 | [
"If",
"s3_dir",
"is",
"specified",
"in",
"arguments",
"file",
"will",
"be",
"uploaded",
"to",
"S3",
"using",
"boto",
".",
"WARNING",
":",
"~",
"/",
".",
"boto",
"credentials",
"are",
"necessary",
"for",
"this",
"to",
"succeed!"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L868-L892 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | upload_bam_to_s3 | 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... | python | 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",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"# I/O",
"job",
".",
"... | Upload bam to S3. Requires S3AM and a ~/.boto config file. | [
"Upload",
"bam",
"to",
"S3",
".",
"Requires",
"S3AM",
"and",
"a",
"~",
"/",
".",
"boto",
"config",
"file",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L895-L915 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | main | 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... | python | 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",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | 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. | [
"This",
"is",
"a",
"Toil",
"pipeline",
"for",
"the",
"UNC",
"best",
"practice",
"RNA",
"-",
"Seq",
"analysis",
".",
"RNA",
"-",
"seq",
"fastqs",
"are",
"combined",
"aligned",
"sorted",
"filtered",
"and",
"quantified",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L918-L951 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | remove_file | 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... | python | 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",
")",
":",
"master_ip",
"=",
"master_ip",
".",
"actual",
"ssh_call",
"=",
"[",
"'ssh'",
",",
"'-o'",
",",
"'StrictHostKeyChecking=no'",
",",
"master_ip",
"]",
"if",
"spark_on_toil",
... | Remove the given file from hdfs with master at the given IP address
:type masterIP: MasterAddress | [
"Remove",
"the",
"given",
"file",
"from",
"hdfs",
"with",
"master",
"at",
"the",
"given",
"IP",
"address"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L52-L70 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | download_data | 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... | python | 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",
")",
":",
"log",
".",
"info",
"(",
"\"Downloading known sites file %s to %s.\"",
",",
"known_snps",
",",
"hdfs_snps",
")",
"c... | Downloads input data files from S3.
:type masterIP: MasterAddress | [
"Downloads",
"input",
"data",
"files",
"from",
"S3",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L96-L107 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | adam_convert | 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],
... | python | 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",
")",
":",
"log",
".",
"info",
"(",
"\"Converting input BAM to ADAM.\"",
")",
"call_adam",
"(",
"job",
... | Convert input sam/bam file and known SNPs file into ADAM format | [
"Convert",
"input",
"sam",
"/",
"bam",
"file",
"and",
"known",
"SNPs",
"file",
"into",
"ADAM",
"format"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L110-L134 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | adam_transform | 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... | python | 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",
")",
":",
"log",
".",
"info",
"(",
"\"Marking duplicate reads.\"",
")",
"call_adam",
"(",
"job",
",... | Preprocess in_file with known SNPs snp_file:
- mark duplicates
- realign indels
- recalibrate base quality scores | [
"Preprocess",
"in_file",
"with",
"known",
"SNPs",
"snp_file",
":",
"-",
"mark",
"duplicates",
"-",
"realign",
"indels",
"-",
"recalibrate",
"base",
"quality",
"scores"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L137-L197 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | upload_data | 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_... | python | 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",
")",
":",
"if",
"mock_mode",
"(",
")",
":",
"truncate_file",
"(",
"master_ip",
",",
"hdfs_name",
",",
"spark_on_toil",
")",
"log",
... | Upload file hdfsName from hdfs to s3 | [
"Upload",
"file",
"hdfsName",
"from",
"hdfs",
"to",
"s3"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L200-L210 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | download_run_and_upload | 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... | python | 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",
")",
":",
"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. | [
"Monolithic",
"job",
"that",
"calls",
"data",
"download",
"conversion",
"transform",
"upload",
".",
"Previously",
"this",
"was",
"not",
"monolithic",
";",
"change",
"came",
"in",
"due",
"to",
"#126",
"/",
"#134",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L213-L264 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | static_adam_preprocessing_dag | 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:
... | python | 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",
"=",
"''",
")",
":",
"inputs",
".",
"sample",
"=",
"sample",
"inputs",
".",
"output_dir",
"=",
"output_dir",
"inputs",
".",
"suffix",
"=",
"... | A Toil job function performing ADAM preprocessing on a single sample | [
"A",
"Toil",
"job",
"function",
"performing",
"ADAM",
"preprocessing",
"on",
"a",
"single",
"sample"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L267-L303 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/hard_filter.py | hard_filter_pipeline | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running Hard Filter on {}'",
".",
"format",
"(",
"uuid",
")",
")",
"# Get the total size of the genome reference",
"... | 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... | [
"Runs",
"GATK",
"Hard",
"Filtering",
"on",
"a",
"Genomic",
"VCF",
"file",
"and",
"uploads",
"the",
"results",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/hard_filter.py#L11-L137 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py | download_and_transfer_sample | 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_... | python | 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",
")",
":",
"analysis_id",
"=",
"sample",
"[",
"0",
"]",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"folder_path",
"=",
"os",
".",
"path",
".",
... | 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 | [
"Downloads",
"a",
"sample",
"from",
"CGHub",
"via",
"GeneTorrent",
"then",
"uses",
"S3AM",
"to",
"transfer",
"it",
"to",
"S3"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py#L65-L108 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py | main | 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... | python | 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",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | 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. | [
"This",
"is",
"a",
"Toil",
"pipeline",
"to",
"transfer",
"TCGA",
"data",
"into",
"an",
"S3",
"Bucket"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py#L111-L137 | train |
bd808/python-iptools | iptools/ipv6.py | validate_ip | 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... | python | 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",
")",
":",
"if",
"_HEX_RE",
".",
"match",
"(",
"s",
")",
":",
"return",
"len",
"(",
"s",
".",
"split",
"(",
"'::'",
")",
")",
"<=",
"2",
"if",
"_DOTTED_QUAD_RE",
".",
"match",
"(",
"s",
")",
":",
"halves",
"=",
"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:7334')
True
>>> va... | [
"Validate",
"a",
"hexidecimal",
"IPv6",
"ip",
"address",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L157-L209 | train |
bd808/python-iptools | iptools/ipv6.py | ip2long | 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:... | python | 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",
")",
":",
"if",
"not",
"validate_ip",
"(",
"ip",
")",
":",
"return",
"None",
"if",
"'.'",
"in",
"ip",
":",
"# convert IPv4 suffix to hex",
"chunks",
"=",
"ip",
".",
"split",
"(",
"':'",
")",
"v4_int",
"=",
"ipv4",
".",
"i... | 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... | [
"Convert",
"a",
"hexidecimal",
"IPv6",
"address",
"to",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L213-L277 | train |
bd808/python-iptools | iptools/ipv6.py | long2ip | 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... | python | 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",
")",
":",
"if",
"MAX_IP",
"<",
"l",
"or",
"l",
"<",
"MIN_IP",
":",
"raise",
"TypeError",
"(",
"\"expected int between %d and %d inclusive\"",
"%",
"(",
"MIN_IP",
",",
"MAX_IP",
")",
")",
"if",
"rf... | 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... | [
"Convert",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"to",
"a",
"canonical",
"IPv6",
"address",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L281-L353 | train |
bd808/python-iptools | iptools/ipv6.py | long2rfc1924 | 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... | python | 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",
")",
":",
"if",
"MAX_IP",
"<",
"l",
"or",
"l",
"<",
"MIN_IP",
":",
"raise",
"TypeError",
"(",
"\"expected int between %d and %d inclusive\"",
"%",
"(",
"MIN_IP",
",",
"MAX_IP",
")",
")",
"o",
"=",
"[",
"]",
"r",
"=",
"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 l: Network byte order 128-b... | [
"Convert",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"to",
"an",
"rfc1924",
"IPv6",
"address",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L357-L384 | train |
bd808/python-iptools | iptools/ipv6.py | rfc19242long | 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... | python | 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",
")",
":",
"global",
"_RFC1924_REV",
"if",
"not",
"_RFC1924_RE",
".",
"match",
"(",
"s",
")",
":",
"return",
"None",
"if",
"_RFC1924_REV",
"is",
"None",
":",
"_RFC1924_REV",
"=",
"{",
"v",
":",
"k",
"for",
"k",
",",
"v... | 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... | [
"Convert",
"an",
"RFC",
"1924",
"IPv6",
"address",
"to",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L387-L420 | train |
bd808/python-iptools | iptools/ipv6.py | validate_cidr | 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')
... | python | 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",
")",
":",
"if",
"_CIDR_RE",
".",
"match",
"(",
"s",
")",
":",
"ip",
",",
"mask",
"=",
"s",
".",
"split",
"(",
"'/'",
")",
"if",
"validate_ip",
"(",
"ip",
")",
":",
"if",
"int",
"(",
"mask",
")",
">",
"128",
"... | 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('... | [
"Validate",
"a",
"CIDR",
"notation",
"ip",
"address",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L423-L462 | train |
bd808/python-iptools | iptools/ipv6.py | cidr2block | 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... | python | 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",
")",
":",
"if",
"not",
"validate_cidr",
"(",
"cidr",
")",
":",
"return",
"None",
"ip",
",",
"prefix",
"=",
"cidr",
".",
"split",
"(",
"'/'",
")",
"prefix",
"=",
"int",
"(",
"prefix",
")",
"ip",
"=",
"ip2long",
"(",... | 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... | [
"Convert",
"a",
"CIDR",
"notation",
"ip",
"address",
"into",
"a",
"tuple",
"containing",
"the",
"network",
"block",
"start",
"and",
"end",
"addresses",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L466-L496 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | parse_input_samples | 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 ... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Parsing input samples and batching jobs'",
")",
"samples",
"=",
"[",
"]",
"if",
"inputs",
".",
"config",
":",
"with",
"open",
"(",
"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) | [
"Parses",
"config",
"file",
"to",
"pull",
"sample",
"information",
".",
"Stores",
"samples",
"as",
"tuples",
"of",
"(",
"uuid",
"URL",
")"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L43-L60 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | download_sample | 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... | python | 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",
")",
":",
"uuid",
",",
"url",
"=",
"sample",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Downloading sample: {}'",
".",
"format",
"(",
"uuid",
")",
")",
"# Download sample",
"tar_id"... | 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) | [
"Download",
"the",
"input",
"sample"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L63-L80 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | process_sample | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Processing sample into read pairs: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileS... | 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 | [
"Converts",
"sample",
".",
"tar",
"(",
".",
"gz",
")",
"into",
"two",
"fastq",
"files",
".",
"Due",
"to",
"edge",
"conditions",
"...",
"BEWARE",
":",
"HERE",
"BE",
"DRAGONS"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L83-L129 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | cutadapt | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running CutAdapt: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileStore",... | 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 | [
"Filters",
"out",
"adapters",
"that",
"may",
"be",
"left",
"in",
"the",
"RNA",
"-",
"seq",
"files"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L132-L177 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | star | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Aligning with STAR: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"f... | 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 | [
"Performs",
"alignment",
"of",
"fastqs",
"to",
"BAM",
"via",
"STAR"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L180-L232 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | variant_calling_and_qc | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Variant calling and QC: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",... | 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... | [
"Perform",
"variant",
"calling",
"with",
"samtools",
"nad",
"QC",
"with",
"CheckBias"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L235-L279 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | spladder | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'SplAdder: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileStore",
"."... | 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... | [
"Run",
"SplAdder",
"to",
"detect",
"and",
"quantify",
"alternative",
"splicing",
"events"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L282-L334 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | consolidate_output_tarballs | 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 ... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Consolidating files and uploading: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work... | 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 | [
"Combine",
"the",
"contents",
"of",
"separate",
"tarballs",
"into",
"one",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L337-L376 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | main | 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 ... | python | 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",
"(",
")",
":",
"# 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",... | This Toil pipeline aligns reads and performs alternative splicing analysis.
Please read the README.md located in the same directory for run instructions. | [
"This",
"Toil",
"pipeline",
"aligns",
"reads",
"and",
"performs",
"alternative",
"splicing",
"analysis",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L379-L425 | train |
bd808/python-iptools | iptools/ipv4.py | validate_ip | 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... | python | 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",
")",
":",
"if",
"_DOTTED_QUAD_RE",
".",
"match",
"(",
"s",
")",
":",
"quads",
"=",
"s",
".",
"split",
"(",
"'.'",
")",
"for",
"q",
"in",
"quads",
":",
"if",
"int",
"(",
"q",
")",
">",
"255",
":",
"return",
"False... | 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... | [
"Validate",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L190-L222 | train |
bd808/python-iptools | iptools/ipv4.py | validate_netmask | 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)... | python | 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",
")",
":",
"if",
"validate_ip",
"(",
"s",
")",
":",
"# Convert to binary string, strip '0b' prefix, 0 pad to 32 bits",
"mask",
"=",
"bin",
"(",
"ip2network",
"(",
"s",
")",
")",
"[",
"2",
":",
"]",
".",
"zfill",
"(",
"32",... | 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... | [
"Validate",
"that",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"is",
"a",
"valid",
"netmask",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L269-L309 | train |
bd808/python-iptools | iptools/ipv4.py | validate_subnet | 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... | python | 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",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"basestring",
")",
":",
"if",
"'/'",
"in",
"s",
":",
"start",
",",
"mask",
"=",
"s",
".",
"split",
"(",
"'/'",
",",
"2",
")",
"return",
"validate_ip",
"(",
"start",
... | 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... | [
"Validate",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"including",
"a",
"netmask",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L313-L352 | train |
bd808/python-iptools | iptools/ipv4.py | ip2long | 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... | python | 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",
")",
":",
"if",
"not",
"validate_ip",
"(",
"ip",
")",
":",
"return",
"None",
"quads",
"=",
"ip",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"quads",
")",
"==",
"1",
":",
"# only a network quad",
"quads",
"=",
"qua... | 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... | [
"Convert",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"to",
"a",
"network",
"byte",
"order",
"32",
"-",
"bit",
"integer",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L356-L389 | train |
bd808/python-iptools | iptools/ipv4.py | ip2network | 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
... | python | 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",
")",
":",
"if",
"not",
"validate_ip",
"(",
"ip",
")",
":",
"return",
"None",
"quads",
"=",
"ip",
".",
"split",
"(",
"'.'",
")",
"netw",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"4",
")",
":",
"netw",
"=",
"(",
... | 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... | [
"Convert",
"a",
"dotted",
"-",
"quad",
"ip",
"to",
"base",
"network",
"number",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L393-L410 | train |
bd808/python-iptools | iptools/ipv4.py | long2ip | 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... | python | 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",
")",
":",
"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",... | 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... | [
"Convert",
"a",
"network",
"byte",
"order",
"32",
"-",
"bit",
"integer",
"to",
"a",
"dotted",
"quad",
"ip",
"address",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L414-L452 | train |
bd808/python-iptools | iptools/ipv4.py | cidr2block | 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', '... | python | 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",
")",
":",
"if",
"not",
"validate_cidr",
"(",
"cidr",
")",
":",
"return",
"None",
"ip",
",",
"prefix",
"=",
"cidr",
".",
"split",
"(",
"'/'",
")",
"prefix",
"=",
"int",
"(",
"prefix",
")",
"# convert dotted-quad ip to bas... | 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... | [
"Convert",
"a",
"CIDR",
"notation",
"ip",
"address",
"into",
"a",
"tuple",
"containing",
"the",
"network",
"block",
"start",
"and",
"end",
"addresses",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L514-L547 | train |
bd808/python-iptools | iptools/ipv4.py | subnet2block | 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... | python | 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",
")",
":",
"if",
"not",
"validate_subnet",
"(",
"subnet",
")",
":",
"return",
"None",
"ip",
",",
"netmask",
"=",
"subnet",
".",
"split",
"(",
"'/'",
")",
"prefix",
"=",
"netmask2prefix",
"(",
"netmask",
")",
"# conver... | 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')
... | [
"Convert",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"including",
"a",
"netmask",
"into",
"a",
"tuple",
"containing",
"the",
"network",
"block",
"start",
"and",
"end",
"addresses",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L579-L613 | train |
bd808/python-iptools | iptools/ipv4.py | _block_from_ip_and_prefix | 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)
"""
... | python | 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",
")",
":",
"# 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... | 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",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L617-L634 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | download_shared_files | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Downloaded shared files'",
")",
"file_names",
"=",
"[",
"'reference'",
",",
"'phase'",
",",
"'mills'",
",",
"'dbsnp'",
",",... | 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 | [
"Downloads",
"files",
"shared",
"by",
"all",
"samples",
"in",
"the",
"pipeline"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L29-L43 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | reference_preprocessing | 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 ... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Processed reference files'",
")",
"config",
".",
"fai",
"=",
"job",
".",
"addChildJobFn",
"(",
"run_samtools_faidx",
",",
... | 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 | [
"Spawn",
"the",
"jobs",
"that",
"create",
"index",
"and",
"dict",
"file",
"for",
"reference"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L46-L57 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | download_sample | 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... | python | 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",
")",
":",
"# Create copy of config that is sample specific",
"config",
"=",
"argparse",
".",
"Namespace",
"(",
"*",
"*",
"vars",
"(",
"config",
")",
")",
"uuid",
",",
"normal_url",
",",
"tumor... | 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 | [
"Download",
"sample",
"and",
"store",
"sample",
"specific",
"attributes"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L60-L82 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | index_bams | 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... | python | 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",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Indexed sample BAMS: '",
"+",
"config",
".",
"uuid",
")",
"disk",
"=",
"'1G'",
"if",
"config",
".",
"ci_test",
"else",
"'20G'",
"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 | [
"Convenience",
"job",
"for",
"handling",
"bam",
"indexing",
"to",
"make",
"the",
"workflow",
"declaration",
"cleaner"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L85-L96 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | preprocessing_declaration | 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... | python | 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",
")",
":",
"if",
"config",
".",
"preprocessing",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Ran preprocessing: '",
"+",
"config",
".",
"uuid",
")",
"disk",
"=",
"'1G'",
"if",
"config... | Declare jobs related to preprocessing
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Argparse Namespace object containing argument inputs | [
"Declare",
"jobs",
"related",
"to",
"preprocessing"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L99-L123 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | static_workflow_declaration | 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... | python | 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",
")",
":",
"# Mutation and indel tool wiring",
"memory",
"=",
"'1G'",
"if",
"config",
".",
"ci_test",
"else",
"'10G'",
"disk",... | 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... | [
"Statically",
"declare",
"workflow",
"so",
"sections",
"can",
"be",
"modularly",
"repurposed"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L126-L155 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | consolidate_output | 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... | python | 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",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"mutect_tar",
",",
"pindel_tar",
",",
"muse_tar",
"=",
"None",
",",
"... | 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... | [
"Combine",
"the",
"contents",
"of",
"separate",
"tarball",
"outputs",
"into",
"one",
"via",
"streaming"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L158-L198 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | parse_manifest | 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... | python | 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",
")",
":",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"path_to_manifest",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"if",
"not",
"line",
".",
"issp... | 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] | [
"Parses",
"samples",
"specified",
"in",
"either",
"a",
"manifest",
"or",
"listed",
"with",
"--",
"samples"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L201-L220 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | main | 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 ... | python | 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",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
"__doc__",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
")",
"subparsers",
"=",
"parser",
".",
"add_subparsers",
"(",... | 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... | [
"Computational",
"Genomics",
"Lab",
"Genomics",
"Institute",
"UC",
"Santa",
"Cruz",
"Toil",
"exome",
"pipeline"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L303-L424 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/bwa_alignment.py | download_reference_files | 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... | python | 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",
")",
":",
"# Create dictionary to store FileStoreIDs of shared input files",
"shared_ids",
"=",
"{",
"}",
"urls",
"=",
"[",
"(",
"'amb'",
",",
"inputs",
".",
"amb",
")",
",",
"(",
"'an... | 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... | [
"Downloads",
"shared",
"files",
"that",
"are",
"used",
"by",
"all",
"samples",
"for",
"alignment",
"or",
"generates",
"them",
"if",
"they",
"were",
"not",
"provided",
"."
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L21-L58 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/bwa_alignment.py | download_sample_and_align | 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... | python | 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",
")",
":",
"uuid",
",",
"urls",
"=",
"sample",
"r1_url",
",",
"r2_url",
"=",
"urls",
"if",
"len",
"(",
"urls",
")",
"==",
"2",
"else",
"(",
"urls",
"[",
"0",
"... | 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 | [
"Downloads",
"the",
"sample",
"and",
"runs",
"BWA",
"-",
"kit"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L61-L96 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/bwa_alignment.py | parse_manifest | 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('#'):... | python | 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",
")",
":",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"manifest_path",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"not",
"line",
".",
"isspace",
"(",
")",
"and",
"not",
"l... | Parse manifest file
:param str manifest_path: Path to manifest file
:return: samples
:rtype: list[str, list] | [
"Parse",
"manifest",
"file"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L192-L212 | train |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/bwa_alignment.py | main | 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... | python | 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",
"(",
")",
":",
"# Define Parser object and add to Toil",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
"__doc__",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
")",
"subparsers",
"=",
... | 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... | [
"Computational",
"Genomics",
"Lab",
"Genomics",
"Institute",
"UC",
"Santa",
"Cruz",
"Toil",
"BWA",
"pipeline"
] | f878d863defcdccaabb7fe06f991451b7a198fb7 | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L215-L292 | train |
bd808/python-iptools | iptools/__init__.py | _address2long | def _address2long(address):
"""
Convert an address string to a long.
"""
parsed = ipv4.ip2long(address)
if parsed is None:
parsed = ipv6.ip2long(address)
return parsed | python | 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",
")",
":",
"parsed",
"=",
"ipv4",
".",
"ip2long",
"(",
"address",
")",
"if",
"parsed",
"is",
"None",
":",
"parsed",
"=",
"ipv6",
".",
"ip2long",
"(",
"address",
")",
"return",
"parsed"
] | Convert an address string to a long. | [
"Convert",
"an",
"address",
"string",
"to",
"a",
"long",
"."
] | 5d3fae0056297540355bb7c6c112703cfaa4b6ce | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/__init__.py#L58-L65 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.