Skip to contents

Write a new Cellucid-ready AnnData file (.zarr.zip) of the whole open dataset with the state shown applied, as Python and R apply a session: renamed labels, user-defined fields and highlight groups as obs columns, gene sets in uns and var, and a record of what was applied; never over the dataset's own file.

Usage

cellucid_history_anndata_save(viewer, file)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

file

The new file's name (.zarr.zip is added when it does not end so); "<dataset> with this state.zarr.zip" 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 applied (False when every change was in the dataset already (no record added)), branch, bytes, cells (Cells written: every cell of the dataset, whichever were open), file (The file's name), layout (A Cellucid-ready AnnData, or a MuData for a dataset of several modalities), left_out (What the copy does not hold of the state, or of the dataset, one sentence each), rows (Every change of the apply plan, in domain order, as Python and R plan it), step (The step applied: the one shown), to (file: a file the person chose in the save dialog; download: the browser's downloads), tracker.

Details

The viewer's action history.anndata.save (History). 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_history_anndata_save(viewer)
  print(request)
  # cellucid_action_result(request) waits for its outcome.
  cellucid_stop(viewer)
}