Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ms2rescore issue with empty MS2 spec #471

Open
ypriverol opened this issue Jan 13, 2025 · 1 comment
Open

ms2rescore issue with empty MS2 spec #471

ypriverol opened this issue Jan 13, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@ypriverol
Copy link
Member

Description of the bug

Recently when analysing a big TMT experiment we find out the following error with quantms-rescoring and ms2rescore:

': 0.4}, 'deeplc': {'deeplc_retrain': False, 'calibration_set_size': 0.15}}, 'rescoring_engine': {}, 'config_file': None, 'psm_file': None, 'psm_file_type': 'infer', 'psm_reader_kwargs': {}, 'spectrum_path': '.', 'output_path': 'Instrument1_sample22_S1R21_062116_Fr05_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': '/hps/nobackup/juan/pride/reanalysis/ms2pip_model/', 'ms2pip_model': 'TMT', 'ms2_tolerance': 0.4, 'calibration_set_size': 0.15, 'rng': 4711}}
2025-01-11 13:37:15,081 WARNING Removed 7480 PSMs without search engine features!
2025-01-11 13:37:15,437 INFO Found 53616 PSMs, of which 37.04% are decoys.
2025-01-11 13:37:16,341 WARNING Non-mapped modifications found: {'Acetyl', 'Oxidation', 'TMT6plex', 'Carbamidomethyl', 'Gln->pyro-Glu'}
This can be ignored if Unimod modification label
2025-01-11 13:37:16,835 INFO Found 8032 identified PSMs at 1% FDR before rescoring.
2025-01-11 13:37:16,907 INFO Adding MS²PIP-derived features to PSMs.
2025-01-11 13:37:17,728 INFO Running MS²PIP for PSMs from run (1/1) `Instrument1_sample22_S1R21_062116_Fr05`...
2025-01-11 13:37:19,114 INFO Processing spectra and peptides...
Warning: OPENMS_DATA_PATH environment variable not found and no share directory was installed. Some functionality might not work as expected.
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.10/site-packages/ms2pip/core.py", line 756, in _process_spectra
    for spectrum in read_spectrum_file(spec_file):
  File "/usr/local/lib/python3.10/site-packages/ms2pip/spectrum_input.py", line 127, in read_spectrum_file
    for spectrum in read_mzml(spectrum_file):
  File "/usr/local/lib/python3.10/site-packages/ms2pip/spectrum_input.py", line 83, in read_mzml
    mz=spectrum["m/z array"],
