Skip to content
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
57 changes: 10 additions & 47 deletions main.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nextflow.enable.dsl=2

nextflow.preview.output = true
//
// Nextflow pipeline for peptide identification with multiple search engines and post-processing tools
//

// default python image
params.python_image = 'ghcr.io/medbioinf/pipeline-of-identification:latest'
Expand Down Expand Up @@ -30,6 +30,7 @@ params.execute_sage = true
params.execute_xtandem = true

// default parameter files
params.outdir = './'
params.comet_params_file = "${baseDir}/config/comet.params"
params.maxquant_params_file = "${baseDir}/config/mqpar.xml"
params.msamanda_config_file = "${baseDir}/config/msamanda_settings.xml"
Expand Down Expand Up @@ -86,7 +87,11 @@ workflow {
}

if (params.raw_files) {
raw_files = Channel.fromPath(params.raw_files).flatten()
if (params.is_timstof) {
raw_files = Channel.fromPath(params.raw_files, type: 'dir').flatten()
} else {
raw_files = Channel.fromPath(params.raw_files).flatten()
}
raw_files_info = raw_files
} else {
raw_files_info = "no raw spectra given"
Expand Down Expand Up @@ -143,7 +148,7 @@ workflow {

if (params.execute_maxquant) {
maxquant_params_file = Channel.fromPath(params.maxquant_params_file).first()
maxquant_identification(maxquant_params_file, fasta_target, mzmls, params.precursor_tol_ppm)
maxquant_identification(maxquant_params_file, fasta_target, raw_files, mzmls, params.precursor_tol_ppm)
}

if (params.execute_msamanda) {
Expand Down Expand Up @@ -171,45 +176,3 @@ workflow {
xtandem_identification(xtandem_config_file, fasta_target_decoy, mzmls, params.precursor_tol_ppm, params.fragment_tol_da)
}
}

output {
'mzmls' {
enabled params.keep_mzmls
path 'mzmls'
}

'comet' {
enabled params.execute_comet
path 'comet'
}

'maxquant' {
enabled params.execute_maxquant
path 'maxquant'
}

'msamanda' {
enabled params.execute_msamanda
path 'msamanda'
}

'msfragger' {
enabled params.execute_msfragger
path 'msfragger'
}

'msgfplus' {
enabled params.execute_msgfplus
path 'msgfplus'
}

'sage' {
enabled params.execute_sage
path 'sage'
}

'xtandem' {
enabled params.execute_xtandem
path 'xtandem'
}
}
22 changes: 7 additions & 15 deletions src/identification/comet_identification.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,15 @@ workflow comet_identification {
psm_tsvs = psm_tsvs_and_pin.psm_tsv
pin_files = psm_tsvs_and_pin.pin_file

pout_files = psm_percolator(pin_files)
psm_percolator(pin_files, 'comet')

psm_tsvs_and_mzmls = psm_tsvs.map { it -> [ it.name, it.name.take(it.name.lastIndexOf('.mzid')) + '.mzML' ] }
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.comet_psm_id_pattern, params.comet_spectrum_id_pattern, '^DECOY_', 'comet')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.comet_scan_id_pattern)
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.comet_spectrum_id_pattern, 'comet')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.comet_scan_id_pattern, 'comet')

// perform percolation
ms2rescore_percolator_results = ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins)
oktoberfest_percolator_results = oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins)

publish:
comet_mzids >> 'comet'
psm_tsvs >> 'comet'
pin_files >> 'comet'
pout_files >> 'comet'
ms2rescore_pins >> 'comet'
ms2rescore_percolator_results >> 'comet'
oktoberfest_pins >> 'comet'
oktoberfest_percolator_results >> 'comet'
ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins, 'comet')
oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins, 'comet')
}


