Log inGet started
World

Fruit Fly

Branchmain
Branchesmain
Commit83f1b94a81

README.md

selection.module

The grammar the lab bench, the experiments panel and the guide all read when a person names a set of neurons. A selection is a line of space separated key:value terms, and it turns into the table brain:select takes.

TermSelection keyShape
type:MN9,DNa01typescomma list, merged across repeated terms
prefix:JO-typePrefixone value, last term wins
pattern:^LB%dpatternone value, a Luau pattern over the type name
class:Kenyon_Cell,MBONclassescomma list, merged
super:descending_neuronsuperclassescomma list, merged
side:Lsidescomma list, merged
excitatory:trueexcitatorytrue or false
indices:0,1,2indicescomma list of neuron indices
limit:100limita number

class:, classes:, super:, superclass:, superclasses:, side:, sides:, type:, types:, index: and indices: are all accepted spellings of the same keys.

Every key given must hold, so terms of different keys intersect and terms of the same key union: type:MN9 type:DNa01 names four neurons, class:Kenyon_Cell side:L names the left Kenyon cells.

Reading it

local Selection = require("~.selection")

local sel, err = Selection.parse("type:MN9,DNa01 side:L")
if sel == nil then
    print(err)                              -- names the term that failed
else
    print(Selection.describe(sel))          -- "types MN9, DNa01; sides L"
    print(#brain:select(sel))
end

local brainComp = Selection.resolve(public.brain)  -- the FruitFlyBrain, or nil

M.PLACEHOLDER is the field placeholder that names every term, and M.KEYS is the same list as one line for an error message, so the field, the error and this table cannot drift apart.