KeyError: 'm/z array'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/rescoring", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/quantmsrescore/rescoring.py", line 23, in main
    cli()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 788, 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/quantmsrescore/ms2rescore.py", line 507, in ms2rescore
    rescore_idxml(psm_file, output_path, config)
  File "/usr/local/lib/python3.10/site-packages/quantmsrescore/ms2rescore.py", line 258, in rescore_idxml
    rescore(config, psm_list)
  File "/usr/local/lib/python3.10/site-packages/ms2rescore/core.py", line 80, in rescore
    fgen.add_features(psm_list)
  File "/usr/local/lib/python3.10/site-packages/ms2rescore/feature_generators/ms2pip.py", line 194, in add_features
    ms2pip_results = correlate(
  File "/usr/local/lib/python3.10/site-packages/ms2pip/core.py", line 186, in correlate
    results = ms2pip_parallelized.process_spectra(psm_list, spectrum_file, spectrum_id_pattern)
  File "/usr/local/lib/python3.10/site-packages/ms2pip/core.py", line 540, in process_spectra
    results = self._execute_in_pool(psm_list, _process_spectra, args)
  File "/usr/local/lib/python3.10/site-packages/ms2pip/core.py", line 469, in _execute_in_pool
    results = [
  File "/usr/local/lib/python3.10/site-packages/ms2pip/core.py", line 470, in <listcomp>
    r.get()
  File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
KeyError: 'm/z array'
Exception ignored in: <generator object track at 0x7f3aaa6f1d20>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 174, in track
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 1191, in __exit__
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 1177, in stop
  File "/usr/local/lib/python3.10/site-packages/rich/live.py", line 150, in stop
  File "/usr/local/lib/python3.10/site-packages/rich/live.py", line 223, in refresh
  File "/usr/local/lib/python3.10/site-packages/rich/live.py", line 203, in renderable
  File "/usr/local/lib/python3.10/site-packages/rich/live.py", line 98, in get_renderable
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 1553, in get_renderable
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 1558, in get_renderables
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 1582, in make_tasks_table
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 1587, in <genexpr>
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 542, in __call__
  File "/usr/local/lib/python3.10/site-packages/rich/progress.py", line 640, in render
  File "/usr/local/lib/python3.10/site-packages/rich/text.py", line 285, in from_markup
ImportError: sys.meta_path is None, Python is likely shutting down

After some investigation looks like some of the MS2 scan in the mzML do not have spectrum information. I actually don't know the way this spectra was acquired to have not spectrum info in the MS2. What could be the best way to fix this?

Command used and terminal output

No response

Relevant files

No response

System information

No response

@ypriverol ypriverol added the bug Something isn't working label Jan 13, 2025
@daichengxin
Copy link
Collaborator

MS2Rescore raise a error when have not spectrum info in the MS2 from these codes: https://github.com/compomics/ms2pip/blob/v4.0.0-dev8/ms2pip/spectrum_input.py#L81-L88.
A spectrum example:

<spectrum id="controllerType=0 controllerNumber=1 scan=93050" index="93049" defaultArrayLength="0">
				<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" />
				<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="2" />
				<cvParam cvRef="MS" accession="MS:1000580" name="MSn spectrum" />
				<cvParam cvRef="MS" accession="MS:1000130" name="positive scan" />
				<cvParam cvRef="MS" accession="MS:1000285" name="total ion current" value="0.0"/>
				<cvParam cvRef="MS" accession="MS:1000504" name="base peak m/z" value="0.0" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS"/>
				<cvParam cvRef="MS" accession="MS:1000505" name="base peak intensity" value="0.0" unitAccession="MS:1000131" unitName="number of detector counts" unitCvRef="MS"/>
				<userParam name="filter string" type="xsd:string" value="ITMS + c NSI t d Full ms2 [email protected] [106.0000-821.0000]"/>
				<scanList count="1">
					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" />
					<scan >
						<cvParam cvRef="MS" accession="MS:1000016" name="scan start time" value="13248.521958208" unitAccession="UO:0000010" unitName="second" unitCvRef="UO" />
						<userParam name="MS:1000927" type="xsd:double" value="100.0" unitAccession="UO:0000028" unitName="millisecond" unitCvRef="UO"/>
						<scanWindowList count="1">
							<scanWindow>
								<cvParam cvRef="MS" accession="MS:1000501" name="scan window lower limit" value="106" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
								<cvParam cvRef="MS" accession="MS:1000500" name="scan window upper limit" value="821" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
							</scanWindow>
						</scanWindowList>
					</scan>
				</scanList>
				<precursorList count="1">
					<precursor spectrumRef="controllerType=0 controllerNumber=1 scan=93048">
						<isolationWindow>
							<cvParam cvRef="MS" accession="MS:1000827" name="isolation window target m/z" value="405.320343017578" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
							<cvParam cvRef="MS" accession="MS:1000828" name="isolation window lower offset" value="0.35" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
							<cvParam cvRef="MS" accession="MS:1000829" name="isolation window upper offset" value="0.35" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
						</isolationWindow>
						<selectedIonList count="1">
							<selectedIon>
								<cvParam cvRef="MS" accession="MS:1000744" name="selected ion m/z" value="405.320343017578" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
								<cvParam cvRef="MS" accession="MS:1000041" name="charge state" value="2" />
							</selectedIon>
						</selectedIonList>
						<activation>
							<cvParam cvRef="MS" accession="MS:1000133" name="collision-induced dissociation" />
							<cvParam cvRef="MS" accession="MS:1000045" name="collision energy" value="35.0" unitAccession="UO:0000266" unitName="electronvolt" unitCvRef="UO"/>
						</activation>
					</precursor>
				</precursorList>
			</spectrum>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants