src/sys_def.jl
MEDYAN.AgentNames
The names of the agents in a simulation
diffusingspeciesnames::Vector{Symbol}
bulkspeciesnames::Vector{Symbol}
membranediffusingspeciesnames::Vector{Symbol}
fixedspeciesnames::Vector{Symbol}
filamentnames::Vector{Tuple{Symbol, Vector{Symbol}}}
vertexnames::Vector{Symbol}
link_2mon_names::Vector{Symbol}
cadherinnames::Vector{Symbol}
MEDYAN.MonomerName
ftid::Int64
: filament type idfid::Int64
: filament idmid::Int64
: monomer id
MEDYAN.VertexName
membraneindex::Int64
: membrane indexvid::Int64
: vertex id
MEDYAN.Link2MonState
There is one instance of this per link_2mon.
chemstate::NamedTuple
: Other state.mechstate::NamedTuple
: Used in link_2mon force calculation.is_minimized::Bool
: Set to true after minimization
MEDYAN.Link2MonParams
Link2mon Parameters, there is one instance of this per link2mon type
defaultstate::MEDYAN.Link2MonState
mechparams::Any
no_collide::Bool
: if true, allows cylinders this link_2mon type connects and adjacent cylinders to clip
MEDYAN.CadherinState
There is one instance of this per cadherin.
chemstate::NamedTuple
: Other state.mechstate::NamedTuple
: Used in link_2mon force calculation.is_minimized::Bool
: Set to true after minimization
MEDYAN.CadherinParams
Cadherin Parameters, there is one instance of this per cadherin type
defaultstate::MEDYAN.CadherinState
mechparams::Any
MEDYAN.SysDef
A mutable struct mapping names to id numbers in a simulation
agent_names::MEDYAN.AgentNames
diffusing::MEDYAN.PropDictionary
diffusing_coeff::MEDYAN.PropDictionary
bulkspecies_indexmap::MEDYAN.PropDictionary
membranediffusing::MEDYAN.PropDictionary
fixedspecies::MEDYAN.PropDictionary
filament::MEDYAN.PropDictionary
filament_params::MEDYAN.PropDictionary
vertex::MEDYAN.PropDictionary
state::MEDYAN.PropDictionary
link_2mon::MEDYAN.PropDictionary
link_2mon_params::MEDYAN.PropDictionary
cadherin::MEDYAN.PropDictionary
cadherinparams::MEDYAN.PropDictionary
filamentsite::MEDYAN.PropDictionary
filamentendsite::MEDYAN.PropDictionary
membranesite::MEDYAN.PropDictionary
: Each membrane site represents the membrane patches in each compartment together with some membrane diffusing species.link_2mon_site::MEDYAN.PropDictionary
mon_link_2mon_site::MEDYAN.PropDictionary
decimated_2mon_site::MEDYAN.PropDictionary
cadherinsite::MEDYAN.PropDictionary
possiblecadherinsite::MEDYAN.PropDictionary
allfixedspeciesnames::Vector{String}
compartmentreactions::Vector{MEDYAN.CompartmentReaction}
compartmentreactioncallbacks::Vector{Any}
bulkreactions::Vector{MEDYAN.BulkReaction}
bulkreactioncallbacks::Vector{Any}
: Context -> Nothing
MEDYAN.add_diffusion_coeff!
MEDYAN.add_filament_params!
Add the filament parameters to the system. Return s.
MEDYAN.add_link_2mon!
MEDYAN.addfilamentendsite!
MEDYAN.add_link_2mon_site!
MEDYAN.add_decimated_2mon_site!
MEDYAN.addcadherin!
MEDYAN.addcadherinsite!
MEDYAN.addpossiblecadherinsite!
MEDYAN.addmembranesite!
MEDYAN.addreaction!
Add a reaction to the system. Return s
reactionexpr
is a string describing the reaction stoichiometry
reactionexpr
is comprised of reactant and product parts seperated by a "-->"
All whitespace characters are ignored.
Each side is then split by "+"
to get the species names.
Repeated or extra "+"
are ignored.
A species name can be prepended by a positive integer to represent multiple copies.
rate::Float64
: Base rate for the reaction. ((nm³)^(invvolumepower
)/s) rate constants correspond to stochastic rate constants in the sense used by Gillespie (J. Comp. Phys., 1976, 22 (4)).invvolumepower::Int
:volumefactor= (1/volume)^invvolumepower
wherevolume
is the volume of the compartment in nm³. Generally this is 0 for reactions without another diffusing reactant, and 1 if there is another diffusing reactant.
Example good reactionexpr
"diffusing.a + diffusing.b --> diffusing.c"
"diffusing.c --> diffusing.a + diffusing.b"
"+ + diffusing.c + --> + diffusing.a + + diffusing.b + +"
" --> diffusing.a + diffusing.b"
"diffusing.a + diffusing.b --> "
"diffusing.a + diffusing.a --> "
"2diffusing.a --> "
"2diffusing.a --> 20diffusing.a"
"diffusing.c + diffusing.b --> diffusing.c + diffusing.b"
"fixedspecies.rate1b --> fixedspecies.g"
"fixedspecies.rate1b + fixedspecies.g --> fixedspecies.g"
"fixedspecies.rate1b + 23fixedspecies.g --> fixedspecies.g"
"fixedspecies.g --> fixedspecies.rate1b + 23fixedspecies.g"
"fixedspecies.g + fixedspecies.rate1b--> 2fixedspecies.rate1b + 23fixedspecies.g"
"filamentsite.MT.d --> filamentsite.MT.d"
"filamentsite.MT.d + diffusing.a --> filamentsite.MT.d"
"fixedspecies.g --> diffusing.a"
"diffusing.a --> fixedspecies.g"
"filamentsite.actin.pm + diffusing.a --> filamentsite.actin.pm"
MEDYAN.addreactioncallback!
addreactioncallback!(s::SysDef, reaction::CompartmentReaction, callback)::SysDef
addreactioncallback!(s::SysDef, reactantexpr::AbstractString, rate::Float64, invvolumepower::Int, callback)::SysDef
Like addreaction!
but also adds callback
. callback
is called when the reaction happens with input of MEDYAN.Context
and Int
the compartment id where the reaction happened.
The reaction should normally have no net stoichiometry because the callback should handle updating species counts. If an AbstractString
is passed instead of a CompartmentReaction
for the reaction, that string will be parsed to determine the reactants. The net stoichiometry will be zero.
MEDYAN.errorcheck_addcallback(callback,s::SysDef)
can optionally be overloaded to add errorchecking when the callback is added.
Callback for bulk reactions: Context -> Nothing.
MEDYAN.addfilament_reaction!
Add filament reaction. Return s. Add a filamentsite
and reaction with callback to change the monomer state. This can be used for filament aging, filament catalyzed reactions, or simple binding reactions.
Arguments
s::SysDef
: the system to add to.filamenttypename::Symbol
: the filament type name.filamentsitename::Symbol
: the new name of thefilamentsite
added. This can be used as a catalyst in other reactions.changedstatenames::Pair{Vector{Symbol}, Vector{Symbol}}
: the changes to the monomer states, the first is the states to match. The second is the new monomer states after the reaction. both should be the same length. Ordered minus end first.center::Int
: Which index ofchangedstatenames.first
is the actual location of thefilamentsite
. Used for determining what compartment the reaction goes in.reactantexpr::AbstractString
: Allows adding other reactants or products to the reaction." + filamentsite.$(filamenttypename).$(filamentsitename) + "
gets added to both sides this to create the full reaction expression. Seeaddreaction!
for syntax.rate::Float64
: Base rate for the reaction. ((nm³)^(invvolumepower
)/s)invvolumepower::Int
:volumefactor= (1/volume)^invvolumepower
wherevolume
is the volume of the compartment in nm³.volumefactor
only applies to this reaction not any other reaction usingfilamentsitename
Generally this is 0 for reactions without another diffusing reactant, and 1 if there is another diffusing reactant.
Examples
MEDYAN.addfilamentend_reaction!
Add filament end reaction. Return s. Add a filamentendsite
and reaction with callback to change the filaments. This can be used for polymerization, depolymeriation, and changing end state.
Arguments
s::SysDef
: the system to add to.filamenttypename::Symbol
: the filament type name.filamentendsitename::Symbol
: the new name of thefilamentendsite
added. This can be used as a catalyst in other reactions.isminusend::Bool
: true if changing the minus end, false if changing the plus end.changedendstatenames::Pair{Vector{Symbol}, Vector{Symbol}}
: the changes to the end monomer states, the first is the states to match. The second is the new monomer states after the reaction. If the second has more states than the first, new monomers will be added, if the second has less, monomers will be removed. Ordered minus end first.spacing::Float64
: Space needed at the filament end for this reaction. (nm)ratefactor= exp(-β*spacing*loadforce)
where β is 1/kT,loadforce
is the external force pushing axially on the end of the filament. andratefactor
affects this reaction propensity and any others usingfilamentendsitename
reactionexpr::AbstractString
: Allows adding other reactants or products to the reaction." + filamentendsite.$(filamenttypename).$(filamentendsitename) + "
gets added to both sides this to create the full reaction expression. Seeaddreaction!
for syntax.rate::Float64
: Base rate for the reaction. ((nm³)^(invvolumepower
)/s)invvolumepower::Int
:volumefactor= (1/volume)^invvolumepower
wherevolume
is the volume of the voxel in nm³.volumefactor
only applies to this reaction not any other reaction usingfilamentendsitename
Generally this is 0 for reactions without another diffusing reactant, and 1 if there is another diffusing reactant.
Examples
using MEDYAN
agent_names = AgentNames(
diffusingspeciesnames= [:a,],
filamentnames= [(:filname,[
:plus,
:mid,
:minus,
]),
],
)
s= SysDef(agent_names)
monomerspacing= 2.7
#minus end polymerization
addfilamentend_reaction!(s, :filname, :pm, true,
[:minus]=>[:minus,:mid], monomerspacing,
"diffusing.a -->", 10E3, 1,
)
#plus end depolymerization
addfilamentend_reaction!(s, :filname, :dpp, false,
[:mid,:plus]=>[:plus], 0.0,
"--> diffusing.a", 1.75E-3, 0,
)
MEDYAN.addunbindinglink_2mon_site!
Add unbinding site, callback, and reaction. Return s.
Arguments
s::SysDef
: the system to add to.link_2mon_typename::Symbol
: the link_2mon type name.link_2mon_sitename::Symbol
: the new name of thelink_2mon_site
added. This can be used as a catalyst in other reactions.link_2mon_site
: the link_2mon site to add.plusfilamenttypename::Symbol
: the filament type name of the plus end.plusnewmonomerstatename::Symbol
: the new name of the monomer state of the plus end.minusfilamenttypename::Symbol
: the filament type name of the minus end.minusnewmonomerstatename::Symbol
: the new name of the monomer state of the minus end.reactionexpr::AbstractString
: Allows adding other reactants or products to the reaction." + link_2mon_site.$(link_2mon_typename).$(link_2mon_sitename) + "
gets added to both sides this to create the full reaction expression. Seeaddreaction!
for syntax.rate::Float64
: Base rate for the reaction. ((nm³)^(invvolumepower
)/s)invvolumepower::Int
:volumefactor= (1/volume)^invvolumepower
wherevolume
is the volume of the compartment in nm³.volumefactor
only applies to this reaction not any other reaction usinglink_2mon_sitename
Generally this is 0 for reactions without another diffusing reactant, and 1 if there is another diffusing reactant.
MEDYAN.add_membranesitereaction!
Add a membrane site with the corresponding reaction with callback.
Keyword arguments:
- s: SysDef.
- name_newmembranesite: Symbol.
- membranediffusingreactants: Vector of symbols as membrane reactants. 0 or 1 reactant is currently supported.
- membranediffusingproducts: Vector of symbols as membrane products.
- reactionexpr_extra: Reaction expression for other species involved.
- rate: Float.
- changerage_bypotentialenergy: Whether the rate is affected by potential energy.
- invvolumepower: rate scaling with compartment volume.
Notes:
- If error occurs, this function does not ensure that s is unchanged.