Adding covariates to MSstatsPTM::groupComparisonPTM

9 views
Skip to first unread message

Courtney R Armour

unread,
Apr 28, 2026, 1:24:23 PM (3 days ago) Apr 28
to MSstats
Hello,
I have a phosphoproteomics dataset that has repeated samples from the same individual and a few additional covariates (e.g. sex, age) I usually include in RNAseq models for this type of dataset. This is my first time doing a proteomic analysis of this cohort and I'm struggling with how to include these in the group comparison with MSstats. Is it possible to include covariates and donorId?
Thank you,
Courtney

Anthony Wu

unread,
Apr 29, 2026, 6:52:37 PM (2 days ago) Apr 29
to MSstats
Hi Courtney,

MSstatsPTM handles covariates with repeated measures.  

I'll illustrate how to do this with the attached annotation file.  This annotation file defines your experimental design and you can directly feed this experimental design into an MSstatsPTM converter (e.g. the annotation parameter in DIANNtoMSstatsPTMFormat).  

In this example, we have sex & age as covariates, and time serving as the primary condition of interest.  Each row in the annotation file is a separate MS run, and the Condition column is a concatenation of the condition of interest & the covariates (e.g. Male_Young_0days).  MSstatsPTM knows it's a repeated measures design using the BioReplicate column - notice how each ID (which would be the donorId in your case) is repeated multiple times, once for each timepoint per unique individual (so here, ID1 is individual 1 and is repeated 3 times, ID2 is individual 2 repeated 3 times, etc).  

Once you get to the groupComparisonPTM function, you can use the contrast.matrix parameter to define your comparison of interest.  

For example, the below contrast matrix compares 7 days vs 0 days (where 0 days serves as a control).    The 14days columns are 0 because they're irrelevant to this comparison. The four -0.25 entries are the 0days baseline across each covariate subgroup summing to a net weight of -1, and the four +0.25 entries are the 7days values summing to a net weight of 1.

contrast.matrix <- matrix(                                                    

    c(-0.25,  0.25,  0,      # Female_Old:   0days, 7days, 14days             

      -0.25,  0.25,  0,      # Female_Young: 0days, 7days, 14days               

      -0.25,  0.25,  0,      # Male_Old:     0days, 7days, 14days               

      -0.25,  0.25,  0),     # Male_Young:   0days, 7days, 14days               

    nrow = 1,                                                                   

    ncol = 12,                                                                  

    dimnames = list(                                                            

      "7days_vs_0days",             

      c("Female_Old_0days",   "Female_Old_7days",   "Female_Old_14days",

        "Female_Young_0days", "Female_Young_7days", "Female_Young_14days",      

        "Male_Old_0days",     "Male_Old_7days",     "Male_Old_14days",

        "Male_Young_0days",   "Male_Young_7days",   "Male_Young_14days")                                                     

    )             

  ) 


Hope this helps, let me know if you need any more clarifications.

Tony
repeated_measures_covariates.csv

Anthony Wu

unread,
Apr 29, 2026, 6:53:27 PM (2 days ago) Apr 29
to MSstats
My bad, meant to attach this annotation file 
repeated_measures_covariates.csv
Reply all
Reply to author
Forward
0 new messages