I tried to convert SingleCellExperiment to Seurat Object, but it does not work, and keep return error: Error in .subset2(x, i, exact = exact) : subscript out of bounds, how to fix it?
1
0
Entering edit mode
2.9 years ago
FantasticAI ▴ 60

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
scRNA Seurat • 3.5k views
ADD COMMENT
0
Entering edit mode
2.9 years ago

The Seurat conversion functions to/from SCE objects have, let's say, a few kinks to work out still, to be nice. This bug has been reported before and supposedly fixed. Seurat just released a new version (4.0.2) today that updated those conversion functions, so you might try that version and see if it's fixed. If not, I'd open an issue on their github.

ADD COMMENT
0
Entering edit mode

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 ?

ADD REPLY
1
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 3672 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6