I have a protein expression data frame with a metadata data frame which includes age and sex:
nph_csf_metadata =
age sex bam tau
70 f 5 2
75 m 6 1
72 m 4 1
71 f 4 2
I want to keep the bam and tau load but remove the effects of age and sex from my protein expression data using removeBatchEffect.
I have tried this:
log_norm_prot <- log10(norm_prot) log_norm_prot <- t(log_norm_prot)
design = model.matrix(~bam + tau, nph_csf_metadata)
reg_log_norm_prot = removeBatchEffect(log_norm_prot, covariates = nph_csf_metadata$age, design = design)
This helps me regress out age but how can I regress both out at the same time using removeBatchEffect. Appreciate any help.
Thank you for your help, I used covariates but was only able to regress out one variable. Will try the method you advised and also check covariates again.
thank you, this worked. Appreciate your help so much.