SCENIC icon indicating copy to clipboard operation
SCENIC copied to clipboard

UMAP to replace tSNE

Open RM-SCB opened this issue 5 years ago • 6 comments

Hi,

Could you please advise how tSNE can by replaced by UMAP throughout the workflow?

Many thanks

RM-SCB avatar Feb 24 '20 23:02 RM-SCB

I have the same problem, any suggestion please?

paolo-kunderfranco avatar Mar 02 '20 15:03 paolo-kunderfranco

I found in the AUCell package that if you use

umap.coord <- reducedDims(SCE)[["UMAP"]] 
colnames(umap.coord) <- c("UMAP_1", "UMAP_2")
AUCell_plotTSNE(tSNE=umap.coord, exprMat=exprMatrix,...)

You can actually plot the enrichment for gene sets on UMAP coordinates that you have calculated previously (eventhough the function name suggests it would be restricted to TSNE). But I am still not sure how UMAP can be more broadly implemented throughout the SCENIC workflow... Any input from the developpers would be greatly appreciated...

RM-SCB avatar Mar 02 '20 15:03 RM-SCB

Hi,

Could you please advise how tSNE can by replaced by UMAP throughout the workflow?

Many thanks

I have the same problem, any suggestion please?

Me too!!

atermanini avatar Mar 02 '20 15:03 atermanini

RM-SCB, did you come across the error "The t-SNE should be a matrix with 2 columns (cell coordinates)"

Using UMAP worked when using the plot function in AUCells. But it doesn't seem to like UMAP when using for AUCELL_plotTSNE.

d-bone992 avatar Jan 06 '21 14:01 d-bone992

Well no idea if anyone still here, but if you take your original seurat object = downsampled.obj. Then, pbmc_umap_coord <- downsampled.obj@reductions$umap pbmc_umap_coord <- [email protected]

now you can just use AUCell_ploTSNE but feed it pbmc_umap_coord like so

AUCell::AUCell_plotTSNE(pbmc_umap_coord, exprMat, aucell_regulonAUC[onlyNonDuplicatedExtended(rownames(aucell_regulonAUC))[c("SPI1", "ELF2", "IRF1")],], plots="Expression")

zincfingers89 avatar Jun 19 '23 15:06 zincfingers89

umap.coord <- sce@reductions[["umap"]]@cell.embeddings

plotTsne_AUCellApp <- function(scenicOptions, exprMat, tSNE_fileName=NULL, skipDuplicatedExtended=TRUE) { if(is.null(tSNE_fileName)) tSNE_fileName <- tsneFileName(scenicOptions) tSNE <- readRDS(tSNE_fileName) regulonAUC <- loadInt(scenicOptions, "aucell_regulonAUC") thresholds <- loadInt(scenicOptions, "aucell_thresholds", ifNotExists="null") cellInfo <- loadFile(scenicOptions, getDatasetInfo(scenicOptions, "cellInfo"), ifNotExists="null") colVars <- loadFile(scenicOptions, getDatasetInfo(scenicOptions, "colVars"), ifNotExists="null")

if(skipDuplicatedExtended) { regulons2plot <- onlyNonDuplicatedExtended(rownames(regulonAUC)) regulonAUC <- regulonAUC[regulons2plot,] thresholds <- thresholds[regulons2plot] } aucellApp <- AUCell_createViewerApp(auc=regulonAUC, thresholds=thresholds, tSNE=umap.coord, exprMat=exprMat, cellInfo=cellInfo, colVars=colVars) invisible(aucellApp) }

exprMat_log <- exprMat # Better if it is logged/normalized aucellApp <- plotTsne_AUCellApp(scenicOptions, exprMat_log) # default t-SNE savedSelections <- shiny::runApp(aucellApp)

gao19970223 avatar May 07 '24 03:05 gao19970223