diff --git a/modules/nf-core/dds/createproject/environment.yml b/modules/nf-core/dds/createproject/environment.yml new file mode 100644 index 000000000000..c4a4b47e7a56 --- /dev/null +++ b/modules/nf-core/dds/createproject/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::pip=25.3 + - conda-forge::python=3.12.13 + - pip: + - dds-cli==2.14.0 diff --git a/modules/nf-core/dds/createproject/main.nf b/modules/nf-core/dds/createproject/main.nf new file mode 100644 index 000000000000..04b3706a387a --- /dev/null +++ b/modules/nf-core/dds/createproject/main.nf @@ -0,0 +1,35 @@ +process DDS_CREATEPROJECT { + 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/97/971f09f84bdc0d023c1ac45905d21bfe4f1a36e4c822edf75325e55b68639a05/data': + 'community.wave.seqera.io/library/python_pip_dds-cli:c4d21ad6e2eb6702' }" + + input: + val title + val description + val pi + path token_file + + output: + path 'output.log', emit: log + tuple val("${task.process}"), val('dds'), eval("dds --version | sed 's/.*version //'"), topic: versions, emit: versions_dds + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + + """ + dds --token-path $token_file project create --title "$title" --description "$description" --principal-investigator "$pi" > output.log + """ + + stub: + def args = task.ext.args ?: '' + + """ + touch output.log + """ +} diff --git a/modules/nf-core/dds/createproject/meta.yml b/modules/nf-core/dds/createproject/meta.yml new file mode 100644 index 000000000000..4e85958d3635 --- /dev/null +++ b/modules/nf-core/dds/createproject/meta.yml @@ -0,0 +1,63 @@ +name: "dds_createproject" +description: This module is used to create a project on the SciLifeLab Data + Delivery System (DDS). +keywords: + - dds + - scilifelab + - data delivery +tools: + - "dds": + description: "The Data Delivery System (DDS) is a cloud-based system for the delivery + of data from SciLifeLab platforms to their users." + homepage: "https://delivery.scilifelab.se" + documentation: "https://scilifelabdatacentre.github.io/dds_cli/" + tool_dev_url: "https://github.com/ScilifelabDataCentre/dds_cli" + licence: + - "MIT" + identifier: "" +input: + - title: + type: string + description: The title of the project. + - description: + type: string + description: A description of the project. + - pi: + type: string + description: Email of the Principal Investigator. + - token_file: + type: file + description: Path to a DDS CLI token file (created via `dds auth`). Must be + readable by the pipeline user. + ontologies: [] +output: + versions_dds: + - - ${task.process}: + type: string + description: The name of the process + - dds: + type: string + description: The name of the tool + - dds --version | sed 's/.*version //': + type: eval + description: The expression to obtain the version of the tool + log: + - output.log: + type: file + description: File containing the projectID of the project created. + ontologies: [] +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - dds: + type: string + description: The name of the tool + - dds --version | sed 's/.*version //': + type: eval + description: The expression to obtain the version of the tool +authors: + - "@annaasklof" +maintainers: + - "@annaasklof" diff --git a/modules/nf-core/dds/createproject/tests/main.nf.test b/modules/nf-core/dds/createproject/tests/main.nf.test new file mode 100644 index 000000000000..ecf3ab5cf9cd --- /dev/null +++ b/modules/nf-core/dds/createproject/tests/main.nf.test @@ -0,0 +1,65 @@ +nextflow_process { + + name "Test Process DDS_CREATEPROJECT" + script "../main.nf" + process "DDS_CREATEPROJECT" + + tag "modules" + tag "modules_nfcore" + tag "dds" + tag "dds/createproject" + + // NOTE: This test requires a valid DDS token file and access to a DDS instance. + // Set DDS_TOKEN_PATH to the path of your token file before running: + // dds auth login # creates ~/.dds_cli_token + // DDS_TOKEN_PATH=~/.dds_cli_token nf-test test + // Not run in standard nf-core CI. + test("dds/createproject") { + + when { + process { + """ + input[0] = "Test title" + input[1] = "Test description" + input[2] = "test-pi@mail.com" + input[3] = file(System.getenv("DDS_TOKEN_PATH") ?: params.modules_testdata_base_path + 'generic/txt/hello.txt') + """ + } + } + + then { + // assert process.success + assertAll( + { assert snapshot( + process.out + )} + ) + } + + } + + test("dds/createproject - stub") { + + options "-stub" + + when { + process { + """ + input[0] = "Test title" + input[1] = "Test description" + input[2] = "test-pi@mail.com" + input[3] = file(params.modules_testdata_base_path + 'generic/txt/hello.txt') + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/dds/createproject/tests/main.nf.test.snap b/modules/nf-core/dds/createproject/tests/main.nf.test.snap new file mode 100644 index 000000000000..3dbc90437f82 --- /dev/null +++ b/modules/nf-core/dds/createproject/tests/main.nf.test.snap @@ -0,0 +1,33 @@ +{ + "dds/createproject - stub": { + "content": [ + { + "0": [ + "output.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + [ + "DDS_CREATEPROJECT", + "dds", + "2.14.0" + ] + ], + "log": [ + "output.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions_dds": [ + [ + "DDS_CREATEPROJECT", + "dds", + "2.14.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.4" + }, + "timestamp": "2026-04-10T16:57:13.178392" + } +} \ No newline at end of file