Fruit Fly
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.
| Term | Selection key | Shape |
|---|---|---|
type:MN9,DNa01 | types | comma list, merged across repeated terms |
prefix:JO- | typePrefix | one value, last term wins |
pattern:^LB%d | pattern | one value, a Luau pattern over the type name |
class:Kenyon_Cell,MBON | classes | comma list, merged |
super:descending_neuron | superclasses | comma list, merged |
side:L | sides | comma list, merged |
excitatory:true | excitatory | true or false |
indices:0,1,2 | indices | comma list of neuron indices |
limit:100 | limit | a 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.