Error when running NBLAST

52 views
Skip to first unread message

Amanda Abusaif

unread,
Feb 2, 2023, 11:27:51 PM2/2/23
to nat-user
Hello,

I am trying to NBLAST neurons from FlyWire against neurons from the FlyCircuit database. However, I keep getting a score of about -0.88 between different FlyWire and FlyCircuit neurons. I am unsure why this is happening, and would appreciate any clarifications on the matter. If it helps, below is the code I used.

To skeletonize a neuron from FlyWire (in Python):
!pip install navis
!pip install --upgrade numpy
import fafbseg
import navis
skeleton = fafbseg.flywire.skeletonize_neuron(ID number)
navis.write_swc(skeleton, 'filename.swc')

To Convert to FlyCircuit FCWB Brain Space (in Python):
!pip install navis
!pip install flybrains
import navis
import flybrains
flybrains.download_jefferislab_transforms()
flybrains.download_jrc_transforms()
flybrains.download_vfb_transforms()
flybrains.register_transforms()
neuron_swc = navis.read_swc('filename.swc') 
neuron_FCWB = navis.xform_brain(neuron_swc, source='FAFB14', target='FCWB')
navis.write_swc(neuron_FCWB, 'filename_FCWB.swc')

Run the NBLAST (in R):
install.packages("natmanager")
natmanager::install('natverse')
library(natverse)
#use setwd("C:/Users/...") to move to folder with neurons of interest
install.packages('nat.nblast')
if(!require("devtools")) install.packages("devtools")
devtools::source_gist("bbaf5d53353b3944c090", filename = "FlyCircuitStartupNat.R") 
library(nat.nblast)
library(nat)
neurontarget=read.neurons("flycircuitfile.swc") #FlyCircuit neuron
neuronquery=read.neurons("filename_FCWB.swc") #FlyWiRE Neuron
nblast_score = nblast(neuronquery, neurontarget, normalised = TRUE)
nblast_score (which returns the ~ -0.88 score)

Thank you,
Amanda Abusaif

Emily Heckman

unread,
Aug 1, 2023, 2:24:20 PM8/1/23
to nat-user
Hi, 

I also have run into this issue - aside from the neurons who are nblasted against themselves, all the similarity scores that are generated from an nblast are between -0.87 and -0.88. 

I was getting these scores while testing out the code below on a group of neurons belonging to the same FlyWire hemibrain_type (aMe12).

For what it's worth, I'm able to run the "kcs20" example without any problems so I'm guessing there's an issue with what I'm inputting to nblast. 

Thank you,
Emily 

----------------------------------------------------------------------------------------------------------------

#Reading in aMe12 neuron meshes, a mix of Left and Right 

aMe12_Meshes = read_cloudvolume_meshes(c('720575940640715392',
                                         '720575940613103283',
                                         '720575940622446106',
                                         '720575940609627403',
                                         '720575940621438123',
                                         '720575940647731252',

                                         '720575940621894822')) 


#Converting meshes to dotprops

dps_aMe12_test = dotprops(aMe12_Meshes, k=5, resample=1)


#An all_by_all nblast on the dotprops. Scores are normalised to the mean of forward and reverse scores. 

aMe12_nblast_aba = nblast_allbyall(dps_aMe12_test, normalisation="mean")

aMe12_nblast_aba

Greg Jefferis

unread,
Aug 1, 2023, 2:51:41 PM8/1/23
to Emily Heckman, nat-user
Dear Both,

NBLAST assumes 

1. that all your neurons are in the same space
2. that they have been converted to "dotprops" format
3. that they are calibrated in microns not nm

If neurons are very far apart then you will get the worst possible score of -0.88.

Emily, in your case your neurons are calibrated in nm. You must convert to µm. You can do this by 

dps_aMe12_test_um= dps_aMe12_test / 1e3

You can also get the dotprops version of your flywire neurons directly.

aMe12_dps=read_l2dp(c('720575940640715392',
                                         '720575940613103283',
                                         '720575940622446106',
                                         '720575940609627403',
                                         '720575940621438123',
                                         '720575940647731252',
                                         '720575940621894822'))

These are already calibrated in microns. This is much faster but you will need to do some extra installation to set up python for R

(essentially 

fafbseg::simple_python()
fafbseg::simple_python(pyinstall='none', pkgs='fafbseg')

)

@Amanda I missed your message earlier, but you should

a)  plot3d your neurons to see if they are actually somewhat overlapping after the transforms.
b) convert to dotprops

For example

neurontarget_dps=dotprops(neurontarget, resample=1, k=5)

before passing to NBLAST. Once again you must ensure that your neurons are calibrated in µm before being passed to dotprops and then NBLAST.

All the best,

Greg.

--
You received this message because you are subscribed to the Google Groups "nat-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nat-user+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/nat-user/cc04b76d-3844-4603-a7d2-ed110ccc6f44n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages