Skip to content

Commit

Permalink
WIP: New Module: Pychopper (#7438)
Browse files Browse the repository at this point in the history
* WIP- add pychopper

* meta yml complete

* Test and snap

* Add stub gzipped format, working version

* try remove all blank entries in meta yml

* linted

* Update main.nf

add version as def var
  • Loading branch information
chriswyatt1 authored Feb 6, 2025
1 parent a33c6de commit 1436029
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/pychopper/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::pychopper=2.7.10"
52 changes: 52 additions & 0 deletions modules/nf-core/pychopper/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
process PYCHOPPER {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pychopper:2.7.10--pyhdfd78af_0':
'biocontainers/pychopper:2.7.10--pyhdfd78af_0' }"

input:
tuple val(meta), path(fastq)

output:
tuple val(meta), path("*.out.fastq.gz"), emit: fastq
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 PYCHOPPER_VERSION = '2.7.10'

"""
pychopper \\
$args \\
-t $task.cpus \\
$fastq \\
${prefix}.out.fastq
gzip -f ${prefix}.out.fastq > ${prefix}.out.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pychopper: $PYCHOPPER_VERSION (hard coded- check container used for this module)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.out.fastq
gzip ${prefix}.out.fastq
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pychopper: 2.7.10 (hard coded- check container used for this module)
END_VERSIONS
"""
}
54 changes: 54 additions & 0 deletions modules/nf-core/pychopper/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "pychopper"
description: Identify, orient and trim nanopore cDNA reads
keywords:
- sort
- trimming
- nanopore
tools:
- "pychopper":
description: "A tool to identify, orient and rescue full length cDNA reads from
nanopore data."
homepage: "https://github.com/epi2me-labs/pychopper"
documentation: "https://github.com/epi2me-labs/pychopper"
tool_dev_url: "https://github.com/epi2me-labs/pychopper"
licence: ["Oxford Nanopore Technologies PLC. Public License Version 1.0"]
identifier: ""
- "gzip":
description: "Gzip reduces the size of the named files using Lempel-Ziv coding
(LZ77)."
documentation: "https://linux.die.net/man/1/gzip"
args_id: "$args3"
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- fastq:
type: file
description: FastQ with reads from long read sequencing e.g. nanopore
pattern: "*.{fastq.gz}"
output:
- fastq:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "*.{fastq.gz}"
- "*.out.fastq.gz":
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "*.{fastq.gz}"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@chriswyatt1"
maintainers:
- "@chriswyatt1"
69 changes: 69 additions & 0 deletions modules/nf-core/pychopper/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
nextflow_process {

name "Test Process PYCHOPPER"
script "../main.nf"
process "PYCHOPPER"
tag "pychopper"
tag "modules"
tag "modules_nfcore"

test("pychopper-test") {

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

then {

def fastq_content = path(process.out.fastq.get(0).get(1)).linesGzip

assertAll(
{ assert process.success },
// original pytest checks
{ assert process.out.fastq.get(0).get(1) ==~ ".*/test_out.out.fastq.gz" },
// additional nf-test checks
// Order of reads is not deterministic, so only assess whether the number of reads is correct
{ assert snapshot(
process.out.fastq,
process.out.versions
).match() }
)
}
}

test("test-pychopper-stub") {
options '-stub'

when {
process {
"""
input[0] = [
[id:'test_out' ], // 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.fastq,
process.out.versions
).match() }
)
}
}

}
42 changes: 42 additions & 0 deletions modules/nf-core/pychopper/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"pychopper-test": {
"content": [
[
[
{
"id": "test_out"
},
"test_out.out.fastq.gz:md5,04f3003f5cb5a78d90cae351beacb094"
]
],
[
"versions.yml:md5,1431ed95e3c77f8742c7b014b26e50f5"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-05T13:57:08.581810556"
},
"test-pychopper-stub": {
"content": [
[
[
{
"id": "test_out"
},
"test_out.out.fastq.gz:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
"versions.yml:md5,1431ed95e3c77f8742c7b014b26e50f5"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-05T15:09:38.47491875"
}
}

0 comments on commit 1436029

Please sign in to comment.