Returns a lazy dbplyr table of every synapse in a local snapshot (see
crant_use_snapshot()) for use with dplyr verbs. Nothing is read
until you dplyr::collect() the result. This needs a local snapshot; there
is no CAVE equivalent.
Usage
crant_synapse_data(
side = NULL,
details = FALSE,
snapshot = getOption("crantr.synapse_snapshot", "latest"),
root = crant_snapshot_root(),
timestamp = NULL
)Arguments
- side
"post"to read the copy sorted bypost_rootwhen the snapshot has one.NULL(the default) and"pre"read the copy sorted bypre_root.- details
Whether to add supervoxel, position and size columns.
- snapshot
The snapshot tag, or
"latest"for the most recent snapshot inroot. Defaults to the one chosen bycrant_use_snapshot().- root
The snapshot folder. Defaults to
crant_snapshot_root().- timestamp
A time (including
"now") to get the synapses at, in place ofsnapshot.
Details
The table has columns id, pre_root and post_root (as
integer64). With details = TRUE it also has pre_sv, post_sv,
pre_x...post_z (positions of the pre and postsynaptic points in nm)
and size.
Rows are sorted by pre_root, so filtering on a few pre_root values
lets DuckDB skip most of the file. Use bit64::as.integer64() for root
ids in filters.
With timestamp, the synapses are those of the newest snapshot at or
before that time when it is at most getOption("crantr.synapse_max_age", 60) seconds older. Otherwise the edits made since the newest published
snapshot are looked up in CAVE (seconds to minutes) and kept in memory
for the rest of the session. Nothing is written to disk; use
crant_update_snapshot() to keep a checkpoint for later sessions.
Examples
if (FALSE) { # \dontrun{
library(dplyr)
id <- bit64::as.integer64(crant_latestid("576460752684030043"))
crant_synapse_data("post") %>%
filter(post_root == id) %>%
count(pre_root, sort = TRUE) %>%
collect()
} # }
