Skip to content

Instantly share code, notes, and snippets.

@jefferis
Created October 9, 2015 16:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jefferis/bbaf5d53353b3944c090 to your computer and use it in GitHub Desktop.
Save jefferis/bbaf5d53353b3944c090 to your computer and use it in GitHub Desktop.
flycircuit neurons with nat
library(flycircuit)
# download NBLAST all by all score matrix (used e.g. for hierarchical clustering)
# this downloads a single 2Gb file to your machine as a one-off
fc_download_data('http://flybrain.mrc-lmb.cam.ac.uk/si/nblast/flycircuit/allbyallblastcv4.5.ff',
type='ff')
# set that as default all by all score matrix
options('flycircuit.scoremat'="allbyallblastcv4.5.ff")
# load neuron list
# the actual neuron data will be downloaded and cached to your machine on demand
dps<-read.neuronlistfh("http://flybrain.mrc-lmb.cam.ac.uk/si/nblast/flycircuit/dpscanon.rds",
localdir=getOption('flycircuit.datadir'))
# set default neuronlist
options('nat.default.neuronlist'='dps')
@jefferis
Copy link
Author

jefferis commented Oct 9, 2015

If you want you can run the gist like this:

if(!require("devtools")) install.packages("devtools")
devtools::source_gist("bbaf5d53353b3944c090")

There is a bug in devtools::source_gist v 1.12.0 (current 2016-08-14), so you may need to do this:

devtools::source_gist("bbaf5d53353b3944c090", filename = "FlyCircuitStartupNat.R")

Then try e.g.

# plot a single neuron
plot3dfc("fru-M-200266")

# plot top 10 nblast matches for that neuron
clear3d()
plot3dfc("fru-M-200266", col='black', lwd=3)
sc=fc_nblast("fru-M-200266")
top10sc=sort(sc, decreasing = T)[1:10]
plot3dfc(names(top10sc), soma=T)

@jefferis
Copy link
Author

jefferis commented Oct 9, 2015

See also package installation instructions at https://github.com/jefferis/flycircuit

@jefferis
Copy link
Author

If you want to download all the neurons then it will be painful if you do this automatically because each neuron will be downloaded one at a time. It is much better to download them all in one go (with a nice progress bar). This can be done as follows:

dps<-read.neuronlistfh("http://flybrain.mrc-lmb.cam.ac.uk/si/nblast/flycircuit/dpscanon.rds",
    localdir=getOption('flycircuit.datadir'))
remotesync(dps,download.missing = TRUE)

It will still take a while (15m to overnight depending on location in the world).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment