feat: add sub-workflow for SRA (#836)

* feat: add sub-workflow for SRA
* Combine prefetch and fasterq-dump into one sub-workflow
* tests: add sub-workflow to pytest config
This commit is contained in:
Moritz E. Beber 2021-10-14 11:50:31 +02:00 committed by GitHub
parent d1794d1934
commit c912117972
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 126 additions and 0 deletions

View file

@ -0,0 +1,34 @@
//
// Download FASTQ sequencing reads from the NCBI's Sequence Read Archive (SRA).
//
params.prefetch_options = [:]
params.fasterqdump_options = [:]
include { SRATOOLS_PREFETCH } from '../../../modules/sratools/prefetch/main' addParams( options: params.prefetch_options )
include { SRATOOLS_FASTERQDUMP } from '../../../modules/sratools/fasterqdump/main' addParams( options: params.fasterqdump_options )
workflow SRA_FASTQ {
take:
sra_ids // channel: [ val(meta), val(id) ]
main:
ch_versions = Channel.empty()
//
// Prefetch sequencing reads in SRA format.
//
SRATOOLS_PREFETCH ( sra_ids )
ch_versions = ch_versions.mix( SRATOOLS_PREFETCH.out.versions.first() )
//
// Convert the SRA format into one or more compressed FASTQ files.
//
SRATOOLS_FASTERQDUMP ( SRATOOLS_PREFETCH.out.sra )
ch_versions = ch_versions.mix( SRATOOLS_FASTERQDUMP.out.versions.first() )
emit:
reads = SRATOOLS_FASTERQDUMP.out.reads // channel: [ val(meta), [ reads ] ]
versions = ch_versions // channel: [ versions.yml ]
}

View file

@ -0,0 +1,37 @@
name: sra_fastq
description: Download FASTQ sequencing reads from the NCBI's Sequence Read Archive (SRA).
keywords:
- sequencing
- FASTQ
- prefetch
- dump
modules:
- sratools/prefetch
- sratools/fasterqdump
input:
- meta:
type: map
description: >
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- id:
type: string
description: >
SRA identifier.
# TODO Update when we decide on a standard for subworkflow docs
output:
- meta:
type: map
description: >
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: Extracted FASTQ file or files if the sequencing reads are paired-end.
pattern: "*.fastq.gz"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- '@Midnighter'

View file

@ -0,0 +1,2 @@
params.prefetch_options = [:]
params.fasterqdump_options = [:]

View file

@ -9,3 +9,8 @@ subworkflows/bam_stats_samtools:
subworkflows/bam_sort_samtools: subworkflows/bam_sort_samtools:
- subworkflows/nf-core/bam_sort_samtools/** - subworkflows/nf-core/bam_sort_samtools/**
- tests/subworkflows/nf-core/bam_sort_samtools/** - tests/subworkflows/nf-core/bam_sort_samtools/**
subworkflows/sra_fastq:
- subworkflows/nf-core/sra_fastq/**
- tests/subworkflows/nf-core/sra_fastq/**

View file

@ -0,0 +1,23 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SRA_FASTQ } from '../../../../subworkflows/nf-core/sra_fastq/main.nf' addParams( [:] )
workflow test_sra_fastq_single_end {
input = [
[ id:'test_single_end', single_end:true ], // meta map
'SRR13255544'
]
SRA_FASTQ ( input )
}
workflow test_sra_fastq_paired_end {
input = [
[ id:'test_paired_end', single_end:false ], // meta map
'SRR11140744'
]
SRA_FASTQ ( input )
}

View file

@ -0,0 +1,25 @@
- name: sra fastq single-end
command: nextflow run ./tests/subworkflows/nf-core/sra_fastq -entry test_sra_fastq_single_end -c tests/config/nextflow.config
tags:
- subworkflows/sra_fastq
# Modules
- sratools
- sratools/prefetch
- sratools/fasterqdump
files:
- path: output/sratools/SRR13255544.fastq.gz
md5sum: 1054c7b71884acdb5eed8a378f18be82
- name: sra fastq paired-end
command: nextflow run ./tests/subworkflows/nf-core/sra_fastq -entry test_sra_fastq_paired_end -c tests/config/nextflow.config
tags:
- subworkflows/sra_fastq
# Modules
- sratools
- sratools/prefetch
- sratools/fasterqdump
files:
- path: output/sratools/SRR11140744_1.fastq.gz
md5sum: 193809c784a4ea132ab2a253fa4f55b6
- path: output/sratools/SRR11140744_2.fastq.gz
md5sum: 3e3b3af3413f50a1685fd7b3f1456d4e