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 id
  • fid::Int64: filament id
  • mid::Int64: monomer id

MEDYAN.VertexName

  • membraneindex::Int64: membrane index
  • vid::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

SysDef(agent_names::AgentNames)

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!

add_diffusion_coeff!(s::SysDef, diffusing_name::Symbol, diffusing_coeff::Float64)

Add the diffusing species to the system with diffusion coefficent in units of (nm²/s). Return s.

MEDYAN.add_filament_params!

add_filament_params!(s::SysDef, filament_name::Symbol, filament_params::FilamentMechParams)

Add the filament parameters to the system. Return s.

See MEDYAN.FilamentMechParams

MEDYAN.addfilamentendsite!

addfilamentendsite!(s::SysDef,filamenttypename::Symbol,filamentendsitename::Symbol,site)::SysDef

MEDYAN.add_decimated_2mon_site!

add_decimated_2mon_site!(s::SysDef,decimated_2mon_sitename::Symbol,site)::SysDef

MEDYAN.addcadherin!

addcadherin!(s::SysDef,cadherintypename::Symbol,defaultstate::CadherinState,mechparams). Add the cadherin to the system. Return s.

MEDYAN.addcadherinsite!

addcadherinsite!(s::SysDef,cadherintypename::Symbol,cadherinsitename::Symbol,site)::SysDef

MEDYAN.addpossiblecadherinsite!

addpossiblecadherinsite!(s::SysDef,possiblecadherinsitename::Symbol,site)::SysDef

MEDYAN.addmembranesite!

addmembranesite!(
    s::MEDYAN.SysDef,
    membranesitename::Symbol,
    site
) -> MEDYAN.SysDef

Add a new site with a specified name. During this process, a new fixed species is created suffixed with “membranesite.”.

MEDYAN.addreaction!

addreaction!(s::SysDef,reaction::CompartmentReaction)::SysDef
addreaction!(s::SysDef,reactionexpr::AbstractString,rate::Float64,invvolumepower::Int)::SysDef

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.

  1. 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)).
  2. invvolumepower::Int: volumefactor= (1/volume)^invvolumepower where volume 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

  1. s::SysDef: the system to add to.
  2. filamenttypename::Symbol: the filament type name.
  3. filamentsitename::Symbol: the new name of the filamentsite added. This can be used as a catalyst in other reactions.
  4. 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.
  5. center::Int: Which index of changedstatenames.first is the actual location of the filamentsite. Used for determining what compartment the reaction goes in.
  6. 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. See addreaction! for syntax.
  7. rate::Float64: Base rate for the reaction. ((nm³)^(invvolumepower)/s)
  8. invvolumepower::Int: volumefactor= (1/volume)^invvolumepower where volume is the volume of the compartment in nm³. volumefactor only applies to this reaction not any other reaction using filamentsitename Generally this is 0 for reactions without another diffusing reactant, and 1 if there is another diffusing reactant.

Examples

using MEDYAN
agent_names = AgentNames(
    filamentnames= [(:filname,[
                            :a,
                            :b,
                            :c,
                        ]),
    ],
)
s= SysDef(agent_names)
addfilament_reaction!(s, :filname, :ab,
    [:a]=>[:b], 1,
    "-->", 1.75E-3, 0,
)
addfilament_reaction!(s, :filname, :aabc,
    [:a,:a]=>[:b,:c], 2,
    "-->", 1.75E-3, 0,
)

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

  1. s::SysDef: the system to add to.
  2. filamenttypename::Symbol: the filament type name.
  3. filamentendsitename::Symbol: the new name of the filamentendsite added. This can be used as a catalyst in other reactions.
  4. isminusend::Bool: true if changing the minus end, false if changing the plus end.
  5. 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.
  6. 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. and ratefactor affects this reaction propensity and any others using filamentendsitename
  7. 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. See addreaction! for syntax.
  8. rate::Float64: Base rate for the reaction. ((nm³)^(invvolumepower)/s)
  9. invvolumepower::Int: volumefactor= (1/volume)^invvolumepower where volume is the volume of the voxel in nm³. volumefactor only applies to this reaction not any other reaction using filamentendsitename 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.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.