Expand Down Expand Up @@ -99,6 +89,8 @@ process identification_with_comet {
memory { params.comet_mem }
container { params.comet_image }

publishDir "${params.outdir}/comet", mode: 'copy'

input:
path fasta
path mzmls
Expand Down
27 changes: 10 additions & 17 deletions src/identification/maxquant_identification.nf
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ workflow maxquant_identification {
take:
maxquant_params_file
fasta
raw_files
mzmls
precursor_tol_ppm

main:
// for TimsTOF data, always process the .d path instead of the mzML files
if (params.is_timstof) {
process_files = Channel.fromPath(params.raw_files).flatten()
process_files = raw_files
} else {
process_files = mzmls
}
Expand All @@ -41,7 +42,7 @@ workflow maxquant_identification {
psm_tsvs = psm_tsvs_and_pin.psm_tsv
pin_files = psm_tsvs_and_pin.pin_file

pout_files = psm_percolator(pin_files)
psm_percolator(pin_files, 'maxquant')

if (params.maxquant_psm_id_pattern) {
psm_id_pattern = params.maxquant_psm_id_pattern
Expand Down Expand Up @@ -75,22 +76,12 @@ workflow maxquant_identification {
psm_tsvs_and_spectra_oktoberfest = psm_tsvs_and_spectrafiles
}

ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_spectrafiles, psm_tsvs.collect(), process_files.collect(), psm_id_pattern, spectrum_id_pattern, '', 'maxquant')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_spectra_oktoberfest, psm_tsvs.collect(), mzmls.collect(), scan_id_pattern)
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_spectrafiles, psm_tsvs.collect(), process_files.collect(), spectrum_id_pattern, 'maxquant')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_spectra_oktoberfest, psm_tsvs.collect(), mzmls.collect(), scan_id_pattern, 'maxquant')

// perform percolation
ms2rescore_percolator_results = ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins)
oktoberfest_percolator_results = oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins)

publish:
maxquant_results >> 'maxquant'
psm_tsvs >> 'maxquant'
pin_files >> 'maxquant'
pout_files >> 'maxquant'
ms2rescore_pins >> 'maxquant'
ms2rescore_percolator_results >> 'maxquant'
oktoberfest_pins >> 'maxquant'
oktoberfest_percolator_results >> 'maxquant'
ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins, 'maxquant')
oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins, 'maxquant')
}


Expand All @@ -99,8 +90,10 @@ process identification_with_maxquant {
memory { params.maxquant_mem }
container { params.maxquant_image }

publishDir "${params.outdir}/maxquant", mode: 'copy'

stageInMode 'copy' // MaxQuant respectively Mono does not support symlinks

input:
path maxquant_params_file
path fasta
Expand Down
22 changes: 7 additions & 15 deletions src/identification/msamanda_identification.nf
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,15 @@ workflow msamanda_identification {
psm_tsvs = psm_tsvs_and_pin.psm_tsv
pin_files = psm_tsvs_and_pin.pin_file

pout_files = psm_percolator(pin_files)
psm_percolator(pin_files, 'msamanda')

psm_tsvs_and_mzmls = psm_tsvs.map { it -> [ it.name, it.name.take(it.name.lastIndexOf('_msamanda.csv')) + '.mzML' ] }
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msamanda_psm_id_pattern, params.msamanda_spectrum_id_pattern, '^DECOY_', 'msamanda')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msamanda_scan_id_pattern)
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msamanda_spectrum_id_pattern, 'msamanda')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msamanda_scan_id_pattern, 'msamanda')

// perform percolation
ms2rescore_percolator_results = ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins)
oktoberfest_percolator_results = oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins)

publish:
msamanda_results.msamanda_csv >> 'msamanda'
psm_tsvs >> 'msamanda'
pin_files >> 'msamanda'
pout_files >> 'msamanda'
ms2rescore_pins >> 'msamanda'
ms2rescore_percolator_results >> 'msamanda'
oktoberfest_pins >> 'msamanda'
oktoberfest_percolator_results >> 'msamanda'
ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins, 'msamanda')
oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins, 'msamanda')
}


Expand All @@ -68,6 +58,8 @@ process identification_with_msamanda {
memory { params.msamanda_mem }
container { params.msamanda_image }

publishDir "${params.outdir}/msamanda", mode: 'copy'

input:
path msamanda_config_file
path fasta
Expand Down
22 changes: 7 additions & 15 deletions src/identification/msfragger_identification.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,15 @@ workflow msfragger_identification {
psm_tsvs = psm_tsvs_and_pin.psm_tsv
pin_files = psm_tsvs_and_pin.pin_file

pout_files = psm_percolator(pin_files)
psm_percolator(pin_files, 'msfragger')

psm_tsvs_and_mzmls = psm_tsvs.map { it -> [ it.name, it.name.take(it.name.lastIndexOf('.pepXML')) + '.mzML' ] }
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msfragger_psm_id_pattern, params.msfragger_spectrum_id_pattern, '^DECOY_', 'msfragger')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msfragger_scan_id_pattern)
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msfragger_spectrum_id_pattern, 'msfragger')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msfragger_scan_id_pattern, 'msfragger')

