Build the consensus column
cellucid_field_consensus.RdThe community annotation's consensus for a categorical column as a column of its own: each cell gets the agreed label of its category, or the status of a category without one (disputed, pending); built again under the same name, it is replaced. The outcome of each category is named in the parameters, so it replays by name on any dataset with the same column and categories.
Arguments
- viewer
A viewer
cellucid_view()orcellucid_serve()returned.- key
The consensus column's name. Text (at least 1 character). Required.
- field
The annotated column the consensus is of. A named list. Required.
sourceCategories belong to columns of the cells. Exactly
"obs". Required.
- mapping
The outcome of each category of the column (a category left out is pending). A vector or list of a named list (at least 1 item). Required.
- settings
The consensus rule it was built with. A named list. Required.
thresholdThe net share of votes the leading label needs (-1 to 1). A number (at least -1, at most 1). Required.
- provenance
Where the votes came from. A named list. Required.
commitThe commit pulled, when known. Text or
NULL(at least 1 character). Required.pulledAtWhen it was last pulled (ISO 8601), null when never. Text or
NULL(at least 1 character). Required.repositoryThe GitHub repository (owner/name), null when none was connected. Text or
NULL(at least 1 character). 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 (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.consensus (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, active-field, filters, colors.
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_consensus(viewer, field = list(key = "cell_type",
source = "obs"), key = "x", mapping = list(list(category = "T cells",
label = "x", status = "consensus", voters = 0)),
provenance = list(branch = "x", commit = "x", pulledAt = "x",
repository = "x"), settings = list(minAnnotators = 0,
threshold = -1))
print(request)
# cellucid_action_result(request) waits for its outcome.
cellucid_stop(viewer)
}