harmony icon indicating copy to clipboard operation
harmony copied to clipboard

Abount variable in each dataset to remove when merge the data

Open hahia opened this issue 3 years ago • 0 comments

Hello, I'm new to harmony, I feel confused about something. I have scRNA data of dataset1 and dataset2, dataset1 have the batch effect of Platform, dataset2 have batch effect of time, first I merge them (I don't want to remove batch effect between datasets), then do

library(harmony)
a<- NormalizeData(a) %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA(verbose = FALSE)
a<- RunHarmony(a, group.by.vars = c('Platform', 'time'))
ElbowPlot(a, reduction = 'harmony', ndims = 150)
a<- RunUMAP(a, reduction = "harmony", dims = 1:50)
a<- FindNeighbors(a, reduction = "harmony", dims = 1:50) %>% FindClusters(., resolution = 0.6)
DimPlot(a, group.by = c("Platform", "time"), ncol = 2)

Is it can remove the batch effect of time in dataset2, not in dataset1? I mean that

table(a$time, useNA = 'always')
12-14PCW 15-17PCW   7-8PCW  9-11PCW     <NA> 
    1942     1267     2129     3174     9725 

Is NA will be treated as a group when I merge the dataset and correct batch effect of time in dataset2. This seems wrong.

Thank you for your help!!!!

hahia avatar May 04 '21 03:05 hahia