Skip to content

Error ms2rescore in big dataset for one run.  #447

Closed

Description

@ypriverol

Description of the bug

This command is failing:

#!/usr/bin/env bash

set -e # Exit if a tool returns a non-zero status/exit code
set -u # Treat unset variables and parameters as an error
set -o pipefail # Returns the status of the last command to exit with a non-zero status or zero if all successfully execute
set -C # No clobber - prevent output redirection from overwriting files.

quantmsutilsc ms2rescore \
    --psm_file f07531_Prot_02_R2_F08_msgf.idXML \
    --spectrum_path . \
    --ms2_tolerance 0.4 \
    --output_path f07531_Prot_02_R2_F08_msgf_ms2rescore.idXML \
    --ms2pip_model_dir null \
    --processes 372 \
    --id_decoy_pattern ^DECOY_ \
    --ms2pip_model TMT --rescoring_engine percolator --calibration_set_size 0.15 --test_fdr 0.05 --feature_generators deeplc,ms2pip \
    2>&1 | tee f07531_Prot_02_R2_F08_ms2rescore.log

cat <<-END_VERSIONS > versions.yml
"NFCORE_QUANTMS:QUANTMS:TMT:ID:PSMRESCORING:MS2RESCORE":
    MS2Rescore: $(echo $(ms2rescore --version 2>&1) | grep -oP 'MS²Rescore \(v\K[^\)]+' )
END_VERSIONS

Error here:

Error: 2024-11-25 15:33:11,160 [<module>] - Creating converter from 7 to 5
2024-11-25 15:33:11,160 [<module>] - Creating converter from 5 to 7
2024-11-25 15:33:11,160 [<module>] - Creating converter from 7 to 5
2024-11-25 15:33:11,160 [<module>] - Creating converter from 5 to 7
2024-11-25 15:33:11,207 [register_filter] - Registered filter: bshuf (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5bshuf.so)
2024-11-25 15:33:11,210 [register_filter] - Registered filter: blosc (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5blosc.so)
2024-11-25 15:33:11,212 [register_filter] - Registered filter: blosc2 (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5blosc2.so)
2024-11-25 15:33:11,213 [register_filter] - Registered filter: bzip2 (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5bzip2.so)
2024-11-25 15:33:11,216 [register_filter] - Registered filter: fcidecomp (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5fcidecomp.so)
2024-11-25 15:33:11,217 [register_filter] - Registered filter: lz4 (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5lz4.so)
2024-11-25 15:33:11,220 [register_filter] - Registered filter: sz (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5sz.so)
2024-11-25 15:33:11,232 [register_filter] - Registered filter: sz3 (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5sz3.so)
2024-11-25 15:33:11,233 [register_filter] - Registered filter: zfp (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5zfp.so)
2024-11-25 15:33:11,234 [register_filter] - init_filter not found for filter zstd: Init phase skipped.
2024-11-25 15:33:11,234 [register_filter] - Registered filter: zstd (/usr/local/lib/python3.10/site-packages/hdf5plugin/plugins/libh5zstd.so)
2024-11-25 15:33:12,843 [<module>] - Falling back to TensorFlow client; we recommended you install the Cloud TPU client directly with pip install cloud-tpu-client.
2024-11-25 15:33:15,677 [wrapper] - matplotlib data path: /usr/local/lib/python3.10/site-packages/matplotlib/mpl-data
2024-11-25 15:33:15,683 [wrapper] - CONFIGDIR=/homes/pst_prd/.config/matplotlib
2024-11-25 15:33:15,684 [<module>] - interactive is False
2024-11-25 15:33:15,684 [<module>] - platform is linux
2024-11-25 15:33:15,815 [wrapper] - CACHEDIR=/homes/pst_prd/.cache/matplotlib
2024-11-25 15:33:15,817 [_load_fontmanager] - Using fontManager instance from /homes/pst_prd/.cache/matplotlib/fontlist-v390.json
2024-11-25 15:33:16,706 [parse_cli_arguments_to_config] - Percolator rescoring engine has been specified. Use the idXML containing rescoring features and run Percolator in a separate step.
2024-11-25 15:33:16,706 [ms2rescore] - MS²Rescore config:
2024-11-25 15:33:16,706 [ms2rescore] - {'$schema': './config_schema.json', 'ms2rescore': {'feature_generators': {'ms2pip': {'model_dir': 'null', 'model': 'TMT', 'ms2_tolerance': 0.4}, 'deeplc': {'deeplc_retrain': False, 'calibration_set_size': 0.15}}, 'rescoring_engine': {}, 'co
nfig_file': None, 'psm_file': None, 'psm_file_type': 'infer', 'psm_reader_kwargs': {}, 'spectrum_path': '.', 'output_path': 'f07531_Prot_02_R2_F08_msgf_ms2rescore.idXML', 'log_level': 'info', 'id_decoy_pattern': '^DECOY_', 'psm_id_pattern': '(.*)', 'spectrum_id_pattern': '(.*)',
 'lower_score_is_better': True, 'modification_mapping': {}, 'fixed_modifications': {}, 'processes': 48, 'rename_to_usi': False, 'fasta_file': None, 'write_report': True, 'ms2pip_model_dir': 'null', 'ms2pip_model': 'TMT', 'ms2_tolerance': 0.4, 'calibration_set_size': 0.15, 'rng':
 4711}}
Warning: OPENMS_DATA_PATH environment variable not found and no share directory was installed. Some functionality might not work as expected.
Traceback (most recent call last):
  File "/usr/local/bin/quantmsutilsc", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/quantmsutils/quantmsutilsc.py", line 38, in main
    cli()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/quantmsutils/rescoring/ms2rescore.py", line 375, in ms2rescore
    rescore_idxml(psm_file, output_path, config)
  File "/usr/local/lib/python3.10/site-packages/quantmsutils/rescoring/ms2rescore.py", line 123, in rescore_idxml
    psm_list = reader.read_file()
  File "/usr/local/lib/python3.10/site-packages/psm_utils/io/_base_classes.py", line 46, in read_file
    return PSMList(psm_list=[psm for psm in self.__iter__()])
  File "/usr/local/lib/python3.10/site-packages/psm_utils/io/_base_classes.py", line 46, in <listcomp>
    return PSMList(psm_list=[psm for psm in self.__iter__()])
  File "/usr/local/lib/python3.10/site-packages/psm_utils/io/idxml.py", line 112, in __iter__
    yield self._parse_psm(self.protein_ids, peptide_id, peptide_hit)
  File "/usr/local/lib/python3.10/site-packages/psm_utils/io/idxml.py", line 201, in _parse_psm
    rescoring_features={
  File "/usr/local/lib/python3.10/site-packages/psm_utils/io/idxml.py", line 202, in <dictcomp>
    key: float(peptide_hit.getMetaValue(key)) for key in self.rescoring_features
TypeError: float() argument must be a string or a real number, not 'NoneType'

Command used and terminal output

No response

Relevant files

Dataset here: https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/quantms-benchmark/94508cae253c72810c2dc0200e2c3e/

System information

No response

Activity

  1. daichengxin commented on Nov 27, 2024

    @daichengxin
    Collaborator

    There is a missing search engines feature that is causing the psm utils parse bug. A example
    image

    I don't know why is this the only PSM identification that doesn't have a search engine features? it's probably an internal bug in openms, export search engines features?

  2. ypriverol commented on Nov 27, 2024

    @ypriverol
    ContributorAuthor

    @timosachsenberg @jpfeuffer looks like some of the search engine scores in MSGFAdapter for some of the psms are not written properly in the idXML.

    Two things:

    • We have seen this error only because we are now intercepting with ms2rescore. In previous runs, do you know if PercolatorAdapter in OpenMS handles issues?
    • For now, we will remove those PSMs from the idXML and do a warning and count them.
  3. jpfeuffer commented on Nov 27, 2024

    @jpfeuffer
    Collaborator

    Which feature is missing?

  4. daichengxin commented on Nov 27, 2024

    @daichengxin
    Collaborator

    These features
    image

  5. ypriverol commented on Nov 27, 2024

    @ypriverol
    ContributorAuthor

    All search engine scores.

  6. jpfeuffer commented on Nov 27, 2024

    @jpfeuffer
    Collaborator

    This is right out of msgfplusadapter?
    Any logs?

  7. ypriverol commented on Nov 27, 2024

    @ypriverol
    ContributorAuthor

    Here the log from MSGFAdapter.

    Running MSGFPlus search...
    Using prefix decoy string 'DECOY_'
    Info: using 'Trypsin/P' as enzyme (obtained from idXML) for digestion.
    Peptide identification engine: MS-GF+
    Enzyme: Trypsin/P
    Info: using 'full' as enzyme specificity (obtained from idXML) for digestion.
        Progress of 'Load first DB chunk':
        -- done [took 0.21 s (CPU), 0.20 s (Wall)] -- 
    Building trie ... done (0s)
    Compressing trie to BFS format ...
     done (0s)
    Mapping 58414 peptides to 82852 proteins.
    Searching with up to 3 ambiguous amino acid(s) and 0 mismatch(es)!
        Progress of 'Aho-Corasick':
        -- done [took 3.99 s (CPU), 0.55 s (Wall)] -- 
    Merge took: 0.01 s (wall), 0.02 s (CPU), 0.01 s (system), 0.01 s (user)
    Memory usage (Aho-Corasick): 17 MB (working set delta), 0 MB (peak working set delta)
    
    
    Aho-Corasick done:
      found 69282 hits for 58414 of 58414 peptides.
    Peptide hits passing enzyme filter: 69282
         ... rejected by enzyme filter: 38187
    -----------------------------------
    Peptide statistics
    
      unmatched                : 0 (0 %)
      target/decoy:
        match to target DB only: 35021 (59 %)
        match to decoy DB only : 22109 (37 %)
        match to both          : 1284 (2 %)
    
      mapping to proteins:
        no match (to 0 protein)         : 0
        unique match (to 1 protein)     : 53568
        non-unique match (to >1 protein): 4846
    -----------------------------------
    Protein statistics
    
      total proteins searched: 82852
      matched proteins       : 33687 (33687 new)
      matched target proteins: 18291 (54 %)
      matched decoy proteins : 15396 (45 %)
      orphaned proteins      : 0 (all removed)
    -----------------------------------
    MS-GF+ PSM with missing NumMatchedMainIons skipped.
    StdevErrorTop7 is NaN, setting as MeanErrorTop7 instead.
    MSGFPlusAdapter took 17:29 m (wall), 38.82 s (CPU), 2.07 s (system), 36.75 s (user); Peak Memory Usage: 2619 MB.
    <MS-GF+ PSM with missing NumMatchedMainIons skipped.> occurred 2805 times
    
  8. timosachsenberg commented on Nov 27, 2024

    @timosachsenberg

    which OpenMS version is this?

  9. ypriverol commented on Nov 27, 2024

    @ypriverol
    ContributorAuthor

    The nightly version.

  10. timosachsenberg commented on Nov 27, 2024

    @timosachsenberg

    if you use the nightly version, then you might want to remove the PSMFeatureExtractor from the workflow.
    I now integrate the annotation into MSGFPlusAdapter, Comet etc.
    This was the relevant PR:
    OpenMS/OpenMS#7323
    Maybe try again without PSMFeatureExtractor? Then we can narrow it down (could also be a MSGFPlus error that we "fixed" by calling the PSMFeatureExtractor).

  11. ypriverol commented on Nov 27, 2024

    @ypriverol
    ContributorAuthor

    This can't be the source of the error because, we have other files that pass.

  12. jpfeuffer commented on Nov 27, 2024

    @jpfeuffer
    Collaborator

    <MS-GF+ PSM with missing NumMatchedMainIons skipped.> occurred 2805 times

    This does not sound good.

  13. timosachsenberg commented on Nov 27, 2024

    @timosachsenberg

    Apparently, we handle this here as some known MSGFPlus issue:
    https://github.com/OpenMS/OpenMS/blob/develop/src/openms/source/ANALYSIS/ID/PercolatorFeatureSetHelper.cpp#L21-L101
    Could also be that we calculated these generic meta values for every search engine result in the past... need to investigate a bi more.

  14. timosachsenberg commented on Nov 27, 2024

    @timosachsenberg

    Is it possible to get the mzid file written by MSGF+? I want to directly check if the output by MSGF+

    looking at some non OpenMS code: https://github.com/percolator/percolator/blob/master/src/converters/MsgfplusReader.cpp#L310-L333

    it indeed seems as if these meta values should be written by MSGF+ to mzid.

  15. 15 remaining items

  16. timosachsenberg commented on Nov 28, 2024

    @timosachsenberg

    ok let's write them out for now. They can be easily filtered with IDFilter if needed and this let's us evaluate if we loose some good ids. If not I can just skip them

  17. ypriverol commented on Nov 28, 2024

    @ypriverol
    ContributorAuthor

    We will not introduce a new step IDFilter. But I guess when we pass it to PercolatorAdapter they will removed.

  18. jpfeuffer commented on Nov 28, 2024

    @jpfeuffer
    Collaborator

    You can just have the filter in the same step. No need for additional steps.

  19. ypriverol commented on Nov 28, 2024

    @ypriverol
    ContributorAuthor

    @jpfeuffer, what do you mean? Do you mean for msgf+ add an extra command rigth after MSGFAdapter to filter out the nonsense psms?

    If we decide to implement this solution what means, in the commandline, this is the help page of IDFILTER:

    IDFilter -- Filters results from protein or peptide identification engines based on different criteria.
    Full documentation: http://www.openms.de/doxygen/nightly/html/TOPP_IDFilter.html
    Version: 3.4.0-pre-nightly-2024-11-27 Nov 28 2024, 02:39:09, Revision: 017cde2
    To cite OpenMS:
     + Pfeuffer, J., Bielow, C., Wein, S. et al.. OpenMS 3 enables reproducible analysis of large-scale mass spec
       trometry data. Nat Methods (2024). doi:10.1038/s41592-024-02197-7.
    
    Usage:
      IDFilter <options>
    
    Options (mandatory options marked with '*'):
      -in <file>*                                               Input file  (valid formats: 'idXML', 'consensusXM
                                                                L')
      -out <file>*                                              Output file  (valid formats: 'idXML', 'consensusX
                                                                ML')
    
    Filtering by precursor attributes (RT, m/z, charge, length):
      -precursor:rt [min]:[max]                                 Retention time range to extract. (default: ':')
      -precursor:mz [min]:[max]                                 Mass-to-charge range to extract. (default: ':')
      -precursor:length [min]:[max]                             Keep only peptide hits with a sequence length in 
                                                                this range. (default: ':')
      -precursor:charge [min]:[max]                             Keep only peptide hits with charge states in this
                                                                 range. (default: ':')
    
    Filtering by peptide/protein score.:
      -score:psm <score>                                        The score which should be reached by a peptide 
                                                                hit to be kept. (use 'NAN' to disable this filter
                                                                ) (default: 'NaN')
      -score:peptide <score>                                    The score which should be reached by a peptide 
                                                                hit to be kept.  (use 'NAN' to disable this filte
                                                                r) (default: 'NaN')
      -score:protein <score>                                    The score which should be reached by a protein 
                                                                hit to be kept. All proteins are filtered based 
                                                                on their singleton scores irrespective of groupin
                                                                g. Use in combination with 'delete_unreferenced_p
                                                                eptide_hits' to remove affected peptides. (use 
                                                                'NAN' to disable this filter) (default: 'NaN')
      -score:proteingroup <score>                               The score which should be reached by a protein 
                                                                group to be kept. Performs group level score filt
                                                                ering (including groups of single proteins). Use 
                                                                in combination with 'delete_unreferenced_peptide_
                                                                hits' to remove affected peptides. (use 'NAN' to 
                                                                disable this filter) (default: 'NaN')
    
    Filtering by whitelisting (only peptides/proteins from a given set can pass):
      -whitelist:proteins <file>                                Filename of a FASTA file containing protein seque
                                                                nces.
                                                                All peptides that are not referencing a protein 
                                                                in this file are removed.
                                                                All proteins whose accessions are not present in 
                                                                this file are removed. (valid formats: 'fasta')
      -whitelist:protein_accessions <accessions>                All peptides that do not reference at least one 
                                                                of the provided protein accession are removed.
                                                                Only proteins of the provided list are retained.
      -whitelist:peptides <file>                                Only peptides with the same sequence and modifica
                                                                tion assignment as any peptide in this file are 
                                                                kept. Use with 'whitelist:ignore_modifications' 
                                                                to only compare by sequence.
                                                                 (valid formats: 'idXML')
    
    Filtering by blacklisting (only peptides/proteins NOT present in a given set can pass):
      -blacklist:proteins <file>                                Filename of a FASTA file containing protein seque
                                                                nces.
                                                                All peptides that are referencing a protein in 
                                                                this file are removed.
                                                                All proteins whose accessions are present in this
                                                                 file are removed. (valid formats: 'fasta')
      -blacklist:protein_accessions <accessions>                All peptides that reference at least one of the 
                                                                provided protein accession are removed.
                                                                Only proteins not in the provided list are retain
                                                                ed.
      -blacklist:peptides <file>                                Peptides with the same sequence and modification 
                                                                assignment as any peptide in this file are filter
                                                                ed out. Use with 'blacklist:ignore_modifications'
                                                                 to only compare by sequence.
                                                                 (valid formats: 'idXML')
    
    This filter option removes peptide hits which are not in the list of in silico peptides generated by the rule
    s specified below:
      -in_silico_digestion:fasta <file>                         Fasta protein sequence database. (valid formats: 
                                                                'fasta')
    
    This filter option removes peptide hits which do not confirm with the allowed missed cleavages specified belo
    w.:
      -missed_cleavages:number_of_missed_cleavages [min]:[max]  Range of allowed missed cleavages in the peptide 
                                                                sequences.
                                                                For example: 0:1 -> peptides with two or more 
                                                                missed cleavages will be removed,
                                                                0:0 -> peptides with any missed cleavages will 
                                                                be removed (default: ':')
    
    Filtering best hits per spectrum (for peptides) or from proteins:
      -best:n_spectra <integer>                                 Keep only the 'n' best spectra (i.e., PeptideIden
                                                                tifications) (for n > 0). A spectrum is considere
                                                                d better if it has a higher scoring peptide hit 
                                                                than the other spectrum. (default: '0') (min: 
                                                                '0')
      -best:n_peptide_hits <integer>                            Keep only the 'n' highest scoring peptide hits 
                                                                per spectrum (for n > 0). (default: '0') (min: 
                                                                '0')
      -best:spectrum_per_peptide <String>                       Keep one spectrum per peptide. Value determines 
                                                                if same sequence but different charges or modific
                                                                ations are treated as separate peptides or the 
                                                                same peptide. (default: false = filter disabled).
                                                                 (default: 'false') (valid: 'false', 'sequence', 
                                                                'sequence+charge', 'sequence+modification', 'sequ
                                                                ence+charge+modification')
      -best:n_protein_hits <integer>                            Keep only the 'n' highest scoring protein hits 
                                                                (for n > 0). (default: '0') (min: '0')
      -best:strict                                              Keep only the highest scoring peptide hit.
                                                                Similar to n_peptide_hits=1, but if there are 
                                                                ties between two or more highest scoring hits, 
                                                                none are kept.
    
      -var_mods                                                 Keep only peptide hits with variable modification
                                                                s (as defined in the 'SearchParameters' section 
                                                                of the input file).
      -remove_shared_peptides                                   Only peptides matching exactly one protein are 
                                                                kept. Remember that isoforms count as different 
                                                                proteins!
      -keep_unreferenced_protein_hits                           Proteins not referenced by a peptide are retained
                                                                 in the IDs.
      -remove_decoys                                            Remove proteins according to the information in 
                                                                the user parameters. Usually used in combination 
                                                                with 'delete_unreferenced_peptide_hits'.
      -delete_unreferenced_peptide_hits                         Peptides not referenced by any protein are delete
                                                                d in the IDs. Usually used in combination with 
                                                                'score:protein' or 'thresh:prot'.
                                                                
    Common TOPP options:
      -ini <file>                                               Use the given TOPP INI file
      -threads <n>                                              Sets the number of threads allowed to be used by 
                                                                the TOPP tool (default: '1')
      -write_ini <file>                                         Writes the default configuration file
      --help                                                    Shows options
      --helphelp                                                Shows all options (including advanced)
    
  20. timosachsenberg commented on Nov 28, 2024

    @timosachsenberg

    Probably something like:

    -remove_peptide_hits_by_metavalue [NumMatchedMainIons eq 0]
    

    right @jpfeuffer

  21. ypriverol commented on Nov 28, 2024

    @ypriverol
    ContributorAuthor

    @timosachsenberg @jpfeuffer can you take a look at this PR, we are also validating it in the ms2rescore, just in case in the future something happen similarly: bigbio/quantms-utils#36

  22. timosachsenberg commented on Nov 28, 2024

    @timosachsenberg

    I merged the fix for MSGF+ here OpenMS/OpenMS#7713

  23. ypriverol commented on Nov 28, 2024

    @ypriverol
    ContributorAuthor

    @timosachsenberg what will be the parameter for idfilter, if we added it in the msgf process step.

  24. ypriverol commented on Nov 29, 2024

    @ypriverol
    ContributorAuthor

    @timosachsenberg @jpfeuffer I have re-run the dataset with the latest version of MSGF+ 202403.. Here the results:

    Current version in OpenMS 2023: https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/quantms-benchmark/94508cae253c72810c2dc0200e2c3e/msgfplus_output-2023.mzid.gz

    Latest version MSGF+ 2024: https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/quantms-benchmark/94508cae253c72810c2dc0200e2c3e/msgfplus_output-2024.mzid.gz

    Can you double check if for the mzId from the latest version the problems remains?

  25. timosachsenberg commented on Nov 29, 2024

    @timosachsenberg

    both have the issue. I am creating the container with the fix on OpenMS side.

    Update:
    container should be updated now

  26. ypriverol commented on Nov 29, 2024

    @ypriverol
    ContributorAuthor

    Ok, Do you want to report the issue to MSGF+ or should I do it? The conda package is still not available, my point is the deployment of the conda nightly.

  27. timosachsenberg commented on Nov 29, 2024

    @timosachsenberg

    yes please report. If you are familiar with the code you might also give it a quick look why these values are not written out

  28. ypriverol commented on Dec 4, 2024

    @ypriverol
    ContributorAuthor

    Here the issue in msgf+ repo: MSGFPlus/msgfplus#157

  29. ypriverol commented on Dec 4, 2024

    @ypriverol
    ContributorAuthor

    I will close this issue because we have solved it "in principle".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions