Merge pull request #1632 from nf-core/refactor-fasterq-dump

Refactor fasterq dump
This commit is contained in:
Harshil Patel 2022-05-11 12:14:22 +01:00 committed by GitHub
commit 9602b989eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 9 deletions

View file

@ -9,6 +9,7 @@ process SRATOOLS_FASTERQDUMP {
input:
tuple val(meta), path(sra)
path ncbi_settings
output:
tuple val(meta), path(output), emit: reads
@ -20,17 +21,12 @@ process SRATOOLS_FASTERQDUMP {
script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n"
// Paired-end data extracted by fasterq-dump (--split-3 the default) always creates
// *_1.fastq *_2.fastq files but sometimes also an additional *.fastq file
// for unpaired reads which we ignore here.
output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz'
"""
eval "\$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')"
if [[ ! -f "\${NCBI_SETTINGS}" ]]; then
mkdir -p "\$(dirname "\${NCBI_SETTINGS}")"
printf '${config}' > "\${NCBI_SETTINGS}"
fi
export NCBI_SETTINGS="\$PWD/${ncbi_settings}"
fasterq-dump \\
$args \\

View file

@ -10,7 +10,7 @@ tools:
homepage: https://github.com/ncbi/sra-tools
documentation: https://github.com/ncbi/sra-tools/wiki
tool_dev_url: https://github.com/ncbi/sra-tools
licence: ["US-Government-Work"]
licence: ["Public Domain"]
input:
- meta:
@ -22,6 +22,11 @@ input:
type: directory
description: Directory containing ETL data for the given SRA.
pattern: "*/*.sra"
- ncbi_settings:
type: file
description: >
An NCBI user settings file.
pattern: "*.mkfg"
output:
- meta:

View file

@ -13,7 +13,7 @@ workflow test_sratools_fasterqdump_single_end {
def input = Channel.of([ id:'test_single_end', single_end:true ])
.combine(UNTAR.out.untar.map{ it[1] })
SRATOOLS_FASTERQDUMP ( input )
SRATOOLS_FASTERQDUMP(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true))
}
workflow test_sratools_fasterqdump_paired_end {
@ -24,5 +24,5 @@ workflow test_sratools_fasterqdump_paired_end {
def input = Channel.of([ id:'test_paired_end', single_end:false ])
.combine(UNTAR.out.untar.map{ it[1] })
SRATOOLS_FASTERQDUMP ( input )
SRATOOLS_FASTERQDUMP(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true))
}

View file

@ -8,6 +8,9 @@
md5sum: 1054c7b71884acdb5eed8a378f18be82
- path: output/untar/SRR13255544/SRR13255544.sra
md5sum: 466d05dafb2eec672150754168010b4d
- path: output/sratools/versions.yml
contains:
- "sratools: 2.11.0"
- name: sratools fasterqdump test_sratools_fasterqdump_paired_end
command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config
@ -21,3 +24,6 @@
md5sum: 3e3b3af3413f50a1685fd7b3f1456d4e
- path: output/untar/SRR11140744/SRR11140744.sra
md5sum: 065666caf5b2d5dfb0cb25d5f3abe659
- path: output/sratools/versions.yml
contains:
- "sratools: 2.11.0"