<p><code>isSpike</code> was provided by <code>SingleCellExperiment</code>. It is now deprecated. The notes in <code>SingleCellExperiment</code> indicate that one should use <code>altExps</code></p>

<p>I am struggling with a similar problem. Can't compile a package (<code>powsimR</code>) because a dependency uses <code>isSpike</code> (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.</p>

CC BY-SA 4.0
2020-05-19T09:52:42.857Z
2020-05-19T10:01:10.007Z
2020-05-19T10:01:10.007Z
Gerard Tromp
<p>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 <a href="https://bioconductor.org/packages/devel/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html" rel="nofollow noreferrer">new tutorial</a>. In any case, the purpose of altExp() is to provide another slot of ERCC reads and MT.. etc.</p>

<p>So in your example (super not recommended to watch video btw) :</p>

<pre><code>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)
</code></pre>

<p>We can pull out the spike in and mt genes:</p>

<pre><code>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,]
</code></pre>

<p>Have a vector of genes to keep:</p>

<pre><code>keep = setdiff(rownames(molecules),c(SpikeIn,MTgenes))
</code></pre>

<p>Then make the single cell object:</p>

<pre><code>sce &lt;- SingleCellExperiment(
assays=list(counts=as.matrix(molecules[keep,])),colData=annotation)
</code></pre>

<p>Use altExp to slot in the stuff:</p>

<pre><code>altExp(sce, "spike-in") &lt;- SummarizedExperiment(SpikeIn)
altExp(sce, "MTgenes") &lt;- SummarizedExperiment(MTgenes)
</code></pre>

CC BY-SA 4.0
2020-05-19T21:09:26.250Z
2020-05-19T21:15:50.240Z
2020-05-19T21:15:50.240Z
StupidWolf
<p>If you already have everything in a SingleCellExperiment called <code>sce</code>, and the old code called for something like this:</p>
<pre><code># old syntax
isSpike(sce, &quot;ERCC&quot;) &lt;- grepl(&quot;^ERCC&quot;, rownames(sce))
</code></pre>
<p>You can do the following instead:</p>
<pre><code># new syntax
is.spike &lt;- grepl(&quot;^ERCC&quot;, rownames(sce))
sce &lt;- splitAltExps(sce, ifelse(is.spike, &quot;ERCC&quot;, &quot;gene&quot;))
</code></pre>
<p>This will remove your ERCC counts from the regular counts assay and put them in an 'alternative experiment', calling <code>sce</code> will print <code>altExpNames(1): ERCC</code>.</p>

CC BY-SA 4.0
2021-03-02T10:19:54.323Z
2021-03-02T10:19:54.323Z
bug313
<p>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. </p>

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

CC BY-SA 4.0
2020-05-18T18:34:49.353Z
I think its deprecated.. can you provide an example of your dataset? Sometimes it might have different annotation in yours
StupidWolf
CC BY-SA 4.0
2020-05-19T19:28:54.127Z
I am following the workshop here [https://scrnaseq-course.cog.sanger.ac.uk/website/index.html].

The github for the course is here [https://github.com/hemberg-lab/scRNA.seq.course].

I pulled the data from here [https://github.com/jdblischak/singleCellSeq] The data files in the tutorial are annotation.txt and molecules.txt which are listed under the Useful files section.
Diana at Duke
CC BY-SA 4.0
2020-05-19T19:42:26.887Z
They hit the code at 01:59:53 in this video https://www.youtube.com/watch?v=thHgPqQpkE4&feature=emb_err_woyt
Diana at Duke
<r><scrnaseq><bioconductor>
isSpike function in SingleCellExperiment package is deprecated?
# isSpike function in SingleCellExperiment package is deprecated?

(Asked by: username_0 on 2020-05-15)

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.

**Tags:** r, scrnaseq, bioconductor
> **Comments:**
> **username_1**: I think its deprecated.. can you provide an example of your dataset? Sometimes it might have different annotation in yours  
> **username_0**: I am following the workshop here [https://scrnaseq-course.cog.sanger.ac.uk/website/index.html].  The github for the course is here [https://github.com/hemberg-lab/scRNA.seq.course].  I pulled the data from here [https://github.com/jdblischak/singleCellSeq] The data files in the tutorial are annotation.txt and molecules.txt which are listed under the Useful files section.  
> **username_0**: They hit the code at 01:59:53 in this video https://www.youtube.com/watch?v=thHgPqQpkE4&feature=emb_err_woyt  

---

## 3 answers

### Answer by username_2 on 2020-05-19. Score: 2

`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.


---

### Answer by username_1 on 2020-05-19. Score: 1

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)


---

### Answer by username_3 on 2021-03-02. Score: 0

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.


---

