8.4 Highlighting specific cells on an embedding

ArchR also allows you to highlight specific cells on the embedding using the highlightCells parameter by passing the cell names of the desired cells to be highlighted. For example, we could highlight just the cells corresponding to cluster C1 by passing the cell names corresponding to those cells.

plotEmbedding(
  ArchRProj = projHeme2,
  embedding = "UMAP",
  colorBy = "cellColData",
  name = "Clusters",
  size = 1,
  sampleCells = NULL,
  highlightCells = getCellNames(ArchRProj = projHeme2)[which(projHeme2@cellColData$Clusters == "C1")],
  baseSize = 10,
  plotAs = "points")
## ArchR logging to : ArchRLogs/ArchR-plotEmbedding-371b01ce11077-Date-2022-12-23_Time-06-23-19.log
## If there is an issue, please report to github with logFile!
## Getting UMAP Embedding
## ColorBy = cellColData
## Plotting Embedding
## 1 
## ArchR logging successful to : ArchRLogs/ArchR-plotEmbedding-371b01ce11077-Date-2022-12-23_Time-06-23-19.log

By default, ArchR colors these highlighted cells red. However, you can change the highlighted cell color using the pal paramter. To do this, you must pass a named vector that includes the name of the highlighted cells (“C1”), and another color designated by “Non.Highlighted”.

plotEmbedding(
  ArchRProj = projHeme2,
  embedding = "UMAP",
  colorBy = "cellColData",
  name = "Clusters",
  size = 1,
  pal=c("C1" = "#50ADF9", "Non.Highlighted" = "lightgrey"),
  sampleCells = NULL,
  highlightCells = getCellNames(ArchRProj = projHeme2)[which(projHeme2@cellColData$Clusters == "C1")],
  baseSize = 10,
  plotAs = "points")
## ArchR logging to : ArchRLogs/ArchR-plotEmbedding-371b035d59447-Date-2022-12-23_Time-06-23-24.log
## If there is an issue, please report to github with logFile!
## Getting UMAP Embedding
## ColorBy = cellColData
## Plotting Embedding
## 1 
## ArchR logging successful to : ArchRLogs/ArchR-plotEmbedding-371b035d59447-Date-2022-12-23_Time-06-23-24.log

You can use this highlightCells parameter in conjuction with other data stored in your ArchRProject, for example colorBy = "GeneScoreMatrix".

plotEmbedding(
  ArchRProj = projHeme2,
  embedding = "UMAP",
  colorBy = "GeneScoreMatrix",
  name = "CD14",
  size = 1,
  sampleCells = NULL,
  highlightCells = getCellNames(ArchRProj = projHeme2)[which(projHeme2@cellColData$Clusters %in% c("C1","C2","C7","C8","C9"))],
  baseSize = 10,
  plotAs = "points")
## Getting ImputeWeights
## No imputeWeights found, returning NULL
## ArchR logging to : ArchRLogs/ArchR-plotEmbedding-371b0406f4bd3-Date-2022-12-23_Time-06-23-29.log
## If there is an issue, please report to github with logFile!
## Getting UMAP Embedding
## ColorBy = GeneScoreMatrix
## Getting Matrix Values...
## 2022-12-23 06:23:31 :
## 
## Plotting Embedding
## 1 
## ArchR logging successful to : ArchRLogs/ArchR-plotEmbedding-371b0406f4bd3-Date-2022-12-23_Time-06-23-29.log