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

Mascot MGF parsing error #153

Closed
sureshhewabi opened this issue Jul 24, 2024 · 6 comments · Fixed by #154
Closed

Mascot MGF parsing error #153

sureshhewabi opened this issue Jul 24, 2024 · 6 comments · Fixed by #154

Comments

@sureshhewabi
Copy link

While I was parsing an MGF file provided by Mascot itself(so which I can trust it is correct), I encountered with this error:


__main__ - ERROR - Pyteomics error, message: 'MGF format error: cannot parse PEPMASS = 352.1888 836632.25 2+'
Traceback (most recent call last):
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/pyteomics/mgf.py", line 207, in _read_spectrum_lines
    pepmass = tuple(map(float, params['pepmass'].split()))
ValueError: could not convert string to float: '2+'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/userpath/xiview-api/process_dataset.py", line 239, in <module>
    main(parser.parse_args())
  File "/userpath/xiview-api/process_dataset.py", line 50, in main
    convert_dir(local_dir, project_identifier, nopeaklist=args.nopeaklist)
  File "/userpath/xiview-api/process_dataset.py", line 213, in convert_dir
    raise e
  File "/userpath/xiview-api/process_dataset.py", line 208, in convert_dir
    id_parser.parse()
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/parser/MzIdParser.py", line 88, in parse
    self.main_loop()
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/parser/MzIdParser.py", line 598, in main_loop
    spectrum = peak_list_reader[sid_result["spectrumID"]]
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/parser/peaklistReader/PeakListWrapper.py", line 71, in __getitem__
    return self.reader[spec_id]
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/parser/peaklistReader/PeakListWrapper.py", line 188, in __getitem__
    spec = self._reader[spec_id]
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/pyteomics/auxiliary/file_helpers.py", line 285, in __getitem__
    return self.get_by_index(key)
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/pyteomics/auxiliary/file_helpers.py", line 263, in get_by_index
    return self.get_by_id(key)
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/pyteomics/auxiliary/file_helpers.py", line 253, in get_by_id
    return self._item_from_offsets(offsets)
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/pyteomics/mgf.py", line 359, in _item_from_offsets
    return self._read_spectrum_lines(lines)
  File "/Users/username/.local/share/virtualenvs/xi-mzidentml-converter-MB5dCI2Q/lib/python3.10/site-packages/pyteomics/mgf.py", line 209, in _read_spectrum_lines
    raise aux.PyteomicsError('MGF format error: cannot parse '
pyteomics.auxiliary.structures.PyteomicsError: Pyteomics error, message: 'MGF format error: cannot parse PEPMASS = 352.1888 836632.25 2+'

Please find the example mgf file in the following link:
https://drive.google.com/drive/folders/14wtAxOamqtf3A0BWQD_8_m5u0kpIRtQw?usp=sharing

@vrkosk
Copy link

vrkosk commented Jul 24, 2024

It may help to refer to https://www.matrixscience.com/help/data_file_help.html#PARAMS:

PEPMASS is peptide mass "optionally followed by intensity and charge".

Positive and negative charge states are specified as "N- to N+ where N is an integer".

@sureshhewabi
Copy link
Author

@vrkosk Yes So will you be able to correct this bug from pyteomics software?

@levitsky
Copy link
Owner

Thanks for reporting, I will try to implement support for this syntax shortly.

@ypriverol
Copy link

@levitsky we can try to do a PR with the changes needed if is needed.

@levitsky
Copy link
Owner

Thanks Yasset, I don't mind fixing this at all, just having a busy weekend celebrating my birthday :) I should be able to have a fix for this on Monday.

@ypriverol
Copy link

happy birthday my friend. All the best and I hope everything is going well for you. We probably will start contributing with some PRs in the future ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants