Skip to content
Merged
7 changes: 7 additions & 0 deletions modules/nf-core/pridepy/fetchsdrf/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::pridepy=0.0.15"
47 changes: 47 additions & 0 deletions modules/nf-core/pridepy/fetchsdrf/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process PRIDEPY_FETCHSDRF {
Comment thread
jonasscheid marked this conversation as resolved.
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pridepy:0.0.15--pyhdfd78af_0':
'quay.io/biocontainers/pridepy:0.0.15--pyhdfd78af_0' }"

input:
tuple val(meta), val(pride_id)

output:
tuple val(meta), path("${prefix}.sdrf.tsv"), emit: sdrf
tuple val("${task.process}"), val('pridepy'), eval('python -c "from importlib.metadata import version; print(version(\'pridepy\'))"'), topic: versions, emit: versions_pridepy

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
pridepy stream-files-metadata \\
-a "${pride_id}" \\
-o files_metadata.json \\
$args

# Check if SDRF is present in metadata and extract
sdrf_name=\$(awk -F'"' '/"fileName" *: *"(sdrf\\.tsv|[^"]+\\.sdrf\\.tsv)"/ {print \$4; exit}' files_metadata.json)
[ -n "\$sdrf_name" ] || { echo "ERROR: No SDRF file found for ${pride_id}" >&2; exit 1; }

pridepy download-file-by-name \\
-a "${pride_id}" \\
-f "\$sdrf_name" \\
-o . \\
$args

mv "\$sdrf_name" "${prefix}.sdrf.tsv"
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.sdrf.tsv
"""
}
68 changes: 68 additions & 0 deletions modules/nf-core/pridepy/fetchsdrf/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "pridepy_fetchsdrf"
description: Fetch an SDRF file from the PRIDE Archive for a given project accession.
keywords:
- pride
- sdrf
- proteomics
- download
- metadata
tools:
- "pridepy":
description: |
Python client library to access PRIDE Archive data programmatically,
including downloading files and metadata for public proteomics datasets.
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 sample information
e.g. `[ id:'PXD004684' ]`
- pride_id:
type: string
description: PRIDE Archive project accession (e.g. PXD004684)

output:
sdrf:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'PXD004684' ]`
- "${prefix}.sdrf.tsv":
type: file
description: SDRF (Sample and Data Relationship Format) file describing the experimental design of the PRIDE project
pattern: "*.sdrf.tsv"
versions_pridepy:
- - ${task.process}:
type: string
description: The process the versions were collected from
- pridepy:
type: string
description: The tool name
- 'python -c "from importlib.metadata import version; print(version(''pridepy''))"':
type: string
description: The command used to generate the version of the tool

topics:
versions:
- - ${task.process}:
type: string
description: The process the versions were collected from
- pridepy:
type: string
description: The tool name
- 'python -c "from importlib.metadata import version; print(version(''pridepy''))"':
type: string
description: The command used to generate the version of the tool

authors:
- "@jonasscheid"
maintainers:
- "@jonasscheid"
59 changes: 59 additions & 0 deletions modules/nf-core/pridepy/fetchsdrf/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
nextflow_process {

name "Test Process PRIDEPY_FETCHSDRF"
script "../main.nf"
process "PRIDEPY_FETCHSDRF"

tag "modules"
tag "modules_nfcore"
tag "pridepy"
tag "pridepy/fetchsdrf"

test("pride - PXD004684") {

when {
process {
"""
input[0] = [
[ id:'PXD004684' ],
'PXD004684'
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.sdrf[0][1]).text.contains('Source Name') },
{ assert snapshot(process.out).match() }
Comment thread
jonasscheid marked this conversation as resolved.
Outdated
)
}

}

test("pride - PXD004684 - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'PXD004684' ],
'PXD004684'
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
Comment thread
jonasscheid marked this conversation as resolved.
Outdated
)
}

}

}
84 changes: 84 additions & 0 deletions modules/nf-core/pridepy/fetchsdrf/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"pride - PXD004684 - stub": {
"content": [
{
"0": [
[
{
"id": "PXD004684"
},
"PXD004684.sdrf.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
"PRIDEPY_FETCHSDRF",
"pridepy",
"0.0.15"
]
],
"sdrf": [
[
{
"id": "PXD004684"
},
"PXD004684.sdrf.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions_pridepy": [
[
"PRIDEPY_FETCHSDRF",
"pridepy",
"0.0.15"
]
]
}
],
"timestamp": "2026-05-04T07:51:07.096175717",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
},
"pride - PXD004684": {
"content": [
{
"0": [
[
{
"id": "PXD004684"
},
"PXD004684.sdrf.tsv:md5,a8a2aa91d85adb241110fe3a7ce8f372"
]
],
"1": [
[
"PRIDEPY_FETCHSDRF",
"pridepy",
"0.0.15"
]
],
"sdrf": [
[
{
"id": "PXD004684"
},
"PXD004684.sdrf.tsv:md5,a8a2aa91d85adb241110fe3a7ce8f372"
]
],
"versions_pridepy": [
[
"PRIDEPY_FETCHSDRF",
"pridepy",
"0.0.15"
]
]
}
],
"timestamp": "2026-05-04T07:50:51.643144802",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
}
}
Loading