I would like to extract date of acquisiton from mzXML and mzML files, using Python. Is it possible e.g. with Pyteomics? pymzml is only for mzML files. Are there other libraries that can do that? I assume of course that the date of acquisition is recored in mzXML/mzML files.
You should be able to extract anything from mzML and mzXML with Pyteomics. You will have to look at your files and figure out what you need to do, though, because you need to know what element contains the information that you want. I don't often work with mzXML and in the files that I have I do not see an acquisition date at all. With mzML it appears that the
<run> element has this information:
<run id="small_raw" defaultInstrumentConfigurationRef="IC1" startTimeStamp="2005-07-20T14:44:22">
So I can get it like this:
In : from pyteomics import mzml In : with mzml.MzML('tests/test.mzML') as f: ...: print(next(f.iterfind('run', recursive=False))['startTimeStamp']) ...: 2005-07-20T14:44:22
P.S. Disclaimer: I am the maintainer of Pyteomics.
pymzml certainly works via Bald et al 2012:
conda install -c bioconda pymzml
Whilst this only works with
mzML you simply convert
msconvert your_mzXML_file --mzML
I believe you managed this via
conda create -n openms -c bioconda openms FileConverter -in file.mzXML -out file.mzML
I suspect the underlying question is direct parsing in
mzXML without the need to perform a conversion from
mzML or without using
Possibility The following may be of use
Note, I've not tested nor read this but the repository looks genuine.