// perform percolation
ms2rescore_percolator_results = ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins)
oktoberfest_percolator_results = oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins)

publish:
fragger_results_pepxml >> 'msfragger'
psm_tsvs >> 'msfragger'
pin_files >> 'msfragger'
pout_files >> 'msfragger'
ms2rescore_pins >> 'msfragger'
ms2rescore_percolator_results >> 'msfragger'
oktoberfest_pins >> 'msfragger'
oktoberfest_percolator_results >> 'msfragger'
ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins, 'msfragger')
oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins, 'msfragger')
}


Expand Down Expand Up @@ -100,6 +90,8 @@ process identification_with_msfragger {
cpus { params.msfragger_threads }
memory { params.msfragger_mem_gb + " GB" }
container { params.msfragger_image }

publishDir "${params.outdir}/msfragger", mode: 'copy'

input:
path fasta
Expand Down
27 changes: 11 additions & 16 deletions src/identification/msgfplus_identification.nf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ workflow msgfplus_identification {

fasta_idx_mzml_chunk_combo = fasta_index.combine(mzmls_to_chunks)

msgfplus_results = identification_with_msgfplus(msgfplus_params_file, fasta_idx_mzml_chunk_combo, precursor_tol_ppm)
msgfplus_results = identification_with_msgfplus(msgfplus_params_file, fasta_idx_mzml_chunk_combo, precursor_tol_ppm, (params.msgfplus_split_fasta == 0))

if ((params.msgfplus_split_fasta > 0)) {
grouped_results = msgfplus_results.map { it ->
Expand Down Expand Up @@ -89,36 +89,29 @@ workflow msgfplus_identification {
psm_tsvs = psm_tsvs_and_pin.psm_tsv
pin_files = psm_tsvs_and_pin.pin_file

pout_files = psm_percolator(pin_files)
psm_percolator(pin_files, 'msgfplus')

psm_tsvs_and_mzmls = psm_tsvs.map { it -> [ it.name, it.name.take(it.name.lastIndexOf('.mzid')) + '.mzML' ] }
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msgfplus_psm_id_pattern, params.msgfplus_spectrum_id_pattern, '^DECOY_', 'msgfplus')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msgfplus_scan_id_pattern)
ms2rescore_pins = ms2rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msgfplus_spectrum_id_pattern, 'msgfplus')
oktoberfest_pins = oktoberfest_rescore_workflow(psm_tsvs_and_mzmls, psm_tsvs.collect(), mzmls.collect(), params.msgfplus_scan_id_pattern, 'msgfplus')

// perform percolation
ms2rescore_percolator_results = ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins)
oktoberfest_percolator_results = oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins)

publish:
fasta_merged_results.map{ it -> it[1] } >> 'msgfplus'
psm_tsvs >> 'msgfplus'
pin_files >> 'msgfplus'
pout_files >> 'msgfplus'
ms2rescore_pins >> 'msgfplus'
ms2rescore_percolator_results >> 'msgfplus'
oktoberfest_pins >> 'msgfplus'
oktoberfest_percolator_results >> 'msgfplus'
ms2rescore_percolator(ms2rescore_pins.ms2rescore_pins, 'msgfplus')
oktoberfest_percolator(oktoberfest_pins.oktoberfest_pins, 'msgfplus')
}

process identification_with_msgfplus {
cpus { params.msgfplus_threads }
memory { params.msgfplus_mem_gb + " GB" }
container { params.msgfplus_image }

publishDir "${params.outdir}/msgfplus", mode: 'copy', enabled: { publish_results }

input:
path msgfplus_params_file
tuple path(fasta), path(canno), path(cnlcp), path(csarr), path(cseq), val(original_mzml_basename), path(mzml)
val precursor_tol_ppm
val publish_results

output:
tuple val(original_mzml_basename), path("${mzml.baseName}*.mzid")
Expand Down Expand Up @@ -199,6 +192,8 @@ process mzid_merger {
memory "8 GB"
container { params.mzidmerger_image }

publishDir "${params.outdir}/msgfplus", mode: 'copy'

input:
tuple val(original_mzml_basename), val(mzml_split), path(mzid_files)

Expand Down
Loading