Plots a 2-D t-SNE of genes coloured by a discrete gene partition (modules) or a continuous numeric score. If no pre-computed embedding or partition is provided, they are computed internally.

VisualizeGeneTSNE(
  dist = NULL,
  gene_embedding = NULL,
  gene_partition = NULL,
  filtered = TRUE,
  perplexity = 30,
  text = TRUE,
  module_color = NULL
)

Arguments

dist

A dist object of pairwise gene distances. Required if gene_embedding or gene_partition is NULL.

gene_embedding

Data frame with columns tSNE_1 and tSNE_2 (output of ObtainGeneTSNE()). If NULL the embedding is computed from dist.

gene_partition

Named factor or character/logical vector of gene module assignments. If NULL, ClusterGenes() is called on dist.

filtered

Logical. Passed to ClusterGenes() when gene_partition is NULL. Default TRUE.

perplexity

Numeric. Passed to ObtainGeneTSNE() when gene_embedding is NULL. Default 30.

text

Logical. If TRUE (default) and gene_partition is a factor, module centroid labels are overlaid.

module_color

Named character vector mapping module levels to colours. If NULL, colours are generated automatically from RColorBrewer::brewer.pal.

Value

A ggplot2 object.

Examples

if (FALSE) {
p <- VisualizeGeneTSNE(dist = gene_dist, gene_partition = gene_partition)
print(p)
}