getClusterColours: Get a vector of cluster colours, optionally highlighting...

Description Usage Arguments Value Author(s) Examples

View source: R/utils_plotting.R

Description

Given a seurat object, get a named character vector of cluster colours, where names are cluster names (coresponding to levels(seurat@ident)), and values are hex codes of the colours, either the default colours from Seurat, or colours you specify. This is trivial to make this yourself, so this is used as a utility function for retaining the colours of clusters you want to highlight, and setting the colours of all other clusters to grey, or another default, non-intrusive colour.

Usage

1
2
getClusterColours(seurat, clusters = NULL, original_colours = NULL,
  default_colour = "gray80")

Arguments

seurat

Seurat object

clusters

Vector of one or more clusters to highlight, matching the levels at levels(seurat@ident). If "none", returns default_colour for every clusters. Default: all clusters, obtained from levels(seurat@ident).

original_colours

(Optional) Vector of colours to use. Either one colour per cluster, in the order of levels(seurat@ident), or one colour per cluster passed to clusters, in the other they were provided. Default: default ggplot2 colours used by Seurat.

default_colour

Colour to use for non-highlighted clusters Default: gray80 (light grey).

Value

Named character vector

Author(s)

Selin Jessa

Examples

1
2
3
4
5
6
7
8
# Trivial: get named character vector with default colours
getClusterColours(pbmc)

# Highlight clusters 2 and 3
getClusterColours(pbmc, clusters = c(2, 3))

# Highlight clusters 2 and 3, set all other cluster colours to white
getClusterColours(pbmc, clusters = c(2, 3), default_colour = "white")

fungenomics/cytobox documentation built on Feb. 13, 2020, 10:51 a.m.