data.for.plot: Retrieve data for plotting

Description Usage Arguments Details Value Discrete List Elements (if as.discrete.list=T)

View source: R/data-for-plot.R

Description

This retrieves data to annotate points on various plots and returns either the data, or the data transformed into colors for plotting. This function is called by most of URD's plotting routines.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data.for.plot(
  object,
  label,
  label.type = c("search", "meta", "group", "sig", "gene", "counts", "pseudotime",
    "nmf", "pca", "diff.data"),
  cells.use = NULL,
  as.color = F,
  as.single.color = F,
  as.discrete.list = F,
  continuous.colors = NULL,
  continuous.color.limits = NULL,
  colors.use = NULL
)

Arguments

object

An URD object

label

(Character) The label of the data to search for

label.type

(Character) Where to look for the data. Default is "search" which looks in order: "meta", "group", "sig", "gene", "counts", "pseudotime", "pca", "diff.data"

cells.use

(Character vector) Which cells to return information for (default is NULL, which returns all cells)

as.color

(Logical) Return hex color values instead of the raw data

as.single.color

(Logical) Return on a scale from 0-1 as a "single color" to feed into rgb() for more complex color generation.

as.discrete.list

(Logical) If TRUE, returns a list (see below).

continuous.colors

(Character vector) Colors to use to produce a continuous color scale (used if data is continuous) and as.color=T.

continuous.color.limits

(Numeric vector, length 2) Limits to use for scaling continuous color data. Data outside the range is squished into range. If NULL, uses the range of the data.

colors.use

(Character vector) Colors to use for discrete data (default is NULL, which will use palette)

palette

(Function) A palette (see Palettes) to use to generate colors for discrete data

Details

By default, it searches for a label in the following order: metadata ("meta"), group IDs ("group"), gene signatures ("sig"), gene expression ("gene"), unnormalized gene expression counts ("counts"), pseudotime ("pseudotime"), NMF modules ("nmf"), principal components ("pca"), simulated diffusion results ("diff.data"). However, data can be requested from a particular source by setting label.type. This can be used to get log-transformed but unnormalized expression data from count.data by setting label.type="counts".

Value

The value returned depends on the flags set. A vector is returned if as.discrete.list=FALSE or a list is returned if as.discrete.list=TRUE (see below). The data is returned directly if as.color=F and as.single.color=F, or it is returned as color values to plot directly if either are TRUE.

Discrete List Elements (if as.discrete.list=T)

$discrete

(Logical) Is the data discrete or continuous?

$data

(Numeric or Character Vector) Either the data itself, or colors if as.color=T or as.single.color=T.

$legend

(Named Character Vector) Colors used, named by the data, returned if as.color=T and data is discrete

$range

(Numeric Vector) If data is continuous, the range of the data, otherwise NULL.


farrellja/URD documentation built on June 17, 2020, 4:48 a.m.