write_catmaid_selection: Make a CATMAID selection file based on neuronlist or skids

View source: R/catmaid_selection.R

write_catmaid_selectionR Documentation

Make a CATMAID selection file based on neuronlist or skids

Description

Make a CATMAID selection file based on neuronlist or skids

Usage

write_catmaid_selection(x, f, color = NULL, opacity = NULL, ...)

Arguments

x

A neuronlist, data.frame or vector of skids

f

Path to output file (usually ends in .json)

color

Optional vector of colours in any format understood by col2rgb

opacity

Optional vector of opacities (alpha values) in range 0-1

...

Additional arguments passed to catmaid_skids

See Also

read_catmaid_selection

Examples

## Not run: 
# Write selection file for neurons defined by annotation or name
write_catmaid_selection("PN", "pns.json")
write_catmaid_selection("name:AV6", "name:av6.json")

pns=read.neurons.catmaid("PN")
# extract the glomerulus from the name
pns[, 'glomerulus'] = stringr::str_match(pns[, 'name'],
                                         ".*glomerulus ([A-z0-9]+) .*")[, 2]
pns[, 'glomerulus']=addNA(factor(pns[, 'glomerulus']))
# get the same colours that nat would normally use in a plot
plotres=plot3d(pns, col=glomerulus)
cols=attr(plotres,'df')$col
# write out selection file with those colours
write_catmaid_selection(pns, f='pns-by-glom.json', color=cols)

## End(Not run)

jefferis/rcatmaid documentation built on Aug. 16, 2022, 8:52 p.m.