Skip to content

Commit

Permalink
Add args in command line - gzrt
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab committed Dec 23, 2024
1 parent 4c771de commit e87b963
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 50 deletions.
13 changes: 7 additions & 6 deletions modules/nf-core/gzrt/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ process GZRT {
tuple val(meta), path(fastqgz)

output:
tuple val(meta), path("${prefix}(?:_1|_2)?.fastq.gz"), emit: recovered
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}*.fastq.gz"), emit: recovered
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
prefix = task.ext.prefix ?: "${meta.id}_recovered"
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}_recovered"
fastqgz.each { file ->
if (file.extension != "gz") {
error "GZRT works with .gz files only. Offending file: ${file}"
Expand All @@ -32,14 +33,14 @@ process GZRT {

"""
if [ "$meta.single_end" == true ]; then
gzrecover -p ${fastqgz} | gzip > ${prefix}.fastq.gz
gzrecover ${args} -p ${fastqgz} | gzip > ${prefix}.fastq.gz
if [ -e "${prefix}.fastq.gz" ] && [ ! -s "${prefix}.fastq.gz" ]; then
echo "" | gzip > ${prefix}.fastq.gz
fi
else
gzrecover -p ${fastqgz[0]} | gzip > ${prefix}_1.fastq.gz
gzrecover -p ${fastqgz[1]} | gzip > ${prefix}_2.fastq.gz
gzrecover ${args} -p ${fastqgz[0]} | gzip > ${prefix}_1.fastq.gz
gzrecover ${args} -p ${fastqgz[1]} | gzip > ${prefix}_2.fastq.gz
if [ -e "${prefix}_1.fastq.gz" ] && [ ! -s "${prefix}_1.fastq.gz" ]; then
echo "" | gzip > ${prefix}_1.fastq.gz
Expand Down
89 changes: 45 additions & 44 deletions modules/nf-core/gzrt/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"Run gzrt on test2_1_corrupted - fastq.gz - stub": {
"Run gzrt on test2_1_corrupted single-end - fastq.gz": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
"id": "test-single",
"single_end": true
},
"test_recovered.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
"test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03"
]
],
"1": [
Expand All @@ -17,10 +17,10 @@
"recovered": [
[
{
"id": "test",
"single_end": false
"id": "test-single",
"single_end": true
},
"test_recovered.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
"test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03"
]
],
"versions": [
Expand All @@ -32,18 +32,21 @@
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-22T10:35:18.233218"
"timestamp": "2024-12-23T19:00:33.679803153"
},
"Run gzrt on test2_1_corrupted single-end - fastq.gz": {
"Run gzrt on test2_1_corrupted - fastq.gz - stub": {
"content": [
{
"0": [
[
{
"id": "test-single",
"single_end": true
"id": "test",
"single_end": false
},
"test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03"
[
"test_recovered_1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_recovered_2.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"1": [
Expand All @@ -52,10 +55,13 @@
"recovered": [
[
{
"id": "test-single",
"single_end": true
"id": "test",
"single_end": false
},
"test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03"
[
"test_recovered_1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_recovered_2.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"versions": [
Expand All @@ -67,52 +73,47 @@
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-22T14:48:19.882831"
"timestamp": "2024-12-23T19:01:25.657233606"
},
"Run gzrt on test2_1_corrupted paired-end - fastq.gz": {
"content": [
{
"0": [

],
"1": [

],
"recovered": [

],
"versions": [

]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-22T14:49:18.818601"
},
"Run gzrt on test2_1_corrupted - fastq.gz": {
"content": [
{
"0": [

[
{
"id": "test-paired",
"single_end": false
},
[
"test-paired_recovered_1.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03",
"test-paired_recovered_2.fastq.gz:md5,641919946a0e572ca7483f6e54476f3b"
]
]
],
"1": [

"versions.yml:md5,6d1e28b8a8043e3cba67606c7acdc676"
],
"recovered": [

[
{
"id": "test-paired",
"single_end": false
},
[
"test-paired_recovered_1.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03",
"test-paired_recovered_2.fastq.gz:md5,641919946a0e572ca7483f6e54476f3b"
]
]
],
"versions": [

"versions.yml:md5,6d1e28b8a8043e3cba67606c7acdc676"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-22T14:35:45.10345"
"timestamp": "2024-12-23T19:01:02.506192477"
}
}

0 comments on commit e87b963

Please sign in to comment.