diff --git a/modules/nf-core/xengsort/index/environment.yml b/modules/nf-core/xengsort/index/environment.yml new file mode 100644 index 000000000000..e92893855e31 --- /dev/null +++ b/modules/nf-core/xengsort/index/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "xengsort_index" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::xengsort=2.0.5" diff --git a/modules/nf-core/xengsort/index/main.nf b/modules/nf-core/xengsort/index/main.nf new file mode 100644 index 000000000000..a0507d3a0a62 --- /dev/null +++ b/modules/nf-core/xengsort/index/main.nf @@ -0,0 +1,54 @@ +process XENGSORT_INDEX { + tag "$host_fasta" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/xengsort:2.0.5--pyhdfd78af_0': + 'biocontainers/xengsort:2.0.5--pyhdfd78af_0' }" + + input: + path(host_fasta, stageAs: "host/*") + path(graft_fasta, stageAs: "graft/*") + val index + val nobjects + val mask + + output: + path "${index}.hash" , emit: hash + path "${index}.info" , emit: info + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + """ + xengsort \\ + index \\ + $args \\ + --index $index \\ + --host $host_fasta \\ + --graft $graft_fasta \\ + --nobjects $nobjects \\ + --mask '$mask' \\ + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xengsort: \$(xengsort --version) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + """ + touch ${index}.info + touch ${index}.hash + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xengsort: \$(xengsort --version) + END_VERSIONS + """ +} diff --git a/modules/nf-core/xengsort/index/meta.yml b/modules/nf-core/xengsort/index/meta.yml new file mode 100644 index 000000000000..570c781d09be --- /dev/null +++ b/modules/nf-core/xengsort/index/meta.yml @@ -0,0 +1,61 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "xengsort_index" +description: Fast lightweight accurate xenograft sorting +keywords: + - index + - QC + - reference + - fasta + - xenograft + - sort + - k-mer +tools: + - "xengsort": + description: "A fast xenograft read sorter based on space-efficient k-mer hashing" + homepage: "https://gitlab.com/genomeinformatics/xengsort" + documentation: "https://gitlab.com/genomeinformatics/xengsort" + tool_dev_url: "https://gitlab.com/genomeinformatics/xengsort" + doi: "10.4230/LIPIcs.WABI.2020.4" + licence: ["MIT"] + +input: + - host_fasta: + type: file + description: | + Reference genome fasta file from host, compressed or uncompressed. + - graft_fasta: + type: file + description: | + Reference genome fasta file from graft, compressed or uncompressed. + - index: + type: string + description: | + File name prefix to store index files. + - nobjects: + type: string + description: | + Number of k-mers that will be stored in the hash table. Underscore should be used, i.e for 1000000, it should be typed 1_000_000. + - mask: + type: string + description: | + Gapped k-mer mask (quoted string like '#__##_##__#'). + +output: + - hash: + type: file + description: File with index hash file. + pattern: "*hash" + - info: + type: file + description: File with index info file. + pattern: "*info" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@diegomscoelho" +maintainers: + - "@diegomscoelho" diff --git a/modules/nf-core/xengsort/index/tests/main.nf.test b/modules/nf-core/xengsort/index/tests/main.nf.test new file mode 100644 index 000000000000..2f7fd5c3c325 --- /dev/null +++ b/modules/nf-core/xengsort/index/tests/main.nf.test @@ -0,0 +1,37 @@ +nextflow_process { + + name "Test Process XENGSORT_INDEX" + script "../main.nf" + process "XENGSORT_INDEX" + + tag "modules" + tag "modules_nfcore" + tag "xengsort" + tag "xengsort/index" + + test("homo_sapiens - sarscov2 - stub") { + + options "-stub" + + when { + process { + """ + input[0] = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) + input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + input[2] = 'index' + input[3] = '10_000_000' + input[4] = '###__#_##__#_#_###__#__###_#_#__##_#__###' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/xengsort/index/tests/main.nf.test.snap b/modules/nf-core/xengsort/index/tests/main.nf.test.snap new file mode 100644 index 000000000000..bdf80349a3a3 --- /dev/null +++ b/modules/nf-core/xengsort/index/tests/main.nf.test.snap @@ -0,0 +1,31 @@ +{ + "homo_sapiens - sarscov2 - stub": { + "content": [ + { + "0": [ + "index.hash:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + "index.info:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "2": [ + "versions.yml:md5,ede2e0a7a166d5af516a5c15ff6891d5" + ], + "hash": [ + "index.hash:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "info": [ + "index.info:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,ede2e0a7a166d5af516a5c15ff6891d5" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-28T13:35:44.83309745" + } +} \ No newline at end of file diff --git a/modules/nf-core/xengsort/index/tests/tags.yml b/modules/nf-core/xengsort/index/tests/tags.yml new file mode 100644 index 000000000000..12361ea74473 --- /dev/null +++ b/modules/nf-core/xengsort/index/tests/tags.yml @@ -0,0 +1,2 @@ +xengsort/index: + - "modules/nf-core/xengsort/index/**"