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.
2 Answers
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 [1]: from pyteomics import mzml
In [2]: 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 mzXML
to pymzml
via ProteoWizard
msconvert your_mzXML_file --mzML
It is described here with your previous question with @haci
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 mzXML
to mzML
or without using Bioconductor
Possibility The following may be of use massspec-toolbox
at:
http://code.google.com/p/massspec-toolbox/source/browse/#svn/trunk/mzxml
Note, I've not tested nor read this but the repository looks genuine.
{}
button to format as code. And it isn't a question of showing the format but of having clear input and output requirements so solutions can be tested. $\endgroup$