Open rxnataliezhang opened 1 year ago
Hi @rxnataliezhang,
You can get the scan window for an MS1 spectrum by:
ms1_spec["scan window lower limit"]
If you want to know the isolation offset for precursor selection you can get it by:
ms2_spec['isolation window lower offset']
In general, if you know the name of an attribute in the mzml you can just access it like this, it should work with any attribute.
However, it might be a good idea for the next release to include this info in the selected_precursors
attribute of a spectrum.
Best, Manuel
Hi,
Did this solve your issue or you need furher support? If there is no problem, I'll close this issue in about a week :)
Best, Manuel
Hi Manuel,
Sorry that I turned to other busy work and forgot to reply.
Not quite. I ran the following code as you suggested and this returns None.
run = pymzml.run.Reader(mzml_file)
for n,spectrum in enumerate(run):
if spectrum.ms_level == 2:
print(spectrum["isolation window lower offset"])
I can confirm that it doesn't work with spectrum["isolation window lower offset"]
, so it seems like the name of the xml element is not parsed correctly in this case.
However, it works using the accession number ("MS:1000828" for lower offset, "MS:1000829" for upper offset). So, try the following:
run = pymzml.run.Reader(mzml_file)
for n,spectrum in enumerate(run):
if spectrum.ms_level == 2:
print(spectrum["MS:1000828"])
I hope that helps, but let us know if it still doesn't work.
@StSchulze Yes, this works. Thank you!
It seems "isolation window lower offset" is just the wrong name, maybe?. What name has MS:1000828 in the current obo?
Do you have any features about getting isolation window information (upper bound and lower bound)? I didn't find any clue about this in the documentation.