Skip to contents

Write the highlighted cells of a highlight page as a file, as the Highlights list's export buttons do: an obs-column CSV (every open cell, a true/false column per highlight, which cellucid.pull() in Python and cellucid_pull() in R read back) or an .h5ad subset of the highlighted cells with their expression rows. The .h5ad reads the cells' expression first; its time and bytes are estimated from this connection before it starts.

Usage

cellucid_cells_export(viewer, format = "csv", page)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

format

csv: the obs-column CSV; h5ad: an AnnData file of the highlighted cells. One of "csv", "h5ad". Default "csv", the viewer's own.

page

The highlight page; the page shown when left out. Text (at least 1 character). Left out unless given (the viewer then chooses as its own control does).

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, cells (Cells highlighted on it), file (The file written), format, page (The highlight page exported), renamed (Names an .h5ad cannot hold as they are, written under other names).

Details

The viewer's action cells.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_cells_export(viewer)
  print(request)
  # cellucid_action_result(request) waits for its outcome.
  cellucid_stop(viewer)
}