NeuronCriteria

class neuprint.queries.NeuronCriteria(matchvar='n', *, bodyId=None, type=None, instance=None, regex='guess', status=None, statusLabel=None, rois=None, inputRois=None, outputRois=None, roi_req='all', min_roi_inputs=1, min_roi_outputs=1, group=None, serial=None, cropped=None, birthtime=None, cellBodyFiber=None, class_=None, entryNerve=None, exitNerve=None, hemilineage=None, longTract=None, modality=None, origin=None, predictedNt=None, serialMotif=None, somaNeuromere=None, somaSide=None, subclass=None, synonyms=None, systematicType=None, target=None, label=None, min_pre=0, min_post=0, somaLocation=None, tosomaLocation=None, rootLocation=None, soma=None, client=None)[source]

Neuron selection criteria.

Specifies which fields to filter by when searching for a Neuron (or Segment). This class does not send queries itself, but you use it to specify search criteria for various query functions.

Note

For simple queries involving only particular bodyId(s) or type(s)/instance(s), you can usually just pass the bodyId or type to the query function, without constructing a full NeuronCriteria.

from neuprint import fetch_neurons, NeuronCriteria as NC

# Equivalent
neuron_df, conn_df = fetch_neurons(NC(bodyId=329566174))
neuron_df, conn_df = fetch_neurons(329566174)

# Equivalent
# (Criteria is satisfied if either type or instance matches.)
neuron_df, conn_df = fetch_neurons(NC(type="OA-VPM3", instance="OA-VPM3"))
neuron_df, conn_df = fetch_neurons("OA-VPM3")

All criteria must be passed as keyword arguments.

Note

Only bodyId, type, instance, and ROI-related criteria are applicable to all datasets. The applicability of all other criteria depends on the dataset being accessed (e.g. hemibrain, manc, etc.).

Note

Options for specifying ROI criteria

The rois argument merely matches neurons that intersect the given ROIs at all (without distinguishing between inputs and outputs).

The inputRois and outputRois arguments allow you to put requirements on whether or not neurons have inputs or outputs in the listed ROIs. It produces a more expensive query, but it’s more selective. It also enables you to require a minimum number of connections in the given inputRois or outputRois using the min_roi_inputs and min_roi_outputs criteria.

In either case, use use roi_req to specify whether a neuron must match just one (any) of the listed ROIs, or all of them.

Note

Matching against missing values (NULL)

To search for neurons which are missing given property entirely, you can use a list containing None, or the special value neuprint.IsNull. For example, to find neurons with no type, use type=[None] or type=IsNull.

Matching against any value (NOT NULL)

To search for any non-null value, you can use neuprint.NotNull. For example, to find neurons that have a type (no matter what the type is), use type=NotNull.

