Learn R Programming

nat (version 1.0.1)

neuronlistfh: neuronlistfh class to store multiple neurons cached on disk

Description

neuronlistfh objects consist of a list of neuron objects along with an optional attached dataframe containing information about the neurons.

is.neuronlistfh test if an object is a neuronlistfh

as.neuronlistfh generic function to convert an object to neuronlistfh

as.neuronlistfh.neuronlist converts a regular neuronlist to one backed by a filehash object with an on disk representation

as.neuronlistfh.default wraps an existing filehash object (with backing objects on disk) into a neuronlistfh

Usage

is.neuronlistfh(nl)

as.neuronlistfh(x, df, ...)

## S3 method for class 'neuronlist': as.neuronlistfh(x, df = attr(x, "df"), dir = NULL, dbClass = c("RDS", "RDS2"), remote = NULL, ...)

## S3 method for class 'filehash': as.neuronlistfh(x, df, ...)

## S3 method for class 'default': as.neuronlistfh(x, df, ...)

Arguments

nl
Object to test
x
Object to convert
df
Optional dataframe, where each row describes one neuron
...
Additional arguments for methods
dir
The path to the underlying filehash database on disk
dbClass
The filehash database class. Defaults to RDS.
remote
The url pointing to a remote repository containing files for each neuron.

Details

neuronlistfh objects also inherit from neuronlist and therefore any appropriate methods e.g. plot3d.neuronlist can also be used on neuronlistfh objects. Presently only backing objects which extend the filehash class are supported. These include:
  • filehash RDS
  • filehash RDS2 (experimental)
We have implemented a simple remote access protocol which is currently only implemented for the RDS format. This allows a neuronlistfh object to be read from a url and downloaded to a local path. Subsequent attempts to access neurons stored in this list will result in automated download of the requested neuron to the local cache.

The RDS2 format is experimental and only available at https://github.com/jefferis/filehash but is likely to be the most effective for large (>5000) collections of neurons.

Note that objects are stored in a filehash, which by definition does not have any ordering of its elements. However neuronlist objects (like lists) do have an ordering. Therefore the names of a neuronlistfh object are not necessarily the same as the result of calling names() on the underlying filehash object.

In as.neuronlistfh.default the rownames of the dataframe determine the ordering of the objects, not the values of names() reported by the backing database (which does not have an intrinsic order).

See Also

filehash-class

Other neuronlist: is.neuronlist, neuronlist; nlapply

Examples

Run this code
kcnl=read.neuronlistfh('http://jefferislab.org/si/nblast/flycircuit/kcs20.rds',
'path/to/my/project/folder')
# this will automatically download the neurons from the web the first time
# it is run
plot3d(kcnl)
# create neuronlistfh object backed by filehash with one file per neuron
kcs20fh=as.neuronlistfh(kcs20,dir='/path/to/my/kcdb/data',filehash.type='RDS')
plot3d(subset(kcs20fh,type=='gamma'))
# save neuronlisfh object next to filehash backing database
save(kcs20fh,file='/path/to/my/kcdb/kcdb.rda')

# in a new session
load("/path/to/my/kcdb.rda")
plot3d(subset(kcs20fh,type=='gamma'))

Run the code above in your browser using DataLab