pymzML icon indicating copy to clipboard operation
pymzML copied to clipboard

How to get isolation window information?

Open rxnataliezhang opened this issue 2 years ago • 6 comments

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.

rxnataliezhang avatar Mar 20 '23 15:03 rxnataliezhang

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

MKoesters avatar Mar 20 '23 15:03 MKoesters

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

MKoesters avatar May 26 '23 12:05 MKoesters

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"])

rxnataliezhang avatar Jun 30 '23 15:06 rxnataliezhang

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 avatar Jun 30 '23 21:06 StSchulze

@StSchulze Yes, this works. Thank you!

rxnataliezhang avatar Jul 02 '23 03:07 rxnataliezhang

It seems "isolation window lower offset" is just the wrong name, maybe?. What name has MS:1000828 in the current obo?

fu avatar Sep 29 '23 12:09 fu