Question: Accessing normalized counts
0
17 months ago by
luke.zappia50
luke.zappia50 wrote:

When I try to access the normalized counts from a path simulation, I get the following error:

Error in assay(object, i = exprs_values) :
'assay(<SingleCellExperiment>, i="character", ...)' invalid subscript 'i'
'i' not in names(assays(<SingleCellExperiment>))


The code that creates the issue is as follows:

sim.paths <- splatSimulate(method="paths")
sim.paths <- normalise(sim.paths)
normX <- normcounts(sim.paths)

modified 17 months ago • written 17 months ago by luke.zappia50
3
17 months ago by
luke.zappia50
luke.zappia50 wrote:

The normcounts function is a shortcut for accessing an assay named normcounts. Neither the simulation functions in Splatter or the normalise function (which is in the scater package) create this assay, which is why you are seeing the error. You can see what assays are present using assayNames(sim.paths) and access them using assay(sim.paths, "assayname").

You might want to take a look at the documentation for the SingleCellExperiment and SummarizedExperiment packages to learn about the structure of the objects produced by Splatter and how to access them.

2

To add to Luke's answer; setting return_log=FALSE in normalize() will yield a "normcounts" assay. The default is to return log-transformed normalized expression values, as these are generally used in downstream analyses anyway.