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

Issue using "TIC" with data set #300

Open
backertix opened this issue Jun 27, 2022 · 3 comments
Open

Issue using "TIC" with data set #300

backertix opened this issue Jun 27, 2022 · 3 comments

Comments

@backertix
Copy link

Trying to access and plot my total ion chromatogram is not working. It does not seem to recognise it for my data. I exported my data from mzmine 3, and there definitely should be a TIC present. Has anyone had a similar issue? How do I access my chromatogram?

Issue using JupyterLab on Ubuntu 20.04.4.

My CODE:
mzml_basename = os.path.basename("22Jun0804.mzML")
pf = Factory()
pf.new_plot()
pf.add(run["TIC"].peaks(), color=(0, 0, 0), style="lines", title=mzml_basename)
pf.save(
"chromatogram_{0}.html".format(mzml_basename),
layout={"xaxis": {"title": "Retention time"}, "yaxis": {"title": "TIC"}},
)

ERROR OUTPUT:

StopIteration Traceback (most recent call last)
Input In [24], in <cell line: 4>()
2 pf = Factory()
3 pf.new_plot()
----> 4 pf.add(run["TIC"].peaks(), color=(0, 0, 0), style="lines", title=mzml_basename)
5 pf.save(
6 "chromatogram_{0}.html".format(mzml_basename),
7 layout={"xaxis": {"title": "Retention time"}, "yaxis": {"title": "TIC"}},
8 )

File ~/anaconda3/lib/python3.9/site-packages/pymzml/run.py:198, in Reader.getitem(self, identifier)
196 except:
197 pass
--> 198 spectrum = self.info["file_object"][identifier]
199 spectrum.calling_instance = self
200 if isinstance(spectrum, spec.Spectrum):

File ~/anaconda3/lib/python3.9/site-packages/pymzml/file_interface.py:101, in FileInterface.getitem(self, identifier)
90 """
91 Access the item with id 'identifier' in the file.
92
(...)
97 data (str): text associated with the given identifier
98 """
99 # if type(self.offset_dict) == dict:
100 # self.offset_dict.update(self.file_handler.offset_dict)
--> 101 return self.file_handler[identifier]

File ~/anaconda3/lib/python3.9/site-packages/pymzml/file_classes/standardMzml.py:103, in StandardMzml.getitem(self, identifier)
99 spectrum = spec.Chromatogram(
100 element, measured_precision=5e-6
101 )
102 elif event == "STOP":
--> 103 raise StopIteration
105 elif identifier in self.offset_dict:
107 start = self.offset_dict[identifier]

StopIteration:

@MKoesters
Copy link
Contributor

Hi @backertix ,

Could you check if 'TIC' is present in run.info['offset_dict']?
If yes I'd need the file or the Chromatogram element from your file to debug this.
If its not, maybe the TIC has another name which you would find in run.info['offset_dict']

Best,
Manuel

@backertix
Copy link
Author

Hi Manuel,

thank you for your response! I tried this, and got the following:

{'TIC': None, 1: (3744236,)}

I am not too sure how to interpret this, I would assume the TIC is under a different name in this case?
There should definitely be a chromatogram present, as I can access it using MZmine3.

Thank you!

@MKoesters
Copy link
Contributor

Hi @backertix,

Could you upload a sample of the mzML file?
Just the chromatogram element would probably be enough, you can also remove the binary data if necessary.
I'll have a look as soon as possible, however i'm on vacation for the next few week, so I guess it will take some time to get this working, sorry!

Best,
Manuel

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

No branches or pull requests

2 participants