NeuroMorphoQuery#

class braincell.io.NeuroMorphoQuery(species=None, brain_region=None, cell_type=None, archive=None, original_format=None, stain=None, age_classification=None, gender=None, raw_q=<factory>, raw_fq=<factory>)[source]#

Typed builder for NeuroMorpho.Org search queries.

Each non-raw field becomes a Solr clause that is ANDed together. Multi-value fields produce (field:a OR field:b) clauses. Use raw_q and raw_fq to append filter strings verbatim

when you need a Solr feature this builder doesn’t expose.

Parameters:

Examples

>>> q = NeuroMorphoQuery(species="mouse", brain_region="cerebellum")
>>> q.to_q()
'species:mouse AND brain_region:cerebellum'
>>> q.to_fq()
[]

>>> multi = NeuroMorphoQuery(species=("mouse", "rat"))
>>> multi.to_q()
'(species:mouse OR species:rat)'
to_fq()[source]#

Return the fq filter list for /api/neuron/select.

Currently only raw_fq populates this list; the typed fields all flow through q. The method exists so callers and the CLI can pass through fq strings without special-casing.

Return type:

list[str]

to_params()[source]#

Return q/fq packaged as a kwargs dict.

Returns:

{"q": ..., "fq": [...]} ready to be unpacked into NeuroMorphoClient.search().

Return type:

dict[str, object]

to_q()[source]#

Return the assembled q parameter for /api/neuron/select.

Returns:

"*:*" when no filters were specified, otherwise an AND-joined string of clauses.

Return type:

str