diff --git a/modules/nf-core/smudgeplot/all/environment.yml b/modules/nf-core/smudgeplot/all/environment.yml new file mode 100644 index 000000000000..caf7a178a781 --- /dev/null +++ b/modules/nf-core/smudgeplot/all/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::fastk=1.2 + - bioconda::smudgeplot=0.5.3 diff --git a/modules/nf-core/smudgeplot/all/main.nf b/modules/nf-core/smudgeplot/all/main.nf new file mode 100644 index 000000000000..e96ad2e260d3 --- /dev/null +++ b/modules/nf-core/smudgeplot/all/main.nf @@ -0,0 +1,45 @@ +process SMUDGEPLOT_ALL { + tag "${meta.id}" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/32/320648514649f5379149eed196b162e0d409b785f670ddecdf948febd6917377/data': + 'community.wave.seqera.io/library/fastk_smudgeplot:1352fed7dbb39646' }" + + input: + tuple val(meta), path(smu) + + output: + tuple val(meta), path("*.png"), emit: png + tuple val(meta), path("*_centralities.txt"), emit: centrality_txt + tuple val(meta), path("*.smudge_report.tsv"), emit: smudge_report + tuple val(meta), path("*.sma"), emit: sma + tuple val("${task.process}"), val('smudgeplot'), eval('smudgeplot -v |& sed "s/.*v//"'), emit: versions_smudgeplot, topic: versions + // FASTK does not report version to cli + tuple val("${task.process}"), val('fastk'), val('1.2'), emit: versions_fastk, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + // Export HOME to avoid issues with MATPLOTLIB needing a + // writable config directory + """ + export HOME=\$PWD/nxf_home + + smudgeplot all \\ + ${args} \\ + -o ${prefix} \\ + ${smu} + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.smu + """ +} diff --git a/modules/nf-core/smudgeplot/all/meta.yml b/modules/nf-core/smudgeplot/all/meta.yml new file mode 100644 index 000000000000..ca7a23cbb66e --- /dev/null +++ b/modules/nf-core/smudgeplot/all/meta.yml @@ -0,0 +1,121 @@ +name: "smudgeplot_all" +description: Generating smudgeplot k-mer inference plots +keywords: + - Smudgeplot + - reference-free + - kmer + - plots +tools: + - "smudgeplot": + description: "Generating smudgeplot kmer counts" + homepage: "https://github.com/KamilSJaron/smudgeplot" + tool_dev_url: "https://github.com/KamilSJaron/smudgeplot" + licence: ["https://github.com/KamilSJaron/smudgeplot/blob/master/LICENSE.md"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - smu: + type: file + description: Smudgeplot kmer coverage flat file + pattern: "*.smu" + ontologies: [] + +output: + png: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.png": + type: file + description: Collection of output PNG files + pattern: "*.png" + ontologies: + - edam: http://edamontology.org/format_3603 # PNG + centrality_txt: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*_centralities.txt": + type: file + description: Centrality of kmers text file + pattern: "*_centralities.txt" + ontologies: + - edam: http://edamontology.org/format_2330 + smudge_report: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.smudge_report.tsv": + type: file + description: Full smudgeplot report of smudges + pattern: "*.smudge_report.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 # TSV + sma: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.sma": + type: file + description: Smudgeplot Kmer coverage file + pattern: "*.sma" + ontologies: [] + + versions_smudgeplot: + - - ${task.process}: + type: string + description: Name of the process + - smudgeplot: + type: string + description: The name of the tool + - smudgeplot -v |& sed "s/.*v//": + type: string + description: The expression to obtain the version of the tool + versions_fastk: + - - ${task.process}: + type: string + description: Name of the process + - fastk: + type: string + description: Name of the tool + - "1.2": + type: string + description: The expression to obtain the version of the tool + +topics: + versions: + - - ${task.process}: + type: string + description: Name of the process + - smudgeplot: + type: string + description: The name of the tool + - smudgeplot -v |& sed "s/.*v//": + type: string + description: The expression to obtain the version of the tool + - - ${task.process}: + type: string + description: Name of the process + - fastk: + type: string + description: Name of the tool + - "1.2": + type: string + description: The expression to obtain the version of the tool + +authors: + - "@DLBPointon" +maintainers: + - "@DLBPointon" diff --git a/modules/nf-core/smudgeplot/all/tests/main.nf.test b/modules/nf-core/smudgeplot/all/tests/main.nf.test new file mode 100644 index 000000000000..9bee73bc2b8e --- /dev/null +++ b/modules/nf-core/smudgeplot/all/tests/main.nf.test @@ -0,0 +1,55 @@ +nextflow_process { + + name "Test Process SMUDGEPLOT_ALL" + script "../main.nf" + process "SMUDGEPLOT_ALL" + + tag "modules" + tag "modules_nfcore" + tag "smudgeplot" + tag "smudgeplot/all" + tag "fastk/fastk" + + setup { + run("FASTK_FASTK") { + script "modules/nf-core/fastk/fastk/main.nf" + config "./nextflow.config" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file("https://tolit.cog.sanger.ac.uk/test-data/Acropora_cervicornis/genomic_data/m84093_241116_151316_s2.hifi_reads.bc2028.subset.fasta.gz", checkIfExists: true) + ] + """ + } + } + + run("SMUDGEPLOT_HETMERS") { + script "modules/nf-core/smudgeplot/hetmers/main.nf" + config "./nextflow.config" + process { + """ + input[0] = FASTK_FASTK.out.ktab + """ + } + } + } + + test("Acropora_cervicornis - reads") { + + when { + process { + """ + input[0] = SMUDGEPLOT_HETMERS.out.kmer_cov + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } +} diff --git a/modules/nf-core/smudgeplot/all/tests/main.nf.test.snap b/modules/nf-core/smudgeplot/all/tests/main.nf.test.snap new file mode 100644 index 000000000000..81a35dc992ba --- /dev/null +++ b/modules/nf-core/smudgeplot/all/tests/main.nf.test.snap @@ -0,0 +1,31 @@ +{ + "Acropora_cervicornis - reads": { + "content": [ + { + "centrality_txt": [ + + ], + "png": [ + + ], + "sma": [ + + ], + "smudge_report": [ + + ], + "versions_fastk": [ + + ], + "versions_smudgeplot": [ + + ] + } + ], + "timestamp": "2026-09-15T12:16:22.673108219", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } + } +} \ No newline at end of file diff --git a/modules/nf-core/smudgeplot/all/tests/nextflow.config b/modules/nf-core/smudgeplot/all/tests/nextflow.config new file mode 100644 index 000000000000..bee2f706dc2c --- /dev/null +++ b/modules/nf-core/smudgeplot/all/tests/nextflow.config @@ -0,0 +1,9 @@ +process { + withName: "FASTK_FASTK" { + ext.args = { "-k31 -t -P." } + } + + withName: "SMUDGEPLOT_HETMERS" { + ext.args = { "-L 12 -t2 -tmp ./ --verbose" } + } +} diff --git a/modules/nf-core/smudgeplot/hetmers/environment.yml b/modules/nf-core/smudgeplot/hetmers/environment.yml new file mode 100644 index 000000000000..caf7a178a781 --- /dev/null +++ b/modules/nf-core/smudgeplot/hetmers/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::fastk=1.2 + - bioconda::smudgeplot=0.5.3 diff --git a/modules/nf-core/smudgeplot/hetmers/main.nf b/modules/nf-core/smudgeplot/hetmers/main.nf new file mode 100644 index 000000000000..1e9bc36700aa --- /dev/null +++ b/modules/nf-core/smudgeplot/hetmers/main.nf @@ -0,0 +1,43 @@ +process SMUDGEPLOT_HETMERS { + tag "${meta.id}" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/32/320648514649f5379149eed196b162e0d409b785f670ddecdf948febd6917377/data': + 'community.wave.seqera.io/library/fastk_smudgeplot:1352fed7dbb39646' }" + + input: + tuple val(meta), path(fastk_table, stageAs: "ktab_dir/*") + + output: + tuple val(meta), path("*.smu"), emit: kmer_cov + tuple val("${task.process}"), val('smudgeplot'), eval('smudgeplot -v |& sed "s/.*v//"'), emit: versions_smudgeplot, topic: versions + // FASTK does not report version to cli + tuple val("${task.process}"), val('fastk'), val('1.2'), emit: versions_fastk, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + // Export HOME to avoid issues with MATPLOTLIB needing a + // writable config directory + """ + export HOME=\$PWD/nxf_home + + smudgeplot hetmers \\ + ${args} \\ + -o ${prefix} \\ + ${fastk_table.find { path -> path.toString().endsWith(".ktab") }} + + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.smu + """ +} diff --git a/modules/nf-core/smudgeplot/hetmers/meta.yml b/modules/nf-core/smudgeplot/hetmers/meta.yml new file mode 100644 index 000000000000..a84831f93045 --- /dev/null +++ b/modules/nf-core/smudgeplot/hetmers/meta.yml @@ -0,0 +1,84 @@ +name: "smudgeplot_hetmers" +description: Generating smudgeplot kmer counts +keywords: + - Smudgeplot + - reference-free + - kmer +tools: + - "smudgeplot": + description: "Generating smudgeplot kmer counts" + homepage: "https://github.com/KamilSJaron/smudgeplot" + tool_dev_url: "https://github.com/KamilSJaron/smudgeplot" + licence: ["https://github.com/KamilSJaron/smudgeplot/blob/master/LICENSE.md"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastk_table: + type: file + description: A kmer table from the program FastK + pattern: "*.ktab*" + ontologies: [] + +output: + kmer_cov: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.smu": + type: file + description: Smudgeplot Kmer coverage file + pattern: "*.smu" + ontologies: [] + + versions_smudgeplot: + - - ${task.process}: + type: string + description: Name of the process + - smudgeplot: + type: string + description: The name of the tool + - smudgeplot -v |& sed "s/.*v//": + type: string + description: The expression to obtain the version of the tool + versions_fastk: + - - ${task.process}: + type: string + description: Name of the process + - fastk: + type: string + description: Name of the tool + - "1.2": + type: string + description: The expression to obtain the version of the tool + +topics: + versions: + - - ${task.process}: + type: string + description: Name of the process + - smudgeplot: + type: string + description: The name of the tool + - smudgeplot -v |& sed "s/.*v//": + type: string + description: The expression to obtain the version of the tool + - - ${task.process}: + type: string + description: Name of the process + - fastk: + type: string + description: Name of the tool + - "1.2": + type: string + description: The expression to obtain the version of the tool + +authors: + - "@DLBPointon" +maintainers: + - "@DLBPointon" diff --git a/modules/nf-core/smudgeplot/hetmers/tests/main.nf.test b/modules/nf-core/smudgeplot/hetmers/tests/main.nf.test new file mode 100644 index 000000000000..6df798c1684f --- /dev/null +++ b/modules/nf-core/smudgeplot/hetmers/tests/main.nf.test @@ -0,0 +1,45 @@ +nextflow_process { + + name "Test Process SMUDGEPLOT_HETMERS" + script "../main.nf" + process "SMUDGEPLOT_HETMERS" + + tag "modules" + tag "modules_nfcore" + tag "smudgeplot" + tag "smudgeplot/hetmers" + tag "fastk/fastk" + + setup { + run("FASTK_FASTK") { + script "modules/nf-core/fastk/fastk/main.nf" + config "./nextflow.config" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file("https://tolit.cog.sanger.ac.uk/test-data/Acropora_cervicornis/genomic_data/m84093_241116_151316_s2.hifi_reads.bc2028.subset.fasta.gz", checkIfExists: true) + ] + """ + } + } + } + + test("homo sapiens - reads") { + + when { + process { + """ + input[0] = FASTK_FASTK.out.ktab + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } +} diff --git a/modules/nf-core/smudgeplot/hetmers/tests/main.nf.test.snap b/modules/nf-core/smudgeplot/hetmers/tests/main.nf.test.snap new file mode 100644 index 000000000000..0a26fbea8108 --- /dev/null +++ b/modules/nf-core/smudgeplot/hetmers/tests/main.nf.test.snap @@ -0,0 +1,36 @@ +{ + "homo sapiens - reads": { + "content": [ + { + "kmer_cov": [ + [ + { + "id": "test", + "single_end": false + }, + "test.smu:md5,3737d9fccdd034c9014691b3ce305536" + ] + ], + "versions_fastk": [ + [ + "SMUDGEPLOT_HETMERS", + "fastk", + "1.2" + ] + ], + "versions_smudgeplot": [ + [ + "SMUDGEPLOT_HETMERS", + "smudgeplot", + "0.5.3" + ] + ] + } + ], + "timestamp": "2026-09-15T12:00:25.420501558", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } + } +} \ No newline at end of file diff --git a/modules/nf-core/smudgeplot/hetmers/tests/nextflow.config b/modules/nf-core/smudgeplot/hetmers/tests/nextflow.config new file mode 100644 index 000000000000..bee2f706dc2c --- /dev/null +++ b/modules/nf-core/smudgeplot/hetmers/tests/nextflow.config @@ -0,0 +1,9 @@ +process { + withName: "FASTK_FASTK" { + ext.args = { "-k31 -t -P." } + } + + withName: "SMUDGEPLOT_HETMERS" { + ext.args = { "-L 12 -t2 -tmp ./ --verbose" } + } +}