diff --git a/modules/nf-core/pcgr/getref/environment.yml b/modules/nf-core/pcgr/getref/environment.yml new file mode 100644 index 00000000000..694ba818a11 --- /dev/null +++ b/modules/nf-core/pcgr/getref/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::coreutils=9.5 + - conda-forge::gzip=1.14 + - conda-forge::tar=1.35 + - conda-forge::curl=8.16.0 diff --git a/modules/nf-core/pcgr/getref/main.nf b/modules/nf-core/pcgr/getref/main.nf new file mode 100644 index 00000000000..031ab42dcc5 --- /dev/null +++ b/modules/nf-core/pcgr/getref/main.nf @@ -0,0 +1,48 @@ +process PCGR_GETREF { + 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/51/517cc3a46129fc586191412f29246889124f4654640a53230aa203a2bcc1d7dc/data' + : 'community.wave.seqera.io/library/coreutils_curl_gzip_tar:17a6ea9a6766c02a'}" + + input: + tuple val(meta), val(bundleversion), val(genome) + + output: + tuple val(meta), path("${bundleversion}"), emit: pcgrref + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def bundle = "pcgr_ref_data.${bundleversion}.${genome}.tgz" + """ + curl -O https://insilico.hpc.uio.no/pcgr/${bundle} + gzip -dc ${bundle} | tar xvf - + + mkdir ${bundleversion} + mv data/ ${bundleversion} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + curl: \$(curl --version | head -1 | cut -d ' ' -f 2) + tar: \$(tar --version | head -1 | cut -d ' ' -f 4) + gzip: \$(gzip --version | head -1 | cut -d ' ' -f 2) + END_VERSIONS + """ + + stub: + """ + mkdir ${bundleversion} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + curl: \$(curl --version | head -1 | cut -d ' ' -f 2) + tar: \$(tar --version | head -1 | cut -d ' ' -f 4) + gzip: \$(gzip --version | head -1 | cut -d ' ' -f 2) + END_VERSIONS + """ +} diff --git a/modules/nf-core/pcgr/getref/meta.yml b/modules/nf-core/pcgr/getref/meta.yml new file mode 100644 index 00000000000..b7a43c93684 --- /dev/null +++ b/modules/nf-core/pcgr/getref/meta.yml @@ -0,0 +1,59 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "pcgr_getref" +description: Get reference to run Personal Cancer Genome Reporter (PCGR) +keywords: + - cancer + - reference + - pcgr + - mtb +tools: + - pcgr: + description: "The Personal Cancer Genome Reporter (PCGR) is a stand-alone software package for functional annotation and translation of individual tumor genomes for precision cancer medicine" + homepage: "https://sigven.github.io/pcgr/index.html" + documentation: "https://sigven.github.io/pcgr/articles/running.html" + tool_dev_url: "https://github.com/sigven/pcgr/" + doi: "10.1093/bioinformatics/btx817" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - bundleversion: + type: string + description: PCGR reference data bundle version + pattern: "*[0-9]*" + ontologies: [] + - genome: + type: string + description: PCGR reference genome version + pattern: "grch37|grch38" + ontologies: [] + +output: + pcgrref: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "${bundleversion}": + type: directory + description: PCGR reference data directory + pattern: "{bundleversion}/" + ontologies: [] + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@famosab" +maintainers: + - "@famosab" diff --git a/modules/nf-core/pcgr/getref/tests/main.nf.test b/modules/nf-core/pcgr/getref/tests/main.nf.test new file mode 100644 index 00000000000..6a8c0ee55d2 --- /dev/null +++ b/modules/nf-core/pcgr/getref/tests/main.nf.test @@ -0,0 +1,66 @@ +nextflow_process { + + name "Test Process PCGR_GETREF" + script "../main.nf" + process "PCGR_GETREF" + + tag "modules" + tag "modules_nfcore" + tag "pcgr" + tag "pcgr/getref" + + // test("human - 20250314 - grch38") { + + // when { + // process { + // """ + // input[0] = [ + // [ id:'test' ], + // '20250314', + // 'grch38' + // ] + // """ + // } + // } + + // then { + // assert process.success + // assertAll( + // { assert snapshot( + // process.out, + // path(process.out.versions[0]).yaml + // ).match() } + // ) + // } + + // } + + test("human - 20250314 - grch38 - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], + '20250314', + 'grch38' + ] + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + process.out, + path(process.out.versions[0]).yaml + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/pcgr/getref/tests/main.nf.test.snap b/modules/nf-core/pcgr/getref/tests/main.nf.test.snap new file mode 100644 index 00000000000..84179309a65 --- /dev/null +++ b/modules/nf-core/pcgr/getref/tests/main.nf.test.snap @@ -0,0 +1,46 @@ +{ + "human - 20250314 - grch38 - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + + ] + ] + ], + "1": [ + "versions.yml:md5,25b668e4db59e455ba5a5b1fde55dc76" + ], + "pcgrref": [ + [ + { + "id": "test" + }, + [ + + ] + ] + ], + "versions": [ + "versions.yml:md5,25b668e4db59e455ba5a5b1fde55dc76" + ] + }, + { + "PCGR_GETREF": { + "curl": "8.16.0", + "tar": 1.35, + "gzip": 1.14 + } + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.04.8" + }, + "timestamp": "2025-10-29T14:11:26.824317" + } +} \ No newline at end of file