Closed jspaezp closed 1 year ago
Hi Sebastian,
You can use the iterfind
method to get this information. Example with one of my files:
>>> f = mzml.MzML(...)
>>> next(f.iterfind('referenceableParamGroup[@id="CommonInstrumentParams"]'))
{'id': 'CommonInstrumentParams',
'Orbitrap Fusion': '',
'instrument serial number': 'FSN20211'}
Note 1: You can actually just use 'referenceableParamGroup'
, but this shows how XPath syntax works.
Note 2: The file pointer must be still at the beginning of the file for this to work. If you have already read some spectra, you can call f.reset()
to go back to the beginning. But after that, iterating over spectra will start from the beginning, as well.
You can also use auxiliary.cvquery()
on this dict so that you get instrument name as a value with a predictable key:
>>> aux.cvquery(next(f.iterfind('referenceableParamGroup[@id="CommonInstrumentParams"]')))
{'MS:1002416': 'Orbitrap Fusion', 'MS:1000529': 'FSN20211'}
Best regards, Lev
Thank you so much!
Hello!
I am using the mzml object to read an indexed mzml file and I was wondering whether there is a way to get that information using the python API (which I would be having a hard time finding within the documentation).
Within the actual mzml file it can be found in L20 like this ...
Thanks for the help beforehand! Kindest wishes, Sebastian