diff --git a/modules/bigbio/pridepy/environment.yml b/modules/bigbio/pridepy/environment.yml new file mode 100644 index 0000000..6fded8f --- /dev/null +++ b/modules/bigbio/pridepy/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::pridepy=0.0.14 diff --git a/modules/bigbio/pridepy/main.nf b/modules/bigbio/pridepy/main.nf new file mode 100644 index 0000000..57a54ea --- /dev/null +++ b/modules/bigbio/pridepy/main.nf @@ -0,0 +1,45 @@ +process PRIDEPY_DOWNLOAD { + tag "${meta.id}" + label 'process_low' + label 'process_long' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/pridepy:0.0.14--pyhdfd78af_0' + : 'biocontainers/pridepy:0.0.14--pyhdfd78af_0'}" + + input: + val(meta) + + output: + tuple val(meta), path("*.{raw,mzML,mzML.gz,mgf,d.tar,d.tar.gz,d.zip,dia,wiff,wiff.scan}"), emit: spectra, optional: true + tuple val(meta), path("*-checksum.tsv"), emit: checksums, optional: true + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + """ + pridepy ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pridepy: \$(python -c "from importlib.metadata import version; print(version('pridepy'))" || echo "unknown") + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def checksum_touch = args.contains('--checksum-check') ? "touch \"${meta.id}-checksum.tsv\"" : '' + """ + touch "${meta.id}.raw" + ${checksum_touch} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pridepy: 0.0.14 + END_VERSIONS + """ +} diff --git a/modules/bigbio/pridepy/meta.yml b/modules/bigbio/pridepy/meta.yml new file mode 100644 index 0000000..6570a05 --- /dev/null +++ b/modules/bigbio/pridepy/meta.yml @@ -0,0 +1,62 @@ +name: pridepy +description: Python client for PRIDE Archive — download and query proteomics datasets +keywords: + - pride + - download + - proteomics + - raw files + - globus + - aspera +tools: + - pridepy: + description: | + pridepy is a Python client for the PRIDE Archive REST API. + It supports downloading public/private files via FTP, Aspera, Globus (HTTPS), or S3, + as well as querying project metadata and file listings. + The specific sub-command and arguments are passed via task.ext.args. + homepage: https://github.com/PRIDE-Archive/pridepy + documentation: https://github.com/PRIDE-Archive/pridepy + tool_dev_url: https://github.com/PRIDE-Archive/pridepy + licence: + - "Apache-2.0" + identifier: "" +input: + - meta: + type: map + description: | + Groovy Map containing task information. + e.g. `[ id: 'PXD001819' ]` +output: + spectra: + - - meta: + type: map + description: | + Groovy Map containing task information forwarded from input. + - "*.{raw,mzML,mzML.gz,mgf,d.tar,d.tar.gz,d.zip,dia,wiff,wiff.scan}": + type: file + description: | + Mass spectrometry spectra files downloaded from PRIDE Archive + (Thermo .raw, mzML, Bruker .d archives, DIA-NN .dia, Sciex .wiff, etc.). + Emitted to the task workDir; downstream pipelines pick specific files + via publishDir / saveAs in their modules.config. + pattern: "*.{raw,mzML,mzML.gz,mgf,d.tar,d.tar.gz,d.zip,dia,wiff,wiff.scan}" + checksums: + - - meta: + type: map + description: | + Groovy Map containing task information forwarded from input. + - "*-checksum.tsv": + type: file + description: SHA1 checksums file generated by pridepy when --checksum-check is enabled. + pattern: "*-checksum.tsv" + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 +authors: + - "@ypriverol" +maintainers: + - "@ypriverol" diff --git a/modules/bigbio/pridepy/tests/main.nf.test b/modules/bigbio/pridepy/tests/main.nf.test new file mode 100644 index 0000000..1bd59a5 --- /dev/null +++ b/modules/bigbio/pridepy/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process PRIDEPY_DOWNLOAD" + script "../main.nf" + process "PRIDEPY_DOWNLOAD" + tag "modules" + tag "modules_bigbio" + tag "modules_pridepy" + tag "pridepy" + + test("Should run stub mode (no checksum)") { + + options "-stub" + + when { + process { + """ + input[0] = [ id: 'PXD001819' ] + """ + } + } + + then { + assert process.success + assert process.out.spectra.size() == 1 + assert process.out.checksums.size() == 0 + assert snapshot( + process.out.spectra, + process.out.versions + ).match("stub_no_checksum") + } + } + + test("Should run stub mode with --checksum-check") { + + options "-stub" + + when { + process { + """ + input[0] = [ id: 'PXD001819' ] + """ + } + params { + module_args = '--checksum-check' + } + config "./nextflow.config" + } + + then { + assert process.success + assert process.out.spectra.size() == 1 + assert process.out.checksums.size() == 1 + assert snapshot( + process.out.spectra, + process.out.checksums, + process.out.versions + ).match("stub_with_checksum") + } + } +} diff --git a/modules/bigbio/pridepy/tests/main.nf.test.snap b/modules/bigbio/pridepy/tests/main.nf.test.snap new file mode 100644 index 0000000..c591913 --- /dev/null +++ b/modules/bigbio/pridepy/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "stub_no_checksum": { + "content": [ + [ + [ + { + "id": "PXD001819" + }, + "PXD001819.raw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + "versions.yml:md5,c27ccb04c91f92f188b7f4cf2d54ed49" + ] + ], + "timestamp": "2026-04-28T18:15:37.876014654", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.10.4" + } + }, + "stub_with_checksum": { + "content": [ + [ + [ + { + "id": "PXD001819" + }, + "PXD001819.raw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "PXD001819" + }, + "PXD001819-checksum.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + "versions.yml:md5,c27ccb04c91f92f188b7f4cf2d54ed49" + ] + ], + "timestamp": "2026-04-28T18:15:43.996367071", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.10.4" + } + } +} \ No newline at end of file diff --git a/modules/bigbio/pridepy/tests/nextflow.config b/modules/bigbio/pridepy/tests/nextflow.config new file mode 100644 index 0000000..266db68 --- /dev/null +++ b/modules/bigbio/pridepy/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'PRIDEPY_DOWNLOAD' { + ext.args = { params.module_args ?: '' } + } +}