MEDYAN.def_fila_reaction!
Tuple{MEDYAN.SysDef}
Add a filament monomer reaction. The reaction fires at monomers whose local neighborhood matches a pattern of states. When it fires, the matched monomers can be changed to new, or a custom affect! callback can handle arbitrary side effects.
All pattern positions must lie on the filament. Monomers near the ends where the pattern would extend past the boundary are automatically skipped. Use def_fila_tip_reaction! for reactions at filament ends.
Keyword Arguments
Required
fila_type::Symbol: Filament type (e.g.,:actin).name::Symbol: Unique name for this reaction site.match::Vector: Pattern of monomer states to match, ordered minus → plus end. Each element can be:Symbol— exact state (e.g.,:a)Vector{Symbol}— any of these states (e.g.,[:a, :b])anystate— any state
State change (provide exactly one)
new::Vector{Symbol}: States to assign to the matched monomers after firing. Must be the same length asmatch. Cannot be used withaffect!.affect!: Custom callback(c::Context; chem_voxel::Int, center::FilaMonoIdx, kwargs...) -> Int. Called instead of automatic state changes. The returnedIntis a status code. Cannot be used withnew.
Stoichiometry
net_stoich::Vector{Pair{Symbol,Int}} = Pair{Symbol,Int}[]: Net change to diffusing species when the reaction fires. Each entry isspecies_name => amount, e.g.[:ligand => -1]to consume one ligand per firing. The callback handles the count update automatically. Can only be used withnew, not withaffect!.
Rate
base_rate::Float64: Rate constant. Units:(nm³)^invvolumepower / s.invvolumepower::Int = 0: Set to 0 for unimolecular, 1 for bimolecular.reactants_extra::String = "": Additional reactant species that contribute to propensity (e.g.,"diffusing.ligand"). The species is not consumed automatically.
Geometry
center::Int = cld(length(match), 2): Which position inmatchis the center of the reaction. Determines which chem_voxel the reaction is assigned to.
Examples
using MEDYAN
s = MEDYAN.SysDef()
def_fila_type!(s; name=:actin, mono_states=[:a, :b, :c], param=MEDYAN.ACTIN_TWIST_PARAMS)
# Aging: every :a monomer transitions to :b
def_fila_reaction!(s;
fila_type = :actin, name = :aging,
match = [:a],
new = [:b],
base_rate = 2.4,
)
# Cooperative transition: :a next to :b on the minus side becomes :b
def_fila_reaction!(s;
fila_type = :actin, name = :cooperate,
match = [:b, :a],
new = [:b, :b],
center = 2,
base_rate = 0.4,
)
# Bimolecular binding with a diffusing ligand using affect!
def_diffusing_species!(s, :ligand; coeff=2.5e7)
def_fila_reaction!(s;
fila_type = :actin, name = :bind_affect,
match = [:a],
affect! = (c; center, chem_voxel, kwargs...) -> let
update_fila_mono_state!(c, center, :b)
add_diffusing_count!(c; species=:ligand, chem_voxel, amount=-1)
1
end,
base_rate = 1e6,
invvolumepower = 1,
reactants_extra = "diffusing.ligand",
)
# Bimolecular binding with a diffusing ligand using net_stoich
def_fila_reaction!(s;
fila_type = :actin, name = :bind_stoich,
match = [:a],
new = [:b],
net_stoich = [:ligand => -1],
base_rate = 1e6,
invvolumepower = 1,
reactants_extra = "diffusing.ligand",
)
# Match a set of states: :a or :b → :c
def_fila_reaction!(s;
fila_type = :actin, name = :a_or_b,
match = [[:a, :b]],
new = [:c],
base_rate = 1.0,
)
# anystate with neighbor constraint: any monomer whose plus neighbor is :a
def_fila_reaction!(s;
fila_type = :actin, name = :any_then_a,
match = [anystate, :a],
new = [:a, :b],
center = 2,
base_rate = 1.0,
)