Is use_dimred deprecated or is this a runTSNE() bug?
0
0
Entering edit mode
2.9 years ago
tbg ▴ 120

I was running a pipeline which I developed some time ago and we spotted a very weird behaviour that had quite an impact over our analyses.

Indeed, the scater's runTSNE() function was subjected to a change in the parameters names and, in particular, the old use_dimred parameter now has a new name, which is dimred.

Interestingly, I was running the pipeline using the runTSNE() function and passing the dimensionality reduction through use_dimred which is apparently deprecated and obtaining very weird results without being aware of that since no warning and/or error was returned.

A quick example:

# load some data
library("scRNAseq")
library("scater")
sce.416b <- LunSpikeInData(which="416b")

check the data and notice no dimensionality reduction is available:

> sce.416b
class: SingleCellExperiment 
dim: 46604 192 
metadata(0):
assays(1): counts
rownames(46604): ENSMUSG00000102693 ENSMUSG00000064842 ...
  ENSMUSG00000095742 CBFB-MYH11-mcherry
rowData names(1): Length
colnames(192): SLX-9555.N701_S502.C89V9ANXX.s_1.r_1
  SLX-9555.N701_S503.C89V9ANXX.s_1.r_1 ...
  SLX-11312.N712_S508.H5H5YBBXX.s_8.r_1
  SLX-11312.N712_S517.H5H5YBBXX.s_8.r_1
colData names(9): Source Name cell line ... spike-in addition block
reducedDimNames(0):            <-- HERE IT IS EMPTY
mainExpName: endogenous
altExpNames(2): ERCC SIRV

at this point I simply run the runTSNE() function using a non-existent dimred:

# add logcounts
sce.416b <- logNormCounts(sce.416b)
# add random colours to cells
colLabels(sce.416b) <- rep(c(1,2,3,4), 48)
# runTSNE, first try
sce.416b <- runTSNE(sce.416b, use_dimred="made_up_dimred", perplexity=30)
# and plot
dev.new(); plotTSNE(sce.416b, colour_by="label")
# runTSNE, second try
sce.416b <- runTSNE(sce.416b, use_dimred="another_made_up_dimred", perplexity=30)
# and plot
dev.new(); plotTSNE(sce.416b, colour_by="label")
# runTSNE, third try
sce.416b <- runTSNE(sce.416b, use_dimred="a_third_made_up_dimred", perplexity=30)
# and plot
dev.new(); plotTSNE(sce.416b, colour_by="label")

it, unfortunately, works. Indeed, I now have three TSNE available that I did plot and that are slightly different with each other.

> sce.416b
class: SingleCellExperiment 
dim: 46604 192 
metadata(0):
assays(2): counts logcounts
rownames(46604): ENSMUSG00000102693 ENSMUSG00000064842 ...
  ENSMUSG00000095742 CBFB-MYH11-mcherry
rowData names(1): Length
colnames(192): SLX-9555.N701_S502.C89V9ANXX.s_1.r_1
  SLX-9555.N701_S503.C89V9ANXX.s_1.r_1 ...
  SLX-11312.N712_S508.H5H5YBBXX.s_8.r_1
  SLX-11312.N712_S517.H5H5YBBXX.s_8.r_1
colData names(10): Source Name cell line ... block sizeFactor
reducedDimNames(1): TSNE      <-- THERE YOU GO: A NICE TSNE COMPUTED OVER A NON-EXISTENT DIMRED
mainExpName: endogenous
altExpNames(2): ERCC SIRV

What is even more interesting is that if I run the function with the newly renamed parameter, i.e. dimred, I do get an error:

> sce.416b <- runTSNE(sce.416b, dimred="made_up_dimred", perplexity=30)
Error in value[[3L]](cond) : 
  invalid subscript 'type' in 'reducedDim(<SingleCellExperiment>, type="character", ...)':
  'made_up_dimred' not in 'reducedDimNames(<SingleCellExperiment>)'

But then, if you have an old pipeline which used the runTSNE function with the use_dimred and you're now running an updated version of scater, I have no idea what you may get.

So, as per my question...is this a bug? Has anyone else noticed this weird behaviour? Am I wrong?

runTSNE dimred scater single_cell use_dimred • 529 views
ADD COMMENT

Login before adding your answer.

Traffic: 1647 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