Skip to content

Commit 274d082

Browse files
authored
Merge pull request #378 from daichengxin/dev
ms2rescore for quant workflow and fixed some bugs
2 parents d64652b + 4111c36 commit 274d082

File tree

12 files changed

+254
-41
lines changed

12 files changed

+254
-41
lines changed

bin/ms2rescore_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def parse_cli_arguments_to_config(**kwargs):
3636
config["ms2rescore"]["feature_generators"]["basic"] = {}
3737
if "ms2pip" in feature_generators:
3838
config["ms2rescore"]["feature_generators"]["ms2pip"] = {
39+
"model_dir": kwargs["ms2pip_model_dir"],
3940
"model": kwargs["ms2pip_model"],
4041
"ms2_tolerance": kwargs["ms2_tolerance"],
4142
}
@@ -147,6 +148,7 @@ def filter_out_artifact_psms(
147148
default="",
148149
)
149150
@click.option("-pipm", "--ms2pip_model", help="MS²PIP model (default: `Immuno-HCD`)", type=str, default="Immuno-HCD")
151+
@click.option("-md", "--ms2pip_model_dir", help="The path of MS²PIP model (default: `./`)", type=str, default="./")
150152
@click.option(
151153
"-ms2tol", "--ms2_tolerance", help="Fragment mass tolerance [Da](default: `0.02`)", type=float, default=0.02
152154
)

conf/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ process {
317317
]
318318
}
319319

320-
withName: '.*:DDA_ID:SAGEFEATURE' {
320+
withName: '.*:SAGEFEATURE' {
321321
publishDir = [
322322
path: { "${params.outdir}/addsagefeature" },
323323
pattern: "*.log",

modules/local/extract_psm/main.nf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ process PSMCONVERSION {
22
tag "$meta.mzml_id"
33
label 'process_medium'
44

5-
conda "bioconda::pyopenms=2.8.0"
5+
conda "bioconda::pyopenms=3.1.0"
66
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
7-
container "https://depot.galaxyproject.org/singularity/pyopenms:2.8.0--py38hd8d5640_1"
7+
container "https://depot.galaxyproject.org/singularity/pyopenms:3.1.0--py39h9b8898c_0"
88
} else {
9-
container "biocontainers/pyopenms:2.8.0--py38hd8d5640_1"
9+
container "biocontainers/pyopenms:3.1.0--py39h9b8898c_0"
1010
}
1111

1212
input:

modules/local/ms2rescore/main.nf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ process MS2RESCORE {
22
tag "$meta.mzml_id"
33
label 'process_high'
44

5-
conda "bioconda::ms2rescore=3.0.2 bioconda::psm-utils=0.8.0 conda-forge::pydantic=1.10"
5+
conda "bioconda::ms2rescore=3.0.3 bioconda::psm-utils=0.8.0 conda-forge::pydantic=1.10"
66
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7-
'https://depot.galaxyproject.org/singularity/ms2rescore:3.0.2--pyhdfd78af_0':
8-
'biocontainers/ms2rescore:3.0.2--pyhdfd78af_0' }"
7+
'https://depot.galaxyproject.org/singularity/ms2rescore:3.0.3--pyhdfd78af_0':
8+
'biocontainers/ms2rescore:3.0.3--pyhdfd78af_0' }"
99

1010
// userEmulation settings when docker is specified
1111
containerOptions = (workflow.containerEngine == 'docker') ? '-u $(id -u) -e "HOME=${HOME}" -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/group:/etc/group:ro -v $HOME:$HOME' : ''
@@ -48,6 +48,7 @@ process MS2RESCORE {
4848
--spectrum_path . \\
4949
--ms2_tolerance $ms2_tolerence \\
5050
--output_path ${idxml.baseName}_ms2rescore.idXML \\
51+
--ms2pip_model_dir ${params.ms2pip_model_dir} \\
5152
--processes $task.cpus \\
5253
--id_decoy_pattern $decoy_pattern \\
5354
$args \\

modules/local/mzmlstatistics/main.nf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ process MZMLSTATISTICS {
33
label 'process_medium'
44
label 'process_single'
55

6-
conda "bioconda::pyopenms=2.8.0"
6+
conda "bioconda::pyopenms=3.1.0"
77
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
8-
container "https://depot.galaxyproject.org/singularity/pyopenms:2.8.0--py38hd8d5640_1"
8+
container "https://depot.galaxyproject.org/singularity/pyopenms:3.1.0--py39h9b8898c_0"
99
} else {
10-
container "biocontainers/pyopenms:2.8.0--py38hd8d5640_1"
10+
container "biocontainers/pyopenms:3.1.0--py39h9b8898c_0"
1111
}
1212

1313
input:

nextflow.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ params {
106106

107107
// MSRESCORE flags
108108
ms2rescore = false
109+
ms2pip_model_dir = null
109110
rescore_range = 'independent_run'
110111
ms2pip_model = 'HCD2021'
111112
feature_generators = 'deeplc,ms2pip'
@@ -124,7 +125,7 @@ params {
124125
// Percolator flags
125126
train_FDR = 0.05
126127
test_FDR = 0.05
127-
fdr_level = 'peptide_level_fdrs'
128+
fdr_level = 'psm_level_fdrs'
128129
klammer = false
129130
description_correct_features = 0
130131
subset_max_train = 300000

nextflow_schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,11 @@
460460
"fa_icon": "fas fa-font",
461461
"default": "HCD2021"
462462
},
463+
"ms2pip_model_dir": {
464+
"type": "string",
465+
"description": "The path of ms2pip model files. Providing model file to avoid repeated download and slow internet connection",
466+
"fa_icon": "fas fa-font"
467+
},
463468
"feature_generators": {
464469
"type": "string",
465470
"description": "Which feature generator to generate feature.",
@@ -525,7 +530,7 @@
525530
"fdr_level": {
526531
"type": "string",
527532
"description": "Calculate FDR on PSM ('psm_level_fdrs') or peptide level ('peptide_level_fdrs')?",
528-
"default": "peptide_level_fdrs",
533+
"default": "psm_level_fdrs",
529534
"fa_icon": "fas fa-list-ol",
530535
"enum": ["peptide_level_fdrs", "psm_level_fdrs"]
531536
},

subworkflows/local/dda_id.nf

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ workflow DDA_ID {
8686
} else if (params.rescore_range == "by_sample") {
8787
// Sample map
8888
GETSAMPLE(ch_expdesign)
89-
ch_expdesign_sample = EXTRACT_SAMPLE.out.ch_expdesign_sample
89+
ch_expdesign_sample = GETSAMPLE.out.ch_expdesign_sample
9090
ch_expdesign_sample.splitCsv(header: true, sep: '\t')
9191
.map { get_sample_map(it) }.set{ sample_map_idv }
9292

@@ -155,7 +155,7 @@ workflow DDA_ID {
155155
IDSCORESWITCHER(MS2RESCORE.out.idxml.combine(Channel.value("PEP")))
156156
ch_software_versions = ch_software_versions.mix(IDSCORESWITCHER.out.version)
157157
ch_consensus_input = IDSCORESWITCHER.out.id_score_switcher.combine(Channel.value("MS:1001491"))
158-
ch_rescoring_results = IDSCORESWITCHER.out.id_files_ForIDPEP
158+
ch_rescoring_results = IDSCORESWITCHER.out.ch_consensus_input
159159
} else {
160160
ch_fdridpep = Channel.empty()
161161
if (params.search_engines.split(",").size() == 1) {
@@ -224,13 +224,25 @@ def convert_exp_meta(Map meta, value, file_name, sample_map) {
224224
} else if (value == "sample_id") {
225225
tag = file(file_name).name.lastIndexOf('_perc.idXML')
226226
if (tag == -1) {
227-
position = file(file_name).name.lastIndexOf('_sage.idXML')
228-
if (position == -1) {
229-
position = file(file_name).name.lastIndexOf('_comet_feat.idXML')
227+
ifms2rescore = file(file_name).name.lastIndexOf('_ms2rescore_')
228+
if (ifms2rescore == -1) {
229+
position = file(file_name).name.lastIndexOf('_sage.idXML')
230230
if (position == -1) {
231-
position = file(file_name).name.lastIndexOf('_msgf_feat.idXML')
231+
position = file(file_name).name.lastIndexOf('_comet_feat.idXML')
232+
if (position == -1) {
233+
position = file(file_name).name.lastIndexOf('_msgf_feat.idXML')
234+
}
235+
}
236+
} else {
237+
position = file(file_name).name.lastIndexOf('_sage_ms2rescore.idXML')
238+
if (position == -1) {
239+
position = file(file_name).name.lastIndexOf('_comet_ms2rescore_feat.idXML')
240+
if (position == -1) {
241+
position = file(file_name).name.lastIndexOf('_msgf_ms2rescore_feat.idXML')
242+
}
232243
}
233244
}
245+
234246
} else {
235247
position = file(file_name).name.lastIndexOf('_sage_perc.idXML')
236248
if (position == -1) {

subworkflows/local/id.nf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ workflow ID {
1616
take:
1717
ch_file_preparation_results
1818
ch_database_wdecoy
19+
ch_expdesign
1920

2021
main:
2122

@@ -33,7 +34,7 @@ workflow ID {
3334
//
3435
// SUBWORKFLOW: PSMReScoring
3536
//
36-
PSMRESCORING (DATABASESEARCHENGINES.out.ch_id_files_idx)
37+
PSMRESCORING (ch_file_preparation_results, DATABASESEARCHENGINES.out.ch_id_files_idx, ch_expdesign)
3738
ch_software_versions = ch_software_versions.mix(PSMRESCORING.out.versions.ifEmpty(null))
3839

3940
//

0 commit comments

Comments
 (0)