These functions try to match a query against the name of a neuron or annotation (catmaid_query_by_name) or against an annotation (tag) that has been applied to a neuron or annotation (catmaid_query_by_annotation). Note that 1) objects can be tagged with multiple annotations and 2) annotation tags are recursive so one annotation can be tagged with a second annotation.

The most common use will be to get a data.frames of neurons when you should use type="neuron". You can also return both neurons and annotations (the default) and just annotations. See type argument for details.

Note that catmaid_query_by_name prepends a "/" to the query argument so that it is treated as a regular expression (which by some slight quirk of the API would otherwise not be the case).

catmaid_query_by_name(
  query,
  pid = 1,
  maxresults = 500,
  type = c("neuron", "annotation"),
  raw = FALSE,
  ...
)

catmaid_query_by_annotation(
  query,
  pid = 1,
  maxresults = 500,
  type = c("neuron", "annotation"),
  raw = FALSE,
  conn = NULL,
  ...
)

Arguments

query

A query string (NB this is a regular expression)

pid

project id (default 1)

maxresults

The maximum number of results to return

type

Type of results to return. Defaults to c("neuron", "annotation"). Only relevant when raw=FALSE.

raw

Whether to return completely unprocessed data (when TRUE) or to convert the nodes and connectors lists into processed data.frames (when FALSE, the default)

...

Additional arguments passed to the catmaid_fetch function.

conn

the catmaid_connection object

Value

For catmaid_query_by_name a data.frame containing the results with an attribute "annotations" containing the annotations as a separate data.frame. For both functions the main data.frame has the following columns

  • id

  • name

  • type (neuron or annotation)

  • skid (the main identifier for the neuron skeleton, catmaid often calls this skeleton_id)

For catmaid_query_by_annotation a data.frame containing the results.

Examples

if (FALSE) {
catmaid_query_by_name("ORN")
# using regex functionality
catmaid_query_by_name("ORN (left|right)")
# fancier regex
catmaid_query_by_name("^[0-9a-f &]+ PN (left|right)")
}
if (FALSE) {
# query matches 3 specific annotations
catmaid_query_by_annotation("ORN PNs")

# what are those 3 annotations?
al=catmaid_get_annotationlist()
subset(al$annotations, grepl("ORN PNs", name))

# Insist on specific annotation by using regex start/finish symbols
catmaid_query_by_annotation("^ORN PNs$")
}