flywire_nuclei: Queries for information about flywire nuclei (helpful for...

View source: R/flywire-nuclei.R

flywire_nucleiR Documentation

Queries for information about flywire nuclei (helpful for finding somata)

Description

flywire_nuclei finds nuclei based on known rootids or nucleus_ids

flywire_nearest_nuclei returns the nearest nucleus to a query xyz location. When rawcoords=T both the input and output positions are in raw voxels. Note however that distances are still calculated in nm. xyz may contain single points unless k>1, in which case only one query point is allowed.

Usage

flywire_nuclei(rootids = NULL, nucleus_ids = NULL, rawcoords = FALSE, ...)

flywire_nearest_nuclei(xyz, rawcoords = F, k = 1)

Arguments

rootids

Character vector specifying one or more flywire rootids. As a convenience for flywire_partner_summary this argument is passed to flywire_ids allowing you to pass in data.frames, flywire URLs or cell type queries.

nucleus_ids

ids from the nucleus table to return (optional, NB only one of rootids and nucleus_ids can be provided).

rawcoords

Whether to return coordinates in raw form rather than nm (default FALSE)

...

Additional arguments passed to flywire_cave_query

xyz

One or more (if k=1) query points. In raw coordinates when rawcoords=T

k

The number of nearest nuclei to return for each query position. When k>1 you are currently limited to one query point.

Details

flywire_nearest_nuclei caches the nucleus table and then updates ids of any selected values. This saves time for subsequent queries assuming that you are returning less than half of the total rows.

Value

A data.frame containing information about nuclei including

  • id nucleus id

  • pt_position the XYZ position of the centre of the nucleus. This will always be in nm when rawcoords=FALSE even if the remote table stores raw (uncalibrated) voxel coordinates. It will be a comma separated string when rawcoords=TRUE since this is most convenient for pasting between applications.

  • pt_supervoxel_id corresponding to the nucleus may be missing if the segmentation is disrupted at the location of the nucleus e.g. because of masking issues, missing sections etc.

  • pt_root_id The current root id (when the pt_position maps onto the segmentation.)

  • volume the volume in cubic microns of the nucleus

For flywire_nearest_nuclei when rawcoords=T both the input and output positions are in raw voxels. Note however that distances are still calculated in nm.

Examples


# an example where there are two nucleus matches
flywire_nuclei(flywire_xyz2id(c(120152, 22864, 3564), rawcoords = TRUE))


nn=flywire_nearest_nuclei(c(480608, 91456, 142560), k=2)
as.data.frame(nn)

flywire_nearest_nuclei('163113, 59074, 5295', rawcoords = TRUE)


## Not run: 
# from clipboard e.g. copied from flywire
flywire_nearest_nuclei(clipr::read_clip(), rawcoords = TRUE)

## End(Not run)

natverse/fafbseg documentation built on Nov. 11, 2024, 9:50 p.m.