Skip to content

Commit

Permalink
Rename to correct module name, add meta and tets
Browse files Browse the repository at this point in the history
  • Loading branch information
jfy133 committed Jan 19, 2025
1 parent 4519129 commit 00c980f
Show file tree
Hide file tree
Showing 6 changed files with 345 additions and 95 deletions.
70 changes: 0 additions & 70 deletions modules/nf-core/catpack/cat/meta.yml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
process CATPACK_CAT {
process CATPACK_CONTIGS {
tag "${meta.id}"
label 'process_medium'

Expand All @@ -9,13 +9,16 @@ process CATPACK_CAT {

input:
tuple val(meta), path(contigs)
path database
path taxonomy
tuple val(meta2), path(database)
tuple val(meta3), path(taxonomy)

output:
tuple val(meta), path("*.ORF2LCA.txt"), emit: orf2lca
tuple val(meta), path("*.contig2classification.txt"), emit: contig2classification
tuple val(meta), path("*.log"), emit: log
tuple val(meta), path("*.diamond"), emit: diamond
tuple val(meta), path("*.predicted_proteins.faa"), emit: faa
tuple val(meta), path("*.gff"), emit: gff
path "versions.yml", emit: versions

when:
Expand All @@ -25,14 +28,14 @@ process CATPACK_CAT {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
CAT_pack cat \\
${args} \\
CAT_pack contigs \\
-n ${task.cpus} \\
-o ${prefix}.bam \\
-c ${contigs} \\
-d ${database} \\
-t ${taxonomy} \\
-o ${prefix}
${args} \\
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -46,6 +49,9 @@ process CATPACK_CAT {
touch ${prefix}.ORF2LCA.txt
touch ${prefix}.contig2classification.txt
touch ${prefix}.log
touch ${prefix}.diamond
touch ${prefix}.predicted_proteins.faa
touch ${prefix}.predicted_proteins.gff
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
142 changes: 142 additions & 0 deletions modules/nf-core/catpack/contigs/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "catpack_contigs"
description: Taxonomic classification of long DNA sequences and metagenome assembled
genomes (e.g. contigs, MAGs / bins).
keywords:
- taxonomic classification
- classification
- long reads
- mags
- assembly
tools:
- "catpack":
description: "CAT/BAT: tool for taxonomic classification of contigs and metagenome-assembled
genomes (MAGs)"
homepage: "https://github.com/MGXlab/CAT_pack"
documentation: "https://github.com/MGXlab/CAT_pack"
tool_dev_url: "https://github.com/MGXlab/CAT_pack"
doi: "10.1186/s13059-019-1817-x"
licence: ["MIT"]
identifier: ""

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- contigs:
type: file
description: A nucleotide FASTA file containing long DNA sequences such as contigs.
pattern: "*.{fasta,fna,fa,fas}"
ontologies:
- edam: "http://edamontology.org/format_1929"

- - meta2:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- database:
type: directory
description: Directory containing CAT_pack database files (e.g. output from
CAT_pack prepare)
pattern: "*./"
ontologies:
- edam: "http://edamontology.org/data_1049"

- - meta3:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- taxonomy:
type: directory
description: Directory containing CAT_pack taxonomy files (e.g. output from
CAT_pack prepare)
pattern: "*./"
ontologies:
- edam: "http://edamontology.org/data_1049"

output:
- orf2lca:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.ORF2LCA.txt":
type: file
description: A TSV file with per-ORF hit stats and identified lineage
pattern: "*.ORF2LCA.txt"
ontologies:
- edam: "http://edamontology.org/format_3475"
- contig2classification:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.contig2classification.txt":
type: file
description: A TSV file with per-contig hit stats and assignment justification
information
pattern: "*.contig2classification.txt"
ontologies:
- edam: "http://edamontology.org/format_3475"
- log:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.log":
type: file
description: Log file with run messages and basic statistics
ontologies:
- edam: "http://edamontology.org/format_2330"
- diamond:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.diamond":
type: file
description: Intermediate DIAMOND TSV summary output file with alignment results
ontologies:
- edam: "http://edamontology.org/format_3475"
- faa:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.predicted_proteins.faa":
type: file
description: FAA file of DIAMOND predicted proteins hits
ontologies:
- edam: "http://edamontology.org/format_3475"
- gff:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.gff":
type: file
description: GFF file of DIAMOND predicted proteins hits
ontologies:
- edam: "http://edamontology.org/format_2305"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@jfy133"
maintainers:
- "@jfy133"
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core modules test catpack/cat
nextflow_process {

name "Test Process CATPACK_CAT"
name "Test Process CATPACK_CONTIGS"
script "../main.nf"
process "CATPACK_CAT"
process "CATPACK_CONTIGS"

tag "modules"
tag "modules_nfcore"
tag "catpack"
tag "catpack/cat"
tag "catpack/contigs"
tag "catpack/prepare"

setup {
run('CATPACK_PREPARE') {
Expand All @@ -25,7 +24,7 @@ nextflow_process {
}
}

test("sarscov2 - bam") {
test("sarscov2 - genome - fasta") {

when {
process {
Expand All @@ -40,37 +39,42 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
//TODO nf-core: Add all required assertions to verify the test output.
// See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples.
{ assert snapshot (
process.out.orf2lca,
process.out.contig2classification,
process.out.diamond,
process.out.faa,
process.out.gff,
process.out.versions,
path(process.out.log.get(0).get(1)).readLines().last().contains("CAT is done!")
).match()
}
)
}

}

// TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix.
test("sarscov2 - bam - stub") {
test("sarscov2 - genome - fasta - stub") {

options "-stub"

when {
process {
"""
// TODO nf-core: define inputs of the process here. Example:
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
]
input[0] = [ [id:'test'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] ]
input[1] = CATPACK_PREPARE.out.db
input[2] = CATPACK_PREPARE.out.taxonomy
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
//TODO nf-core: Add all required assertions to verify the test output.
{ assert snapshot(
process.out
).match()
}
)
}

Expand Down
Loading

0 comments on commit 00c980f

Please sign in to comment.