fc_read_neurons: Fetch FlyCircuit neuron skeletons from the Taiwan FlyCircuit...

View source: R/read-neurons.R

fc_read_neuronsR Documentation

Fetch FlyCircuit neuron skeletons from the Taiwan FlyCircuit server

Description

Reads FlyCircuit skeletons from http://www.flycircuit.tw/, and bridges them into the FCWB space.

Usage

fc_read_neurons(fc.ids, xform = TRUE, ...)

Arguments

fc.ids

vector of valid FlyCircuit neuron ids. To acquire these in bulk, see fc_get_ids and flycircuit-ids.

xform

Whether or not to tranform neurons from their original space to the FCWB template space.

...

additional arguments passed to methods

Value

A neuronlist of FlyCircuit neurons registered in the intersex FCWB brain space

Source

http://www.flycircuit.tw/

See Also

fc_get_ids, flycircuit-ids, read.neurons

fc_get_ids, fc_page

Examples


# Let's read a neuron from the FlyCircuit database
library(nat.flybrains)
fcn <- fc_read_neurons("Gad1-F-200234")
plot3d(fcn)
plot3d(FCWB)


## Not run: 
# We can also read all neurons
clear3d()
# nb this will take tens of minutes to hours
fc.ids = fc_get_ids()
fcns <- fc_read_neurons(fc.ids)
plot3d(fcns)
plot3d(FCWB, alpha = 0.1)

## Now mirror all neurons to the right of the brain
# estimate whether soma is on left or right of midline
# nb this assumes that FCWB brain surface is mirror symmetric
# which is apporoximately but not exactly the case
left.somas <- function(neuron, surf = FCWB.surf) {
  bb=boundingbox(surf)
  midline=(bb[1,1]+bb[2,1])/2
  r = nat::rootpoints(neuron)
  somaposition = nat::xyzmatrix(neuron$d[r,])
  somaposition[,"X"]>midline
}
leftsomas = unlist(nat::nlapply(fcns,left.somas))
fcsleft = nat.templatebrains::mirror_brain(fcns[leftsomas], brain = FCWB)
fcns = c(fcns[!names(fcns)%in%names(fcsleft)],fcsleft)

## End(Not run)

natverse/flycircuit documentation built on Jan. 26, 2023, 6:46 p.m.