Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get isolation window information? #327

Open
rxnataliezhang opened this issue Mar 20, 2023 · 6 comments
Open

How to get isolation window information? #327

rxnataliezhang opened this issue Mar 20, 2023 · 6 comments

Comments

@rxnataliezhang
Copy link

rxnataliezhang commented Mar 20, 2023

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.

@MKoesters
Copy link
Contributor

MKoesters commented Mar 20, 2023

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
Copy link
Contributor

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

@rxnataliezhang
Copy link
Author

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

@StSchulze
Copy link
Contributor

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.

@rxnataliezhang
Copy link
Author

@StSchulze Yes, this works. Thank you!

@fu fu closed this as completed Sep 29, 2023
@fu fu reopened this Sep 29, 2023
@fu
Copy link
Member

fu commented Sep 29, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants