Skip to contents

Write a column of the cells (categorical or continuous) as an obs-column CSV, as its Export button in Color by does: every open cell and its value, which cellucid.pull() in Python and cellucid_pull() in R read back.

Usage

cellucid_field_export(viewer, field)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

field

A column of the cells by name (source "obs"), categorical or continuous. A named list. Required.

source

A column of the cells. Exactly "obs". Required.

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: a list of bytes, field (The field exported), file (The file written), kind.

Details

The viewer's action field.export (Exports). It acts outside the viewer's state and history (a file the person receives in the browser, a publication, or what the browser keeps for later visits), which Undo does not take back: it makes no step of the history.

When an agent (Claude, ChatGPT) runs it, the viewer asks the person first (writes-file); from R it is not asked.

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_export(viewer, field = list(key = "cell_type",
      source = "obs"))
  print(request)
  # cellucid_action_result(request) waits for its outcome.
  cellucid_stop(viewer)
}