4
$\begingroup$

I know that batch effects are variations in the data that are not biological, but from outside factors, like who took the samples, when was it taken (AM or PM), and so on.

My situation is the following: I'm gathering RNA-seq transcriptomic data about people who were treated with a certain cancer drug, but before they were treated. So I have the labeling if they responded or not, and I have their RNA-seq data before they were treated. After gathering the data, I conduct a cell type enrichement analysis for each dataset individually, to see if the people who responde and people who do not responde have different tumor cellular profile. The data is from different cancer types, different datasets, it's heterogenous. I have datasets of melanoma, lung cancer, renal cell carcinoma, gastro, and more cancer types.

After doing the cell type enrichement analysis for each dataset separatly, I combined all the scores into one comprehensive dataframe, called scores, and do batch effect correction with this code:

scores.batch = limma::removeBatchEffect(scores, batch = scores$cancertype)

what does this do exactly, and do you think I should also correct for data set?

This is the scores[1:15,1:15]:

structure(c(0, 0.0679901419400528, 0.0400496750811988, 0.0482367326065044, 
0, 0.0311229574337865, 0, 0.230766724561802, 0.0130401911422858, 
0.0340701040525204, 0.170909076828328, 0.01773848926898, 0.0644291992845225, 
0, 0.00716656856094877, 0, 0.0256702878665956, 0.146618059188406, 
0, 0, 0, 0, 0, 0.0137608540969118, 0, 0, 0.0100999977354592, 
0, 0.014951880422075, 0, 0, 0.157670478795813, 0.626964572395372, 
0, 0, 0, 0, 0.267217181299341, 0.0208607997305519, 0.0317512643538273, 
0.216134089444667, 0, 0.133133976872855, 0.0509764894291432, 
0, 0.00643390666442725, 0.0198563471760109, 0.0269546957969239, 
0.00839612466157775, 0, 0, 0, 0.135792129150605, 0.0306791807449823, 
0.0245322813632248, 0.0581232794898189, 0, 0.0113306571628598, 
0.0736402473717223, 0, 0.0562788278940215, 0.0197365476488731, 
0.510288824627519, 0, 0, 0, 0, 0, 0.00808293565225856, 0, 0.0120576870198705, 
0, 0.0756065852977926, 0.033804095025975, 0, 0, 0, 0.0883095578108505, 
0, 0, 0, 0, 0, 0.0152483703858198, 0, 0, 0, 0, 0.0180766544827361, 
0, 0, 0.0453699522236652, 0.0862072776187677, 0.0135920854235664, 
0, 0.0121970616856621, 0, 0.135535206654987, 0.0101591049475456, 
0.0121784241136469, 0.128072268753123, 0.0210894284621647, 0.0194646121245035, 
0.0540381655396803, 0, 0.18079139586031, 0.189254463003303, 0.029888048321481, 
0.0541812778427424, 0, 0, 0, 0.215022381991572, 0.00969491427150976, 
0.0223406673571106, 0.144924194478157, 0.0921982845361599, 0.0320096514933575, 
0.0961220443664323, 0.0126588948335048, 0, 0.022785243112039, 
0.0893620137600288, 0, 0, 0, 0, 0.0627768984349815, 0.0216749854839462, 
0.0124888431122003, 0.0078666361898362, 0.0224340322794678, 0.00918758007722465, 
0, 0, 0.0167099491258054, 0.0149569599862252, 0.225776419265983, 
0.0296939571626858, 0, 0, 0, 0.0267052090394147, 0.0368229910899846, 
0, 0, 0.0244839860392415, 0, 0.0125436970237014, 0.0372759973763743, 
0.00618735419664188, 0.0710179399375031, 0.0723424649726667, 
0, 0, 0, 0, 0, 0.0337322795006411, 0.0375867797836129, 0.0572019757148853, 
0.0237748490504673, 0.0167169014275168, 0.0111345646016615, 0, 
0, 0.046688139968337, 0.0351708018702931, 0, 0, 0, 0, 0.0591350872295602, 
0.0219554939925585, 0, 0.0124552946680113, 0, 0.0313457001492319, 
0.0318126127338407, 0, 0.0238070594883507, 0.0887393545717189, 
0.0836483327726664, 0.00782113454476318, 0, 0, 0, 0.120060643116735, 
0.0393210466824994, 0.0508059149670181, 0.10179828698662, 0, 
0.0478576770902387, 0.0344903509973101, 0, 0.442372249995689, 
0.0312811844417772, 0, 0.00563099608437556, 0, 0, 0, 0.0926041796109331, 
0, 0, 0.0149318321524897, 0.0125028189664699, 0.0703454111710074, 
0.26414814527198, 0.0187728466245726, 0, 0, 0, 0, 0, 0, 0, 0.133354279086491, 
0.0211140306442408, 0.0174288870187779, 0, 0.0118475583427554, 
0.0403579720283282, 0.0222583264159109, 0.00644966434608166), .Dim = c(15L, 
15L), .Dimnames = list(c("Adipocytes", "B-cells", "Basophils", 
"CD4+ memory T-cells", "CD4+ naive T-cells", "CD4+ T-cells", 
"CD4+ Tcm", "CD4+ Tem", "CD8+ naive T-cells", "CD8+ T-cells", 
"CD8+ Tcm", "Class-switched memory B-cells", "DC", "Endothelial cells", 
"Eosinophils"), c("Pt1", "Pt10", "Pt103", "Pt106", "Pt11", "Pt17", 
"Pt2", "Pt24", "Pt26", "Pt27", "Pt28", "Pt29", "Pt31", "Pt36", 
"Pt37")))
$\endgroup$

1 Answer 1

3
$\begingroup$

From the limma help page for removeBatchEffect():

The function (in effect) fits a linear model to the data, including both batches and regular treatments, then removes the component due to the batch effects.

It expects data "containing log-expression values for a series of samples."

Batch-effect corrections with this function are done at the early stage of log-expression values. Your code indicates that you are trying to apply a batch-effect correction to the downstream results of your cell-type enrichment analysis, which presumably represent the fraction of each cell type estimated from the RNAseq data. That's not what the function is designed to do.

If you have multiple data sets for the same cancer type, then it might make sense to do a batch correction for data sets within that cancer type. But do that on the original log-expression values, not after the cell type enrichement analysis.

$\endgroup$
2
  • $\begingroup$ And by log-expression values you mean the transcriptomic data? The point is to make it general, not cancer specific. So for example I want to see t-SNE for those scores without the effect of cancer type. $\endgroup$ Jul 19, 2022 at 13:28
  • $\begingroup$ @L0987 yes, the function works with original transcriptomic data expressed on the log scale. You might be able to use its general approach to remove “batch effects” due to differences in expression among cancer types. But you are probably better off doing that with your own modeling rather than depend on a function, designed for a different purpose, whose inner workings you haven’t yet fully investigated. Look at the code and see if it does what you need. $\endgroup$
    – EdM
    Jul 19, 2022 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.