0
$\begingroup$

I am trying to follow a tutorial from Sanger institute (from May 2019) on analysis of single cell RNA Seq data. They use isSpike function to filter out ERCC (control) and MT (mitochondrial RNA) reads, but I am getting an error message that isSpike is a deprecated function. I am trying to use altExp instead as recommended by some people. I can't seem to figure this out. Can anyone provide some code to use instead of isSpike? I am new to bioinformatics.

I tried to swap out the isSpike function with the altExp function, but I am getting stuck on how to translate the grepl function.

$\endgroup$
3

3 Answers 3

2
$\begingroup$

isSpike was provided by SingleCellExperiment. It is now deprecated. The notes in SingleCellExperiment indicate that one should use altExps

I am struggling with a similar problem. Can't compile a package (powsimR) because a dependency uses isSpike (not used in the code directly), so I have to hunt down where it is used by one of a very long list of dependencies.

$\endgroup$
1
$\begingroup$

You are on the latest version of SingleCellExperiment most likely. You should not go back to using the old version. One thing is to check out the new tutorial. In any case, the purpose of altExp() is to provide another slot of ERCC reads and MT.. etc.

So in your example (super not recommended to watch video btw) :

molecules = read.delim("https://raw.githubusercontent.com/jdblischak/singleCellSeq/master/data/molecules.txt",stringsAsFactors=FALSE,row.names=1)

annotation = read.delim("https://raw.githubusercontent.com/jdblischak/singleCellSeq/master/data/annotation.txt",stringsAsFactors=FALSE)

We can pull out the spike in and mt genes:

library(SingleCellExperiment)
library(EnsDb.Hsapiens.v86)

Spikein_names = grep("^ERCC-",rownames(molecules),value=TRUE)
SpikeIn = molecules[Spikein_names,]

g = genes(EnsDb.Hsapiens.v86)
MTgene_names = g[seqnames(g)=="MT"]$gene_id
MTgenes = molecules[rownames(molecules) %in% MTgene_names,]

Have a vector of genes to keep:

keep = setdiff(rownames(molecules),c(SpikeIn,MTgenes))

Then make the single cell object:

sce <- SingleCellExperiment(
assays=list(counts=as.matrix(molecules[keep,])),colData=annotation)

Use altExp to slot in the stuff:

altExp(sce, "spike-in") <- SummarizedExperiment(SpikeIn)
altExp(sce, "MTgenes") <- SummarizedExperiment(MTgenes)
$\endgroup$
0
$\begingroup$

If you already have everything in a SingleCellExperiment called sce, and the old code called for something like this:

# old syntax
isSpike(sce, "ERCC") <- grepl("^ERCC", rownames(sce))

You can do the following instead:

# new syntax
is.spike <- grepl("^ERCC", rownames(sce))
sce <- splitAltExps(sce, ifelse(is.spike, "ERCC", "gene"))

This will remove your ERCC counts from the regular counts assay and put them in an 'alternative experiment', calling sce will print altExpNames(1): ERCC.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.