Skip to content

[BUG] FDR to QValue Numba Typing Error #134

@singjc

Description

@singjc

Hi @RalfG,

I'm not sure if I should make the issue here or in the ms2rescore repo, but the downstream error seems to be in Mokapot.

When performing rescoring using MS2Rescore (v3.1.4) on Sage search results (Bruker immunopeptidomics data from the Thunder-DDA-PASEF paper), Mokapot (v0.10.0) seems to run into an error when computing the confidence estimates. I'm not entirely sure what the error is, but it seems to be an issue with Numba (see log below).

If you would like the sage results tsv file for debugging, let me know.

Best,

Justin

Log

2025-01-23 09:57:20 INFO     ms2rescore.feature_generators.im2deep // Running   
                             IM2Deep for PSMs from run (18/18):                 
                             `G230411_026_Slot2-29_1_9464`...                   
2025-01-23 10:10:13 INFO     ms2rescore.core // Removed 0 PSMs with rank >= 1.  
2025-01-23 10:10:40 ERROR    ms2rescore.__main__ // Failed in nopython mode     
                             pipeline (step: nopython frontend)                 
                             non-precise type array(pyobject, 1d, C)            
                             During: typing of argument at                      
                             /home/roestlab/anaconda3/envs/py310_JS/lib/python3.
                             10/site-packages/mokapot/qvalues.py (186)          
                                                                                
                             File                                               
                             "../../../../../../../../home/roestlab/anaconda3/en
                             vs/py310_JS/lib/python3.10/site-packages/mokapot/qv
                             alues.py", line 186:                               
                             def crosslink_tdc(scores, num_targets, desc=True): 
                                 <source elided>                                
                                                                                
                             @nb.njit                                           
                             ^
Full Traceback Error Log
2025-01-23 09:57:20 INFO     ms2rescore.feature_generators.im2deep // Running   
                             IM2Deep for PSMs from run (18/18):                 
                             `G230411_026_Slot2-29_1_9464`...                   
2025-01-23 10:10:13 INFO     ms2rescore.core // Removed 0 PSMs with rank >= 1.  
2025-01-23 10:10:40 ERROR    ms2rescore.__main__ // Failed in nopython mode     
                             pipeline (step: nopython frontend)                 
                             non-precise type array(pyobject, 1d, C)            
                             During: typing of argument at                      
                             /home/roestlab/anaconda3/envs/py310_JS/lib/python3.
                             10/site-packages/mokapot/qvalues.py (186)          
                                                                                
                             File                                               
                             "../../../../../../../../home/roestlab/anaconda3/en
                             vs/py310_JS/lib/python3.10/site-packages/mokapot/qv
                             alues.py", line 186:                               
                             def crosslink_tdc(scores, num_targets, desc=True): 
                                 <source elided>                                
                                                                                
                             @nb.njit                                           
                             ^
                                                                                
                             ╭─────── Traceback (most recent call last) ───────╮
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/ms2rescore/__main__.py:237 │
                             │  in main                                        │
                             │                                                 │
                             │   234 │   │   │   profiled_rescore = profile(re │
                             │   235 │   │   │   profiled_rescore(configuratio │
                             │   236 │   │   else:                             │
                             │ ❱ 237 │   │   │   rescore(configuration=config) │
                             │   238 │   except Exception as e:                │
                             │   239 │   │   LOGGER.exception(e)               │
                             │   240 │   │   sys.exit(1)                       │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/ms2rescore/core.py:168 in  │
                             │ rescore                                         │
                             │                                                 │
                             │   165 │   if all(psm_list["pep"] == 1.0):       │
                             │   166 │   │   psm_list = _fix_constant_pep(psm_ │
                             │   167 │   psm_list = _filter_by_rank(psm_list,  │
                             │ ❱ 168 │   psm_list = _calculate_confidence(psm_ │
                             │   169 │   _ = _log_id_psms_after(psm_list, id_p │
                             │       max_rank=config["max_psm_rank_output"])   │
                             │   170 │                                         │
                             │   171 │   # Write output                        │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/ms2rescore/core.py:317 in  │
                             │ _calculate_confidence                           │
                             │                                                 │
                             │   314 │   )                                     │
                             │   315 │                                         │
                             │   316 │   # Recalculate confidence              │
                             │ ❱ 317 │   new_confidence = lin_psm_data.assign_ │
                             │   318 │                                         │
                             │   319 │   # Add new confidence estimations to P │
                             │   320 │   add_psm_confidence(psm_list, new_conf │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/mokapot/dataset.py:607 in  │
                             │ assign_confidence                               │
                             │                                                 │
                             │   604 │   │                                     │
                             │   605 │   │   if self._group_column is None:    │
                             │   606 │   │   │   LOGGER.info("Assigning confid │
                             │ ❱ 607 │   │   │   return LinearConfidence(      │
                             │   608 │   │   │   │   self,                     │
                             │   609 │   │   │   │   scores,                   │
                             │   610 │   │   │   │   eval_fdr=eval_fdr,        │
                             │                                                 │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/mokapot/confidence.py:375  │
                             │ in __init__                                     │
                             │                                                 │
                             │   372 │   │   self._perform_tdc(self._psm_colum │
                             │   373 │   │   LOGGER.info("\t- Found %i PSMs fr │
                             │   374 │   │                                     │
                             │ ❱ 375 │   │   self._assign_confidence(desc=desc │
                             │   376 │   │                                     │
                             │   377 │   │   self.accepted = {}                │
                             │   378 │   │   for level in self.levels:         │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/mokapot/confidence.py:455  │
                             │ in _assign_confidence                           │
                             │                                                 │
                             │   452 │   │   │                                 │
                             │   453 │   │   │   # Estimate q-values and assig │
                             │   454 │   │   │   LOGGER.info("Assiging q-value │
                             │ ❱ 455 │   │   │   data["mokapot q-value"] = qva │
                             │   456 │   │   │                                 │
                             │   457 │   │   │   # Make output tables pretty   │
                             │   458 │   │   │   data = data.drop(self._target │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/mokapot/qvalues.py:109 in  │
                             │ tdc                                             │
                             │                                                 │
                             │   106 │   with open('other_args.pkl', 'wb') as  │
                             │   107 │   │   pickle.dump(other_args, psm_file) │
                             │   108 │                                         │
                             │ ❱ 109 │   qvals = _fdr2qvalue(fdr, num_total, u │
                             │   110 │   qvals = np.flip(qvals)                │
                             │   111 │   qvals = qvals[np.argsort(srt_idx)]    │
                             │   112                                           │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/numba/core/dispatcher.py:4 │
                             │ 23 in _compile_for_args                         │
                             │                                                 │
                             │    420 │   │   │   │   │      f"by the followin │
                             │    421 │   │   │   │   e.patch_message(msg)     │
                             │    422 │   │   │                                │
                             │ ❱  423 │   │   │   error_rewrite(e, 'typing')   │
                             │    424 │   │   except errors.UnsupportedError a │
                             │    425 │   │   │   # Something unsupported is p │
                             │    426 │   │   │   error_rewrite(e, 'unsupporte │
                             │                                                 │
                             │                                                 │
                             │ /home/roestlab/anaconda3/envs/py310_JS/lib/pyth │
                             │ on3.10/site-packages/numba/core/dispatcher.py:3 │
                             │ 64 in error_rewrite                             │
                             │                                                 │
                             │    361 │   │   │   if config.FULL_TRACEBACKS:   │
                             │    362 │   │   │   │   raise e                  │
                             │    363 │   │   │   else:                        │
                             │ ❱  364 │   │   │   │   raise e.with_traceback(N │
                             │    365 │   │                                    │
                             │    366 │   │   argtypes = []                    │
                             │    367 │   │   for a in args:                   │
                             ╰─────────────────────────────────────────────────╯
                             TypingError: Failed in nopython mode pipeline      
                             (step: nopython frontend)                          
                             non-precise type array(pyobject, 1d, C)            
                             During: typing of argument at                      
                             /home/roestlab/anaconda3/envs/py310_JS/lib/python3.
                             10/site-packages/mokapot/qvalues.py (186)          
                                                                                
                             File                                               
                             "../../../../../../../../home/roestlab/anaconda3/en
                             vs/py310_JS/lib/python3.10/site-packages/mokapot/qv
                             alues.py", line 186:                               
                             def crosslink_tdc(scores, num_targets, desc=True): 
                                 <source elided>                                
                                                                                
                             @nb.njit                                           
                             ^

To Reproduce:

Command

ms2rescore -p ./ms2rescore_mars/results.sage.tsv -t sage -c ./ms2rescore_mars/ms2rescore_config.json
MS2Rescore Config
{
    "$schema": "./config_schema.json",
    "ms2rescore": {
        "feature_generators": {
            "deeplc": {
                "calibration_set_size": 0.6,
                "deeplc_retrain": false
            },
            "ms2pip": {
                "model": "HCD",
                "ms2_tolerance": 0.02
            },
            "im2deep": {
                "reference_dataset": "/media/roestlab/Data1/User/JustinS/jpst002044_pxd040385_thunder_ddapasef/results/20241206_no_redeem_lda/ms2rescore_mars/reference_ccs"
            }
        },
        "rescoring_engine": {
            "mokapot": {
                "write_weights": true,
                "write_flashlfq": false
            }
        },
        "config_file": "/media/roestlab/Data1/User/JustinS/jpst002044_pxd040385_thunder_ddapasef/results/20241206_no_redeem_lda/ms2rescore_mars/ms2rescore_config.json",
        "psm_file": [
            "/media/roestlab/Data1/User/JustinS/jpst002044_pxd040385_thunder_ddapasef/results/20241206_no_redeem_lda/ms2rescore_mars//results.sage.tsv"
        ],
        "psm_file_type": "sage",
        "psm_reader_kwargs": {},
        "spectrum_path": "/media/roestlab/Data1/User/JustinS/jpst002044_pxd040385_thunder_ddapasef/results/20241206_no_redeem_lda/G230411_data/",
        "output_path": "/media/roestlab/Data1/User/JustinS/jpst002044_pxd040385_thunder_ddapasef/results/20241206_no_redeem_lda/ms2rescore_mars/",
        "log_level": "info",
        "id_decoy_pattern": "rev_",
        "psm_id_pattern": null,
        "spectrum_id_pattern": null,
        "lower_score_is_better": false,
        "modification_mapping": {
            "+15.9949": "U:Oxidation",
            "+57.0215": "U:Carbamidomethyl"
        },
        "fixed_modifications": {},
        "processes": 30,
        "rename_to_usi": false,
        "fasta_file": null,
        "write_report": true
    }
}

System

OS:

  • Ubuntu 18.04.6 LTS
  • 187Gb RAM
  • 18 CPU cores

Python:

  • Python 3.10 (Anaconda Env)
  • MS2Rescore v3.1.4
  • Mokapot v0.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions