pymzml / pymzML

pymzML - an interface between Python and mzML Mass spectrometry Files
https://pymzml.readthedocs.io/en/latest/
MIT License
162 stars 92 forks source link

UV Spec Data Error (again) #195

Closed pyeguy closed 4 years ago

pyeguy commented 4 years ago

Describe the bug

Can't read a mzML file that contains UV data, will throw an AttributeError when looking to get ms_level.

This is because MS:1000511 doesn't exist for these scans and instead the following child is in the element tree:

          <cvParam cvRef="MS" accession="MS:1000804" name="electromagnetic radiation spectrum" value=""/>

This is related to #119 but a slightly different flavor.

To Reproduce

pymzml.run.Reader(<some_uv_containing_chromatagram.mzML>).next()

Expected behavior In the past ms_level was set to 0 which I think is sane enough.

Desktop (please complete the following information):

Additional Context I can work on a PR when I get a chance but what I've done as a work around is modify the ms_level property here to include a try except block if MS:1000511 doesn't exist but MS:1000804 does.

fu commented 4 years ago

Hi pyeguy,

I guess a quick fix would be that the @property functions like ms_level don't fail, but return None or similar, would that work?

Cheers

.c

fu commented 4 years ago

Hi pyeguy,

please have look at branch: feature/manage_missing_ms_level_information

Cheers

.c