Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add m/z shift option #24

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/source/workflow_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 ``''``.
Expand Down
41 changes: 27 additions & 14 deletions modules/msconvert.nf
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion modules/skyline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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'"' '/<view name=/ { print $2 }' "$skyrfile" | while read reportname; do
Expand Down
2 changes: 2 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion resources/pipeline.config
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -114,4 +115,4 @@ mail {
smtp.starttls.enable = true
smtp.starttls.required = false
mail.smtp.ssl.protocols = 'TLSv1.2'
}
}
4 changes: 1 addition & 3 deletions workflows/get_mzmls.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 1 addition & 3 deletions workflows/get_pdc_files.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading