Skip to content

Commit

Permalink
Merge pull request #378 from daichengxin/dev
Browse files Browse the repository at this point in the history
ms2rescore for quant workflow and fixed some bugs
  • Loading branch information
ypriverol committed Jun 17, 2024
2 parents d64652b + 4111c36 commit 274d082
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 41 deletions.
2 changes: 2 additions & 0 deletions bin/ms2rescore_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def parse_cli_arguments_to_config(**kwargs):
config["ms2rescore"]["feature_generators"]["basic"] = {}
if "ms2pip" in feature_generators:
config["ms2rescore"]["feature_generators"]["ms2pip"] = {
"model_dir": kwargs["ms2pip_model_dir"],
"model": kwargs["ms2pip_model"],
"ms2_tolerance": kwargs["ms2_tolerance"],
}
Expand Down Expand Up @@ -147,6 +148,7 @@ def filter_out_artifact_psms(
default="",
)
@click.option("-pipm", "--ms2pip_model", help="MS²PIP model (default: `Immuno-HCD`)", type=str, default="Immuno-HCD")
@click.option("-md", "--ms2pip_model_dir", help="The path of MS²PIP model (default: `./`)", type=str, default="./")
@click.option(
"-ms2tol", "--ms2_tolerance", help="Fragment mass tolerance [Da](default: `0.02`)", type=float, default=0.02
)
Expand Down
2 changes: 1 addition & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ process {
]
}

withName: '.*:DDA_ID:SAGEFEATURE' {
withName: '.*:SAGEFEATURE' {
publishDir = [
path: { "${params.outdir}/addsagefeature" },
pattern: "*.log",
Expand Down
6 changes: 3 additions & 3 deletions modules/local/extract_psm/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ process PSMCONVERSION {
tag "$meta.mzml_id"
label 'process_medium'

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

input:
Expand Down
7 changes: 4 additions & 3 deletions modules/local/ms2rescore/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ process MS2RESCORE {
tag "$meta.mzml_id"
label 'process_high'

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

// userEmulation settings when docker is specified
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' : ''
Expand Down Expand Up @@ -48,6 +48,7 @@ process MS2RESCORE {
--spectrum_path . \\
--ms2_tolerance $ms2_tolerence \\
--output_path ${idxml.baseName}_ms2rescore.idXML \\
--ms2pip_model_dir ${params.ms2pip_model_dir} \\
--processes $task.cpus \\
--id_decoy_pattern $decoy_pattern \\
$args \\
Expand Down
6 changes: 3 additions & 3 deletions modules/local/mzmlstatistics/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ process MZMLSTATISTICS {
label 'process_medium'
label 'process_single'

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

input:
Expand Down
3 changes: 2 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ params {

// MSRESCORE flags
ms2rescore = false
ms2pip_model_dir = null
rescore_range = 'independent_run'
ms2pip_model = 'HCD2021'
feature_generators = 'deeplc,ms2pip'
Expand All @@ -124,7 +125,7 @@ params {
// Percolator flags
train_FDR = 0.05
test_FDR = 0.05
fdr_level = 'peptide_level_fdrs'
fdr_level = 'psm_level_fdrs'
klammer = false
description_correct_features = 0
subset_max_train = 300000
Expand Down
7 changes: 6 additions & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@
"fa_icon": "fas fa-font",
"default": "HCD2021"
},
"ms2pip_model_dir": {
"type": "string",
"description": "The path of ms2pip model files. Providing model file to avoid repeated download and slow internet connection",
"fa_icon": "fas fa-font"
},
"feature_generators": {
"type": "string",
"description": "Which feature generator to generate feature.",
Expand Down Expand Up @@ -525,7 +530,7 @@
"fdr_level": {
"type": "string",
"description": "Calculate FDR on PSM ('psm_level_fdrs') or peptide level ('peptide_level_fdrs')?",
"default": "peptide_level_fdrs",
"default": "psm_level_fdrs",
"fa_icon": "fas fa-list-ol",
"enum": ["peptide_level_fdrs", "psm_level_fdrs"]
},
Expand Down
24 changes: 18 additions & 6 deletions subworkflows/local/dda_id.nf
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ workflow DDA_ID {
} else if (params.rescore_range == "by_sample") {
// Sample map
GETSAMPLE(ch_expdesign)
ch_expdesign_sample = EXTRACT_SAMPLE.out.ch_expdesign_sample
ch_expdesign_sample = GETSAMPLE.out.ch_expdesign_sample
ch_expdesign_sample.splitCsv(header: true, sep: '\t')
.map { get_sample_map(it) }.set{ sample_map_idv }

Expand Down Expand Up @@ -155,7 +155,7 @@ workflow DDA_ID {
IDSCORESWITCHER(MS2RESCORE.out.idxml.combine(Channel.value("PEP")))
ch_software_versions = ch_software_versions.mix(IDSCORESWITCHER.out.version)
ch_consensus_input = IDSCORESWITCHER.out.id_score_switcher.combine(Channel.value("MS:1001491"))
ch_rescoring_results = IDSCORESWITCHER.out.id_files_ForIDPEP
ch_rescoring_results = IDSCORESWITCHER.out.ch_consensus_input
} else {
ch_fdridpep = Channel.empty()
if (params.search_engines.split(",").size() == 1) {
Expand Down Expand Up @@ -224,13 +224,25 @@ def convert_exp_meta(Map meta, value, file_name, sample_map) {
} else if (value == "sample_id") {
tag = file(file_name).name.lastIndexOf('_perc.idXML')
if (tag == -1) {
position = file(file_name).name.lastIndexOf('_sage.idXML')
if (position == -1) {
position = file(file_name).name.lastIndexOf('_comet_feat.idXML')
ifms2rescore = file(file_name).name.lastIndexOf('_ms2rescore_')
if (ifms2rescore == -1) {
position = file(file_name).name.lastIndexOf('_sage.idXML')
if (position == -1) {
position = file(file_name).name.lastIndexOf('_msgf_feat.idXML')
position = file(file_name).name.lastIndexOf('_comet_feat.idXML')
if (position == -1) {
position = file(file_name).name.lastIndexOf('_msgf_feat.idXML')
}
}
} else {
position = file(file_name).name.lastIndexOf('_sage_ms2rescore.idXML')
if (position == -1) {
position = file(file_name).name.lastIndexOf('_comet_ms2rescore_feat.idXML')
if (position == -1) {
position = file(file_name).name.lastIndexOf('_msgf_ms2rescore_feat.idXML')
}
}
}

} else {
position = file(file_name).name.lastIndexOf('_sage_perc.idXML')
if (position == -1) {
Expand Down
3 changes: 2 additions & 1 deletion subworkflows/local/id.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ workflow ID {
take:
ch_file_preparation_results
ch_database_wdecoy
ch_expdesign

main:

Expand All @@ -33,7 +34,7 @@ workflow ID {
//
// SUBWORKFLOW: PSMReScoring
//
PSMRESCORING (DATABASESEARCHENGINES.out.ch_id_files_idx)
PSMRESCORING (ch_file_preparation_results, DATABASESEARCHENGINES.out.ch_id_files_idx, ch_expdesign)
ch_software_versions = ch_software_versions.mix(PSMRESCORING.out.versions.ifEmpty(null))

//
Expand Down
Loading

0 comments on commit 274d082

Please sign in to comment.