Skip to content

Commit a7bd119

Browse files
authored
Merge pull request #627 from daichengxin/prbranch
move thermorawfileparser from local to bigbio nf-core
2 parents 4d9d253 + a85d38c commit a7bd119

File tree

7 files changed

+216
-0
lines changed

7 files changed

+216
-0
lines changed

modules.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@
3636
}
3737
}
3838
}
39+
},
40+
"https://github.com/bigbio/nf-modules.git": {
41+
"modules": {
42+
"bigbio": {
43+
"thermorawfileparser": {
44+
"branch": "main",
45+
"git_sha": "f85bcb529b16e03e8f46374d0fde5bfaf604b676",
46+
"installed_by": ["modules"]
47+
}
48+
}
49+
}
3950
}
4051
}
4152
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: thermorawfileparser
2+
channels:
3+
- conda-forge
4+
- bioconda
5+
- defaults
6+
dependencies:
7+
- bioconda::thermorawfileparser=1.4.5
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
process THERMORAWFILEPARSER {
2+
tag "$meta.mzml_id"
3+
label 'process_low'
4+
label 'process_single'
5+
label 'error_retry'
6+
7+
conda "${moduleDir}/environment.yml"
8+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
9+
'https://depot.galaxyproject.org/singularity/thermorawfileparser:1.4.5--h05cac1d_1' :
10+
'biocontainers/thermorawfileparser:1.4.5--h05cac1d_1' }"
11+
12+
stageInMode {
13+
if (task.attempt == 1) {
14+
if (task.executor == "awsbatch") {
15+
'symlink'
16+
} else {
17+
'link'
18+
}
19+
} else if (task.attempt == 2) {
20+
if (task.executor == "awsbatch") {
21+
'copy'
22+
} else {
23+
'symlink'
24+
}
25+
} else {
26+
'copy'
27+
}
28+
}
29+
input:
30+
tuple val(meta), path(rawfile)
31+
32+
output:
33+
tuple val(meta), path("*.{mzML,mgf,parquet}"), emit: convert_files
34+
path "versions.yml", emit: versions
35+
path "*.log", emit: log
36+
37+
script:
38+
def args = task.ext.args ?: ''
39+
// Default to indexed mzML format (-f=2) if not specified in args
40+
def formatArg = args.contains('-f=') ? '' : '-f=2'
41+
42+
"""
43+
ThermoRawFileParser.sh -i='${rawfile}' ${formatArg} ${args} -o=./ 2>&1 | tee '${rawfile.baseName}_conversion.log'
44+
45+
cat <<-END_VERSIONS > versions.yml
46+
"${task.process}":
47+
ThermoRawFileParser: \$(ThermoRawFileParser.sh --version)
48+
END_VERSIONS
49+
"""
50+
51+
stub:
52+
def prefix = task.ext.prefix ?: "${meta.mzml_id}"
53+
def args = task.ext.args ?: ''
54+
// Determine output format from args, default to mzML
55+
// Format 0 = MGF, formats 1-2 = mzML, format 3 = Parquet, format 4 = None
56+
def outputExt = (args =~ /-f=0\b/).find() ? 'mgf' : 'mzML'
57+
58+
"""
59+
touch '${prefix}.${outputExt}'
60+
touch '${prefix}_conversion.log'
61+
62+
cat <<-END_VERSIONS > versions.yml
63+
"${task.process}":
64+
ThermoRawFileParser: \$(ThermoRawFileParser.sh --version)
65+
END_VERSIONS
66+
"""
67+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: thermorawfileparser
2+
description: Convert RAW file to mzML or MGF files
3+
keywords:
4+
- raw
5+
- mzML
6+
- MGF
7+
- OpenMS
8+
tools:
9+
- thermorawfileparser:
10+
description: |
11+
ThermoRawFileParser converts Thermo RAW files to open standard formats like mzML, producing indexed output files.
12+
Use `task.ext.args` to pass additional arguments, e.g.:
13+
- `-f=0` for MGF output, `-f=1` for mzML, `-f=2` for indexed mzML (default), `-f=3` for Parquet, `-f=4` for None
14+
- `-L` or `--msLevel=VALUE` to select MS levels (e.g., `-L=1,2` or `--msLevel=1-3`)
15+
homepage: https://github.com/compomics/ThermoRawFileParser
16+
documentation: https://github.com/compomics/ThermoRawFileParser
17+
input:
18+
- meta:
19+
type: map
20+
description: |
21+
Groovy Map containing sample information
22+
- rawfile:
23+
type: file
24+
description: |
25+
Thermo RAW file
26+
pattern: "*.{raw,RAW}"
27+
output:
28+
- meta:
29+
type: map
30+
description: |
31+
Groovy Map containing sample information
32+
e.g. [ id:'sample1', mzml_id:'UPS1_50amol_R3' ]
33+
- convert_files:
34+
type: file
35+
description: |
36+
Converted files in mzML or MGF format depending on the format parameter (-f).
37+
Format options: 0 for MGF, 1 for mzML, 2 for indexed mzML (default), 3 for Parquet, 4 for None.
38+
pattern: "*.{mzML,mgf}"
39+
- log:
40+
type: file
41+
description: log file
42+
pattern: "*.log"
43+
- versions:
44+
type: file
45+
description: File containing software version
46+
pattern: "versions.yml"
47+
authors:
48+
- "@daichengxin"
49+
- "@ypriverol"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
nextflow_process {
2+
3+
name "Test Process THERMORAWFILEPARSER"
4+
script "../main.nf"
5+
process "THERMORAWFILEPARSER"
6+
tag "modules"
7+
tag "modules_bigbio"
8+
tag "thermorawfileparser"
9+
10+
test("Should convert RAW to mzML") {
11+
12+
when {
13+
process {
14+
"""
15+
input[0] = [
16+
[ id: 'test', mzml_id: 'UPS1_50amol_R3' ],
17+
file(params.test_data['proteomics']['msspectra']['ups1_50amol_r3'], checkIfExists: false)
18+
]
19+
"""
20+
}
21+
}
22+
23+
then {
24+
assert process.success
25+
assert snapshot(process.out.versions).match("versions")
26+
assert new File(process.out.convert_files[0][1]).name == 'TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML'
27+
assert process.out.log.size() == 1
28+
}
29+
}
30+
31+
test("Should run stub mode") {
32+
33+
options "-stub"
34+
35+
when {
36+
process {
37+
"""
38+
input[0] = [
39+
[ id: 'test', mzml_id: 'test_sample' ],
40+
file(params.test_data['proteomics']['msspectra']['ups1_50amol_r3'], checkIfExists: false)
41+
]
42+
"""
43+
}
44+
}
45+
46+
then {
47+
assert process.success
48+
assert snapshot(process.out.versions).match("versions_stub")
49+
assert new File(process.out.convert_files[0][1]).name == 'test_sample.mzML'
50+
assert process.out.log.size() == 1
51+
}
52+
}
53+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"versions": {
3+
"content": [
4+
[
5+
"versions.yml:md5,dc9625538c025d615109ef8cac3a86ab"
6+
]
7+
],
8+
"meta": {
9+
"nf-test": "0.9.3",
10+
"nextflow": "25.04.8"
11+
},
12+
"timestamp": "2025-12-11T06:27:00.000000"
13+
},
14+
"versions_stub": {
15+
"content": [
16+
[
17+
"versions.yml:md5,dc9625538c025d615109ef8cac3a86ab"
18+
]
19+
],
20+
"meta": {
21+
"nf-test": "0.9.3",
22+
"nextflow": "25.04.8"
23+
},
24+
"timestamp": "2025-12-11T06:27:00.000000"
25+
}
26+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
process {
2+
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
3+
}

0 commit comments

Comments
 (0)