Question: Cannot create SingleCellExperiment object
gravatar for Shian Su
13 months ago by
Shian Su10
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Shian Su10 wrote:


Using R 3.4.2, BioC 3.6, SingleCellExperiment_1.0.0. The following example code from ?SingleCellExperiment produces an error



ncells <- 100
u <- matrix(rpois(20000, 5), ncol=ncells)
v <- log2(u + 1)

pca <- matrix(runif(ncells*5), ncells)
tsne <- matrix(rnorm(ncells*2), ncells)

sce <- SingleCellExperiment(
  assays = list(counts=u, logcounts=v),
  reducedDims = SimpleList(PCA=pca, tSNE=tsne)


The error message is

Error in checkSlotAssignment(object, name, value) : 
  assignment of an object of class “GRangesList” is not valid for slot ‘rowRanges’ in an object of class “SingleCellExperiment”; is(value, "GenomicRangesORGRangesList") is not TRUE


This on a fresh Centos7 VM. If I'm not mistaken these examples are also tested as a part of the build process so I'm very puzzled how the code could fail on me.

EDIT: This appears to work perfectly fine on my MacBook Pro. It may be something strange in the setup of the Unix server I'm on.

ADD COMMENTlink modified 13 months ago by Aaron Lun21k • written 13 months ago by Shian Su10

Can you provide the output of sessionInfo() after library(SingleCellExperiment), and also BiocInstaller::biocValid() ?

ADD REPLYlink written 13 months ago by Martin Morgan ♦♦ 22k
gravatar for Aaron Lun
13 months ago by
Aaron Lun21k
Cambridge, United Kingdom
Aaron Lun21k wrote:

Works fine on my machine. Make sure you've properly updated all dependencies, as mentioned in:

C: SingleCellExperiment function in SingleCellExperiment package returns error (whe

ADD COMMENTlink written 13 months ago by Aaron Lun21k

Thanks Aaron, following that other question thread lead me to the solution. I had been drawing most of the BioC packages from a shared location I have no access to. The solution was to use

biocLite("SingleCellExperiment", dependencies=TRUE, lib="~/R/library")

to get a copy of all the dependencies in a local library. This removed the error.

ADD REPLYlink written 13 months ago by Shian Su10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 327 users visited in the last hour