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-
rawfield becomes a Solr clause that is ANDed together. Multi-value fields produce(field:a OR field:b)clauses. Useraw_qandraw_fqto append filter strings verbatimwhen you need a Solr feature this builder doesn’t expose.
- Parameters:
species (
str|tuple[str,...] |None) – Filter on thespeciesfield.brain_region (
str|tuple[str,...] |None) – Filter on thebrain_regionfield.cell_type (
str|tuple[str,...] |None) – Filter on thecell_typefield.archive (
str|tuple[str,...] |None) – Filter on thearchivefield.original_format (
str|tuple[str,...] |None) – Filter on theoriginal_formatfield.stain (
str|tuple[str,...] |None) – Filter on thestainfield.age_classification (
str|tuple[str,...] |None) – Filter on theage_classificationfield.gender (
str|tuple[str,...] |None) – Filter on thegenderfield.raw_q (
tuple[str,...]) – Extra clauses appended verbatim to theqparameter.raw_fq (
tuple[str,...]) – Extra filter strings appended verbatim tofq.
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
fqfilter list for/api/neuron/select.Currently only
raw_fqpopulates this list; the typed fields all flow throughq. The method exists so callers and the CLI can pass throughfqstrings without special-casing.
- to_params()[source]#
Return
q/fqpackaged as a kwargs dict.- Returns:
{"q": ..., "fq": [...]}ready to be unpacked intoNeuroMorphoClient.search().- Return type: