MannLabs / alphabase

Infrastructure of AlphaX ecosystem
https://alphabase.readthedocs.io
Apache License 2.0
31 stars 9 forks source link

Adjust isotope distribution if first isotope isn't the monoisotopic intensity #120

Closed GeorgWa closed 11 months ago

GeorgWa commented 12 months ago

In certain cases the array returned from dist, mono = isotope_dist.calc_formula_distribution() will start before the monoisotopic mass. In these cases, it needs to betrimmed or tracked.

alphabase.peptide.precursor.calc_precursor_isotope_intensity() needs to be adapted to handle this case.

jalew188 commented 12 months ago
dist = dist / dist.sum()

in https://github.com/MannLabs/alphabase/blob/main/alphabase/peptide/precursor.py#L587

I think it is better to do mono-level normalization

dist = dist / dist[mono]

Then it is easier to track the mono index, I guess it does not affect AlphaDIA search.

And add mono_idx to precursor_df

precursor_df["mono_isotope_idx"] = mono_idx

I will quickly fixed this and you can review.

GeorgWa commented 12 months ago

I'm using the isotope distribution a lot to calculate weighted means. Fore me the more natural way would be therefore:

dist = dist[mono:]
dist = dist / dist.sum()

Should I do this on the side of alphaDIA or should we do this with a switch in AB?

normalize: typing.Literal['mono','sum']`,
crop_below_mono: bool = False

I'm fine with both