This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in idx[i, ] <- res[[i]][[1]] : number of items to replace is not a multiple of replacement length

I was trying to integrate human cancer single-cell data, using IntegrateData() in Seurat. The code is as follows.

object.list_new <- list(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62)
for (i in 1:length(object.list_new)) {
  object.list_new[[i]] <- NormalizeData(object.list_new[[i]], verbose = FALSE)
  object.list_new[[i]] <- FindVariableFeatures(object.list_new[[i]], selection.method = "vst", 
                                               nfeatures = 2000, verbose = FALSE) 
  object.list_new[[i]][["percent.mt"]] <- PercentageFeatureSet(object = object.list_new[[i]], pattern = "^MT-") ##mito genes

  Feature_range = quantile(object.list_new[[i]]$nFeature_RNA, probs=c(.025,.975))
  Count_range = quantile(object.list_new[[i]]$nCount_RNA, probs=c(.025,.975))
  percent.mt_range = quantile(object.list_new[[i]]$percent.mt, probs=c(.05, .975))
  #We filter cells that have unique feature counts over 2,500 or less than 200, cells that have >5% mitochondrial counts
  object.list_new[[i]] <- subset(object.list_new[[i]], subset = nFeature_RNA > Feature_range[1] & nFeature_RNA < Feature_range[2] & percent.mt < 5 & nCount_RNA > Count_range[1] & nCount_RNA < Count_range[2])
  object.list_new[[i]]<- SCTransform(object = object.list_new[[i]], vars.to.regress = "percent.mt", verbose = FALSE)
}
options(future.globals.maxSize= 150000000000)

integrate.features <- SelectIntegrationFeatures(object.list = object.list_new, nfeatures = 2000)

object.list_new <- PrepSCTIntegration(object.list = object.list_new, anchor.features = integrate.features, 
                                      verbose = FALSE)

data.anchors_new <- FindIntegrationAnchors(object.list = object.list_new, normalization.method = "SCT", 
                                           anchor.features = integrate.features, verbose = FALSE)
data.combined_new <- IntegrateData(anchorset = data.anchors_new, normalization.method = "SCT", verbose = FALSE)

When I run the code

data.combined_new <- IntegrateData(anchorset = data.anchors_new, normalization.method = "SCT", verbose = FALSE)

Then it shows an error

Error in idx[i, ] <- res[[i]][[1]] :    number of items to replace is not a multiple of replacement length

Do you have any experience to handle this?

seurat r

Were you able to solve this issue? I'm having the same problem.

0 answers

No answers yet.

Log in to answer this question.