get_reducedDimPlot.sce: Visualizing tSNE and PCA results

Description Usage Arguments Details Value See Also

View source: R/prep_dimRedPlot_sce.R

Description

This will generate a ggplot starting from a DimRedPlot object. See get_reducedDimPlot.sce to start from a SingleCellExperiment object.

Wrapper function for extracting the X and Y coordinates for the plot as well as the variables for coloring, shape assignment etc. This function expects a SingleCellExperiment object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plt.DimRedPlot(drp_object, X = "x_axs", Y = "y_axs", color_by = NULL,
  shape_by = NULL, size_by = NULL, circle_by = NULL, which_quantile = 1,
  ignore_drp_labels = FALSE, theme_size = 14, legend = "auto",
  alpha = 0.75, remove_rug = FALSE, set_colors = TRUE,
  set_fill_colors = TRUE)

get_reducedDimPlot.sce(object, which_reddim = NULL, which_pcs = c(1, 2),
  X = NULL, Y = NULL, dim_red_type = NULL, color_by = NULL,
  shape_by = NULL, size_by = NULL, circle_by = NULL,
  exprs_values = "counts", add_cell_info = NULL)

Arguments

drp_object

a DimRedPlot object

X

name of the drp_object column that contains the values for the x axis

Y

name of the drp_object column that contains the values for the y axis

color_by

specify the column of drp_object$plot_data whose entries will be used to assign either discrete or continous color schemes.

shape_by

the factor to assign the shape of the points to; max. 10 levels are accepted for shape_by. If you want to specify the (same) shape for all points, use an integer (default shape is 19).

size_by

the factor to assign the size of the points to; default: NULL. If you want to specify the (same) size for all points, use one integer (the default size is 3).

circle_by

a factor (e.g. "condition") that will be used to draw circles around the points belonging to the same factor instance.

which_quantile

default: 1

ignore_drp_labels

If set to TRUE, all entries of drp_object$factors will be ignored. If you want to ignore only selected labels, indicate their name (e.g. c("color_by", "exprs_val_type")). The default setting (FALSE) will make use of the information from the drp_object unless specified here via color_by, shape_by, size_by, circle_by.

theme_size

font size for the plot

legend

choose wether there should be no legend ("none"), a legend for every factor or whether the legend will only show up for those factors that have more than 1 level ("auto", default setting).

alpha

define the opacity of the points, default: .65

remove_rug

Define whether the bars at both axes that represent the two 1d marginal distributions should be removed. Default: FALSE.

set_colors

Set to FALSE if you want to add your own color scheme to the resulting plot. The default behavior is to try to automatically assign an optimized coloring scheme. Default: TRUE.

set_fill_colors

Set to FALSE if you want to add your own color scheme to the resulting plot for the background circles. The default behavior is to try to automatically assign an optimized coloring scheme.

object

SingleCellExperiment object

which_reddim

accessor to retrieve the list of choice for the reduced dimension coordinates from reducedDims(object). See details.

which_pcs

vector of integers to specify which (principal) components are going to be used for the x and y coordinates. The default (c(1,2)) will assign PC1 to the X axis and PC2 to the Y axis. This parameter will be ignored if X and Y are specified directly.

dim_red_type

what type of dimensionality reduction was used to generate the data (e.g. "PCA"). Will mostly be used for labelling purposes. Default: NULL

exprs_values

types of expression values that will be used for plotting if a gene name is being specified in either color_by, shape_by, size_by

add_cell_info

if you want to add columns for certain entries of colData(object), specify their names here. Default: NULL

X

directly supply the X coordinates, e.g. pca_res$PC1; if this is used, which_reddim and which_pcs are ignored. X should be of the same length (and order!) as colData(object) (or pData2.0(object)).

Y

directly supply the Y coordinates, e.g. pca_res$PC2. Should be of the same length (and order!) as colData(object) (or pData2.0(object)). which_reddim and which_pcs will be ignored if X and Y are specified.

color_by

entry of either colData(object), rowData(object), rownames(object), which will be used to assign either discrete or continous color schemes. Alternatively, you can supply a list with a label stored in list$title and values stored in list$result (result should be as long as dim(object)[2]. Default: NULL

shape_by

default: NULL

size_by

default: NULL

circle_by

Used for encircling points of interest; default: NULL

Details

which_reddim The reducedDims slot of the SingleCellExperiment object is a list (SimpleList. To know which coordinates to extract, the accessor for the specific reducedDims list member must be given.

Value

ggplot2 object (a plot)

DimRedPlot object: a simple S3-based object, i.e. a list with:

  1. plot_data: data.frame fit for ggplot2-based plotting

  2. label_data: additional stuff that may be used for labelling the x and y axes of the final plot

  3. factors: names of the plotting variables, e.g. which values were used for defining the coloring etc.

See Also

get_reducedDimPlot.sce, which generates the DimRedPlot object that will be used here.

SingleCellExperiment, reducedDims, plt.DimRedPlot


evanbiederstedt/sandbox documentation built on May 26, 2019, 12:31 p.m.