Skip to content

Commit

Permalink
Add nf-test to porechop_abi (#6049)
Browse files Browse the repository at this point in the history
* Add nf-test to the module porechop_abi

* update standard output

* update licence

* update tags.yml

* Update modules/nf-core/porechop/abi/main.nf

Co-authored-by: Simon Pearce <[email protected]>

* Update modules/nf-core/porechop/abi/main.nf

Co-authored-by: Simon Pearce <[email protected]>

* Update modules/nf-core/porechop/abi/main.nf

Co-authored-by: Simon Pearce <[email protected]>

* Update modules/nf-core/porechop/abi/meta.yml

Co-authored-by: Simon Pearce <[email protected]>

* remove pytest and update the prefix

* Update modules/nf-core/porechop/abi/main.nf

Co-authored-by: Simon Pearce <[email protected]>

* Update modules/nf-core/porechop/abi/tests/main.nf.test

Co-authored-by: Simon Pearce <[email protected]>

* Update modules/nf-core/porechop/abi/tests/main.nf.test

Co-authored-by: Simon Pearce <[email protected]>

* Update modules/nf-core/porechop/abi/tests/main.nf.test

Co-authored-by: Simon Pearce <[email protected]>

* update main.nf.test

* Update main.nf

check input and output are not same

---------

Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
LilyAnderssonLee and SPPearce authored Jul 30, 2024
1 parent e61e5a1 commit 870f9af
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 10 deletions.
2 changes: 2 additions & 0 deletions modules/nf-core/porechop/abi/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: porechop_abi
channels:
- conda-forge
Expand Down
24 changes: 19 additions & 5 deletions modules/nf-core/porechop/abi/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,37 @@ process PORECHOP_ABI {
tuple val(meta), path(reads)

output:
tuple val(meta), path("*.fastq.gz"), emit: reads
tuple val(meta), path("*.log") , emit: log
path "versions.yml" , emit: versions
tuple val(meta), path("*.fastq.gz") , emit: reads
tuple val(meta), path("*.log") , emit: log
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def prefix = task.ext.prefix ?: "${meta.id}.porechop_abi"
if ("$reads" == "${prefix}.fastq.gz") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
porechop_abi \\
--input $reads \\
--threads $task.cpus \\
$args \\
--output ${prefix}.fastq.gz \\
> ${prefix}.log
| tee ${prefix}.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
porechop_abi: \$( porechop_abi --version )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}.porechop_abi"
"""
echo "" | gzip > ${prefix}.fastq.gz
touch ${prefix}.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
porechop_abi: \$( porechop_abi --version )
Expand Down
6 changes: 4 additions & 2 deletions modules/nf-core/porechop/abi/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tools:
documentation: "https://github.com/bonsai-team/Porechop_ABI"
tool_dev_url: "https://github.com/bonsai-team/Porechop_ABI"
doi: "10.1101/2022.07.07.499093"
licence: "['GPL v3']"
licence: ["MIT"]
input:
- meta:
type: map
Expand All @@ -35,12 +35,14 @@ output:
- reads:
type: file
description: Adapter-trimmed fastq.gz file
pattern: "*fastq.gz"
pattern: "*.fastq.gz"
- log:
type: file
description: Log file containing stdout information
pattern: "*.log"
authors:
- "@sofstam"
- "LilyAnderssonLee"
maintainers:
- "@sofstam"
- "LilyAnderssonLee"
59 changes: 59 additions & 0 deletions modules/nf-core/porechop/abi/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
nextflow_process {

name "Test Process PORECHOP_ABI"
script "../main.nf"
process "PORECHOP_ABI"
tag "modules"
tag "modules_nfcore"
tag "porechop"
tag "porechop/abi"

test("sarscov2-nanopore") {

when {
process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test.fastq.gz', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.reads,
file(process.out.log.get(0).get(1)).readLines()[20..40],
process.out.versions).match()
}
)
}
}

test("sarscov2-nanopore - stub") {

options "-stub"

when {

process {
"""
input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test.fastq.gz', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
94 changes: 94 additions & 0 deletions modules/nf-core/porechop/abi/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"sarscov2-nanopore": {
"content": [
[
[
{
"id": "test"
},
"test.porechop_abi.fastq.gz:md5,886fdb859fb50e0dddd35007bcff043e"
]
],
[
" Best \u001b[0m",
" read Best \u001b[0m",
" start read end\u001b[0m",
" \u001b[4mSet %ID %ID \u001b[0m",
" \u001b[32mSQK-NSK007 100.0 73.1\u001b[0m",
" Rapid 40.4 0.0",
" RBK004_upstream 77.5 0.0",
" SQK-MAP006 75.8 72.7",
" SQK-MAP006 short 65.5 66.7",
" PCR adapters 1 73.9 69.6",
" PCR adapters 2 80.0 72.7",
" PCR adapters 3 70.8 69.6",
" 1D^2 part 1 71.4 70.0",
" 1D^2 part 2 84.8 75.8",
" cDNA SSP 63.0 61.7",
" \u001b[32mBarcode 1 (reverse) 100.0 100.0\u001b[0m",
" Barcode 2 (reverse) 70.8 69.2",
" Barcode 3 (reverse) 76.0 70.4",
" Barcode 4 (reverse) 74.1 71.4",
" Barcode 5 (reverse) 77.8 80.8",
" Barcode 6 (reverse) 73.1 70.8"
],
[
"versions.yml:md5,0e9e5e0d35a68ff8e6490c949b257f98"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-07-29T13:50:49.318599"
},
"sarscov2-nanopore - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.porechop_abi.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
[
{
"id": "test"
},
"test.porechop_abi.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,0e9e5e0d35a68ff8e6490c949b257f98"
],
"log": [
[
{
"id": "test"
},
"test.porechop_abi.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"reads": [
[
{
"id": "test"
},
"test.porechop_abi.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,0e9e5e0d35a68ff8e6490c949b257f98"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-07-29T13:50:54.425389"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/porechop/abi/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
porechop/abi:
- "modules/nf-core/porechop/abi/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,6 @@ pmdtools/filter:
pneumocat:
- modules/nf-core/pneumocat/**
- tests/modules/nf-core/pneumocat/**
porechop/abi:
- modules/nf-core/porechop/abi/**
- tests/modules/nf-core/porechop/abi/**
preseq/ccurve:
- modules/nf-core/preseq/ccurve/**
- tests/modules/nf-core/preseq/ccurve/**
Expand Down

0 comments on commit 870f9af

Please sign in to comment.