Open FLD-123 opened 8 months ago
bumping into the same problem. It might be related to the package Matrix https://github.com/satijalab/seurat/issues/7986 Tried with ‘Matrix’ 1.6-1.1 but >= 1.6.3 is required for METAFlux. Any help would be appreciated, Thanks
Same Error, I referred to this one satijalab/seurat/issues/8164 Still have this Error:
And my packages' versions:
Thanks
Hi, same issue here. I tried reinstalling Matrix package but it didn't help.
and I'm using "Matrix_1.6-1.1". Please help if you could! Thanks in advance!
I am running into the same issue after running previously with no issues. Looking for a solution as well- thanks so much!
I am having the same issue, checked my Seurat object and all the features and there were no duplicate rows but still getting the error "> mean_exp=calculate_avg_exp(myseurat = patient_data,myident = 'celltype_by_marker',n_bootstrap=3,seed=1) Error in validObject(.Object) : invalid class ?LogMap? object: Duplicate rownames not allowed" Please suggest!!
I have the same issue as well!
It works with Seuat V4.
I had the same issue as well and followed source code of calculate_avg_exp() function. I found the same error message in line
SeuratObject<-suppressWarnings(
CreateSeuratObject(count=sample, meta.data = meta.data))
which is included in get_ave_exp() function.
This error is caused by duplicated cell ids, generated from random sampling with replacement in the process of bootstrap. Therefore, I added codes to edit cell ids to avoid duplication before creating seurat object and the function operated well without any error messages.
Below are the codes I used. If there are any issues or concerns, leave additional comment plsease. Thanks.
generate_boots <- function(celltype, n) {
dt <- data.frame(cluster = celltype, id = 1:length(celltype))
index <- do.call(cbind, sapply(1:n, function(x) {
splits <- dt %>%
group_by(cluster) %>%
sample_n(dplyr::n(), replace = TRUE) %>%
ungroup() %>%
dplyr::select("id")
}))
return(index)
}
get_ave_exp <- function(i, myseurat, samples,myident) {
meta.data=myseurat@meta.data[samples[,i],]
sample <-myseurat@assays$RNA@counts[,samples[,i]]
name <- colnames(sample)
for (j in 1:length(name)) {
name[j] <- paste0(name[j], "_", j)
}
colnames(sample) <- name
rownames(meta.data) <- name
SeuratObject<-suppressWarnings(
CreateSeuratObject(count=sample, meta.data = meta.data))
SeuratObject<-NormalizeData(SeuratObject,verbose = TRUE)
ave<-GetAssayData(AverageExpression(SeuratObject,group.by = myident,return.seurat = T), assay = "RNA") %>% as.data.frame()
return(ave)
}
edit_calculate_avg_exp <- function(myseurat,myident,n_bootstrap,seed) {
set.seed(seed)
samples=generate_boots(myseurat@meta.data[,myident],n_bootstrap)
exp <- lapply(1:n_bootstrap,get_ave_exp,myseurat,samples,myident)
exp <- do.call(cbind, exp)
return(exp)
}
mean_exp = edit_calculate_avg_exp(myseurat = sc, myident = 'celltype', n_bootstrap = 50, seed = 1)
Hi METAFlux Developers,
Thank you so much for developing this wonderful tool.
I am currently exploring the METAFlux single-cell data tutorial, utilizing the single-cell data and other information provided by you. However, I encountered an error during the "mean_exp=calculate_avg_exp(myseurat = sc_test_example, myident = 'Cell_type', n_bootstrap=3, seed=1)" step.
The error message is as follows: "Error in validObject(.Object) : Duplicate rownames not allowed." Despite carefully inspecting the data, I couldn't identify any duplicated row names. If possible, could you kindly offer some solutions or guidance on how to address this issue?
Your assistance in resolving this matter would be greatly appreciated.
Thank you in advance.
Best regards, Fulan Deng