Closed zhang-HZAU closed 5 months ago
Hello,
You should likely use the RNA
assay rather than the SCT
assay to calculate percent.mt
.
Regarding the inconsistency, could you please check if you get the same problem (percent.mt>100) if you run the same code on one of your objects separately? My hunch is that this has something due to running SCT on multi-layered objects.
Also, it would be great if you could provide a reproducible example so we could look into this further. I wasn't able to reproduce this using SeuratData
objects.
library(Seurat)
library(SeuratData)
data("pbmcsca")
pbmcsca <- UpdateSeuratObject(pbmcsca)
data("pbmc3k")
pbmc3k <- UpdateSeuratObject(pbmc3k)
pbmcsca[["RNA"]] <- as(object = pbmcsca[["RNA"]], Class = "Assay5")
pbmc3k[["RNA"]] <- as(object = pbmc3k[["RNA"]], Class = "Assay5")
obj <- merge(pbmc3k, pbmcsca)
obj <- SCTransform(obj, variable.features.n = 3000)
sum(obj$nCount_SCT != colSums(obj[['SCT']]$counts))
[1] 0
obj[["percent.mt"]] <- PercentageFeatureSet(obj, pattern = "^MT-")
sum(obj[["percent.mt"]]>100 )
> sum(obj[["percent.mt"]]>100 )
[1] 0
Hello,
You should likely use the
RNA
assay rather than theSCT
assay to calculatepercent.mt
.Regarding the inconsistency, could you please check if you get the same problem (percent.mt>100) if you run the same code on one of your objects separately? My hunch is that this has something due to running SCT on multi-layered objects.
Thank you very much for your reply.
I'm so confused now, feel like I've encountered the proton in the Three-Body novel, hhh.
Because I'm re-executing with the same input data, code and environment. It is found that the percent.mt calculated using the "sct" assay this time is normal and is less than 100.
The data used this time are: GSE140812, GSE193265. At present, it is normal for percent.mt to use "RNA" assay calculation.
I reviewed the entire operation and now I know what caused percent.mt to be greater than 100.
After executing SCTransform
, in order to successfully execute FindAllMarkers
, there will be an intermediate step s_merged <- PrepSCTFindMarkers(object = s_merged)
. PrepSCTFindMarkers will update the count value in the expression, but will not update nCount_SCT in meta.data, which leads to the inconsistency in nCount_SCT and percentage.mt is greater than 100.
My wrong execution order:
s_merged <- merge(x = merge_list[[1]], y = merge_list[2:3]) %>%
SCTransform(assay = "RNA", variable.features.n = 3000)
s_merged <- PrepSCTFindMarkers(object = s_merged)
s_merged[["percent.mt"]] <- PercentageFeatureSet(s_merged, pattern = "^mt-", assay = "SCT")
correct order:
s_merged <- merge(x = merge_list[[1]], y = merge_list[2:3]) %>%
SCTransform(assay = "RNA", variable.features.n = 3000)
s_merged[["percent.mt"]] <- PercentageFeatureSet(s_merged, pattern = "^mt-", assay = "SCT")
s_merged <- PrepSCTFindMarkers(object = s_merged)
I'm very sorry, personal reasons led to this error. thank you for your reply.
I use three seurat objects to merge and then execute
SCTransform
, and use "SCT" assay to executePercentageFeatureSet(s_merged, pattern = "^mt-")
.Then it was discovered that pencent.mt was greater than 100.The code that generates the exception is as follows:
merge_list as follows:
Debug:
During the debugging process, it was found that nCount_SCT obtained through colSums was inconsistent with the meta.data in Fig 1.Through the debug code I got the same exception percentage.mt as in meta.data in fig1.My understanding of the calculation process of pencent.mt should be
feature_count/all_count * 100
, and the result is also in line with expectations. The problem lies in the inconsistency ofnCount_SCT
.My question is: