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

Track scan numbers in MGF files #142

Open
wsnoble opened this issue Mar 2, 2023 · 0 comments
Open

Track scan numbers in MGF files #142

wsnoble opened this issue Mar 2, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@wsnoble
Copy link
Contributor

wsnoble commented Mar 2, 2023

It is unfortunate that scan numbers in MGF files are not retained by Casanovo. We should make it possible to keep this information, in addition to the scan index. In the future, DepthCharge is going to be modified to be more flexible with the information it parses from the mass spec data files. When that happens, we can use that functionality to track scan numbers. However, prior to these changes, we could accomplish this by adding to Casanovo a post-processing step wherein the MGF file is read again. It’s not hard to do---something like the following would work:

with open("test.mgf") as mgf_file:
    index_counter = 0 
    index2scan = {}
    for line in mgf_file:
        if line.startswith("SCAN ID"):
            index2scan[index_counter] = line.split("=", 1)[1]
            index_counter += 1

index2scan would be a dictionary mapping the scan index to the scan id value, again assuming all scans had the SCAN ID field.

In practice, we should probably support SCAN ID, SCAN and SCANS, since there is no definitive standard for MGF.

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

No branches or pull requests

2 participants