compomics / ms2rescore

Modular and user-friendly platform for AI-assisted rescoring of peptide identifications
https://ms2rescore.readthedocs.io
Apache License 2.0
49 stars 15 forks source link

Wrong indexing during parsing MGF titles and retention times #80

Closed caetera closed 11 months ago

caetera commented 1 year ago

Hello,

retention_times dictionary returned by parse_mgf_title_rt function has scan order index as keys, thus, mapping in peprec_from_pin function fails with Could not map all MGF retention times to spectrum indices. error message.

Indexing with spectrum titles seems to solve the problem:

#current code
            if line[0] == "R":
                if line.startswith("RTINSECONDS="):
                    retention_times[index] = float(line[12:].strip())

#new code
            if line[0] == "R":
                if line.startswith("RTINSECONDS="):
                    retention_times[titles[index]] = float(line[12:].strip())

This change has been introduced at some point after v 2.0.0 (see #79). Earlier mapping in peprec_from_pin where performed in the opposite order and, thus, were still successful.

ArthurDeclercq commented 1 year ago

Hi @caetera,

Thank you for the comment, indeed there was a bug introduced in the newer versions causing this to break. Thank you for suggesting the solution by using earlier version of MS²Rescore to still be able to run this. We will fix this in the next version of MS²Rescore.

Thank you! Cheers, Arthur

RalfG commented 11 months ago

Hi @caetera, Happy to say that this should now fixed in v3.0 of MS²Rescore.