CCA integration
0
0
Entering edit mode
11 weeks ago
kayah ▴ 20

I’m currently analyzing my data using the following code:

WAT <- readRDS("~/Desktop/GSE137869/GSE137869(AtoZ)/WAT.RDS")
WAT<- NormalizeData(object = WAT)
WAT<- FindVariableFeatures(object = WAT)
WAT<- ScaleData(object = WAT)
WAT<- RunPCA(object = WAT)
ElbowPlot(WAT)
WAT<- FindNeighbors(object = WAT, dims = 1:10)
WAT<- FindClusters(object = WAT)
WAT<- RunUMAP(object = WAT, dims = 1:10)
library(gridExtra)
p1<-DimPlot(WAT, reduction = 'umap' , group.by = 'orig.ident')
p2<-DimPlot(WAT, reduction = 'umap' , group.by = 'type', cols = c('red','blue'))
grid.arrange(p1, p2, ncol = 2, nrow = 2)
#####################\\\\
WAT.list <- SplitObject(WAT, split.by = 'sex')
View(WAT.list@meta.data)
for(i in 1:length(WAT.list)){
  WAT.list[[i]] <- NormalizeData(object = WAT.list[[i]])
  WAT.list[[i]] <- FindVariableFeatures(object = WAT.list[[i]])
}

features <- SelectIntegrationFeatures(object.list = WAT.list)
WAT.list <- lapply(WAT.list, function(x) {
  x <- ScaleData(x, features = features)
  x <- RunPCA(x, features = features)
  return(x)
})
anchors <- FindIntegrationAnchors(object.list = WAT.list, anchor.features = features)
WAT.integrated <- IntegrateData(anchorset = anchors)
WAT.integrated <- ScaleData(WAT.integrated)
WAT.integrated <- RunPCA(WAT.integrated)
WAT.integrated <- RunUMAP(WAT.integrated, dims = 1:30)
WAT.integrated <- FindNeighbors(WAT.integrated, dims = 1:30)
WAT.integrated <- FindClusters(WAT.integrated, resolution = 0.5)
DimPlot(WAT.integrated, reduction = 'umap', group.by = 'sex', label = TRUE, pt.size = 0.5)

for(i in 1:length(WAT.list)){
  WAT.list[[i]] <- NormalizeData(object = WAT.list[[i]])
  WAT.list[[i]] <- FindVariableFeatures(object = WAT.list[[i]])
}

However, when I run this code, I get the following error:

Error in [<-.data.frame(*tmp*, , i, value = c(0.00151975683890578, : replacement has 15601 rows, data has 16176)

Is there a good way to match the number of rows to resolve this issue? Also, the datasets for males and females have different sizes—do I need to perform any resizing to match them?

single-cell scRNA-seq batch-correction • 323 views
ADD COMMENT
0
Entering edit mode

Is there any reason for trying to use old method in integrating your data? I would you recommend to use the new approach from Seurat V5 for this purpose. Please check the link below:

https://satijalab.org/seurat/articles/seurat5_integration

ADD REPLY
0
Entering edit mode

Thank you so much!

ADD REPLY

Login before adding your answer.

Traffic: 1946 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6