-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add module openms/idmassaccuracy (#6647)
* Setup cometadapter module * cometadapter draft * finalize tests * remove defaults * enclosing input as channel * replace collect with map * add channel of again * fix input channles by joining them * update correct snapshot * fix lint * fix snapshots, comet writes timestamps in output file * prettier * Update environment.yml * strip out suffix version tag, which differs between container and conda * move to version content check instead of hash * align conda version and container version tag * add idmassaccuracy module * shorten version parsing --------- Co-authored-by: Simon Pearce <[email protected]>
- Loading branch information
1 parent
e2b2fde
commit f768b28
Showing
6 changed files
with
310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- "bioconda::openms=3.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
process OPENMS_IDMASSACCURACY { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/openms:3.1.0--h191ead1_4' : | ||
'biocontainers/openms:3.1.0--h191ead1_4' }" | ||
|
||
input: | ||
tuple val(meta), path(mzmls), path(idxmls) | ||
|
||
output: | ||
tuple val(meta), path("*frag_mass_err.tsv") , emit: frag_err | ||
tuple val(meta), path("*prec_mass_err.tsv") , emit: prec_err, optional: true | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
IDMassAccuracy \\ | ||
-in $mzmls \\ | ||
-id_in $idxmls \\ | ||
-out_fragment ${prefix}_frag_mass_err.tsv \\ | ||
-threads $task.cpus \\ | ||
$args | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
OpenMS: \$(FileInfo 2>&1 | grep -E '^Version(.*)' | cut -d ' ' -f 2 | cut -d '-' -f 1) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
touch ${prefix}_frag_mass_err.tsv | ||
touch ${prefix}_prec_mass_err.tsv | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
OpenMS: \$(FileInfo 2>&1 | grep -E '^Version(.*)' | cut -d ' ' -f 2 | cut -d '-' -f 1) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: "openms_idmassaccuracy" | ||
description: Calculates a distribution of the mass error from given mass spectra and IDs. | ||
keywords: | ||
- mass_error | ||
- openms | ||
- proteomics | ||
tools: | ||
- "openms": | ||
description: "OpenMS is an open-source software C++ library for LC-MS data management and analyses" | ||
homepage: "https://openms.de" | ||
documentation: "https://openms.readthedocs.io/en/latest/index.html" | ||
tool_dev_url: "https://github.com/OpenMS/OpenMS" | ||
doi: "10.1038/s41592-024-02197-7" | ||
licence: ["BSD"] | ||
|
||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'test' ]` | ||
- mzmls: | ||
type: file | ||
description: | | ||
List containing one or more mzML files | ||
e.g. `[ 'file1.mzML', 'file2.mzML' ]` | ||
pattern: "*.{mzML}" | ||
- idxmls: | ||
type: file | ||
description: | | ||
List containing one or more idXML files | ||
e.g. `[ 'file1.idXML', 'file2.idXML' ]` | ||
pattern: "*.{idXML}" | ||
|
||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'test' ]` | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
- frag_err: | ||
type: file | ||
description: TSV file containing the fragment mass errors | ||
pattern: "*frag_mass_err.{tsv}" | ||
- prec_err: | ||
type: file | ||
description: Optional TSV file containing the precursor mass errors | ||
pattern: "*prec_mass_err.{tsv}" | ||
|
||
authors: | ||
- "@jonasscheid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
nextflow_process { | ||
|
||
name "Test Process OPENMS_IDMASSACCURACY" | ||
script "../main.nf" | ||
process "OPENMS_IDMASSACCURACY" | ||
config "./nextflow.config" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "openms" | ||
tag "openms/idmassaccuracy" | ||
tag "thermorawfileparser" | ||
tag "openms/decoydatabase" | ||
tag "openmsthirdparty/cometadapter" | ||
|
||
setup { | ||
run("THERMORAWFILEPARSER") { | ||
script "../../../thermorawfileparser/main.nf" | ||
process { | ||
""" | ||
input[0] = Channel.of([ | ||
[ id:'test'], | ||
file(params.modules_testdata_base_path + 'proteomics/msspectra/PXD012083_e005640_II.raw', checkIfExists: true) | ||
]) | ||
""" | ||
} | ||
} | ||
run("OPENMS_DECOYDATABASE") { | ||
script "../../../openms/decoydatabase/main.nf" | ||
process { | ||
""" | ||
input[0] = Channel.of([ | ||
[ id:'test'], | ||
file(params.modules_testdata_base_path + 'proteomics/database/UP000005640_9606.fasta', checkIfExists: true) | ||
]) | ||
""" | ||
} | ||
} | ||
run("OPENMSTHIRDPARTY_COMETADAPTER") { | ||
script "../../../openmsthirdparty/cometadapter/main.nf" | ||
process { | ||
""" | ||
input[0] = THERMORAWFILEPARSER.out.spectra.join(OPENMS_DECOYDATABASE.out.decoy_fasta) | ||
""" | ||
} | ||
} | ||
} | ||
|
||
test("proteomics - openms - mass_error") { | ||
when { | ||
process { | ||
""" | ||
input[0] = THERMORAWFILEPARSER.out.spectra.join(OPENMSTHIRDPARTY_COMETADAPTER.out.idxml) | ||
""" | ||
} | ||
} | ||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("proteomics - openms - mass_error - stub") { | ||
options "-stub" | ||
when { | ||
process { | ||
""" | ||
input[0] = THERMORAWFILEPARSER.out.spectra.join(OPENMSTHIRDPARTY_COMETADAPTER.out.idxml) | ||
""" | ||
} | ||
} | ||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
modules/nf-core/openms/idmassaccuracy/tests/main.nf.test.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"proteomics - openms - mass_error - stub": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_frag_mass_err.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"1": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_prec_mass_err.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"2": [ | ||
"versions.yml:md5,84212cbbf016bbcae0eb1bb0fcc30db7" | ||
], | ||
"frag_err": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_frag_mass_err.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"prec_err": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_prec_mass_err.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,84212cbbf016bbcae0eb1bb0fcc30db7" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-09-16T05:12:06.655389198" | ||
}, | ||
"proteomics - openms - mass_error": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_frag_mass_err.tsv:md5,c659254bc1305edde65eca890a6cf36f" | ||
] | ||
], | ||
"1": [ | ||
|
||
], | ||
"2": [ | ||
"versions.yml:md5,84212cbbf016bbcae0eb1bb0fcc30db7" | ||
], | ||
"frag_err": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
"test_frag_mass_err.tsv:md5,c659254bc1305edde65eca890a6cf36f" | ||
] | ||
], | ||
"prec_err": [ | ||
|
||
], | ||
"versions": [ | ||
"versions.yml:md5,84212cbbf016bbcae0eb1bb0fcc30db7" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-09-16T05:11:55.087464408" | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
modules/nf-core/openms/idmassaccuracy/tests/nextflow.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
process { | ||
|
||
withName:OPENMSTHIRDPARTY_COMETADAPTER { | ||
ext.args = [ | ||
"-instrument low_res", | ||
"-fragment_bin_offset 0.4", | ||
"-precursor_mass_tolerance 5", | ||
"-precursor_error_units 'ppm'", | ||
"-fragment_mass_tolerance 0.50025", | ||
"-digest_mass_range '800:5000'", | ||
"-max_variable_mods_in_peptide 1", | ||
"-precursor_charge '2:5'", | ||
"-activation_method 'CID'", | ||
"-variable_modifications 'Oxidation (M)'", | ||
"-enzyme 'unspecific cleavage'", | ||
"-spectrum_batch_size 0" | ||
].join(' ').trim() | ||
} | ||
|
||
withName:OPENMS_IDMASSACCURACY { | ||
ext.args = [ | ||
"-precursor_error_ppm", | ||
"-fragment_mass_tolerance 0.50025" | ||
].join(' ').trim() | ||
} | ||
|
||
} |