We’ve been discussing this problem with differing return value types in relation to other issues. This is particularly problematic when some vendors produce params with empty value strings regardless of whether the param has a value type.
As for your main question, that metadata can be accessed using something like the code below:
Given an mzIdentML file with the following content:
<FragmentTolerance>
<cvParam accession="MS:1001412" name="search tolerance plus value" value="0.4" cvRef="PSI-MS" unitAccession="UO:0000221" unitName="dalton" unitCvRef="UO"/>
<cvParam accession="MS:1001413" name="search tolerance minus value" value="0.4" cvRef="PSI-MS" unitAccession="UO:0000221" unitName="dalton" unitCvRef="UO"/>
</FragmentTolerance>
The following code will get you the data you want:
from pyteomics import mzid
reader = mzid.read("path/to/file.mzid")
# Get the piece of the document described in the snippet
gen = reader.iterfind("FragmentTolerance")
datum = next(gen)
for k, v in datum.items():
print(k, type(k), k.accession, k.unit_accession)
print(v, type(v), v.unit_info)
This will produce the following output:
search tolerance plus value <class 'pyteomics.auxiliary.cvstr'> MS:1001412 UO:0000221
0.4 <class 'pyteomics.auxiliary.unitfloat'> dalton
search tolerance minus value <class 'pyteomics.auxiliary.cvstr'> MS:1001413 UO:0000221
0.4 <class 'pyteomics.auxiliary.unitfloat'> dalton
These “augmented” value types were used because they let us preserve backwards-compatibility.
--
---
You received this message because you are subscribed to the Google Groups "Pyteomics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyteomics+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Could you point me to the mzIdentML file and id where you’re getting different output from iterfind
and get_by_id
please?
To unsubscribe from this group and stop receiving emails from it, send an email to pyteomics+unsubscribe@googlegroups.com.