Skip to contents

A new categorical column whose categories are highlight pages: each page's cells take its label; cells on several pages follow the overlap rule.

Usage

cellucid_field_create_from_pages(
  viewer,
  key,
  pages,
  intersection_labels,
  overlap = "first",
  overlap_label = "Overlap",
  uncovered_label = "Unassigned"
)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

key

The new column's name. Text (at least 1 character). Required.

pages

The pages, in order (first and last refer to it), each with its category label. A vector or list of a named list (at least 1 item). Required.

intersection_labels

With overlap "intersections": the label of each combination of pages that has cells. A vector or list of a named list. Left out unless given (the viewer then chooses as its own control does).

overlap

Cells on several pages: the first page's label, the last's, the overlap label, or one label per combination of pages. One of "first", "last", "overlap-label", "intersections". Default "first", the viewer's own.

overlap_label

The label of cells on several pages when overlap is "overlap-label". Text. Default "Overlap", the viewer's own.

uncovered_label

The category of cells on no page; empty leaves them without one. Text. Default "Unassigned", 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 its outcome (what it did, as names, counts and ids), or NULL when it had nothing to report; request$step is the history step it made.

Details

The viewer's action field.create-from-pages (Fields). It changes the viewer's state: one step of the viewer's history, labelled as R's, undone like any other. The state it can change: field-overlays.

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_create_from_pages(viewer,
      key = "x", pages = list(list(label = "T cells",
          page = "x")))
  print(request)
  # cellucid_action_result(request) waits for its outcome.
  cellucid_stop(viewer)
}