levitsky / pyteomics

Pyteomics is a collection of lightweight and handy tools for Python that help to handle various sorts of proteomics data. Pyteomics provides a growing set of modules to facilitate the most common tasks in proteomics data analysis.
http://pyteomics.readthedocs.io
Apache License 2.0
105 stars 34 forks source link

Add a warning when an empty index is created, customize it for mgf #138

Closed levitsky closed 4 months ago

levitsky commented 5 months ago

This addresses https://github.com/levitsky/pyteomics/issues/134#issuecomment-1850726407 by raising a warning if an IndexedTextReader creates an empty offset index. IndexedMGF has a customized warning text, additionally advising to toggle index_by_scans.

Would this be a welcome change? A possible point of concern is that the warning is triggered regardless of "Index Saving", i.e. it doesn't matter if the index is built or just read from a file. Would we want to silence it if it's read from a file? Did I perhaps miss anything else?

levitsky commented 4 months ago

After merging #142, I changed this PR so that the warning is triggered in TextReaderMixin.build_byte_index. If IndexSavingMixin.build_byte_index is successful in reading the index from the external file, the warning is not raised.