I have a SingleCellExperiment Obejct "scp.ref", and I would like to convert it to Seurat Object, I was using the following command:
seurat.ref <- as.Seurat(x = sce.ref, counts = NULL, data = "logcounts")
As you can see in the following output, my SingleCellExperiment object contains only logcounts, there is no raw counts there, so I followed the document of seurat and put counts = NULL
, but somehow it still does not work. I'm using R.4.0.5, Seurat 4.0. How to fix the bug?
class: SingleCellExperiment
dim: 20143 33392
metadata(0):
assays(1): logcounts
rownames(20143): 0610010F05Rik 1110034G24Rik ... XIST-intron Zfp30
rowData names(0):
colnames(33392): SuHx.PH1.SCR3_TGTCGCGAGATC
SuHx.PH1.SCR3_GAATTATTCCAT ... SuHx.PH2D2.SCR10_CCGTTGTACGCG
SuHx.PH2D2.SCR2_TCTCCACATTCG
colData names(4): celllabel condition nFeatures nCounts
reducedDimNames(0):
altExpNames(0):
Errors I have:
Error in .subset2(x, i, exact = exact) : subscript out of bounds
Thank you, I upgrade to 4.0.2, it still does not work. I wonder If I could bypass this by directly creating an Seurat object, but I only have logcounts and metadata, how to create Seurat object with only logcounts and metadata, it requires raw counts, right ?
It requires a numeric matrix, not necessarily raw counts, so you can just input any random made-up numeric matrix, and then just be sure this slot is not going to be used in the analysis you do. Not ideal, but probably sufficient if you only need the object for a single analysis step which I assume.