Entering edit mode
2.0 years ago
sandy
•
0
Good evening,
I am trying to analysis my scrna-seq data with seurat. Since I combined my data from several databases, thus I want to normalize them first. Then I wrote a for loop, the code is following:
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-")
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))
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)
}
But, after running I meet an error, and R said:
Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': invalid character indexing.
Could you guys please give me some suggestions on to solve this problem?
Thank you
Are you using LoadH5Seurat to load your data?
No, I did not. Since some my data is txt file, and some has 3 files (barcode, matrix, features), thus I use read.table, and read10X to load data.