Closed hmayes closed 2 years ago
Hi Heather,
The line that's throwing you the error is trying to get the precision with which the corresponding spectrum has been measured. That info is looked up in the corresponding dictionary, which can be defined while initializing the reader (using the keyword MS_precisions
). So you should be able to define a precision for each ms level that you're dealing with, e.g. using:
run = pymzml.run.Reader(
mzml_file,
MS_precisions={
0: 0.0001,
1: 5e-6,
2: 20e-6,
3: 20e-6,
},
)
I hope that helps and let us know if not, or if you come across other issues with weird attributes ;)
Best, Stefan
Thank you! that is very helpful. I don't know why the file even had level "3"; just trying to process what I'm given.
Hello! I have to process a wide variety of mzML files which can have some weird attributes. I'm trying to read a file which fails on line 158 of run.py, "spectrum.measured_precision = self.ms_precisions[ms_level]". For some reason, this file seems to have an ms level 3 and is thus throwing a KeyError. I don't need this info from the mzML file, so could like line be changed to a try catch, and leave as None if it raises a KeyError?
I've attached the mzML file causing this error when I iterate through the spectra (called with
for n, spec in enumerate(ms_run_data):
). I changed the file name from 1-_319CAD0.mzML to -_319CAD0_mzML.txt so that GitHub would allow me to upload it.Thanks! -Heather