Closed ftwkoopmans closed 6 years ago
Hi,
I'll have a look into this and will try to reimplement this feature Thanks for reporting this!
Best, Manuel
@ftwkoopmans You may want to have a look at the fix_#92 branch, I had no appropriate file to test, but I mocked one of my test files and tried to reproduce your mzML This is a quick fix and I will have a closer look hopefully this weekend, but at least for my mocked file it does the job
@MKoesters thanks for looking into this. I've uploaded an mzML for you to test with @ https://surfdrive.surf.nl/files/index.php/s/cbahqYlPV7DSxvT
I've downloaded the fix_#92 branch, ran python setup.py install
and get the following error when parsing the mzML file;
File "test_mzML.py", line 7, in <module>
for spec in run:
File "...\lib\site-packages\pymzml-2.0.3-py3.6.egg\pymzml\run.py", line 145, in __next__
ms_level = spectrum.ms_level
File "...\lib\site-packages\pymzml-2.0.3-py3.6.egg\pymzml\spec.py", line 851, in ms_level
ns=self.ns
AttributeError: 'NoneType' object has no attribute 'get'
my test code;
import pymzml
import sys
if __name__ == '__main__':
path = sys.argv[1]
run = pymzml.run.Reader(path)
for spec in run:
if spec.ms_level == 2:
print(spec.ID)
print(spec.selected_precursors)
break
ps. when I run the code using a mzML without a <referenceableParamGroup>
I get:
Traceback (most recent call last):
File "test_mzML.py", line 7, in <module>
for spec in run:
File "...\lib\site-packages\pymzml-2.0.3-py3.6.egg\pymzml\run.py", line 135, in __next__
has_ref_group = self.info['referenceable_param_group_list']
KeyError: 'referenceable_param_group_list'
Thanks for providing an example file. I tested your code with your example file and our standard example.mzML, it should work now. As soon as I know its fine for you, I'll merge this fix. Thanks again for reporting this and using pymzML
Best, Manuel
I've just tested with 2 different files, works like a charm. Thanks 👍
Hello, I am new to programming and want to parse my mzml file with pymzml. Can someone write an example script please? Thanks in advance
Hi @Trapacology ,
thanks for giving pymzml a try.
Please note that it would be best to open a new issue if you need help with a specific problem, instead of replying on a closed issue.
In the folder "example_scripts", you can find a lot of examples for various applications. In addition, the documentation offers a quick start guide with code examples: https://pymzml.readthedocs.io/en/latest/quick_start.html
Please let us know about your specific problem/task, if none of the above helps with that.
My mzML files lack common
<cvParam>
elements (eg; centroid, mslevel) in the<spectrum>
elements, and instead contain references to<referenceableParamGroup>
.There was support for this in older pymzML versions (eg; pymzML-0.7.9 -->> 'referenceableParamGroupList' @ run.py and 'initFromTreeObjectWithRef' @ spec.py).
I assume this usecase is not so common and therefore glanced over in initial v2 release, but I'm hoping this feature can be reimplemented so we can migrate from the old version :)
Example snippets: