neuprint_get_adjacency_matrix | R Documentation |
Get an adjacency matrix for the synaptic connectivity within a set of specified bodies
neuprint_get_adjacency_matrix(
bodyids = NULL,
inputids = NULL,
outputids = NULL,
threshold = 1L,
dataset = NULL,
chunksize = 1000L,
all_segments = FALSE,
conn = NULL,
sparse = FALSE,
cache = FALSE,
...
)
bodyids |
the body IDs for neurons/segments (bodies) you wish to query.
This can be in any form understood by |
inputids, outputids |
identifiers for input and output bodies (use as an
alternative to |
threshold |
Return only connections greater than or equal to the indicated strength (default 1 returns all connections). |
dataset |
optional, a dataset you want to query. If |
chunksize |
Split large queries into chunks of this many ids to prevent
server timeouts. The default of 1000 seems to be a reasonable compromise.
Set to |
all_segments |
if TRUE, all bodies are considered, if FALSE, only 'Neurons', i.e. bodies with a status roughly traced status. |
conn |
optional, a neuprintr connection object, which also specifies the
neuPrint server. If NULL, the defaults set in your
|
sparse |
Whether to return a sparse adjacency matrix (of class
|
cache |
the query to neuPrint server, so that it does not need to be
repeated. Of course you can save the results, but this may be helpful e.g.
inside a wrapper function that post-processes the results like
|
... |
methods passed to |
a n x n matrix, where the rows are input neurons and the columns are their targets. Only neurons supplied as the argument 'bodyids' are considered.
neuprint_fetch_custom
,
neuprint_simple_connectivity
,
neuprint_common_connectivity
,
CsparseMatrix
)
# these will mostly be axo-axonic connections between DA2 PNs
neuprint_get_adjacency_matrix('DA2 lPN')
# rectangular matrix with different in/out neurons
neuprint_get_adjacency_matrix(inputids='DA2 lPN', outputids='DL4 adPN')
# Note the use of cache=T, which will avoid a subsequent query to the
# neuPrint server if the same information is requested
pnkc=neuprint_get_adjacency_matrix(inputids='name:mPN', outputids='/KC.*',
cache=TRUE)
hist(colSums(pnkc), xlab = 'PN inputs / KC', br=100)
sum(rowSums(pnkc)>0)
## Not run:
# sparse adjacency matrix
pnkcs=neuprint_get_adjacency_matrix(inputids='name:mPN',
outputids='/KC.*', sparse=TRUE, cache=TRUE)
library(Matrix)
# PN-KC connectivity is itself sparse, so < 2% of entries are non zero
nnzero(pnkcs)/length(pnkcs)
# while memory requirements are ~ 5%
as.numeric(object.size(pnkcs)/object.size(pnkc))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.