Skip to contents

A continuous field or a gene per category of a categorical field (cells, mean, median, range, share above zero), or a categorical field's top categories per category.

Usage

cellucid_field_summary(viewer, field, by, top = 50, visible_only = FALSE)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

field

A field by name: source "obs" for a column of the cells, "var" for a gene; key is the name as shown. A named list. Required.

source

"obs" for a column of the cells, "var" for a gene. One of "obs", "var". Required.

by

The categorical obs field to group the cells by. A named list. Required.

source

"obs" for a column of the cells, "var" for a gene. One of "obs", "var". Required.

top

For a categorical field: at most this many of its categories per group. A whole number (at least 1). Default 50, the viewer's own.

visible_only

Only the cells the active view shows. TRUE or FALSE. Default FALSE, the viewer's own.

Value

A cellucid_action_request, at once and invisibly: the action is sent now, or when the viewer's channel opens. cellucid_action_result(request) returns what it read: a list of by, field, groups, read_for (For a gene read for a sample of the open cells: the cells its statistics are of). Cells in it are original positions (0-based rows of the dataset's obs).

Details

The viewer's action field.summary (Dataset). It reads, and changes nothing: it makes no step of the history.

See also

cellucid_act() sends any action by its type, and cellucid_action_result() collects its answer.

Examples

if (interactive() && requireNamespace("SeuratObject", quietly = TRUE)) {
  data("pbmc_small", package = "SeuratObject")
  viewer <- cellucid_view(SeuratObject::UpdateSeuratObject(pbmc_small))
  request <- cellucid_field_summary(viewer, by = list(key = "cell_type",
      source = "obs"), field = list(key = "cell_type",
      source = "obs"))
  print(request)
  # cellucid_action_result(request) waits for what it read.
  cellucid_stop(viewer)
}