14.1. steps.API_2.model
The model
module contains classes related to model definition: species, complexes, reactions, diffusion rules, channels, etc.
14.1.1. Detailed documentation
Containers
Vesicles and rafts
Reactants
Reaction-diffusion
Currents
- class Model(*args, **kwargs)[source]
Bases:
NamedObject
Top-level container for the objects in a kinetic model
Should be used as a context manager for the declaration of Volume systems, reactions, diffusion rules, etc:
mdl = Model() with mdl: vsys = VolumeSystem.Create() ... # Declare other objects in mdl
After having declared children objects in the
with mdl:
block, they can be accessed as attributes ofmdl
with their name (seesteps.API_2.utils.NamedObject
andsteps.API_2.utils.NamedObject.Create()
):mdl.vsys
- class VolumeSystem(*args, **kwargs)[source]
Bases:
NamedObject
A container that groups reactions and diffusion rules located in a volume
Should be used as a context manager for the declaration of reactions, diffusion rules, etc:
... with mdl: ... vsys = VolumeSystem.Create() with vsys: diff1 = Diffusion.Create(...) ... # Declare other objects in vsys
After having declared children objects in the
with vsys:
block, they can be accessed as attributes ofvsys
with their name (seesteps.API_2.utils.NamedObject
andsteps.API_2.utils.NamedObject.Create()
):vsys.diff1
- class SurfaceSystem(*args, **kwargs)[source]
Bases:
NamedObject
A container that groups reactions and diffusion rules located in a surface
Should be used as a context manager for the declaration of surface reactions, surface diffusion rules, etc:
... with mdl: ... ssys = SurfaceSystem.Create() with ssys: diff2 = Diffusion.Create(...) ... # Declare other objects in ssys
After having declared children objects in the
with ssys:
block, they can be accessed as attributes ofssys
with their name (seesteps.API_2.utils.NamedObject
andsteps.API_2.utils.NamedObject.Create()
):ssys.diff2
- class VesicleSurfaceSystem(*args, **kwargs)[source]
Bases:
SurfaceSystem
A container that groups reactions and diffusion rules located in a vesicle surface
Should be used as a context manager for the declaration of vesicle surface reactions, vesicle surface diffusion rules, etc:
... with mdl: ... vssys = VesicleSurfaceSystem.Create() with vssys: diff3 = Diffusion.Create(...) ... # Declare other objects in vssys
After having declared children objects in the
with vssys:
block, they can be accessed as attributes ofvssys
with their name (seesteps.API_2.utils.NamedObject
andsteps.API_2.utils.NamedObject.Create()
):vssys.diff3
- class RaftSurfaceSystem(*args, **kwargs)[source]
Bases:
SurfaceSystem
A container that groups reactions and diffusion rules located in a raft surface
Should be used as a context manager for the declaration of raft surface reactions, raft endocytosis rules, etc:
... with mdl: ... rssys = RaftSurfaceSystem.Create() with rssys: rend1 = RaftEndocytosis.Create(...) ... # Declare other objects in rssys
After having declared children objects in the
with rssys:
block, they can be accessed as attributes ofrssys
with their name (seesteps.API_2.utils.NamedObject
andsteps.API_2.utils.NamedObject.Create()
):rssys.rend1
- class Vesicle(diameter, dcst=0, vesSurfSys=None, **kwargs)[source]
Bases:
NamedObject
Represents a vesicle object
Vesicles are described by a spherical diameter and diffusion rate. It models the many behaviours and interactions of these complex biological entities. A vesicle may be formed by endocytosis or by direct user input, may exit by exocytosis or user input, may transport species on its surface or luminally, and may undergo many interactions with its environment. These interactions are individually described in each corresponding class.
- Parameters
diameter (float) – Diameter of the vesicle (in m)
dcst – Default diffusion coefficient of the vesicle (in m^2 s^-1)
vesSurfSys (
VesicleSurfaceSystem
) – Optional vesicle surface system to be associated with the vesicle
- addSystem(sys)[source]
Add a vesicle surface system to the vesicle
- Parameters
sys (Union[
steps.API_2.model.VesicleSurfaceSystem
, str]) – The vesicle surface system to be added, or its name.- Returns
None
- __call__(loc)[source]
Get a version of the vesicle with added information
Parentheses notation (function call) can be used on a vesicle to specify additional information. This should never be needed during model declaration but is frequently needed for simulation control and data saving (see
steps.API_2.sim.SimPath
).- Parameters
loc – If ‘surf’, the simulation path represents the surface of the selected vesicles, if ‘in’, it represents the inside of the selected vesicles
- Returns
An object that represents the vesicle with the added information
- property Diameter
Vesicle diameter (in m)
- Type
Union[float,
steps.API_2.nutils.Parameter
], read-only
- property Dcst
Diffusion constant (in m^2 s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class Raft(diameter, dcst=0, raftSurfSys=None, **kwargs)[source]
Bases:
NamedObject
Represents a membrane raft
The membrane analogy of vesicles, rafts effectively group surface species within a defined radius and exist in and may diffuse within patches. Rafts and the species they contain undergo special interactions such as raft endocytosis, raft generation and raft dissolution.
Rafts can represent lipid rafts or other clusters. They occupy space defined by a diameter projected onto the surface, and can be mobile.
- Parameters
diameter (float) – Diameter of the raft (in m)
dcst – Default diffusion coefficient of the raft (in m^2 s^-1)
raftSurfSys (
RaftSurfaceSystem
) – Optional raft surface system to be associated with the raft
- addSystem(sys)[source]
Add a raft surface system to the raft
- Parameters
sys (Union[
steps.API_2.model.RaftSurfaceSystem
, str]) – The raft surface system to be added, or its name.- Returns
None
- property Diameter
Raft diameter (in m)
- Type
Union[float,
steps.API_2.nutils.Parameter
], read-only
- property Dcst
Raft diffusion constant (in m^2 s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class Species(*args, valence=0, **kwargs)[source]
Bases:
ReactionElement
,NamedObject
A chemical species
Species can be involved in
Reaction
,Diffusion
, or other transport mechanisms.- Parameters
valence (int) – Optional, the valence of the species (defaults to 0)
- property valence
The valence of the species (defaults to 0)
- Type
Union[int,
steps.API_2.utils.Parameter
]
- class LinkSpecies(dcst=0, **kwargs)[source]
Bases:
ReactionElement
,NamedObject
A chemical species that can form links between vesicles
A link species is a special kind of chemical species that links two vesicles (by forming a bond with another link species). A link species is formed by a vesicle binding event and exists within a specified upper and lower bound of length for the duration of its existence. A link species may diffuse on a vesicle surface, but only within this length bound. Link species are destroyed by a vesicle unbinding event.
- Parameters
dcst (float) – Optional, diffusion coefficient of the vesicle (in m^2 s^-1, defaults to 0)
- class Complex(subUnits, *args, statesAsSpecies=False, NoOrdering>, **kwargs)[source]
Bases:
NamedObject
Multi-state complex class
A complex is composed of one or more subunits, each subunit has a finite (preferably low) number of states. Subunit states can be used inside reactions so as to simplify the declaration of reactions for multi-subunits complexes. This class can also be used as a way to automatically declare complex states as species.
- Parameters
subUnits (List[
SubUnit
] or List[SubUnitState
]) – The list ofSubUnit
of the complex. Can also be a list ofSubUnitState
in which case aSubUnit
will automatically be created and the complex will be composed of only thisSubUnit
.statesAsSpecies (bool) – If True, all the possible states of the complex are declared as
Species
. If not, and if your STEPS implementation supports it, the complex will be declared as a native STEPS multi-state complex.order (Callable[[Tuple[
SubUnitState
]], Tuple[SubUnitState
]]) – A callable that defines a custom state ordering. It should map a tuple ofSubUnitState
into a unique ordering. It defaults to andNoOrdering()
, which considers that subunits have no spatial position. SeeStrongOrdering()
,NoOrdering()
, andRotationalSymmetryOrdering()
for details.
Declaration:
S1A, S1B, S1C, S2A, S2B = SubUnitState.Create() SU1, SU2 = SubUnit.Create( [S1A, S1B, S1C], [S2A, S2B] ) Comp = Complex.Create([SU1, SU1, SU2])
- Usage in reactions:
Centered on complexes:
# Get a single 'Comp' complex, when several complexes of the same type are used in # the same reaction, it allows to determine which complex undergoes which changes. C = Comp.get() # Ca binding to the first subunit of complex Comp in state S1A and changing its # state to S1B C[S1A, :, :] + Ca <r[1]> C[S1B, :, :]
Centered on subunit states:
with Comp[...]: # Ca Binding to any subunit in state S1A and changing it to state S1B S1A + Ca <r[1]> S1B # Ca Binding to first subunit in state S1A and changing it to state S1B S1A[0] + Ca <r[1]> S1B[0] with Comp[...] as C1, Comp[..., S2B] as C2: S1A[C1] + S1B[C2] <r[1]> S1B[C1] + S1C[C2]
- __iter__()[source]
Iterator over all the possible states of the complex.
- Returns
An iterator that iterates over all unique (as defined by the custom ordering)
ComplexState
of the complex.- Return type
Iterator[
ComplexState
]
Usage:
Comp1 = Complex.Create(...) for state in Comp1: # Do something with the state ...
- __getitem__(subStates)[source]
Square-bracket operator for defining states or sets of states.
- Parameters
subStates (Tuple[Union[
SubUnitState
,SubUnitSelector
], …]) – A sequence of one or moreSubUnitState
orSubUnitSelector
that corresponds to one or severalComplexState
.- Returns
A single complex state or a set of complex states matching the arguments.
- Return type
Union[
ComplexState
,ComplexSelector
]
Return the
ComplexState
corresponding to the combination ofSubUnitState
given as argument. If the state is fully determined (the number and type of SubUnitStates must match theSubUnit
that have been declared when the complex was created), return the correspondingComplexState
. Otherwise, return aComplexSelector
representing all the possible states.The slice operator (’
:
’) as well as ellipsis (’...
’) can be used in the same way as when slicing numpy arrays. See https://numpy.org/doc/1.18/reference/arrays.indexing.html for details.Valid examples:
Comp[S1A, S1B, S2A] # Valid, returns the corresponding ComplexState Comp[S1A, :, :] # Valid, returns a ComplexSelector in which the first SubUnit is # in state S1A and the other subunits are in any state Comp[S1A, ...] # Valid, the ellipsis operator ('...') is equivalent to filling # the remaining subUnits with ':' Comp[..., S2A] # Valid, returns a ComplexSelector in which the last SubUnit is in # state S2A and the other subunits are in any state Comp[S1A|S1B, :, :] # Valid, first subunit is either in state S1A or S1B and the other # subunits are in any state Comp[~S1C, :, :] # Valid, first subunit is not in state S1C and the other subunits # are in any state
See
SubUnitState
andSubUnitSelector
for the syntax relative to the last two examples.Invalid examples:
Comp[S2A, S1B, S1A] # Invalid, the order of states does not match the one used for # complex creation Comp[S1A] # Invalid, only one subunit is specified while the complex has 3 Comp[..., S1A, ...] # Invalid, cannot use more than one ellipsis operator
- class Channel(subUnits, *args, statesAsSpecies=True, **kwargs)[source]
Bases:
Complex
Ion channel class
- Parameters
See
Complex
for a description of the parameters.
Channels behave like complexes. This simplifies the declaration of reactions between channel states in cases like the Hodgkin-Huxley model of Na+ channel, in which gating variable m and h are independent and can thus be declared as separate SubUnits. All combinations are then automatically computed for creating the channel states.
- class Reaction(*args, **kwargs)[source]
Bases:
NamedObject
A (possibly reversible) reaction.
A reaction needs to be declared within a
Model
and within aVolumeSystem
or aSurfaceSystem
(i.e. inside awith
block, see e.g.VolumeSystem
)A
Reaction
is defined by a left hand side (lhs) and a right hand side (rhs). Both sides are instances ofReactionSide
and the overall reaction is declared with a custom syntax designed to look like standard chemical reactions notation. WhenComplex
are involved, aReaction
object can represent several elementary reactions, see user guide for details.Note
Reactions should always be instantiated from a
ReactionManager
.Usage:
r = ReactionManager() with vsys: # Simple forward reaction SA >r[1]> SB r[1].K = 1 # Set forward rate # Bidirectional reaction SA + SB <r[1]> SC + SD r[1].K = 2, 1 # Set forward and backward rates # Chained reactions SA <r[1]> SB >r[2]> SC r[1].K = 2, 1 r[2].K = 3
Warning
The corresponding reactions are only truly added to steps after the with vsys: block is exited.
- __getitem__(key)[source]
Get sub-reactions from a reaction
Square bracket notation can be used on a reaction to retrieve either the forward reaction(s), or the backward one(s). This should never be needed during model declaration but it is very important for simulation control and data saving (see
steps.API_2.sim.SimPath
).- Parameters
key (str) – Use
'fwd'
to access the forward reaction(s) or'bkw'
to access the backward reaction(s).- Returns
The querried reaction(s).
See Well-Mixed Reaction System for usage example.
- property AntiDependencies
Reaction anti-dependencies
A set of species that, if present, will prevent the reaction from happenning.
If the reaction is reversible, this value corresponds to a tuple composed of the forward and backward anti-dependencies. The anti-dependencies can be a special function that depends e.g. on complex states (
CompDepFunc
).Note that for now, only species on the surfaces of rafts can be used as anti-dependencies.
The anti-dependencies should be given in the shape of a reaction side, for example: SA.r + SC.r In that example, the reaction will be prevented if either SA or SC are present in the raft. If e.g. 2*SA.R + SC.r is used, the reaction will be prevented is at least two SA are present or at least one SC.
Usage examples:
# Bidirectional reactions SA.r + SB.s <r[1]> SA.r + SB.r r[1].K = fwd_rate, bkw_rate # SC will prevent the forward reaction, SD the backward: r[1].AntiDependencies = SC.r, SD.r # Unidirectional reactions SC.r >r[2]> SD.r r[1].K = single_rate r[1].AntiDependencies = SA.r
The anti-dependencies are empty by default.
- Type
Union[
steps.API_2.ReactionElement
,steps.API_2.ReactionSide
,CompDepFunc
]
- property Dependencies
Reaction dependencies
A set of species that need to be present in order for the reaction to happen but their amount will not have any effect on the reaction rate.
If the reaction is reversible, this value corresponds to a tuple composed of the forward and backward dependencies. The dependencies can be a special function that depends e.g. on complex states (
CompDepFunc
).Note that for now, only species on the surfaces of rafts and vesicles can be used as dependencies.
The dependencies should be given in the shape of a reaction side, for example: SA.v + SC.v
Usage examples:
# Bidirectional reactions SA.v + SB.o <r[1]> SA.v + SB.v r[1].K = fwd_rate, bkw_rate # SC is a dependency for the forward reaction, SD for the backward: r[1].Dependencies = SC.v, SD.v # Unidirectional reactions SC.v >r[2]> SD.v r[1].K = single_rate r[1].Dependencies = SA.v
The dependencies are empty by default.
- Type
Union[
steps.API_2.ReactionElement
,steps.API_2.ReactionSide
,CompDepFunc
]
- property Immobilization
Reaction immobilization flag
The immobilization flag is only applicable to reactions involving rafts or vesicles, it can either be
IMMOBILIZING
,NO_EFFECT
orMOBILIZING
.If the reaction is reversible, this value corresponds to a tuple composed of the forward and backward immobilization flags. Immobilization flags can be a special function that depends e.g. on complex states (
CompDepFunc
).Usage examples:
# Bidirectional reactions SA.v + SB.o <r[1]> SA.v + SB.v r[1].K = fwd_rate, bkw_rate # Forward reaction immobilizes, backward reaction does not: r[1].Immobilization = IMMOBILIZING, NO_EFFECT # Unidirectional reactions SC.v >r[2]> SD.v r[1].K = single_rate r[1].Immobilization = IMMOBILIZING
The immobilization flag defaults to
NO_EFFECT
.- Type
Union[
steps.API_2.model.IMMOBILIZING
,steps.API_2.model.NO_EFFECT
,steps.API_2.model.MOBILIZING
,CompDepFunc
]
- property K
Reaction rate(s)
If the reaction is reversible, this value corresponds to a tuple composed of the forward and backward rate. The rate can be a special function that depends e.g. on membrane potential (
VDepRate
) or on complex states (CompDepRate
).Usage examples:
# Bidirectional reactions SA + SB <r[1]> 2 * SC r[1].K = forward_rate, backward_rate # Unidirectional reactions SC >r[2]> SD r[1].K = single_rate
The reaction rate(s) default(s) to 0.
- Type
Union[float,
steps.API_2.utils.Parameter
,XDepFunc
]
- property MaxDistance
Maximum distance (in m) between vesicle and patch for the reaction to occur
Note that only reactions involving vesicles can have a maximum distance parameter.
If the reaction is reversible, this value corresponds to a tuple composed of the forward and backward maximum distances. Maximum distances can be a special function that depends e.g. on complex states (
CompDepFunc
).Usage examples:
# Bidirectional reactions SA.v + SB.s <r[1]> SA.v + SB.v r[1].K = fwd_rate, bkw_rate # Forward reaction has a maximum distance, backward reaction does not: r[1].MaxDistance = 0.1e-6, None # Unidirectional reactions SC.v + SD.s >r[2]> 2 * SD.v r[1].K = single_rate r[1].MaxDistance = 5e-7
The maximum distance defaults to None, i.e. no maximum distance.
- Type
Union[float,
CompDepFunc
]
- class Diffusion(elem, Dcst, *args, **kwargs)[source]
Bases:
NamedObject
A diffusion rule for a chemical species in a volume or on a surface
- Parameters
elem (Union[
Species
,ComplexState
,Complex
,ComplexSelector
]) – The element that subject to diffusionDcst (Union[float,
CompDepDcst
]) – The diffusion constant in S.I. units
Usage:
with vsys: # Volume diffusion of Species S1 # The diffusion rule is named 'diffS1' for later access during simulation diffS1 = Diffusion.Create(S1, 0.2e-9) with ssys: # Surface diffusion of Species S2 # The diffusion rule is not named and will thus not be accessible during simulation Diffusion(S2, 0.08e-12)
- __getitem__(key)[source]
Get sub diffusion rules from a diffusion object
Square bracket notation can be used on a diffusion rule when it was defined for a complex or a complex selector. This should never be needed during model declaration but it is very important for simulation control and data saving (see
steps.API_2.sim.SimPath
).- Parameters
key (Tuple[Union[
SubUnitState
,SubUnitSelector
], …]) – A sequence of one or moreSubUnitState
orSubUnitSelector
that corresponds to one or severalComplexState
.- Returns
The diffusion rule associated to
key
- __call__(direc=None)[source]
Get a version of the diffusion rule with added information
Parentheses notation (function call) can be used on a diffusion rule to represent a diffusion rule further specified with additional information. This should never be needed during model declaration but can become handy for simulation control and data saving (see
steps.API_2.sim.SimPath
).- Parameters
direc – A direction for the diffusion rule
- Returns
A version of the diffusion rule that is specific to direction
direc
.
- property Dcst
Diffusion constant (in m^2 s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class Endocytosis(vesicle, kcst=0, deps=None, inside=True, **kwargs)[source]
Bases:
NamedObject
A specific type of interaction that models endocytosis of a vesicle
An endocytosis event models the process of vesicle endocytosis by creating a new vesicle within a compartment. A vesicle will be created at a given rate when an optional species signature is met within an endocytic zone of a patch (see
steps.API_2.geom.EndocyticZone
).- Parameters
vesicle (
Vesicle
) – Vesicle that should appearkcst (float) – Rate constant of the reaction in s^-1
deps (Union[None,
ReactionElement
,ReactionSide
]) – Species dependenciesinside (bool) – If true, the vesicle should appear in the inside compartment, otherwise it should appear in the outside compartment.
- property Dependencies
Species dependencies for the endocytosis reaction
- Type
ReactionSide
, read-only
- property K
Endocytosis reaction constant (in s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class Exocytosis(kcst=0, deps=None, raft=None, kissAndRun=False, knrSpecChanges=None, knrPartialRelease=1, **kwargs)[source]
Bases:
NamedObject
A specific type of interaction that models exocytosis of a vesicle
An exocytosis event models the process of vesicle exocytosis. By default the vesicle is destroyed, species in the vesicle surface are deposited in the patch at the location at which exocytosis occurs, and species inside the vesicle lumen are deposited in the opposite compartment.
- Parameters
kcst (float) – Rate constant of the exocytosis reaction in s^-1
deps (Union[None,
ReactionElement
,ReactionSide
]) – Species dependencies on the vesicle surfaceraft (
Raft
) – If this argument is given the exocytosis event will create a raft on the patch at the location that exocytosis occurs. Any species on the vesicle surface will be deposited in the raft instead of in the patch.kissAndRun (bool) – This parameter can be set to True to model a kiss-and-run exocytosis event. This does not result in collapse of the vesicle, instead the vesicle is maintained in position after the release of vesicle lumen contents into the opposite compartment. The vesicle surface species are maintained on the vesicle.
knrSpecChanges – To aid kiss-and-run modeling, this argument can be a list of tuples of two
Species
; when the kiss-and-run event happens, all vesicle surface species from the first element of the tuple get changed to species of the second element. This feature can be used to specify any species changes that take place on the vesicle surface upon a kiss-and-run exocytosis event. This can be useful for modeling maturation of a complex for which undocking may be dependent.knrPartialRelease (float) – To aid kiss-and-run modeling, this argument can be used to specify partial release of any inner species that are released upon a kiss-and-run exocytosis event. 1.0 means all species are released, 0.0 means none of the species are released. If not specified, it defaults to 1.0.
- property Raft
Raft optionally associated with the exocytosis reaction
- Type
Union[
Raft
, None], read-only
- property Dependencies
Species dependencies for the exocytosis reaction
- Type
ReactionSide
, read-only
- property KnRSpecChanges
Species changes upon kiss-and-run ecoxytosis reaction
- property KnRPartialRelease
Fraction of inner species that are released upon a kiss-and-run exocytosis event
- Type
float, read-only
- property K
Exocytosys reaction constant (in s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class RaftEndocytosis(vesicle, kcst=0, deps=None, inside=True, **kwargs)[source]
Bases:
NamedObject
A specific type of interaction that models endocytosis of a raft to form a vesicle
A raft endocytosis event models the process of vesicle endocytosis by creating a new vesicle within a compartment from a raft. A vesicle will be created at a given rate when an optional species signature is met within the raft.
- Parameters
vesicle (
Vesicle
) – Vesicle that should appearkcst (float) – Rate constant of the reaction
deps (Union[None,
ReactionElement
,ReactionSide
]) – Species dependencies for endocytosis on the raftinside (bool) – If true, the vesicle should appear in the inside compartment, otherwise it should appear in the outside compartment.
- property Dependencies
Species dependencies for the raft endocytosis reaction
- Type
ReactionSide
, read-only
- property K
RaftEndocytosys reaction constant (in s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class RaftGen(raft, kcst=0, deps=None, **kwargs)[source]
Bases:
NamedObject
A specific type of interaction that models a raft genesis event
Generate a raft at a given rate when a defined species signature is met within a patch triangle.
- Parameters
raft (
Raft
) – Raft that should be createdkcst (float) – Rate constant
deps (Union[None,
ReactionElement
,ReactionSide
]) – Species dependencies on the patch surface
- property Dependencies
Species dependencies for the raft genesis reaction
- Type
ReactionSide
, read-only
- property K
Raft genesis reaction constant (in s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class RaftDis(kcst=0, antideps=None, **kwargs)[source]
Bases:
NamedObject
A specific type of interaction that models a raft dissolution event
A raft dissolution event results in removal of a raft at a given rate when the population of species within a raft are at or below an anti-dependencies signature. Any remaining species in the raft are inserted into patch triangles.
- Parameters
kcst (float) – Rate constant in s^-1
antideps – Species anti-dependencies on the raft surface. The raft dissolution cannot happen if species count on the raft are strictly bigger than at least one of the anti-dependencies.
- property AntiDependencies
Species antidependencies for the raft dissolution reaction
- Type
ReactionSide
, read-only
- property K
Raft dissolution reaction constant (in s^-1)
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class VesicleBind(vesicles, reactants, linkProducts, lenMin, lenMax, kcst=0, immobilization=_py_Immobilization.NO_EFFECT, deps=(None, None), **kwargs)[source]
Bases:
NamedObject
Vesicle binding reaction in a volume system
A vesicle binding event binds two vesicles by creating link species between them. The types of vesicle are arbitrarily termed 1 and 2, and may be the same. A reactant on vesicle surface of vesicle 1 binds with a reactant on vesicle 2, and link species are created, one on vesicle 1 and one on vesicle 2. Internally these two link species will be associated with each other and exist within a defined length bound.
- Parameters
vesicles (Tuple[
Vesicle
,Vesicle
]) – The two vesicles involved in the binding reaction (in a tuple)reactants (Tuple[
Species
,Species
]) – The species involved in the binding reaction for each vesicle (in a tuple, the order should match the vesicles parameter)linkProducts (Tuple[
LinkSpecies
,LinkSpecies
]) – The link species resulting from the binding for each vesicle (in a tuple, the order should match the vesicles parameter)lenMin (float) – Minimum length of the link between the two vesicles, in m
lenMax (float) – Minimum length of the link between the two vesicles, in m
kcst (float) – Rate constant in M^-1 s^-1
immobilization (Union[
steps.API_2.model.IMMOBILIZING
,steps.API_2.model.NO_EFFECT
,steps.API_2.model.MOBILIZING
]) – immobilization flag for the binding reaction (seeVesicleBind.Immobilization
)deps (Tuple[Union[None,
ReactionElement
,ReactionSide
], Union[None,ReactionElement
,ReactionSide
]]) – Dependencies for the binding reaction (in a tuple, the order should match the vesicle parameter)
- property Vesicles
Vesicles associated with the binding reaction
- property Immobilization
Immobilization flag (
IMMOBILIZING
,NO_EFFECT
orMOBILIZING
).Defaults to
NO_EFFECT
.- Type
Union[
steps.API_2.model.IMMOBILIZING
,steps.API_2.model.NO_EFFECT
,steps.API_2.model.MOBILIZING
]
- property Dependencies
Vesicle binding dependencies
A set of species or link species that need to be present in order for the binding reaction to happen.
The dependencies should be given in the shape of a reaction side, for example: SA.v + SC.v
The dependencies are empty by default.
- Type
Tuple[Union[None,
ReactionElement
,ReactionSide
], Union[None,ReactionElement
,ReactionSide
]]
- class VesicleUnbind(vesicles, linkReactants, products, kcst=0, immobilization=_py_Immobilization.NO_EFFECT, **kwargs)[source]
Bases:
NamedObject
Vesicle unbinding reaction in a volume system
A vesicle unbinding event unbinds two vesicles bound by two link species. The types of vesicle are arbitrarily termed 1 and 2, and may be the same. Upon application of this reaction, the link species on vesicle 1 becomes a species on the vesicle 1 surface and the link species on vesicle 2 becomes a species on the vesicle 2 surface.
- Parameters
vesicles (Tuple[
Vesicle
,Vesicle
]) – The two vesicles involved in the binding reaction (in a tuple)linkReactants (Tuple[
LinkSpecies
,LinkSpecies
]) – The link species involved in the link for each vesicle (in a tuple, the order should match the vesicles parameter)products (Tuple[
Species
,Species
]) – The species resulting from the unbinding for each vesicle (in a tuple, the order should match the vesicles parameter)kcst (float) – Rate constant in s^-1
immobilization (Union[
steps.API_2.model.IMMOBILIZING
,steps.API_2.model.NO_EFFECT
,steps.API_2.model.MOBILIZING
]) – immobilization flag for the binding reaction (seeVesicleUnbind.Immobilization
)
- property Vesicles
Vesicles associated with the binding reaction
- property Immobilization
Immobilization flag (
IMMOBILIZING
,NO_EFFECT
orMOBILIZING
)Defaults to
NO_EFFECT
.- Type
Union[
steps.API_2.model.IMMOBILIZING
,steps.API_2.model.NO_EFFECT
,steps.API_2.model.MOBILIZING
]
- class Current(*args, **kwargs)[source]
Bases:
NamedObject
Base class representing a current associated with one or more channel states
All
Current
objects need to be declared inside aSurfaceSystem
.Note
A
Current
object should not be directly instantiated by the user, only its subclasses should be instantiated. It is only documented for clarity.- __getitem__(key)[source]
Get sub current from a current object
Square bracket notation can be used on a current to retrieve the specific current object corresponding to a specific channel state. This should never be needed during model declaration but it is very important for simulation control and data saving (see
steps.API_2.sim.SimPath
). If aComplexSelector
covering several complex states is used, an iterable list of subcurrents is returned.- Parameters
key (Tuple[Union[
SubUnitState
,SubUnitSelector
], …]) – A sequence of one or moreSubUnitState
orSubUnitSelector
that corresponds to one or severalComplexState
.- Returns
The sub current(s) associated to
key
- class OhmicCurr(states, conduct=0, rev_pot=0, *args, **kwargs)[source]
Bases:
Current
An ohmic current through a channel in one or more conducting states
- Parameters
states (Union[
ComplexState
,ComplexSelector
]) – The conducting state(s) of the channelconduct (Union[float,
CompDepCond
]) – A constant conductance in Siemens or aCompDepCond
function that returns a conductance in Siemens as a function of a complex state. Defaults to 0 Siemens.rev_pot (float) – Reversal potential in Volts. Defaults to 0 Volts.
An ohmic current object is a simple current based on a (possibly state specific) fixed value for single-channel conductance and a constant reversal potential. An ohmic current does not result in movement of ions between compartments, but simply contributes a continuous current to the EField solver for every conducting channel on a membrane surface that contains the ohmic current.
Usage:
with ssys: # Constant conductance: OC_SK = OhmicCurr.Create(SKchan[sko1|sko2], SK_G, SK_rev) # The above line declares an ohmic current named OC_SK for channel SKchan when its # single subunit is in states sko1 or sko2. # Complex dependent conductance: cond = CompDepCond(lambda s: k1 + k2 * s.Count(S1A), [Chan1]) OC_Chan1 = OhmicCurr.Create(Chan1[:, :, S2A], cond, e_rev) # The above 2 lines declare an ohmic current from channel Chan1 when its 3rd subunit # is in state S2A. Thanks to the CompDepCond function, the conductance changes # depending on the specific states of the other subunits. In this case, there is a # basal conductance k1 and this conductance is increased by k2 for each subunit in # state S1A.
Warning
The corresponding currents are only truly added to steps after the with ssys: block is exited.
- property ERev
Reversal potential in Volts
Can only be set in the with ssys: block in which the current has been declared.
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- property G
Conductance in Siemens
Can only be set in the with ssys: block in which the current has been declared.
- Type
Union[float,
CompDepCond
]
- class GHKCurr(states, spec, P, computeflux=True, virtual_oconc=None, vshift=0, *args, **kwargs)[source]
Bases:
Current
A Goldman-Hodgkin-Katz current through a channel in one or more conducting states
- Parameters
states (Union[
ComplexState
,ComplexSelector
]) – The conducting state(s) of the channel.spec (
Species
) – The species involved in the current, must have a non zeroSpecies.valence()
.P (Union[float,
PInfo
,CompDepP
]) – A single channel permeability in m^3/s, or aPInfo
object, or aCompDepP
function that returns a permeability as a function of a complex state.computeflux (bool) – If True, then the current will result in movement of ions between compartments, if False the current will be calculated but will not correspond to a real ion flux.
virtual_oconc (float) – A ‘virtual outer concentration’ that can be specified so that the outer compartment does not have to be explicitly simulated (if it retains default None value then the outer concentration of ion must be simulated).
vshift (float) –
Each GHK current in the simulation is solved within the SSA with a rate determined from the simulation state, i.e. membrane potential, ‘outer’ and ‘inner’ concentration of the ion and temperature (which is fixed), and constant parameters ion valence and permeability. The user can supply a call to
PInfo()
instead of a permeability, STEPS will compute the corresponding permeability.A GHK current involves, optionally, a real transfer of ions between comparments separated by a membrane in the STEPS simulation. It is important that these ions implement diffusion if compartments are not well-mixed.
Usage:
with mdl: Ca = Species.Create() Ca.valence = 2 with ssys: # Constant permeability: GC_CaP = GHKCurr.Create(CaPchan[m3], Ca, CaP_P, computeflux = True) # The above line declares GHK current named OC_CaP for Ca2+ ions and for # channel CaPchan when its single subunit is in state m3. # Complex dependent permeability: P = CompDepP(lambda s: p1 + p2 * s.Count(S1A), [Chan2]) GC_Chan2 = GHKCurr.Create(Chan2[:, :, S2A], Ca, P, computeflux = True) # The above 2 lines declare GHK current for Ca2+ ions and for channel Chan2 # when its 3rd subunit is in state S2A. Thanks to the CompDepP function, # the permeability changes depending on the specific states of the other # subunits. In this case, there is a basal permeability p1 and this # permeability is increased by p2 for each subunit in state S1A.
- classmethod PInfo(g, V, T, oconc, iconc)[source]
Provide information from channel measurement instead of permeability
- Parameters
g (Union[float,
steps.API_2.nutils.Parameter
]) – A measured single-channel conductance in SiemensV (Union[float,
steps.API_2.nutils.Parameter
]) – The potential in VoltsT (Union[float,
steps.API_2.nutils.Parameter
]) – The temperature in Kelvin (may be different from the STEPS simulation temperature)oconc (Union[float,
steps.API_2.nutils.Parameter
]) – The ‘outer’ concentration of the ion in molar unitsiconc (Union[float,
steps.API_2.nutils.Parameter
]) – The ‘inner’ concentration of the ion in molar units
- Returns
An aggregate object. Does not return the permeability.
Usage:
Pinfos = GHKCurr.PInfo(g=20e-12, V=-22e-3, T=293.15, oconc=4e-3, iconc=155e-3) GC_CaP = GHKCurr.Create(CaPchan[m3], Ca, Pinfos, computeflux = True)
The actual permeability can be accessed with GC_CaP.P.value.
- property VOConc
Virtual outer concentration, in Molars
Can only be set in the with ssys: block in which the current has been declared.
- Type
Union[float,
steps.API_2.nutils.Parameter
]
- class Location(value)[source]
Bases:
Enum
The different locations that reaction elements can be in
- IN = 1
- SURF = 2
- OUT = 3
- VESSURF = 4
- RAFTSURF = 5
- In(elem)[source]
Get a version of an element located in the inside compartment
- Parameters
elem (Union[
ReactionElement
,ReactionSide
]) – The element- Returns
A version of the element located in the inside compartment
- Return type
Union[
ReactingElement
,ReactionSide
]
- Out(elem)[source]
Get a version of an element located in the outside compartment
- Parameters
elem (Union[
ReactionElement
,ReactionSide
]) – The element- Returns
A version of the element located in the outside compartment
- Return type
Union[
ReactingElement
,ReactionSide
]
- Surf(elem)[source]
Get a version of an element located on the surface patch
- Parameters
elem (Union[
ReactionElement
,ReactionSide
]) – The element- Returns
A version of the element located on the surface patch
- Return type
Union[
ReactingElement
,ReactionSide
]
- VesSurf(elem)[source]
Get a version of an element located on the surface of a vesicle
- Parameters
elem (Union[
ReactionElement
,ReactionSide
]) – The element- Returns
A version of the element located on the surface of a vesicle
- Return type
Union[
ReactingElement
,ReactionSide
]
- RaftSurf(elem)[source]
Get a version of an element located on the surface of a raft
- Parameters
elem (Union[
ReactionElement
,ReactionSide
]) – The element- Returns
A version of the element located on the surface of a raft
- Return type
Union[
ReactingElement
,ReactionSide
]
- class ReactionManager(*args, **kwargs)[source]
Bases:
Class used to instantiate reactions
A
ReactionManager
object allows to easily declare reactions by associating them to an identifier using the square bracket syntax:r = ReactionManager() # Only one ReactionManager is needed S1 + S2 >r['R01']> S3 # String identifier for permanently naming the reaction S1 + S2 >r[1]> S3 # Integer identifier for reactions that do not need explicit # naming
String identifiers are used when the reaction will need to be accessed during simulation (see
steps.API_2.sim.SimPath
for usage), they cannot be reused for different reactions. Integer identifiers are temporary identifiers and can be reused for declaring several un-named reactions:S1 + S2 >r[1]> S3 # First use of temporary identifier 1. r[1] now refers to this r[1].K = ... # reaction until a new reaction is defined with r[1]. S1 + S3 <r[1]> S4 # r[1] now refers to this new reaction. r[1].K = ...
In general, only one
ReactionManager
should be instantiated and given a short variable name (r
in all examples) for convenience. In some specific cases however, one might need several independent reaction managers so this class is not implemented as a singleton.
- class ReactionElement(*args, **kwargs)[source]
Bases:
NamedObject
Base class for objects that can be included in a reaction
Can be combined to other
ReactionElement
with the+
operator to form aReactionSide
.- __add__(other)[source]
Add two elements and form a reaction side
- Parameters
other (
ReactionElement
) – The other element- Returns
A reaction side containing itself and the other element it was added to.
- Return type
Usage:
... S1 + S2 <r[1]> ... S1 + 2*S2 <r[2]> ... S1 + (S2 + S3) <r[3]> ... ...
- __rmul__(stoich)[source]
Specify a stoichiometric coefficient
- Parameters
stoich (int) – The stoichimetric coefficient
- Returns
A reacting element object that uses stoich as a stoichiometric coefficient.
- Return type
Usage:
... 2*S1 <r[1]> ... # Equivalent to: S1 + S1 <r[1]> ... ...
- property i
Get a version of the element located in the inside compartment
Shorthand for
In()
.- Type
ReactingElement
, read-only
- property o
Get a version of the element located in the outside compartment
Shorthand for
Out()
.- Type
ReactingElement
, read-only
- property s
Get a version of the element located on the surface patch
Shorthand for
Surf()
.- Type
ReactingElement
, read-only
- property v
Get a version of the element located on the surface of a vesicle
Shorthand for
VesSurf()
.- Type
ReactingElement
, read-only
- property r
Get a version of the element located on the surface of a raft
Shorthand for
RaftSurf()
.- Type
ReactingElement
, read-only
- class ReactingElement(elem, stoich, loc=None, *args, **kwargs)[source]
Bases:
ReactionElement
A reaction element with a stoichiometric coefficient and a location
All elements in a
ReactionSide
areReactingElement
. WhileReactionElement
is the base class for all objects that could be included in a reaction,ReactingElement
is a wrapper that is actually included in reactions. It contains additional information about stoichiometry and location of the element.Note
This class should not be instantiated by the user, it is only documented for clarity.
- class ReactionSide(elems, *args, **kwargs)[source]
Bases:
Unordered collection of reactants
Represents one of the sides of a reaction. Reactants can be added with +. Reactants are unordered.
Note
This class should not be instantiated by the user, it is only documented for clarity.
- __add__(other)[source]
Get the reaction side resulting from the addition of other to self
- Parameters
other (Union[
ReactionElement
,ReactionSide
]) – The object to be added to the reaction side- Returns
The reaction side resulting from the addition of other to self
- Return type
- class SubUnit(subStates, *args, **kwargs)[source]
Bases:
NamedObject
Class for representing complex subunits
- Parameters
subStates (List[
SubUnitState
]) – List of states in which the subunit can be.
Does not necessarily represent a biological subunit, it can be used to group substates of a complex. For example, if a complex can bind to species, it could have a binding
SubUnit
withSubUnitState
representing the species being bound.A
SubUnit
can only be asscoiated to a singleComplex
.- __iter__()[source]
Iterator over all the possible states of the subunit.
- Returns
An iterator that iterates over all
SubUnitState
in the subunit state. The order is the same as the one defined during the creation of the subunit.- Return type
Iterator[
SubUnitState
]
Usage:
>>> su = SubUnit.Create([h0, h1]) >>> for subState in su: ... print(subState.name) ... h0 h1
- class SubUnitState(*args, **kwargs)[source]
Bases:
ReactionElement
State of a
SubUnit
Can take part in reactions (see
Complex
) and be combined with|
and~
to form aSubUnitSelector
.In reactions, further information can be provided with the square bracket operator, see
SubUnitState.__getitem__()
.A
SubUnitState
can only be associated to a singleSubUnit
.Warning
When used in reactions in conjunction with the | operator, the expression must be wrapped in parentheses to avoid incorrect operator precedence.
- __or__(other)[source]
Get the union between two
SubUnitState
- Parameters
other (Union[
SubUnitState
,SubUnitSelector
]) – The other state(s)- Returns
An object representing the union between the current state and the state(s) from ‘other’.
- Return type
Usage:
(S1A | S1B) # It can also be chained (S1A | S1B | S1C)
If the associated
SubUnit
was defined withS1A
,S1B
, andS1C
as states,(S1A | S1B | S1C)
is equivalent to:
(all SubUnitStates).Warning
Do not forget to wrap the overall expression in parentheses in order to avoid issues with operator precedence when used in reaction declaration.
- __invert__()[source]
Get all
SubUnitState
except itself- Returns
An object representing all states of the associated
SubUnit
except itself- Return type
Usage:
~S1A # All subunits except S1A
If the associated
SubUnit
was defined withS1A
,S1B
, andS1C
as states,~S1A
is equivalent to(S1B | S1C)
- __getitem__(key)[source]
Specify additional information
Transform the subunit state into a
SubUnitSelector
that only selects the current state, and call__getitem__
on it. SeeSubUnitSelector.__getitem__()
for details.
- class SubUnitSelector(su, states, *args, **kwargs)[source]
Bases:
ReactionElement
Set of
SubUnitState
associated to aSubUnit
Represents a selection among the states of a
SubUnit
.Note
Should not be instantiated by a user, the class is only documented for clarity.
- __getitem__(key)[source]
Specify additional information
- Parameters
key (Union[int, str,
ComplexSelector
]) – The information(s) (it is possible to provide several within the same square brackets)- Returns
The subunit selector, annotated with the information
- Return type
This method allows the usage of square brackets notation for providing the following additional informations:
Position of the associated
SubUnit
in the complex:with Comp[...]: # Ca binds to the first subunit (index 0) when in state S1A S1A[0] + Ca <r[1]> S1B[0]
Association with a specific complex within a reaction:
with Comp[...] as C1, Comp[...] as C2: # Two instances of Comp react, S1A in the first one is modified into S1B # while S1B in the second is modified to S1C. S1A[C1] + S1B[C2] <r[1]> S1B[C1] + S1C[C2]
Custom identifier (useful when a reaction is ambiguous):
with Comp[...]: # A subunit in state S1A reacts with another subunit is state S1B. Since # both states are associated to the same subunit (and this subunit is # present twice in the complex), the following reaction could be read in # two different ways: # S1A + S1B >r[1]> S1B + S1C # We could have (S1A, S1B) -> (S1B, S1C) or (S1A, S1B) -> (S1C, S1B). In # the first case both subunit changed while in the second, only the first # one changed. Custom identifiers allow us to specify this reaction # without ambiguities: S1A['a'] + S1B['b'] >r[1]> S1B['a'] + S1C['b']
Note that it is possible to provide several information at the same time. For example:
with Comp[...] as C1, Comp[...] as C2: # Two instances of Comp react, in the first one (S1A, S1B) -> (S1B, S1C) while # in the second one S1B -> S1A S1A[C1, 'a'] + S1B[C1, 'b'] + S1B[C2] >r[1]> S1B[C1, 'a'] + S1C[C1, 'b'] + S1A[C2]
- __or__(other)[source]
Get the union between the states of two
SubUnitSelector
- Parameters
other (Union[
SubUnitState
,SubUnitSelector
]) – The other subunit selector, has to be associated to the sameSubUnit
. Can also be a singleSubUnitState
.- Returns
A subunit selector representing the union between the current selector states and the state(s) from ‘other’.
- Return type
See
SubUnitState.__or__
for usage examples.Warning
Do not forget to wrap the overall expression in parentheses in order to avoid issues with operator precedence when used in reaction declaration.
- __and__(other)[source]
Get the intersection between the states of two
SubUnitSelector
- Parameters
other (Union[
SubUnitState
,SubUnitSelector
]) – The other subunit selector, has to be associated to the sameSubUnit
. Can also be a singleSubUnitState
.- Returns
A subunit selector representing the intersection between the current selector states and the state(s) from ‘other’.
- Return type
Usage:
AorB = S1A | S1B BorC = S1B | S1C (AorB & BorC) # Equivalent to S1B (AorB & (~S1A) & (~S1C)) # Equivalent to S1B
If the intersection is empty, it returns an empty
SubUnitSelector
which might raise exceptions if later used in a reaction declaration.Warning
Do not forget to wrap the overall expression in parentheses in order to avoid issues with operator precedence when used in reaction declaration.
- __invert__()[source]
Get all
SubUnitState
except the ones in self- Returns
An object representing all states of the associated
SubUnit
minus the ones present in self- Return type
Usage:
~(S1A | S1C) # All subunits except S1A and S1C
If the associated
SubUnit
was defined withS1A
,S1B
, andS1C
as states,~(S1A | S1C)
is equivalent toS1B
- __contains__(sus)[source]
Test whether a subunit state is present in the subunit selector
- Parameters
sus (
SubUnitState
) – The subunit state- Returns
True if the given subunit state is in the current selector, False otherwise.
- Return type
Usage:
>>> AorB = S1A | S1B >>> S1A in AorB True >>> S1C in AorB False
- class ComplexState(comp, state, *args, **kwargs)[source]
Bases:
ReactionElement
Fully specified state of a complex
Can be used in the same way as a
ReactionElement
.Note
A
ComplexState
object should not be directly instantiated by the user, instead it is obtained by using the square bracket notation on aComplex
object:Comp[S1B, S1B, S2A] # Returns the complex state for which the two S1 subunits are # in state S1B and the S2 subunit is in state S2A.
See
Complex.__getitem__()
for details.- Count(sus)[source]
Count the number of subunits that match a given subunit selector
- Parameters
sus (Union[
SubUnitSelector
,SubUnitState
]) – A subunit state or a subunit selector- Returns
The number of subunits in the complex state that match
sus
.- Return type
Usage:
>>> state = Comp[S1A, S1B, S2A] >>> state.Count(S1B) 1 >>> state.Count(S1C) 0 >>> state.Count(S1A | S1B) 2
- __iter__()[source]
Iterator over all the subunit states of the complex state.
- Returns
An iterator that iterates over all
SubUnitState
in the complex state. The order is the same as the one defined during the creation of the associatedComplex
.- Return type
Iterator[
SubUnitState
]
Usage:
>>> state = Comp[S1A, S1B, S2A] >>> for subState in state: ... print(subState.name) ... S1A S1B S2A
- __or__(other)[source]
Get a complex selector representing the union between the states of self and other
- Parameters
other (Union[
ComplexState
,ComplexSelector
]) – The other complex state(s), has to be associated to the sameComplex
.- Returns
An object representing the union between the current state and the complex state(s) from ‘other’.
- Return type
Usage:
Comp[S1A, S1A, S2A] | Comp[S1B, S1B, S2A] # Represents only these two states # Note that Comp[S1A | S1B, S1A | S1B, S2A] is equivalent to more than two states Comp[S1A, S1A, S2A] | Comp[S1A, S1B, S2A] | Comp[S1B, S1B, S2A] # If the custom order of the complex (See :py:class:`Complex`) is set to # StrongOrdering, it is equivalent to 4 states: Comp[S1A, S1A, S2A] | Comp[S1A, S1B, S2A] | Comp[S1B, S1A, S2A] | Comp[S1B, S1B, S2A]
Warning
Do not forget to wrap the overall expression in parentheses in order to avoid issues with operator precedence when used in reaction declaration.
- class ComplexSelector(comp, subSels, *args, **kwargs)[source]
Bases:
ReactionElement
,NamedObject
Partially specified state of a complex
Can be used in the same way as a
ReactionElement
.Note
A
ComplexSelector
object should not be directly instantiated by the user, instead it is obtained by using the square bracket notation on aComplex
object in a way that does not fully specify the whole state:Comp[S1B, S1B, :] # Returns the complex state for which the two S1 subunits are # in state S1B and the S2 subunit is in any state.
See
Complex.__getitem__()
for details.- __or__(other)[source]
Get a complex selector representing the union between the states of self and other
- Parameters
other (Union[
ComplexSelector
,ComplexState
]) – The other complex state(s), has to be associated to the sameComplex
.- Returns
A complex selector representing the union between the states in the current selector and the state(s) from ‘other’.
- Return type
- Usage:
States that have the first two subunits as
S1A
or the first asS1A
and third asS2A
:Comp[S1A, S1A, :] | Comp[S1A, :, S2A]
Beware, the above expression is NOT equivalent to
Comp[S1A, :, :]
:>>> for state in (Comp[S1A, S1A, :] | Comp[S1A, :, S2A]): ... print(state.name) ... Comp_S1A_S1A_S2A Comp_S1A_S1A_S2B Comp_S1A_S1B_S2A Comp_S1A_S1C_S2A >>> for state in Comp[S1A, :, :]: ... print(state.name) ... Comp_S1A_S1A_S2A Comp_S1A_S1A_S2B Comp_S1A_S1B_S2A Comp_S1A_S1B_S2B Comp_S1A_S1C_S2A Comp_S1A_S1C_S2B
In general, an OR operation between two
ComplexSelector
is NOT equivalent to doing OR operations between theirSubUnitSelector
.
Warning
Do not forget to wrap the overall expression in parentheses in order to avoid issues with operator precedence when used in reaction declaration.
- __and__(other)[source]
Get a complex selector representing the intersection between the states of self and other
- Parameters
other (Union[
ComplexSelector
,ComplexState
]) – The other complex state(s), has to be associated to the sameComplex
.- Returns
A complex selector representing the intersection between the states in the current selector and the state(s) from ‘other’.
- Return type
- Usage:
States that have the first two subunits as
S1A
and the first asS1A
and third asS2A
:Comp[S1A, S1A, :] & Comp[S1A, :, S2A]
The above expression corresponds to only one state:
Comp[S1A, S1A, S2A]
. Note that, in constrast to__or__()
, this does correspond to a series of AND operations between theSubUnitSelector
.
If the intersection is empty, it returns an empty
ComplexSelector
which might raise exceptions if later used in a reaction declaration.Warning
Do not forget to wrap the overall expression in parentheses in order to avoid issues with operator precedence when used in reaction declaration.
- __lshift__(subSels)[source]
Get a complex selector representing the insertion of one or several subunit selector(s).
This operator is mainly used with complexes that have a
StrongOrdering()
, meaning that subunits have specific positions. With this ordering,Comp[S1A, S1B, S2A]
is not the same asComp[S1B, S1A, S2A]
(the order of the first two subunits was changed).Since, with this order function, the specific positions of the subunits matter, it would be cumbersome to write
Comp[S1A, :, :] | Comp[:, S1A, :]
to express “a SU1 subunit is in state S1A, in any position”. And it would become harder and harder as the number of identical subunits grows. The<<
operator helps expressing this type of selectors.- Parameters
subSels (Union[
SubUnitState
,SubUnitSelector
,ReactionSide
]) – One or several subunit states or selectors. If several, they should be provided in the form of aReactionSide
(S1A + S1B
for example).- Returns
A complex selector to which subunit selectors present in subSels were added in all possible positions.
- Return type
Assuming we have a complex that has 3 identical subunits, declared like so:
with mdl: S3A, S3B = SubUnitState.Create() S3U = SubUnit.Create([S3A, S3B]) Comp2 = Complex([S3U, S3U, S3U], order=StrongOrdering, statesAsSpecies=True)
Usage of the
<<
operator:(Comp2[...] << S3A) # Equivalent to: # (Comp2[S3A, : , : ] | # Comp2[ : , S3A, : ] | # Comp2[ : , : , S3A]) (Comp2[...] << S3A + S3B) # Equivalent to: # (Comp2[S3A, S3B, : ] | # Comp2[S3A, : , S3B] | # Comp2[S3B, S3A, : ] | # Comp2[ : , S3A, S3B] | # Comp2[S3B, : , S3A] | # Comp2[ : , S3B, S3A])
Warning
Do not forget to wrap the overall expression in parentheses in order to avoid issues with operator precedence when used in reaction declaration.
- __iter__()[source]
Iterator over all the possible states of the complex selector.
- Returns
An iterator that iterates over all unique (as defined by the custom ordering)
ComplexState
of the complex selector.- Return type
Iterator[
ComplexState
]
Usage:
>>> selector = Comp[S1A, :, S2A] >>> for state in selector: ... print(state.name) ... Comp_S1A_S1A_S2A Comp_S1A_S1B_S2A Comp_S1A_S1C_S2A
- NoOrdering(state)[source]
No ordering function for complex states
- Parameters
state (Tuple[
SubUnitState
]) – A complex state, i.e. a sequence ofSubUnitState
- Returns
The equivalent unique ordering
- Return type
Tuple[
SubUnitState
]
Take a tuple of
SubUnitState
as input and return the unique equivalent based on the type of ordering chosen.NoOrdering considers that the subunits have no physical position, a state is just a set of SubUnitStates.
- StrongOrdering(state)[source]
Strong ordering function for complex states
- Parameters
state (Tuple[
SubUnitState
]) – A complex state, i.e. a sequence ofSubUnitState
- Returns
The equivalent unique ordering
- Return type
Tuple[
SubUnitState
]
Take a tuple of
SubUnitState
as input and return the unique equivalent based on the type of ordering chosen.StrongOrdering corresponds to no symmetry in the complex.
- RotationalSymmetryOrdering(state)[source]
Rotational symmetry ordering function for complex states
- Parameters
state (Tuple[
SubUnitState
]) – A complex state, i.e. a sequence ofSubUnitState
- Returns
The equivalent unique ordering
- Return type
Tuple[
SubUnitState
]
Take a tuple of
SubUnitState
as input and return the unique equivalent based on the type of ordering chosen.RotationalSymmetryOrdering represents central symmetry: state [a,b,c] is equivalent to [b,c,a] and [c,a,b].
- class XDepFunc(func, *args, **kwargs)[source]
Bases:
NamedObject
Base class for functions depending on some simulation or object state
This is a wrapper around a function that adds some functionalities.
- Parameters
func (Callable[[Any, ...], Number]) – lambda function or standard function. There is not support for variable named arguments (**kwargs).
- property func
Access the function itself
- Type
Callable, read-only
- class VDepFunc(func, vrange=None, *args, **kwargs)[source]
Bases:
XDepFunc
Hold a function and a voltage range for computing e.g. voltage-dependent reaction rates
For efficiency reasons, the values of these functions are pre-computed for specific voltage values (by default between -150mV and 100mV with a 0.1mV step) and these values might be changed by providing the optional
vrange
parameter.- Parameters
func (Callable[[float], Number]) – lambda function or standard function that takes a membrane potential (in Volts) as parameter and returns a single numerical value.
vrange (Tuple[float, float, float]) – Voltage range at which the function should be computed. Should be a 3-tuple in the form
(min_voltage, max_voltage, step_voltage)
, all expressed in Volts.
See
VDepRate
for an example.
- class CompDepFunc(func, compsOrCompSels, *args, **kwargs)[source]
Bases:
XDepFunc
Hold a function that depends on the fully specified state of a complex
- Parameters
func (Callable[[
ComplexState
, …], Number]) – lambda function or standard function that takes one or several fully specified state(s) of complex(es) as parameter and returns a single numerical value.compsOrCompSels (List[Union[
Complex
,ComplexSelector
]]) – A list of complexes or complex selectors in the same order as they should be provided to the wrapped function.
See
CompDepRate
for an example.
- class VDepRate(func, vrange=None, *args, **kwargs)[source]
Bases:
VDepFunc
Voltage dependent reaction rate
See base class
VDepFunc
for how to create.Usage:
with CaPchan[...]: # VDepRate declaration # alpha_cap and beta_cap are normal functions taking the membrane potential in Volts # as parameter and returning the corresponding rate. # with custom voltage range: a_cap = VDepRate(alpha_cap, vrange = [-100.0e-3, 50e-3, 1e-4]) # with default voltage range b_cap = VDepRate(beta_cap) m0.s <r[1]> m1.s <r[2]> m2.s <r[3]> m3.s r[1].K = 3 * a_cap, 1 * b_cap r[2].K = 2 * a_cap, 2 * b_cap r[3].K = 1 * a_cap, 3 * b_cap # The transitions from m0 to m3 have rates that are multiples of a_cap and b_cap # it is thus easier to first define these two VDepRate functions and reuse them # when declaring reactions.
- class CompDepRate(func, compsOrCompSels, *args, **kwargs)[source]
Bases:
CompDepFunc
Complex state dependent reaction rate
See base class
CompDepFunc
for how to create.Usage:
with Comp[...]: S1A >r[1]> S1B rate = CompDepRate(lambda s: k1 + k2 * s.Count(S1B), [Comp]) r[1].K = rate # The above reaction specifies that the subunit state S1A changes to S1B with # a basal rate of k1 and this rate is increased by k2 for each subunit in the complex # being in state S1B. with Comp1[...] as C1, Comp2[...] as C2: S1A[C1] + S3A[C2] >r[1]> S1B[C1] + S3B[C2] rate = CompDepRate(lambda s1, s2: k3 + k4 * s1.Count(S2A) * s2.Count(S4A), [C1, C2]) r[1].K = rate # The above reaction takes place between a subunit of Comp1 in state S1A and a # subunit of Comp2 in state S3A. It takes place with a basal rate k3 and this rate # is increased by a value that depends on the number of subunits in state S2A in # Comp1 and the number of subunits in state S4A in Comp2.
- class CompDepCond(func, compsOrCompSels, *args, **kwargs)[source]
Bases:
CompDepFunc
Complex state dependent conductance
See base class
CompDepFunc
for how to create.
- class CompDepP(func, compsOrCompSels, *args, **kwargs)[source]
Bases:
CompDepFunc
Complex state dependent permeability
See base class
CompDepFunc
for how to create.
- class CompDepDcst(func, compsOrCompSels, *args, **kwargs)[source]
Bases:
CompDepFunc
Complex state dependent diffusion constant
See base class
CompDepFunc
for how to create.