From 82fda79c12127cc33b35da65ce30c81266a6e9dd Mon Sep 17 00:00:00 2001 From: mauraisa Date: Fri, 11 Oct 2024 17:48:37 -0700 Subject: [PATCH 1/3] Change how MSCONVERT storeDir path is structured and add mz_shift_ppm parameter --- modules/msconvert.nf | 41 +++++++++++++++++++++++++------------- nextflow.config | 2 ++ resources/pipeline.config | 3 ++- workflows/get_mzmls.nf | 4 +--- workflows/get_pdc_files.nf | 4 +--- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/modules/msconvert.nf b/modules/msconvert.nf index 38e9935..3eec184 100644 --- a/modules/msconvert.nf +++ b/modules/msconvert.nf @@ -1,5 +1,30 @@ + +/** + * Generate the msconvert command based off user defined parameters. + */ +def msconvert_command() { + return """ + wine msconvert -v --zlib --mzML --64 \ + --ignoreUnknownInstrumentError --filter "peakPicking true 1-" \ + ${params.msconvert.do_demultiplex ? '--filter "demultiplex optimization=overlap_only"' : ''} \ + ${params.msconvert.do_simasspectra ? '--simAsSpectra' : ''} \ + ${params.msconvert.mz_shift_ppm == null ? '' : '--filter "mzShift ' + "${params.msconvert.mz_shift_ppm}" + 'ppm msLevels=1-"'} \ + """ +} + +/** + * Calculate a unique hash for msconvert configuration. + * + * The hash combines the text of the msconvert command without the raw file and + * the proteowizard container. + */ +def msconvert_cache_dir() { + def str = params.images.proteowizard + msconvert_command() + return str.md5() +} + process MSCONVERT { - storeDir "${params.mzml_cache_directory}/${workflow.commitId}/${params.msconvert.do_demultiplex}/${params.msconvert.do_simasspectra}" + storeDir "${params.mzml_cache_directory}/${msconvert_cache_dir()}" publishDir params.output_directories.msconvert, pattern: "*.mzML", failOnError: true, mode: 'copy', enabled: params.msconvert_only && !params.panorama.upload label 'process_medium' label 'process_high_memory' @@ -8,26 +33,14 @@ process MSCONVERT { input: path raw_file - val do_demultiplex - val do_simasspectra output: path("${raw_file.baseName}.mzML"), emit: mzml_file script: - demultiplex_param = do_demultiplex ? '--filter "demultiplex optimization=overlap_only"' : '' - simasspectra = do_simasspectra ? '--simAsSpectra' : '' - """ - wine msconvert \ - ${raw_file} \ - -v \ - --zlib \ - --mzML \ - --ignoreUnknownInstrumentError \ - --filter "peakPicking true 1-" \ - --64 ${simasspectra} ${demultiplex_param} + ${msconvert_command()} ${raw_file} """ stub: diff --git a/nextflow.config b/nextflow.config index 17ff899..59a6988 100644 --- a/nextflow.config +++ b/nextflow.config @@ -57,8 +57,10 @@ params { email = null // email to notify of workflow outcome, leave null to send no email skyline.template_file = null // the skyline template, if null use default_skyline_template_file panorama_upload = false; // whether or not to upload the results to PanoramaWeb + msconvert.do_demultiplex = true; // whether or not to demultiplex with msconvert msconvert.do_simasspectra = true; // whether or not to do simAsSpectra with msconvert + msconvert.mz_shift_ppm = null // shift all mz values by n ppn. // If set to true, only run msconvert and stop. Resulting mzML files will be saved to the // "msconvert" subdirectory of the results directory. diff --git a/resources/pipeline.config b/resources/pipeline.config index 4e72ee3..5b0bb49 100644 --- a/resources/pipeline.config +++ b/resources/pipeline.config @@ -45,6 +45,7 @@ params { // options for msconvert msconvert.do_demultiplex = true; // whether or not to demultiplex with msconvert msconvert.do_simasspectra = true; // whether or not to do simAsSpectra with msconvert + msconvert.mz_shift_ppm = null // shift all mz values by n ppn. // default parameters for Encyclopedia searches, can be overridden encyclopedia.chromatogram.params = '-enableAdvancedOptions -v2scoring' @@ -114,4 +115,4 @@ mail { smtp.starttls.enable = true smtp.starttls.required = false mail.smtp.ssl.protocols = 'TLSv1.2' -} \ No newline at end of file +} diff --git a/workflows/get_mzmls.nf b/workflows/get_mzmls.nf index b6b4b98..34322a9 100644 --- a/workflows/get_mzmls.nf +++ b/workflows/get_mzmls.nf @@ -80,9 +80,7 @@ workflow get_mzmls { }.set{ms_file_ch} // Convert raw files if applicable - MSCONVERT(ms_file_ch.raw, - params.msconvert.do_demultiplex, - params.msconvert.do_simasspectra) + MSCONVERT(ms_file_ch.raw) mzml_ch = MSCONVERT.out.concat(ms_file_ch.mzml) } diff --git a/workflows/get_pdc_files.nf b/workflows/get_pdc_files.nf index d039204..1f678f8 100644 --- a/workflows/get_pdc_files.nf +++ b/workflows/get_pdc_files.nf @@ -42,9 +42,7 @@ workflow get_pdc_files { | map{row -> tuple(row.url, row.file_name, row.md5sum)} \ | GET_FILE - MSCONVERT(GET_FILE.out.downloaded_file, - params.msconvert.do_demultiplex, - params.msconvert.do_simasspectra) + MSCONVERT(GET_FILE.out.downloaded_file) wide_mzml_ch = MSCONVERT.out.mzml_file } From f2b0b1fc0a29230326122970c5dbf6d5736f0c08 Mon Sep 17 00:00:00 2001 From: mauraisa Date: Fri, 11 Oct 2024 17:47:19 -0700 Subject: [PATCH 2/3] Add mz_shift_ppm parameter to docs. --- docs/source/workflow_parameters.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/workflow_parameters.rst b/docs/source/workflow_parameters.rst index c88bee9..2b53e28 100644 --- a/docs/source/workflow_parameters.rst +++ b/docs/source/workflow_parameters.rst @@ -101,6 +101,9 @@ The ``params`` Section * - - ``msconvert.do_simasspectra`` - If starting with raw files, this is the value used by ``msconvert`` for the ``do_simasspectra`` parameter. Default: ``true``. + * - + - ``msconvert.mz_shift_ppm`` + - If starting with raw files, ``msconvert`` will shift all mz values by ``n`` ppm when converting to ``mzML``. If ``null`` the mz values are not shifed. Default: ``null``. * - - ``encyclopedia.chromatogram.params`` - If you are generating a chromatogram library for quantification, this is the command line options passed to EncyclopeDIA during the chromatogram generation step. Default: ``'-enableAdvancedOptions -v2scoring'`` If you do not wish to pass any options to EncyclopeDIA, this must be set to ``''``. From 04383014df9c4141d3e4729b7bc13438f942ed74 Mon Sep 17 00:00:00 2001 From: mauraisa Date: Fri, 11 Oct 2024 17:34:57 -0700 Subject: [PATCH 3/3] Override conflicting skyline reports. --- modules/skyline.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/skyline.nf b/modules/skyline.nf index 844e5c4..8de7886 100644 --- a/modules/skyline.nf +++ b/modules/skyline.nf @@ -304,7 +304,7 @@ process SKYLINE_RUN_REPORTS { for skyrfile in ./*.skyr; do # Add report to document - echo "--report-add=\\"${skyrfile}\\"" >> export_reports.bat + echo "--report-add=\\"${skyrfile}\\" --report-conflict-resolution=overwrite" >> export_reports.bat # Export report awk -F'"' '/