neuprint_search | R Documentation |
neuprint_search
searches for bodyids corresponding to a
given name. By default performs regex sensitive matches against neuron
names and returns a data.frame
.
neuprint_ids
provides for flexible search / specification
of neuprint body ids. Use it at the start of any function that accepts body
ids. Queries are by default partial and fixed (i.e. non-regex) against
type. Returns a character vector of bodyids.
neuprint_search(
search,
field = "name",
fixed = FALSE,
exact = NULL,
meta = TRUE,
all_segments = FALSE,
dataset = NULL,
conn = NULL,
...
)
neuprint_ids(
x,
mustWork = TRUE,
unique = TRUE,
fixed = TRUE,
conn = NULL,
dataset = NULL,
...
)
search |
Search query, by default a regular expression that must match
the whole of the neuPrint instance name field. See examples and the
|
field |
the meta data field in which you want a match for your search
query. Defaults to name (or instance, as handled by
|
fixed |
if |
exact |
Whether the query must match the whole field. This is always
true for regular expression queries while the default ( |
meta |
if |
all_segments |
if TRUE, all bodies are considered, if FALSE, only 'Neurons', i.e. bodies with a status roughly traced status. |
dataset |
optional, a dataset you want to query. If |
conn |
optional, a neuprintr connection object, which also specifies the
neuPrint server. If NULL, the defaults set in your
|
... |
Additional arguments passed to |
x |
A set of bodyids or a query |
mustWork |
Whether to insist that at least one valid id is returned
(default |
unique |
Whether to ensure that only unique ids are returned (default
|
a vector of body ids, or a data frame with their meta information
For neuprint_ids
, a character vector of bodyids (of length 0
when there are none and mustWork=FALSE
).
It is probably best just to look at the examples, but the query syntax is as follows where square brackets denote optional parts:
[!/][<field>:]<query>
Starting with the optional leading character. An exclamation mark denotes an exact, fixed search. The / denotes a regular expression (exact) search. When both are missing, a partial, fixed search is carried out.
The optional field argument terminated by a colon defines a field other than the default one to use for the query.
Finally the query itself is a plain text (fixed) or regular expression query.
As a stepping stone to writing full CYPHER
queries against Neo4J you can used the special where
keyword to
introduce your queries:
where:<cypher query>
e.g.
"where:exists(n.somaLocation) AND n.post>30000 AND NOT n.cropped"
Note that properties of individual nodes (i.e. neurons) must be prefixed
with n.
as would be typical in a CYPHER query. This feature is still
experimental and details of the interface may still change. If you have
feedback please do so at
https://github.com/natverse/neuprintr/pull/153.
neuprint_get_meta
,
neuprint_get_neuron_names
neuprint_search(".*DA2.*")
neuprint_search(".*DA2.*", meta=FALSE)
# Search the type field
neuprint_search("MBON.*", field = "type", meta=FALSE)
neuprint_search("MBON[0-9]+", field = "type", meta=FALSE)
# compact specification of field
neuprint_search("type:MBON[0-9]+", meta=FALSE)
# starts with MBON
neuprint_search("type:MBON.*", meta=FALSE)
# full access to WHERE cypher queries over nodes (i.e. neurons) in neo4j
# NB fields must be prefixed with n. to indicate that they are node properties.
# note also that exists(n.somaLocation) is cypher to ensure soma==TRUE
neuprint_search("where:exists(n.somaLocation) AND n.post>30000 AND NOT n.cropped")
## Not run:
neuprint_search("MBON.*", field = "type")
# fixed=TRUE can be useful when you don't want to worry about special
# characters like brackets
neuprint_search("PEN_a(PEN1)", field="type", fixed=TRUE)
# by default fixed=TRUE returns partial matches
neuprint_search("MBON16", field = "type", fixed=TRUE)
# here the type must exactly match the query i.e. complete match
neuprint_search("MBON16", field = "type", fixed=TRUE, exact = TRUE)
neuprint_search("AVF1", field = "cellBodyFiber")
neuprint_search("cellBodyFiber:AVF1")
## End(Not run)
# exact match against whole type
neuprint_ids("!MBON01")
# partial match
neuprint_ids("MBON01")
# partial match against name field rather than type
neuprint_ids("name:MBON01")
# initial / indicates to use regex search (which must be exact)
neuprint_ids("/MBON01")
# more interesting regex search
neuprint_ids("/MBON0[1-4]")
# partial regex search against the name field (note leading/trailing .*)
neuprint_ids("/name:.*MBON0[1-4].*")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.