Closed amnahsiddiqa closed 2 years ago
Hi Amnah,
Accessing the polarity can be done using the tag you posted.
In [1]: import pymzml
In [2]: with pymzml.run.Reader('/home/manuel/Data/Proteomics/mzML_examples/200414_HILIC_pos_Ph
...: ospholipid_Soy-Soybean Phospholipid.mzML') as run:
...: for spec in run:
...: print(spec["MS:1000130"]) # positive scan
...: print(spec["MS:1000129"]) # negative scan
...: break
...:
True
None
In [3]:
You could do the same thing using the names instead of the MS tags
In [2]: with pymzml.run.Reader('/home/manuel/Data/Proteomics/mzML_examples/200414_HILIC_pos_Ph
...: ospholipid_Soy-Soybean Phospholipid.mzML') as run:
...: for spec in run:
...: print(spec["positive scan"]) # positive scan
...: print(spec["negative scan"]) # negative scan
...: break
...:
True
None
Currently, its a bit awkward, as you see the return value of spec["MS:1000130"]
is True, since its actually a positive scan.
A return value of None
would mean, that the tag (in this case MS:1000129) was not found.
Loading a run measured in negative mode would result in spec["MS:1000130"]
returning None
and spec["MS:1000130"]
returning True
EDIT:
In [3]: 'negative scan' in spec
Out[3]: False
In [4]: 'positive scan' in spec
Out[4]: True
In [5]: 'MS:1000129' in spec
Out[5]: False
In [6]: 'MS:1000130' in spec
Out[6]: True
would also work and is probably the best method :)
Hope this help and feel free to ask if you need more information :)
Best, Manuel
hey Manuel, Thanks much. Closing the issue now.
I need toe extract a cvparam ; MS:1000130 for polarity of scans ; looking at #219 ; I wanted to know can we not access any information using accession like "MS:1000130" directly; it might be a naive question but I am just getting started; '