plotStateTrajectory {CellTrails} | R Documentation

## Visualize state trajectory graph

### Description

Method visualizes the state-to-state relations delineating the trajectory backbone.

### Usage

    plotStateTrajectory(
      sce,
      color_by = c("phenoName", "featureName"),
      name,
      component = NULL,
      point_size = 3,
      label_offset = 2,
      recalculate = FALSE
    )

### Arguments

`sce` | A `SingleCellExperiment` object
`color_by` | Indicates if nodes are colorized by a feature expression ('featureName') or phenotype label ('phenoName')
`name` | A character string specifying the featureName or phenoName
`component` | Component of trajectory graph that should be shown (integer value)
`point_size` | Adjusts the point size of the data points shown
`label_offset` | Adjusts the offset of the data point labels
`recalculate` | If layout should be re-drawn (default: FALSE)

### Details

Shows a single tree component of the computed trajectory graph. Each point in this plot represents a state and can be colorized according to feature expression (mean expression per state) or experimental metadata (arithmetic mean or percentage distribution of categorial values). The component is defined by parameter `component`. If the trajectory graph contains only a single component, then this parameter can be left undefined. The points' coloration can be defined via the attributes `color_by` and `name`, respectively. Missing sample lables are recovered using nearest neighbor learning.
If the state trajectory graph layout was set with `stateTrajLayout<-` then the layout will be reused for visualization.

### Value

A `ggplot` object

### Author(s)

Daniel C. Ellwanger

### See Also

`connectStates`

### Examples

    # Example data
    data(exSCE)

    plotStateTrajectory(exSCE, color_by="phenoName", name="age",
                        component=1, point_size = 1.5, label_offset = 4)

    gp <- plotStateTrajectory(exSCE, color_by="featureName", name="feature_1",
                              component=1, recalculate=TRUE)
    stateTrajLayout(exSCE) <- gp

[Package CellTrails version 1.12.0 Index]