Pair StatisticsΒΆ

Neuron pair statistics

This widget assists with assigning lineages and cell type annotations to sets of neurons and verifying assigned annotations are consistent with the observed morpholgy. In order to do this, it relies heavily on a particular use of annotations and meta-annotations (annotations on annotations). From a pool of annotations, group annotations are selected based on whether ther name matches a particular pattern (e.g. pick only annotations with an underscore character and use everything in front of the first underscore as the group name). These groups are then further divided into subgroups/instances, based on a second pattern (e.g. everything after the first underscore character will become the subgroup name.

For each annotation-based subgroup within each group all annotated neurons are selected.

Defining a pool of annotations

The pool of annotations to work on can be defined in terms of a general pattern (Annotation filter field in the UI), which can be a regular expression if it starts with a forward slash character. Alternatively, a meta-annotation can be specified (Meta-annotation field in the UI), which all candidate annotations need to be annotated with.

It is of course fine to use all available annotations (e.g. with a regular expression: /.* Generelly it seems cleaner to constrain all available annotations to the ones that should form the actual pool of options.

Updating the filter pattern will updatea the table below that shows the list of groups and subgroups based on the current configuration.

Example: Assume all relevant annotations start with an asterisk and have the suffix "-cencus". A useful annotation filter would be this regular expression: /^\*.*-census$.

Groups and subgroups

With a set of pool of candidate annotations defined, groups and subgroups can now be extracted. Groups can contain multiple annotations if their name shares a common pattern, e.g. the same text in front of the first underscore character. Subgroups are groups within groups: all annotations that consitute a group are further devided based on a second pattern. The allows to represent different variants of the group. Both patterns are expressed in a single regular expression, where the first match-group (pair of parentheses) represents the group name and the second match-group represents the subgroup. An example can hopefully illustrate this point a bit more:

Example: We have organized the lineage annotations following the pattern <lineage-name>_<side> where <lineage-name> (the part before the underscore) represents the lineage name (e.g. BLDc) and the part right after the underscore (<side>) denotes the left or the right side of the brain, specified by either l or r. As a grouping pattern we could therefore write. In such a setup, we can use the default Grouping pattern: /(.*)_([lr]) . The part from the begining of the annotation name up to the first underscore is stored as the first match-group, the group name: /(.*) . The subgroup name is by either l or r right after the underscore by the second match-group: ([lr]) . This will then match annotations like BLDc_l and BLDc_r and would map them to separate subgroups. Note that this pattern also works if the annotation name continues after the side specification, like with the "-census" suffix from the previous example, e.g. BLDc_l-cencsus and BLDc_r-cencus. If an annotation from the pool doesn't match this pattern, it won't contribute to the set of grouping annotations.

In addition to the group and subgroup pattern, it is also possible to only allow groups that have a minimum and maximum number of subgroups through the Min subgroups and Max subgroups fields.

Extra groups and subgroups

Sometimes there are outliers to a common pattern or there is no pattern in the first place. This widget allows to also add custom groups and subgroups, as long as they can be mapped to actual annotations. To add a custom group, add first a group name in the Group name field in the New group section. The group's subgroups are defined in terms of a comma separate list consisting of the patterns <subgroup-name>|<annotation-name>, where <subgroup-name> defines the name of the subgroup (like l and r above). Each subgroup entry is mapped to a particular annotation, which is given by the <annotation-name> part. Pressing the "Add" button, will add the extra group to the list of "Extra groups" in the content section. It is possible to add multiple extra groups.

Example:To add the example lineage from before explicitely, the Group name could be set to BLDc and the list of subgroups could be l|BLDc_l, r|BLDc_r or even l|BLDc_l-census, r|BLDc_r-census.

Mapping neurons to subgroups

With all groups and subgroups set up, the next step is to find the neurons belonging into each subgroup. This is performed in the second tab, Matching pairs. These are of course the neurons annotated with the respective subgroup annotation, but in addition the Pair Statistics Widget will only allow neurons into subgroups that are considered complete. This is done to weed out fragments, partial neurons and also unreviewed neurons that to increase the quality of the result by making individual morphologies more comparable.


Neurons are considered compelete if at least two, optionally three conditions are met:

  1. The skeleton doesn't have more than a defined percentage of open ends, i.e. leaf nodes plus root that are not marked with one of the following tags: "uncertain continuation", "not a branch", "ends", "really ends", "uncertain end", "anterior end", "posterior end", "soma", "out to nerve". By default 3% open ends are allowed.
  2. The skeleton has a minimum length, either in terms of nodes (Min nodes field) or nanometers (Min cable field).
  3. Optionally, only neurons that aren't "fragments" can be considered complete. A neuron is considered a fragment if it doesn't have either a "soma" tagged node or a node tagged "out to nerve". The "Ignore fragments checkbox" controls whether this should be tested.

These completeness parameters can be defined separately for both the pattern based annotation set and the set of extra groups.

Pressing "Match pairs" will get the completeness information from the server. All complete neurons are mapped to their respective subgroups, which can be looked at either through the "Active groups" section in the content view of the "Matching pairs" tab, or in terms of skeleton sources, that are provided for each subgroup. Note that for larger sets of skeletons this process can take a few minutes to complete. At the

The Batch size allows to tune how many skeletons will be queried completeness for at a time. If the server supports longer open connections, this value can be higher and more data queried in one request.

Active groups

Shows the list of all found subgroups across all groups. It shows the groups each subgroup is found in as well as all complete skeletons associated with the respective annotations.

Additionally, it is possible to define a landmark group for each subgroup. These are spatial spaces defined through landmarks (see Landmark Widget). This is needed to compute the similarity between pairs across subgroups for each group. It allows transforming skeletons from one subgroup into the other.

Matching pairs

Based on the sets of (completed) skeletons that are collected for each annotation subgroup, pairs of skeletons are selected that share a common annotation. This can be any annotation as long as the annotation is annotated with a particular meta-annotation. This meta-annotation is defined in terms of the Pairing meta-annotation field in the UI.

Besides this set of matching skeleton pairs, two other sets of pairs are created, resulting in the following three sets of skeleton pairs:

  1. Matching pairs: both skeletons are from different subgroups within the same group.
  2. Same-group pairs: both skeletons are from the same subgroup, regardless of their meta-annotations.
  3. Unmatched pairs: both skeletons are from different subgroups with the same group, while one of them has the required meta-annotation and the other doesn't.

These sets will also be available as skeleton sources, in which one color is used per skeleton pair.

Example:Consider the previously used example group, the lineage BLDc, with its two subgroups BLDc_l and BLDc_r. In some cases pairs of neurons across both groups have been matched up and annotated with hemilateral_pair__. These annotations in turn are annotated with brain-census. Using the brain-census annotation as pairing meta-annotation allows the widget to use the fact that some pairs are already verified. The Matching pairs tab will then display the three sets of skeleton pairs above across these two subgroups, viewing all skeleton pairs with both skeleton IDs meta-annotated with brain-census.