diff --git a/modules/bigbio/onsite/environment.yml b/modules/bigbio/onsite/environment.yml index d1890de..dccfdef 100644 --- a/modules/bigbio/onsite/environment.yml +++ b/modules/bigbio/onsite/environment.yml @@ -3,4 +3,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::pyonsite=0.0.4 + - bioconda::pyonsite=0.0.5 diff --git a/modules/bigbio/onsite/main.nf b/modules/bigbio/onsite/main.nf index 0b0f55c..c59d652 100644 --- a/modules/bigbio/onsite/main.nf +++ b/modules/bigbio/onsite/main.nf @@ -4,14 +4,14 @@ process ONSITE { label 'onsite' container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container - ? 'oras://ghcr.io/bigbio/pyonsite-sif:0.0.4' - : 'ghcr.io/bigbio/pyonsite:0.0.4'}" + ? 'oras://ghcr.io/bigbio/pyonsite-sif:0.0.5' + : 'ghcr.io/bigbio/pyonsite:0.0.5'}" input: tuple val(meta), path(mzml_file), path(id_file) output: - tuple val(meta), path("${prefix}_*.idparquet"), emit: ptm_in_id_onsite + tuple val(meta), path("${prefix}_*.{idparquet,idXML,mzIdentML}"), emit: ptm_in_id_onsite path "versions.yml", emit: versions path "*.log", emit: log @@ -36,6 +36,12 @@ process ONSITE { def fragment_unit = '' def add_decoys = onsite_add_decoys ? '--add-decoys' : '' def debug = params.onsite_debug ? '--debug' : '' + def suffix = id_file.name.endsWith(".idparquet") + ? "idparquet" + : id_file.name.endsWith(".idXML") + ? "idXML" + : id_file.name.endsWith(".mzIdentML") + ? "mzIdentML" : "idparquet" // Build algorithm-specific command def algorithm_cmd = '' @@ -48,7 +54,7 @@ process ONSITE { onsite ascore \\ -in ${mzml_file} \\ -id ${id_file} \\ - -out ${prefix}_ascore.idparquet \\ + -out ${prefix}_ascore.${suffix} \\ --fragment-mass-tolerance ${fragment_tolerance} \\ --fragment-mass-unit ${fragment_unit}${optional_flags ? ' \\\n ' + optional_flags : ''} """ @@ -61,7 +67,7 @@ process ONSITE { onsite phosphors \\ -in ${mzml_file} \\ -id ${id_file} \\ - -out ${prefix}_phosphors.idparquet \\ + -out ${prefix}_phosphors.${suffix} \\ --fragment-mass-tolerance ${fragment_tolerance} \\ --fragment-mass-unit ${fragment_unit}${optional_flags ? ' \\\n ' + optional_flags : ''} ${args} @@ -92,7 +98,7 @@ process ONSITE { onsite lucxor \\ -in ${mzml_file} \\ -id ${id_file} \\ - -out ${prefix}_lucxor.idparquet \\ + -out ${prefix}_lucxor.${suffix} \\ --fragment-method ${fragment_method} \\ --fragment-mass-tolerance ${fragment_tolerance} \\ --fragment-error-units ${fragment_unit} \\ diff --git a/modules/bigbio/onsite/meta.yml b/modules/bigbio/onsite/meta.yml index d82458b..b8f4e16 100644 --- a/modules/bigbio/onsite/meta.yml +++ b/modules/bigbio/onsite/meta.yml @@ -35,8 +35,8 @@ input: ontologies: [] - id_file: type: file - description: Protein/peptide identifications file in idparquet format - pattern: "*.idparquet" + description: Protein/peptide identifications file + pattern: "*.{idparquet,idXML,mzIdentML}" ontologies: [] output: ptm_in_id_onsite: @@ -46,9 +46,9 @@ output: Groovy Map containing sample information - ${prefix}_*.idparquet: type: file - description: Output idparquet file containing PTM localization results from + description: Output id file containing PTM localization results from onsite - pattern: "${prefix}_*.idparquet" + pattern: "${prefix}_*.{idparquet,idXML,mzIdentML}" ontologies: [] log: - "*.log": diff --git a/modules/bigbio/onsite/tests/main.nf.test b/modules/bigbio/onsite/tests/main.nf.test index 340d85e..587af85 100644 --- a/modules/bigbio/onsite/tests/main.nf.test +++ b/modules/bigbio/onsite/tests/main.nf.test @@ -90,6 +90,87 @@ nextflow_process { } } + test("Should run AScore algorithm with idXML input") { + + when { + process { + """ + input[0] = [ + [ id: 'test', mzml_id: 'test_sample' ], + file(params.test_data['proteomics']['onsite']['idxml_mzml'], checkIfExists: true), + file(params.test_data['proteomics']['onsite']['idxml'], checkIfExists: true) + ] + """ + } + params { + onsite_algorithm = 'ascore' + } + } + + then { + assert process.success + assert snapshot(process.out.versions).match("versions_ascore_idxml") + assert process.out.ptm_in_id_onsite.size() == 1 + assert process.out.log.size() == 1 + // Check output file has correct naming + assert process.out.ptm_in_id_onsite[0][1].toString().endsWith('_ascore.idXML') + } + } + + test("Should run PhosphoRS algorithm with idXML input") { + + when { + process { + """ + input[0] = [ + [ id: 'test', mzml_id: 'test_sample' ], + file(params.test_data['proteomics']['onsite']['idxml_mzml'], checkIfExists: true), + file(params.test_data['proteomics']['onsite']['idxml'], checkIfExists: true) + ] + """ + } + params { + onsite_algorithm = 'phosphors' + } + } + + then { + assert process.success + assert snapshot(process.out.versions).match("versions_phosphors_idxml") + assert process.out.ptm_in_id_onsite.size() == 1 + assert process.out.log.size() == 1 + // Check output file has correct naming + assert process.out.ptm_in_id_onsite[0][1].toString().endsWith('_phosphors.idXML') + } + } + + test("Should run LucXor algorithm with idXML input") { + + when { + process { + """ + input[0] = [ + [ id: 'test', mzml_id: 'test_sample' ], + file(params.test_data['proteomics']['onsite']['idxml_mzml'], checkIfExists: true), + file(params.test_data['proteomics']['onsite']['idxml'], checkIfExists: true) + ] + """ + } + params { + onsite_algorithm = 'lucxor' + } + } + + then { + assert process.success + assert snapshot(process.out.versions).match("versions_lucxor_idxml") + assert process.out.ptm_in_id_onsite.size() == 1 + assert process.out.log.size() == 1 + // Check output file has correct naming + assert process.out.ptm_in_id_onsite[0][1].toString().endsWith('_lucxor.idXML') + } + } + test("Should run stub mode") { options "-stub" diff --git a/tests/config/test_data.config b/tests/config/test_data.config index bb0b73b..39b7290 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -22,6 +22,8 @@ params { // Test data for onsite PTM localization module mzml = "https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/quantms-ci-github/onsite/Phospho_redissolve_final_01.mzML" idparquet = System.getenv('ONSITE_IDPARQUET_PATH') ?: "https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/quantms-ci-github/onsite/Phospho_redissolve_final_01_clean_perc.idparquet" + idxml = "https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/quantms-ci-github/onsite/1_consensus_fdr_filter_pep.idXML" + idxml_mzml = "https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/quantms-ci-github/onsite/1.mzML" } qpx { // DIA-NN results for QPX export testing (reuses pmultiqc DIANN example)