Parameters
  • matchvar (str) – An arbitrary cypher variable name to use when this NeuronCriteria is used to construct cypher queries. Must begin with a lowercase letter.

  • bodyId (int or list of ints) – List of bodyId values.

  • type (str or list of str) – Cell type. Matches depend on the the regex argument. If both type and instance criteria are supplied, any neuron that matches EITHER criteria will match the overall criteria.

  • instance (str or list of str) – Cell instance (specific cell name). Matches depend on the the regex argument. If both type and instance criteria are supplied, any neuron that matches EITHER criteria will match the overall criteria.

  • regex (bool) – If True, the instance and type arguments will be interpreted as regular expressions, rather than exact match strings. If False, only exact matches will be found. By default, the matching method will be automatically chosen by inspecting the type and instance strings. If they contain regex-like characters, then we assume you intend regex matching. (You can see which method was chosen by checking the regex field after the NeuronCriteria is constructed.)

  • status (str or list of str) – Indicates the status of the neuron’s reconstruction quality. Typically, named/annotated neurons have Traced status, the best quality.

  • statusLabel (str or list of str) – statusLabel is typically more fine-grained than status, and mostly of interest during the construction of the connectome, not for end-users. The possible values of statusLabel do not correspond one-to-one to those of status.

  • rois (str or list of str) – ROIs that merely intersect the neuron, without specifying whether they’re intersected by input or output synapses. If not provided, will be auto-set from inputRois and outputRois.

  • inputRois (str or list of str) – Only Neurons which have inputs in EVERY one of the given ROIs will be matched. regex does not apply to this parameter.

  • outputRois (str or list of str) – Only Neurons which have outputs in EVERY one of the given ROIs will be matched. regex does not apply to this parameter.

  • min_roi_inputs (int) – How many input (post) synapses a neuron must have in each ROI to satisfy the inputRois criteria. Can only be used if you provided inputRois.

  • min_roi_outputs (int) – How many output (pre) synapses a neuron must have in each ROI to satisfy the outputRois criteria. Can only be used if you provided outputRois.

  • roi_req (Either 'any' or 'all') – Whether a neuron must intersect all of the listed input/output ROIs, or any of the listed input/output ROIs. When using ‘any’, each neuron must still match at least one input AND at least one output ROI.

  • group (int or list of int) – In some datasets, the group ID is used to associate neurons morphological type, including left-right homologues. Neurons with the same group ID have matching morphology.

  • serial (int or list of int) – Similar to group, but used for associating neurons across segmental neuropils in the nerve cord. Neurons with the same serial ID are analogous to one another, but in different leg segments.

  • cropped (bool) – If given, restrict results to neurons that are cropped or not.

  • birthtime (str or list of str) –

  • cellBodyFiber (str or list of str) –

  • class_ (str or list of str) – Matches for the neuron class field.

  • entryNerve (str or list of str) –

  • exitNerve (str or list of str) –

  • hemilineage (str or list of str) –

  • longTract (str or list of str) –

  • modality (str or list of str) –

  • origin (str or list of str) –

  • predictedNt (str or list of str) –

  • serialMotif (str or list of str) –

  • somaNeuromere (str or list of str) –

  • somaSide (str or list of str) – Valid choices are ‘RHS’, ‘LHS’, ‘Midline’

  • subclass (str or list of str) –

  • synonyms (str or list of str) –

  • systematicType (str or list of str) –

  • target (str or list of str) –

  • label (Either 'Neuron' or 'Segment') – Which node label to match with. (In neuprint, all Neuron nodes are also Segment nodes.) By default, 'Neuron' is used, unless you provided a non-empty bodyId list. In that case, 'Segment' is the default. (It’s assumed you’re really interested in the bodies you explicitly listed, whether or not they have the 'Neuron' label.)

  • min_pre (int) – Exclude neurons that don’t have at least this many t-bars (outputs) overall, regardless of how many t-bars exist in any particular ROI.

  • min_post (int) – Exclude neurons that don’t have at least this many PSDs (inputs) overall, regardless of how many PSDs exist in any particular ROI.

  • somaLocation – The somaLocation property of :Neuron objects contains the [X,Y,Z] coordinate (in voxels) of the cell body. NeuronCriteria does not allow you to match a specific coordinate, but you may set this argument to NotNull` (or ```IsNull) to search for cells with (or without) a recorded cell body.

  • tosomaLocation – Neurons which could not be successfully attached to their cell body do not have a recorded somaLocation. Instead, they have an annotaiton on the cell body fiber, on the severed end extending out toward the cell body. Like somaLocation, you can’t match a specific coordinate using NeuronCriteria, but you can use NotNull/IsNull.

  • rootLocation – Some (but not all) Neurons which have no soma in the tissue sample are tagged with a rootLocation, indicating where they enter/exit the sample. Like somaLocation, you can’t match a specific coordinate using NeuronCriteria, but you can use NotNull/IsNull.

  • soma (Either True, False, or None) – DEPRECATED. Use somaLocation=NotNull or somaLocation=IsNull.

  • client (neuprint.client.Client) – Used to validate ROI names. If not provided, the global default Client will be used.

neuprint.queries.SegmentCriteria = <class 'neuprint.queries.neuroncriteria.NeuronCriteria'>[source]

Neuron selection criteria.

Specifies which fields to filter by when searching for a Neuron (or Segment). This class does not send queries itself, but you use it to specify search criteria for various query functions.

Note

For simple queries involving only particular bodyId(s) or type(s)/instance(s), you can usually just pass the bodyId or type to the query function, without constructing a full NeuronCriteria.

from neuprint import fetch_neurons, NeuronCriteria as NC

# Equivalent
neuron_df, conn_df = fetch_neurons(NC(bodyId=329566174))
neuron_df, conn_df = fetch_neurons(329566174)

# Equivalent
# (Criteria is satisfied if either type or instance matches.)
neuron_df, conn_df = fetch_neurons(NC(type="OA-VPM3", instance="OA-VPM3"))
neuron_df, conn_df = fetch_neurons("OA-VPM3")