First, load and initialize required modules
In [2]:
import pymaid
from pymaid import rmaid
print('Tested with pymaid version {0}'.format(pymaid.__version__))
remote_instance = pymaid.('server_url', 'api_token', 'http_user', 'http_password')
You can load neurons, edit them (e.g. prune) and pass them to the nblast wrapper directly. In this example, we will keep it simple and just blast a unedited neuron: an olfactory projection neuron with skeleton ID 16
See help(rmaid.nblast)
for details.
In [3]:
nbl_res = rmaid.nblast( 16, remote_instance = remote_instance )
nbl_res
is instance of the rmaid.nbl_results
class. It holds all data from the nblasting and offers a (growing) number functions to do stuff with the results. See the help:
In [4]:
help(nbl_res)
Here is an example on how to sort and then access the results
In [6]:
#Sort by mean score ((forward+reverse)/2)
nbl_res.sort( 'mu_score' )
#Check top results
nbl_res.results.head()
Out[6]:
nbl_res
also contains a wrapper that uses pymaid.plot.plot3d
to generate results much like in R. Pymaid's plot3d
can use two different backends: vispy
(default) which opens a window much like R's plot3d()
, and plotly
that renders in the browser. Because it is fairly easy to embedd plotly
in Jupyiter notebooks, we will use that for this example. Note that you have to run the code, otherwise the cell below will be empty!
In [7]:
import plotly.offline as pyoff
#We need to initialize plotly for interactive rendering with Jupyter notebooks
from plotly.offline import init_notebook_mode
init_notebook_mode(connected=True)
In [21]:
fig = nbl_res.plot3d( hits=2, backend='plotly', width = 1100)
In [22]:
pyoff.iplot(fig)
The red neuron is the CATMAID neuron we've blasted. The green and blue neurons are the top two hits.
In [ ]: