diff --git a/modules/nf-core/sylph/profile/environment.yml b/modules/nf-core/sylph/profile/environment.yml new file mode 100644 index 00000000000..fd9d6bf1294 --- /dev/null +++ b/modules/nf-core/sylph/profile/environment.yml @@ -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::sylph=0.7.0" diff --git a/modules/nf-core/sylph/profile/main.nf b/modules/nf-core/sylph/profile/main.nf new file mode 100644 index 00000000000..2bd20e60fc6 --- /dev/null +++ b/modules/nf-core/sylph/profile/main.nf @@ -0,0 +1,52 @@ +process SYLPH_PROFILE { + tag "$meta.id" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/sylph:0.7.0--h919a2d8_0' : + 'biocontainers/sylph:0.7.0--h919a2d8_0' }" + + input: + tuple val(meta), path(reads) + path(pre_sketched_files) + + output: + tuple val(meta), path('*.tsv'), emit: profile_out + 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}" + + """ + sylph profile \\ + $args \\ + $reads \\ + $pre_sketched_files\\ + -o ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sylph: \$(sylph -V|awk '{print \$2}') + END_VERSIONS + + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sylph: \$(sylph -V|awk '{print \$2}') + END_VERSIONS + """ + +} diff --git a/modules/nf-core/sylph/profile/meta.yml b/modules/nf-core/sylph/profile/meta.yml new file mode 100644 index 00000000000..88eda04c0a3 --- /dev/null +++ b/modules/nf-core/sylph/profile/meta.yml @@ -0,0 +1,56 @@ +name: "sylph_profile" +description: Sylph profile command for taxonoming profiling +keywords: + - profile + - metagenomics + - sylph + - classification +tools: + - sylph: + description: Sylph quickly enables querying of genomes against even low-coverage + shotgun metagenomes to find nearest neighbour ANI. + homepage: https://github.com/bluenote-1577/sylph + documentation: https://github.com/bluenote-1577/sylph + tool_dev_url: https://github.com/bluenote-1577/sylph + doi: 10.1038/s41587-024-02412-y + licence: ["MIT"] + identifier: biotools:sylph +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - reads: + type: file + description: | + List of input FastQ/FASTA files of size 1 and 2 for single-end and paired-end data, + respectively. They are automatically sketched to .sylsp/.syldb + - - pre_sketched_files: + type: file + description: Pre-sketched *.syldb/*.sylsp files + pattern: "*.{syldb,sylsp}" +output: + - profile_out: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + pattern: "*tsv" + - "*.tsv": + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + pattern: "*tsv" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@jiahang1234" + - "@sofstam" +maintainers: + - "@sofstam" diff --git a/modules/nf-core/sylph/profile/tests/main.nf.test b/modules/nf-core/sylph/profile/tests/main.nf.test new file mode 100644 index 00000000000..de0f0e35ba1 --- /dev/null +++ b/modules/nf-core/sylph/profile/tests/main.nf.test @@ -0,0 +1,86 @@ +nextflow_process { + + script "../main.nf" + process "SYLPH_PROFILE" + tag "modules" + tag "modules_nfcore" + tag "sylph" + tag "sylph/profile" + + test("sarscov2 illumina single-end [fastq_gz]") { + when { + process { + """ + input[0] = [ [ id:'test', single_end:true ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] + ] + input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.profile_out.collect { file(it[1]).readLines().contains("complete genome") }, + ).match() + } + ) + } + } + + test("sarscov2 illumina paired-end [fastq_gz]") { + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ] + ] + input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.profile_out.collect { file(it[1]).readLines().contains("complete genome") }, + ).match() + } + ) + } + } + + test("sarscov2 illumina paired-end [fastq_gz]-stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ] + ] + input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.profile_out.collect { file(it[1]).readLines().contains("complete genome") }, + ).match() + } + ) + } + } +} diff --git a/modules/nf-core/sylph/profile/tests/main.nf.test.snap b/modules/nf-core/sylph/profile/tests/main.nf.test.snap new file mode 100644 index 00000000000..da7a092b33a --- /dev/null +++ b/modules/nf-core/sylph/profile/tests/main.nf.test.snap @@ -0,0 +1,59 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,7b5a545483277cc0ff9189f8891e737f" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-12-05T10:06:07.353254" + }, + "sarscov2 illumina paired-end [fastq_gz]": { + "content": [ + [ + "versions.yml:md5,7b5a545483277cc0ff9189f8891e737f" + ], + [ + false + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-12-05T10:31:09.774052" + }, + "sarscov2 illumina single-end [fastq_gz]": { + "content": [ + [ + "versions.yml:md5,7b5a545483277cc0ff9189f8891e737f" + ], + [ + false + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-12-05T10:29:46.733197" + }, + "sarscov2 illumina paired-end [fastq_gz]-stub": { + "content": [ + [ + "versions.yml:md5,7b5a545483277cc0ff9189f8891e737f" + ], + [ + false + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-12-05T10:31:16.953204" + } +} \ No newline at end of file diff --git a/modules/nf-core/sylph/sketch/meta.yml b/modules/nf-core/sylph/sketch/meta.yml index 7a9abdf85b1..9d3645c959a 100644 --- a/modules/nf-core/sylph/sketch/meta.yml +++ b/modules/nf-core/sylph/sketch/meta.yml @@ -35,7 +35,6 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - pattern: "my_sketches/*.sylsp" - my_sketches/*.sylsp: type: map description: |