-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
429 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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::cat=6.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
process CATPACK_SUMMARISE { | ||
tag "${meta.id}" | ||
label 'process_single' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container | ||
? 'https://depot.galaxyproject.org/singularity/cat:6.0.1--hdfd78af_0' | ||
: 'biocontainers/cat:6.0.1--hdfd78af_0'}" | ||
|
||
input: | ||
tuple val(meta), path(classification) | ||
tuple val(meta2), path(contigs) | ||
|
||
output: | ||
tuple val(meta), path("*.txt"), emit: txt | ||
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}" | ||
if ("${classification}" == "${prefix}.txt") { | ||
error("Input and output names are the same, set prefix in module configuration to disambiguate!") | ||
} | ||
def insert_contigs = contigs ? "-c ${contigs}" : '' | ||
""" | ||
CAT_pack summarise \\ | ||
${args} \\ | ||
-i ${classification} \\ | ||
${insert_contigs} \\ | ||
-o ${prefix}.txt | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
catpack: \$(CAT_pack --version | sed 's/CAT_pack pack v//g;s/ .*//g') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
if ("${classification}" == "${prefix}.txt") { | ||
error("Input and output names are the same, set prefix in module configuration to disambiguate!") | ||
} | ||
def insert_contigs = contigs ? "-c ${contigs}" : '' | ||
""" | ||
echo "CAT_pack summarise \\ | ||
${args} \\ | ||
-i ${classification} \\ | ||
${insert_contigs} \\ | ||
-o ${prefix}.txt" | ||
touch ${prefix}.txt | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
catpack: \$(CAT_pack --version | sed 's/CAT_pack pack v//g;s/ .*//g') | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
name: "catpack_summarise" | ||
description: Summarises results from CAT/BAT/RAT classification steps | ||
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 ]` | ||
- classification: | ||
type: file | ||
description: CAT/BAT/RAT classification table annotated with official names (from CAT_pack addnames) | ||
pattern: "*.txt" | ||
ontologies: | ||
- edam: "http://edamontology.org/format_3475" | ||
- - meta2: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- contigs: | ||
type: file | ||
description: Optional nucleotide FASTA file containing long DNA sequences such as contigs that were classified (only if classification table is from CAT_pack contigs) | ||
pattern: "*.{fasta,fna,fa,fas}" | ||
ontologies: | ||
- edam: "http://edamontology.org/format_1929" | ||
|
||
output: | ||
- txt: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- "*.txt": | ||
type: file | ||
description: | | ||
Summary statistics table of CAT/BAT/RAT results | ||
pattern: "*.txt" | ||
ontologies: | ||
- edam: "http://edamontology.org/format_3475" | ||
|
||
- versions: | ||
- "versions.yml": | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
authors: | ||
- "@jfy133" | ||
maintainers: | ||
- "@jfy133" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
nextflow_process { | ||
|
||
name "Test Process CATPACK_SUMMARISE" | ||
script "../main.nf" | ||
process "CATPACK_SUMMARISE" | ||
config './nextflow.config' | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "catpack" | ||
tag "catpack/summarise" | ||
tag "catpack/prepare" | ||
tag "catpack/contigs" | ||
tag "catpack/bins" | ||
tag "catpack/addnames" | ||
|
||
setup { | ||
run('CATPACK_PREPARE') { | ||
script '../../prepare/main.nf' | ||
process { | ||
""" | ||
input[0] = [ [id:'test'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] ] | ||
input[1] = [ file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot_nodes.dmp', checkIfExists: true) ] | ||
input[2] = [ file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot_names.dmp', checkIfExists: true) ] | ||
input[3] = [ file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot.accession2taxid.gz', checkIfExists: true) ] | ||
""" | ||
} | ||
} | ||
} | ||
|
||
test("sarscov2 - contigs - with names") { | ||
|
||
setup { | ||
run('CATPACK_CONTIGS') { | ||
script '../../contigs/main.nf' | ||
process { | ||
""" | ||
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 | ||
input[3] = [[:], []] | ||
input[4] = [[:], []] | ||
""" | ||
} | ||
} | ||
|
||
run('CATPACK_ADDNAMES') { | ||
script '../../addnames/main.nf' | ||
process { | ||
""" | ||
input[0] = CATPACK_CONTIGS.out.contig2classification | ||
input[1] = CATPACK_PREPARE.out.taxonomy | ||
""" | ||
} | ||
} | ||
} | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = CATPACK_ADDNAMES.out.txt | ||
input[1] = [ [id:'test'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] ] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("sarscov2 - bins - raw") { | ||
|
||
setup { | ||
run('CATPACK_BINS') { | ||
script '../../bins/main.nf' | ||
process { | ||
""" | ||
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 | ||
input[3] = [[:], []] | ||
input[4] = [[:], []] | ||
""" | ||
} | ||
} | ||
|
||
run('CATPACK_ADDNAMES') { | ||
script '../../addnames/main.nf' | ||
process { | ||
""" | ||
input[0] = CATPACK_BINS.out.bin2classification | ||
input[1] = CATPACK_PREPARE.out.taxonomy | ||
""" | ||
} | ||
} | ||
} | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = CATPACK_ADDNAMES.out.txt | ||
input[1] = [[:],[]] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
test("sarscov2 - contigs - stub") { | ||
|
||
options "-stub" | ||
|
||
setup { | ||
run('CATPACK_CONTIGS') { | ||
script '../../contigs/main.nf' | ||
process { | ||
""" | ||
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 | ||
input[3] = [[:], []] | ||
input[4] = [[:], []] | ||
""" | ||
} | ||
} | ||
} | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = CATPACK_CONTIGS.out.contig2classification | ||
input[1] = [ [id:'test'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] ] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.