plot_tsne: scClustViz plot: Plot cell embedding in 2D

View source: R/shinyModules.R

plot_tsneR Documentation

scClustViz plot: Plot cell embedding in 2D

Description

This function plots cells in two dimensions, with various overlays.

Usage

plot_tsne(
  cell_coord,
  md,
  md_title,
  md_cols = NULL,
  md_log = F,
  label = NULL,
  sel_cells,
  sel_cells_A,
  sel_cells_B
)

Arguments

cell_coord

A numeric matrix where named rows are cells, and two columns are the x and y dimensions of the cell embedding.

md

The overlay information. Either a factor or numeric vector matching the rows (cells) of the cell_coord matrix. If this is a factor, the cells will be coloured by the factor levels. If a positive numeric vector, the cells will be coloured using the Viridis sequential colourscale implemented in sequential_hcl. Otherwise a diverging red-blue colourscale from diverging_hcl will be used.

md_title

NULL or a character vector of one. If NULL, md is assumed to be cluster assignments. Otherwise this should be the title of the overlay represented by md.

md_log

Default=FALSE. Logical vector of length one indicating whether md should be log-transformed. Only to be used when md is numeric.

label

Default=NULL. The output of tsne_labels to have cluster names overlaid on the plot.

sel_cells

Optional. A character vector of cell names (rownames of cell_coord) to highlight in the plot.

sel_cells_A

Optional. Alternative highlighting method to sel_cells, can be used in conjunction. Meant for indicating a selected set of cells when building manual cell set comparisons, in conjunction with sel_cells_B.

sel_cells_B

Optional. See sel_cells_A.

cols

Default = NULL. A vector of colours used to label the clusters. Only used in md_title is NULL.

Examples

## Not run: 
# Cluster overlay:
plot_tsne(cell_coord=getEmb(input_data_obj,"tsne"),
          md=Clusters(sCVdata),
          md_title=NULL,
          label=tsne_labels(sCVd=sCVdata,
                            cell_coord=getEmb(input_data_obj,"tsne"),
                            lab_type="ClusterNames"))

# Metadata overlay:
plot_tsne(cell_coord=getEmb(input_data_obj,"tsne"),
          md=getMD(input_data_obj)$total_counts,
          md_title="Library Size",
          md_log=TRUE,
          label=tsne_labels(sCVd=sCVdata,
                            cell_coord=getEmb(input_data_obj,"tsne"),
                            lab_type="ClusterNames"))

# Gene expression overlay:
plot_tsne(cell_coord=getEmb(input_data_obj,"tsne"),
          md=getExpr(input_data_obj,Param(sCVdata,"assayType"))["Actb",],
          md_title="Actb")

## End(Not run)


BaderLab/scClustViz documentation built on Sept. 10, 2023, 11:51 p.m.