msmu.pp.adjust_ptm_by_protein
Adjust PTM site intensities by parent protein abundance from a matched global dataset.
This computes differential PTM usage (DPU), as described by Demeulemeester et al. (2024): the site's log intensity minus the log intensity of its parent protein in the same sample, so that a site's change is read relative to whatever its protein did. It is not occupancy/stoichiometry -- that additionally requires the unmodified counterpart peptide, and is a different estimand with far lower coverage.
A site's denominator is found through the accessions it was localized on, translated into a
global protein group via the global dataset's .uns['protein_map']. Nothing is looked up by
peptide, so a PTM peptide the global run never observed is still adjustable whenever its protein
was quantified there. Sites whose accessions span two or more quantified global groups have no
valid denominator and are left unadjusted; .var['adjustment_status'] records why for every
site.
The adjusted values replace the quantification that was read -- .X, or .layers[layer] when
given -- the same contract as log2_transform,
normalise and correct_batch_effect. A
site that could not be adjusted is set to NaN rather than left holding its raw abundance, so
residuals and raw abundances never share a matrix. To keep the unadjusted values, copy them into
a layer first::
mdata[modality].layers["unadjusted"] = mdata[modality].X.copy()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdata
|
MuData
|
|
required |
global_mdata
|
MuData | str | PathLike[str]
|
Matched global protein data as a |
required |
modality
|
str
|
PTM modality to adjust (e.g., |
'phospho_site'
|
layer
|
str | None
|
Layer to adjust. If |
None
|
method
|
PTMAdjustmentMethod
|
Estimator to use. |
'ratio'
|
rescale
|
bool
|
If |
True
|
ridge_alpha
|
float | None
|
Ridge penalty, used only when |
None
|
Returns:
| Type | Description |
|---|---|
MuData
|
|
References
Demeulemeester, N. et al. msqrob2PTM: differential abundance and differential usage analysis of MS-based proteomics data at the posttranslational modification and peptidoform level. Molecular & Cellular Proteomics 23, 100708 (2024). https://doi.org/10.1016/j.mcpro.2023.100708.