diff --git a/modules/nf-core/mygene/main.nf b/modules/nf-core/mygene/main.nf index 70141d142f80..1d49dc52f75f 100644 --- a/modules/nf-core/mygene/main.nf +++ b/modules/nf-core/mygene/main.nf @@ -13,11 +13,23 @@ process MYGENE { output: tuple val(meta), path("*.gmt"), emit: gmt tuple val(meta), path("*.tsv"), emit: tsv , optional: true - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions_mygene, topic: versions when: task.ext.when == null || task.ext.when script: template "mygene.py" + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.gmt + touch ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + mygene: \$(python3 -c 'import mygene; print(mygene.__version__)') + END_VERSIONS + """ } diff --git a/modules/nf-core/mygene/meta.yml b/modules/nf-core/mygene/meta.yml index 8356c502ef32..2683c9ee20f9 100644 --- a/modules/nf-core/mygene/meta.yml +++ b/modules/nf-core/mygene/meta.yml @@ -11,9 +11,9 @@ tools: documentation: "https://docs.mygene.info/projects/mygene-py/en/latest/" tool_dev_url: "https://github.com/biothings/mygene.py" doi: "10.1093/nar/gks1114" - licence: ["Apache-2.0"] + licence: + - "Apache-2.0" identifier: biotools:mygene - input: - - meta: type: map @@ -22,9 +22,9 @@ input: e.g. `[ id:'sample1' ]` - gene_list: type: file - description: A tsv/csv file that contains a list of gene ids in one of the columns. - By default, the column name should be "gene_id", but this can be changed by - using "--columname gene_id" in ext.args. + description: A tsv/csv file that contains a list of gene ids in one of the + columns. By default, the column name should be "gene_id", but this can + be changed by using "--columname gene_id" in ext.args. pattern: "*.{csv,tsv}" ontologies: - edam: http://edamontology.org/format_3752 # CSV @@ -55,14 +55,23 @@ output: query, mygene_id, go_id, go_term, go_evidence, go_category, symbol, name, taxid pattern: "*.tsv" ontologies: - - edam: http://edamontology.org/format_3475 # TSV + - edam: http://edamontology.org/format_3475 + + versions_mygene: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 +topics: versions: - versions.yml: type: file description: File containing software versions pattern: "versions.yml" ontologies: - - edam: http://edamontology.org/format_3750 # YAML + - edam: http://edamontology.org/format_3750 authors: - "@suzannejin" maintainers: diff --git a/modules/nf-core/mygene/tests/main.nf.test b/modules/nf-core/mygene/tests/main.nf.test index e5ba64caa3b8..f3b418f44ef6 100644 --- a/modules/nf-core/mygene/tests/main.nf.test +++ b/modules/nf-core/mygene/tests/main.nf.test @@ -25,8 +25,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.gmt).match("mygene - default options - gmt") }, - { assert snapshot(process.out.versions).match("mygene - default options - versions") } + { assert snapshot( + sanitizeOutput(process.out), + process.out.versions_mygene[0] + ).match() } ) } } @@ -49,9 +51,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.gmt).match("mygene - default with tsv file - gmt") }, - { assert snapshot(process.out.tsv).match("mygene - default with tsv file - tsv") }, - { assert snapshot(process.out.versions).match("mygene - default with tsv file - versions") } + { assert snapshot( + sanitizeOutput(process.out), + process.out.versions_mygene[0] + ).match() } ) } } @@ -74,8 +77,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.gmt).match("mygene - filter by go category - gmt") }, - { assert snapshot(process.out.versions).match("mygene - filter by go category - versions") } + { assert snapshot( + sanitizeOutput(process.out), + process.out.versions_mygene[0] + ).match() } ) } } @@ -98,8 +103,35 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.gmt).match("mygene - filter by go evidence - gmt") }, - { assert snapshot(process.out.versions).match("mygene - filter by go evidence - versions") } + { assert snapshot( + sanitizeOutput(process.out), + process.out.versions_mygene[0] + ).match() } + ) + } + } + + test("mygene - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id : 'test'], + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/mus_musculus/rnaseq_expression/SRP254919.gene_meta.tsv") + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + sanitizeOutput(process.out), + process.out.versions_mygene[0] + ).match() } ) } } diff --git a/modules/nf-core/mygene/tests/main.nf.test.snap b/modules/nf-core/mygene/tests/main.nf.test.snap index d6a334c7ed62..23a9b58244fd 100644 --- a/modules/nf-core/mygene/tests/main.nf.test.snap +++ b/modules/nf-core/mygene/tests/main.nf.test.snap @@ -1,135 +1,142 @@ { - "mygene - filter by go evidence - versions": { + "mygene - stub": { "content": [ - [ - "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:20:31.854823" - }, - "mygene - default options - versions": { - "content": [ - [ - "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:19:43.081388" - }, - "mygene - default with tsv file - versions": { - "content": [ - [ - "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:20:01.837699" - }, - "mygene - default options - gmt": { - "content": [ - [ - [ - { - "id": "test" - }, - "test.gmt:md5,d76d4d06dad199c5e3ecef7060876834" + { + "gmt": [ + [ + { + "id": "test" + }, + "test.gmt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tsv": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_mygene": [ + "versions.yml:md5,8ed326917ca1d32d3f633a2f0be6a47c" ] - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:19:43.060437" - }, - "mygene - filter by go category - versions": { - "content": [ - [ - "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" - ] + }, + "versions.yml:md5,8ed326917ca1d32d3f633a2f0be6a47c" ], + "timestamp": "2026-05-01T07:52:01.578258", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:20:17.233994" + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } }, - "mygene - filter by go evidence - gmt": { + "mygene - default options": { "content": [ - [ - [ - { - "id": "test" - }, - "test.gmt:md5,da6b31a5f889e3aedb16b4154f9652af" + { + "gmt": [ + [ + { + "id": "test" + }, + "test.gmt:md5,1ab1d063c8ea81d5fa70c1c05ac8eef8" + ] + ], + "tsv": [ + + ], + "versions_mygene": [ + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ] - ] + }, + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ], + "timestamp": "2026-05-01T07:51:09.551117", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:20:31.827798" + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } }, - "mygene - default with tsv file - tsv": { + "mygene - filter by go evidence": { "content": [ - [ - [ - { - "id": "test" - }, - "test.tsv:md5,018e23173b224cbf328751006593900e" + { + "gmt": [ + [ + { + "id": "test" + }, + "test.gmt:md5,9522f1a93897fb9b1a2b2109cb49baa1" + ] + ], + "tsv": [ + + ], + "versions_mygene": [ + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ] - ] + }, + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ], + "timestamp": "2026-05-01T07:51:54.816787", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:20:01.81872" + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } }, - "mygene - default with tsv file - gmt": { + "mygene - filter by go category": { "content": [ - [ - [ - { - "id": "test" - }, - "test.gmt:md5,d76d4d06dad199c5e3ecef7060876834" + { + "gmt": [ + [ + { + "id": "test" + }, + "test.gmt:md5,369d949e20afdb7a1645c7794a078e8b" + ] + ], + "tsv": [ + + ], + "versions_mygene": [ + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ] - ] + }, + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ], + "timestamp": "2026-05-01T07:51:41.300263", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:20:01.79811" + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } }, - "mygene - filter by go category - gmt": { + "mygene - default with tsv file": { "content": [ - [ - [ - { - "id": "test" - }, - "test.gmt:md5,213c1d1d2345df8ea51d67cb1670f4f7" + { + "gmt": [ + [ + { + "id": "test" + }, + "test.gmt:md5,1ab1d063c8ea81d5fa70c1c05ac8eef8" + ] + ], + "tsv": [ + [ + { + "id": "test" + }, + "test.tsv:md5,3a7e5fe0b8efb0258dcd46326a498eb1" + ] + ], + "versions_mygene": [ + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ] - ] + }, + "versions.yml:md5,09d72645c3ae7e886af6e8bd2876c72b" ], + "timestamp": "2026-05-01T07:51:27.504956", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T17:20:17.208509" + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } } } \ No newline at end of file