Hello,
I am trying to use scTransformed counts instead of log-transformed counts for training and predicting cell types. I created a Seurat object, performed the sctranform and then created a SingleCellExperiment object from the sctransformed counts. The execution fails at this line:
sce_with_sctransformed_counts <- selectFeatures(sce_with_sctransformed_counts, suppress_plot = TRUE), producing the following error:
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases
In addition: Warning message:
In linearModel(object, n_features) :
Your object does not contain counts() slot. Dropouts were calculated using logcounts() slot...
It does not seem like there are any NA values in the logcounts
any(is.na(logcounts(sce_with_sctransformed_counts)))
[1] FALSE
I suspected that since the sctransformed values are negative, it could be a potential source of error. Hence, I executed the following:
logcounts(sce_with_sctransformed_counts) <- log2(normcounts(sce_with_sctransformed_counts) + 5)
But I still keep getting the same error.
Could you please help me with this?
This is a portion of the code I am using.
sce_seurat <- CreateSeuratObject(counts = Data[,Train_Idx[[i]]])
sce_seurat <- SCTransform(object = sce_seurat)
sce_with_sctransformed_counts = SingleCellExperiment(assays = list(normcounts = GetAssayData(object = sce_seurat, slot = "scale.data")),
colData = data.frame(cell_type1 = Labels[Train_Idx[[i]]]))
rowData(sce_with_sctransformed_counts)$feature_symbol <- rownames(sce_with_sctransformed_counts)
logcounts(sce_with_sctransformed_counts) <- log2(normcounts(sce_with_sctransformed_counts) + 5)
sce_with_sctransformed_counts <- selectFeatures(sce_with_sctransformed_counts, suppress_plot = TRUE)
Thank you.
Hello,
I am trying to use scTransformed counts instead of log-transformed counts for training and predicting cell types. I created a Seurat object, performed the sctranform and then created a SingleCellExperiment object from the sctransformed counts. The execution fails at this line:
sce_with_sctransformed_counts <- selectFeatures(sce_with_sctransformed_counts, suppress_plot = TRUE), producing the following error:It does not seem like there are any NA values in the logcounts
I suspected that since the sctransformed values are negative, it could be a potential source of error. Hence, I executed the following:
But I still keep getting the same error.
Could you please help me with this?
This is a portion of the code I am using.
Thank you.