Regulation

All currently implemented gene regulation models assume (discrete-space) pure jump process dynamics and (only) allow stochastically realizing concrete trajectories. For this purpose, they are first instantiated as Models.SciML.JumpModels containing Catalyst.ReactionSystems that are assembled according to various kinds of model definitions. This compilation process proceeds in multiple stages that recursively translate higher- to lower-level definitions, and each stage wraps its result in a Wrapped model along with its (intermediate) definition.

While most of this package assumes a dynamics interpretation in terms of jump processes and discrete counts, when the package is used as a library, the intermediate definitions are accessible (including the underlying Catalyst.ReactionSystem and JumpProcesses.JumpSystem). It is therefore possible, for example, to use these objects for static analysis with other SciML tooling or to simulate trajectories from an ODE relaxation. Given any Wrapped model object, its definition property holds just that, and accessing the model property peels off one layer. For example, given a JSON model specification

d = """
    {"{regulation/kronecker}": {
        "seed": "seed",
        "base_rates": {"\$": ["defaults", "gene", "base_rates"]},
        "activation": {
            "adjacency": {
                "initiator": [[0.7, 0.6], [0.4, 0.2]],
                "power": 3
            },
            "at": ["LogNormal", 2.0, 1.0]
        },
        "repression": {
            "adjacency": {
                "initiator": [
                    [0.7, 0.6],
                    [0.5, 0.2]
                ],
                "power": 3
            },
            "at": ["LogNormal", 2.0, 1.0]
        }
    }}
"""

nothing

we have:

julia> model = Models.parse(d);

julia> model isa Models.Wrapped
true

julia> typeof(model.definition)
GeneRegulatorySystems.Models.KroneckerNetworks.Definition

julia> typeof(model.model.definition)
GeneRegulatorySystems.Models.V1.Definition

julia> typeof(model.model.model.definition)
Catalyst.ReactionSystem{Catalyst.NetworkProperties{Int64, SymbolicUtils.BasicSymbolic{Real}}}

julia> typeof(model.model.model.model)
GeneRegulatorySystems.Models.SciML.JumpModel

julia> typeof(model.model.model.model.system)
ModelingToolkit.JumpSystem{RecursiveArrayTools.ArrayPartition{Any, Tuple{Vector{JumpProcesses.MassActionJump}, Vector{JumpProcesses.ConstantRateJump}, Vector{JumpProcesses.VariableRateJump}, Vector{Symbolics.Equation}}}}

Higher-order model blueprints such Differentiation are expressed in terms of a common first-iteration model of simplified gene regulation defined in the Models.V1 module. Some of these models (named "templates", currently Kronecker-linked networks and Random differentiation) are stochastic and only become concerete model definitions (i.e., their structure deterministic) by affixing a seed.

V1 model

GeneRegulatorySystems.Models.V1Module

Contains components to build SciML.JumpModels for gene regulation.

These models can be constructed by build, either directly (from a Definition or from the corresponding JSON specification), or indirectly from a model template such as KroneckerNetworks.Definition or Differentiation.Definition via their respective build functions.

The regulation models require setting up the initial state to include required molecular species (polymerases, ribosomes and proteasomes) before they can be invoked. If a model is specified as part of a Schedule and therefore the defaults are available, this can be achieved by prefixing the model specification with an Instant adjustment step such as:

{"{add}": {"$": ["defaults", "bootstrap"]}}

See examples/specification/simple.schedule.json for an example.

source
GeneRegulatorySystems.Models.V1.buildFunction
build(specification::AbstractDict{Symbol})
build(definition::Definition; method::Symbol = :default)

Construct a SciML.JumpModel from a Definition.

When interpreting a JSON specification, this function (in its first form) is called to construct a concrete regulation model on encountering a {"{regulation/v1}": {...}} literal. It will first destructure the parsed JSON into a Definition and then proceed from there.

This function is also called (directly in its second form) when lowering a higher-level model template (such as Models.Differentiation).

The result is constructed by first assembling a Catalyst.ReactionSystem as specified by definition, interpreting it as a JumpProcesses.JumpSystem, packaging that up as a JumpModel, wrapping that up with the ReactionSystem in a Models.Wrapped, and finally further wrapping that in another Wrapped with definition. This will result in the following stack of abstractions:

The method to use for the JumpModel can be set in specification[:method] or passed as a keyword argument. By default, a method will automatically be chosen based on the size of the ReactionSystem: SortingDirect for small systems (having less than 100 species and less than 1000 reactions), and RSSACR otherwise.

Specification

V1 models are specified in JSON as {"{regulation/v1}": <definition>} where <definition> specifies a Definition as described there.

For an example, see examples/specification/simple.schedule.json.

source
GeneRegulatorySystems.Models.V1.DefinitionType
Definition

Defines how to construct a JumpModel with transcriptionally and proteolytically inter-regulated genes, and optionally additional reactions with independent rates constants.

A Definition can be constructed directly or parsed from a JSON specification, for example as part of a Schedule execution. It contains instructions for build to assemble a concrete Catalyst.ReactionSystem and embed it into a resulting JumpModel, which will interpret the contained reactions as constituting a mass-action jump process.

Specification

In JSON, a V1 Definition is specified as a JSON object

{
    "genes": [<gene>...],
    "reactions": [<Models.Reaction>...],
    "polymerases": <polymerases>,
    "ribosomes": <ribosomes>,
    "proteasomes": <proteasomes>
}}

where [<gene>...] is a JSON array of Gene specifications, [<reaction>...] is a JSON array of Models.Reactions, and <polymerases>, <ribosomes> and <proteasomes> are JSON strings specifying the names the species taking that function in the resulting model. All of these mappings are optional, with the following defaults:

  • [<gene>...]: []
  • [<reaction>...]: []
  • <polymerases>: "polymerases"
  • <ribosomes>: "ribosomes"
  • <proteasomes>: "proteasomes"

However, at least one gene or at least one reaction must be specified so that the system is not empty.

source
GeneRegulatorySystems.Models.V1.GeneType
Gene{BaseRates}

Defines a single gene within a V1 Definition, including the reaction rate constants of its reaction cascade, and optionally inbound regulation and other information.

Specification

In JSON, a V1 Gene is specified as a JSON object

{
    "name": <name>,
    "base_rates": <base_rates>,
    "unique": <unique>,
    "activation": <activation>,
    "repression": <repression>,
    "proteolysis": <proteolysis>
}

where only <base_rates> is required and the other mappings are optional.

If present, <name> must be a JSON string, otherwise it will be set automatically to the gene's index. (All-digits names are therefore reserved and should not be specified.) The gene can then be referred to by name in other Gene specifications as a transcription factor (see below) or in additional mass-action reactions.

<base_rates> specifies either ProkaryoteBaseRates or EukaryoteBaseRates, depending on which build will instantiate a corresponding reaction cascade for this Gene. The cascade will include the following reactions:

@reaction_network begin
    trigger, active + $polymerases --> active + elongations
    transcription, elongations --> premrnas + $polymerases
    processing, premrnas --> mrnas
    translation, mrnas + $ribosomes --> mrnas + proteins + $ribosomes
    abortion, elongations --> $polymerases
    premrna_decay, premrnas --> 0
    mrna_decay, mrnas --> 0
    protein_decay, proteins + $proteasomes --> $proteasomes
end

Here, polymerases, ribosomes and proteasomes are chemical species that will be shared by all genes. build will then add reactions for the inter-gene regulation network, in which the activation and deactivation base rates will be respectively tempered by repression and activation links as defined below. For prokaryotic genes, the processing and premrna_decay reactions will be omitted, and transcription will directly produce mrnas instead.

If present, <unique> must be a JSON boolean, otherwise it defaults to true. Setting it to false makes the promoter's copy number a dynamic quantity (starting at 0) instead of the constant 1 – see also examples/specification/copies.schedule.json.

In the constructed model, genes' promoters dynamically change their configuration (between active and inactive) depending on the base activation and deactivation rates as well as potentially on the presence of transcription factors (although only active is actually tracked if <unique> is true).

If present, <activation> must specify inbound transcriptional regulation by Activation.

If present, <repression> must specify inbound transcriptional regulation by Repression.

Transcriptionally regulating links correspond to abstract promoter binding sites for the regulated gene. They are defined by the choice of transcription factor (from, typically another gene's protein) and a binding affinity parameter at. The binding and unbinding is assumed to occur on a fast time scale and therefore to always be in quasi-steady state, and at specifies the amount of from at which the promoter is bound half of the time. build synthesizes Catalyst.Reactions for promoter activation and deactivation, and their respective reaction rates are tempered from the specified activation and deactivation base rates by the fractional binding of the transcription factor.

If multiple transcriptionally regulating links of the same type are specified for this Gene, in V1, they are simply aggregated as chosen in <activation> and <repression>.

If present, <proteolysis> must specify inbound regulation by Proteolysis.

source
GeneRegulatorySystems.Models.V1.EukaryoteBaseRatesType
EukaryoteBaseRates

Defines a eukaryotic Gene reaction cascade's base rates.

Specification

They are specified in JSON as a JSON object

{
    "activation": <...>,
    "deactivation": <...>,
    "trigger": <...>,
    "transcription": <...>,
    "processing": <...>,
    "translation": <...>,
    "abortion": <...>,
    "premrna_decay": <...>,
    "mrna_decay": <...>,
    "protein_decay": <...>
}

where <...> are JSON numbers setting the corresponding reaction rate constants.

source
GeneRegulatorySystems.Models.V1.ProkaryoteBaseRatesType
ProkaryoteBaseRates

Defines a prokaryotic Gene reaction cascade's base rates.

Specification

They are specified in JSON as a JSON object

{
    "activation": <...>,
    "deactivation": <...>,
    "trigger": <...>,
    "transcription": <...>,
    "translation": <...>,
    "abortion": <...>,
    "mrna_decay": <...>,
    "protein_decay": <...>
}

where <...> are JSON numbers setting the corresponding reaction rate constants.

source
GeneRegulatorySystems.Models.V1.ActivationType
Activation <: Regulation

Defines how a Gene should be transcriptionally regulated by tempering its deactivation rate.

For details, see Gene.

Specification

In JSON, a V1 Activation is specified by either one of:

  • A JSON array of slots [<slot>...], each <slot> a JSON object {"from": <from>, "at": <at>} specifying a single inbound transcriptional regulation link. <from> is a JSON string referring to the regulating chemical species (potenially containing . separators), or if it names a gene, that gene's proteins. <at> is a JSON number specifying the number of <from> molecules where the link is at half-saturation (assuming quasi-steady state). If more than one slot is specified, default aggregation will apply (see below).
  • A JSON object {"slots": [<slot>...], "aggregation": <aggregation>} where <aggregation> is a JSON string specifying how to aggregate inbound regulatory links if more than one of them is present by type – one of the following:
    • "neutral"
    • "minimum" (default)
    • "maximum"
    • "mean"
    • "geometric_mean"
    • "harmonic_mean"
    • "generalized_mean"
    If "aggregation" is set to "generalized_mean", "p" may additionally set to a numeric value to control the generalized mean parameter. It is set to 0.0 by default, corresponding to a geometric mean. The defaults for "aggregation" and "p" may be overridden by specifying them in "activation" or "repression" JSON objects at the Definition level; see also examples/specification/aggregations.schedule.json.
source
GeneRegulatorySystems.Models.V1.ProteolysisType
Proteolysis <: Regulation

Defines how a Gene should be proteolytically regulated.

For each inbound link, build synthesizes a reaction of the form @reaction k, proteases + proteins --> proteases.

(This is in addition to the degradation @reaction protein_decay, proteasomes + proteins --> proteasomes that is implicitly defined for each gene.)

Specification

In JSON, a V1 Proteolysis is specified by a JSON array of slots [<slot>...], each <slot> a JSON object {"from": <from>, "k": <k>} specifying a single inbound proteolytical repression link. <from> is a JSON string referring to the protease chemical species (potenially containing . separators), or if it names a gene, that gene's proteins. <k> is a JSON number specifying the decay reaction propensity.

source
GeneRegulatorySystems.Models.ReactionType
Reaction

Defines a constant-rate reaction pair between two sets of Reagentss as part of a model.

Specification

In JSON, a Reaction is specified as a JSON object

{
    "from": <from>,
    "to": <to>,
    "rates": [<forward>, <reverse>]
}

where <from> and <to> each specify Reagents defining the (integer) stoichiometries respectively for the reactants and products (of the forward reaction), and <forward> and <reverse> must be JSON numbers defining the corresponding rate constants.

For example,

{"from": ["A", "B.mrnas"], "rates": [0.00001, 0.00002], "to": ["AB"]}

will define the Catalyst.jl

@reaction (0.00001, 0.00002), A + B <--> AB

e.g. to be added to a JumpModel.

As a convenience, "rates": [<forward>, <reverse>] may alternatively by written as "rate": <forward>, setting <reverse> to zero.

source
GeneRegulatorySystems.Models.ReagentsType
Reagents

Defines (integer) stoichiometries for a set of chemical species.

This is used to define reagents on either side of a Reaction.

Specification

In JSON, Reagents are specified as a JSON object mapping species names to (integer JSON number) stoichiometric coefficients. Names may contain . separators to refer to species of a subsystem (such as a gene).

As a shortcut, Reagents may alternatively be specified as a JSON Array of such species names. Repeated entries will increment the corresponding stoichiometric coefficient.

source

Kronecker-linked networks

GeneRegulatorySystems.Models.KroneckerNetworksModule

Contains components to build random Models.V1-based SciML.JumpModels for gene regulation with an SKG-linked network.

These models can be constructed by build from a Definition or from the corresponding JSON specification. The link structure is sampled from a stochastic Kronecker graph ("SKG") network model, and link types and parameters are sampled independently for each link.

source
GeneRegulatorySystems.Models.KroneckerNetworks.buildFunction
build(specification::AbstractDict{Symbol})
build(definition::Definition; method::Symbol = :default)

Construct a SciML.JumpModel from a Definition.

When interpreting a JSON specification, this function (in its first form) is called to construct a concrete regulation model on encountering a {"{regulation/kronecker}": {...}} literal. It will first destructure the parsed JSON into a Definition and then proceed from there.

The result is constructed by first making a concrete V1.Definition from definition.template to obtain the corresponding Model and then wrapping that up in a Models.Wrapped with definition. This will result in the following stack of abstractions:

Specification

Kronecker-linked networks are specified in JSON as {"{regulation/kronecker}": <definition>} where <definition> specifies a Definition as described there.

For an example, see examples/specification/kronecker.schedule.json.

source
GeneRegulatorySystems.Models.KroneckerNetworks.TemplateType
Template

Defines how to sample a V1.Definition from given base rate and regulation network templates.

build uses these definitions to generate genes independently according to the specified base rate distribution and then adds links for the activation, repression and proteolysis regulatory networks. The existence of those links is determined by a stochastic Kronecker graph, and their parameters are chosen independently according to the specified distributions.

Specification

In JSON, a KroneckerNetworks.Template is specified as a JSON object

{
    "base_rates": <base_rates>,
    "activation": <activation>,
    "repression": <repression>,
    "proteolysis": <proteolysis>
}

where only <base_rates> is required and the other mappings are optional.

These define the priors that build uses to pick the generated genes' base rates as well as the existence and parameters of inter-gene regulatory links. The regulatory networks for activation, repression and proteolysis are specified separately, and build will implicitly overlay them.

<base_rates> specifies a BaseRatesTemplate.

If present, <activation> must specify a ActivationNetworkTemplate.

If present, <repression> must specify a RepressionNetworkTemplate.

If present, <proteolysis> must specify a ProteolysisNetworkTemplate.

(Note that the JSON object specifying the Template will typically also contain a "seed" mapping if it is specified as part of a KroneckerNetworks.Definition.)

source
GeneRegulatorySystems.Models.Sampling.BaseRatesTemplateType
BaseRatesTemplate

Defines how to sample a V1.EukaryoteBaseRates.

Base rates are sampled independently for each kind of rate.

Specification

In JSON, a BaseRatesTemplate is specified as a JSON object

{
    "activation": <...>,
    "deactivation": <...>,
    "trigger": <...>,
    "transcription": <...>,
    "processing": <...>,
    "translation": <...>,
    "abortion": <...>,
    "premrna_decay": <...>,
    "mrna_decay": <...>,
    "protein_decay": <...>
}

where each <...> specifies a Nonnegative{<:UnivariateDistribution} from which that rate should be sampled from.

source
GeneRegulatorySystems.Models.Sampling.NonnegativeType
struct Nonnegative{T <: UnivariateDistribution}

Wraps a Distributions.jl UnivariateDistribution, but requires it to have nonnegative support.

Specification

In JSON, a Nonnegative{T <: UnivariateDistribution} is specified as one of the following:

  • In the simple case, it is specified as a JSON number, which will result in a Dirac distribution parameterized by that number.
  • Otherwise, it is specified as a JSON Array [<distribution>, <parameters>...] where <distribution> is a JSON string naming a nonnegative UnivariateDistribution, and <parameters>... will be passed to its constructor. For example: ["LogNormal", 2.0, 1.0].
source
GeneRegulatorySystems.Models.KroneckerNetworks.NetworkTemplateType
NetworkTemplate

Abstract supertype of network templates.

These define how to sample a regulatory network of a specific link type, which includes both link existence and parameters. Existence is sampled from a Bernoulli distribution independently for each potential link according to a stochastic adjacency matrix of unit-range values. Link parameters are determined differently between NetworkTemplate subtypes, but the adjacency specification is equivalent.

Specification

In JSON, any <:NetworkTemplate is specified by a JSON object {"adjacency": <adjacency>, ...} with subtype-specific other mappings.

The <adjacency> must be specified in one of the following forms:

  • In the simplest case, the values are given directly. The specification must then be a JSON array of JSON arrays, each specifying a single row of the matrix. For example:
    [
        [0.7, 0.6],
        [0.4, 0.2]
    ]
  • Otherwise, <adjacency> may be a JSON array of such matrices. They will then be Kronecker-multiplied to give an expanded adjacency matrix.
  • Finally, <adjacency> may be defined as a Kronecker power. In this case, it is specified as a JSON object
    {
        "initiator": <initiator>,
        "power": <power>,
        "expected_links_per_gene": <links>
    }
    where <initiator> is a matrix specification like in the first case and <power> is a JSON (integer) number that specifies to which power the initiator should be raised by an iterated Kronecker product. This therefore specifies a stochastic Kronecker graph that shapes the regulatory network. The "expected_links_per_gene" specification is optional; if present, <links> must be a JSON number, and all entries of the final expanded adjacency matrix will then be shifted on the logit scale such that the expected total number of sampled links is equal to <links>. This can be used to control the density of the regulatory network without changing its nesting structure.
source

Differentiation

GeneRegulatorySystems.Models.DifferentiationModule

Contains components to build Models.V1-based SciML.JumpModels for gene regulation that exhibit trajectories following a predefined differentiation tree.

These models can be constructed by build from a Definition or from the corresponding JSON specification.

They include a core network controlling differentiation according to a binary tree with specified developmental timing and split ratios. For each node in the tree, the resulting model will contain a signalling gene which indicates (by high expression) that its branch was taken. In addition, an arbitrary V1 peripheral network may be specified and regulated from the core network.

The differentiation machinery requires setting up initial state (in addition to the polymerases, ribosomes and proteasomes required anyway). The required initial deposits can be triggered by first invoking an Instant bootstrap model – constructed by bootstrap – before invoking the actual regulation model.

source
GeneRegulatorySystems.Models.Differentiation.buildFunction
build(specification::AbstractDict{Symbol})
build(definition::Definition; method::Symbol = :default)

Construct a differentiating SciML.JumpModel from a Definition.

When interpreting a JSON specification, this function (in its first form) is called to construct a concrete regulation model on encountering a {"{regulation/differentiation}": {...}} literal. It will first destructure the parsed JSON into a Definition and then proceed from there.

The result is constructed by first interpreting the peripheral network specification as a V1 model and extending that by the differentiation specification, and then wrapping that up in a Models.Wrapped with the model definition. This will result in the following stack of abstractions:

Note that typically, using Differentiation models requires preparation of the system state; see bootstrap.

Specification

Differentiated models are specified in JSON as {"{regulation/differentiation}": <definition>} where <definition> specifies a Definition as described there.

For an example, see examples/specification/differentiation.schedule.json.

source
GeneRegulatorySystems.Models.Differentiation.DefinitionType
Definition

Defines how to construct a SciML.JumpModel (via V1) from a specific differentiation tree and peripheral network.

A Definition contains instructions for build to assemble a (lower-level) V1.Definition that exhibits differentiating behavior; it consists of definitions for the differentiation tree, the peripheral network to be regulated downstream, and the deposit of chemical species required initially to boostrap the system.

The differentiation is a nested structure of Transients that each represent an inner node of the tree and correspond to transient cell states during differentiation.

Specification

In JSON, a Differentiation.Definition is specificed as a JSON object specifying a V1.Definition (as described there) that is taken as the downstream peripheral network and further contains an additional mapping "differentiation": <differentiation> that defines the differentiation tree. Here, <differentiation> must specify a Transient. (The deposit definitions are collected automatically from that differentiation.) ```

source
GeneRegulatorySystems.Models.Differentiation.TransientType
Transient

Defines a module of inter-regulated genes that engineer a time-controlled bifurcation in the simulated trajectory.

Such a module consists of a differentiator gene that has higher expression whenever the corresponding transient state has been reached or surpassed, and a timer gene that controls when the trajectory should bifurcate into one of the defined downstream states. The Transient may also contain a dimerization buffer that can make timing more robust.

The (two) downstream states next and alternative can either be terminal (differentiator) genes or Transients of their own, and the target probability of moving into the next state is given by ratio.

In the current implementation, initial deposits of molecules must be made for the timer (and potentially the buffer) before the differentiation model is invoked for the assembled machinery to work properly. The timings and split proportions are calibrated for the default deposit amounts as defined in defaults.specification.json, so for now these values should always be used.

Specification

In JSON, the Definition containing a Transient (perhaps indirectly) is usually specified as part of a Schedule and therefore has "defaults" available. While many Transient properties can be set by the specification, most should typically be left at their defaults. In that simple case, the Transient is specified as a JSON object

{
    "$": ["defaults", "differentiation"],
    "duration": <duration>,
    "ratio": <ratio>,
    "next": <next>,
    "alternative": <alternative>
}

to mostly use the differentiation defaults and only override node-specific attributes. Here, <duration> must be a JSON number specifying the delay (in simulation time units) after entering this Transient when the trajectory should start bifurcating to the downstream states <next> and <alternative>, which specify either nested Transients for transient states or V1.Genes for terminal states. Optionally specifying <ratio> as a JSON number (in the unit range) changes the target probability to take the next branch from its default value of 0.5.

A special requirement applies to the initial (top-level) Transient in a Differentiation: if its differentiator represents a changing quantity in the system such a gene (with protein production and decay), the timing for that transient state will be inaccurate. The easiest way to prevent this is to set e.g. "differentiator": "differentiator" on that intial Transient to have it refer to a molecule species "differentiator", and to initially add a sufficient amount of it when the simulation state is set up anyway, for example like

{"{add}": {
    "$": ["defaults", "bootstrap"],
    "differentiator": 500
}}

in the first step of a Schedule.

In cases where the defaults are not available, or where more control is needed, the set of user-facing parameters that make up a Transient definition can be specified in more detail as a JSON object

{
    "differentiator": <differentiator>,
    "duration": <duration>,
    "timer": <timer>,
    "buffer": [<forward>, <reverse>],
    "ratio": <ratio>,
    "next": <next>,
    "alternative": <alternative>,
    "timer_deposit": <timer_deposit>,
    "buffer_deposit": <buffer_deposit>,
}

where:

  • <differentiator> specifies the V1.Gene whose increased expression should indicate that this Transient state has been reached. This may either specify the gene directly or alternatively a JSON string that names an already existing gene (e.g. in the peripheral network), which will in this case participate in the new reactions controlling the differentiation. As a special case, only for the initial (top-level) Transient in a Differentiation, <differentiator> as a JSON string may refer to an arbitrary (non-gene) molecular species to use as the upstream switch. The whole Differentiation is then enabled by the presence of this factor.
  • <duration> must be a JSON number specifying the target time to remain in the transient state as described above.
  • <timer> specifies a V1.Gene to represent the remaining time in this transient state.
  • <forward> and <reverse> must be JSON numbers specifying the reaction rates of the timer dimerization buffer. If the containing JSON array is not set or empty, timer will have no such buffer.
  • <ratio> must be a JSON number (defaulting to 0.5) defining the trajectory split proportion as described above.
  • <next> and <alternative> specify the follow-on stages that the dynamics should bifurcate into. They may either be specified as another Transient, as a V1.Gene to signify a terminal differentiator gene as described above, or as a JSON string referring to such a gene (e.g. in the peripheral network). The downstream differentiators will participate in the synthesized reactions controlling the differentiation. Unnamed differentiators will be automatically named depending on their parent differentiator, appending "0" for <next> and "1" for <alternative>.
  • <timer_deposit> must be a JSON object mapping any of "elongations", "premrnas", "mrnas" and "proteins" to JSON (integer) numbers that the bootstrap model should initialize this Transient's timer gene species to.
  • <buffer_deposit> must be a JSON (integer) number that the bootstrap model should initialize the buffer to.
source
GeneRegulatorySystems.Models.Differentiation.bootstrapFunction
bootstrap(model)

Construct an Instant model that deposits species required by the differentiation model before regulation can start.

Specification

A bootstrap model is specified in JSON by referring to the differentiation model that should be prepared for regulation. This typically means that they are both specified as part of a Schedule where the differentiation is defined in an outer scope (e.g. bound to "do") and the bootstrap model is then specified as {"{bootstrap/differentiation}": {"$": "do"}}.

For an example, see examples/specification/differentiation.schedule.json.

source

Random differentiation

GeneRegulatorySystems.Models.RandomDifferentiationModule

Contains components to build Differentiation-based SciML.JumpModels for random differentiation trees.

These models can be constructed by build from a Definition or from the corresponding JSON specification. The differentiation tree is chosen as the Huffman tree of a randomly sampled unit vector of target ratios for the terminal states, with other parameters sampled independently for each inner node. The corresponding Differentiation core network may optionally regulate a peripheral network that is constructed from a KroneckerNetworks.Definition.

Like for Differentiation, the initial state must be set up before regulation can start, which can be achieved by [Differentiation.bootstrap].

source
GeneRegulatorySystems.Models.RandomDifferentiation.buildFunction
build(specification::AbstractDict{Symbol})
build(definition::Definition; method::Symbol = :default)

Construct a randomly differentiating SciML.JumpModel from a Definition.

When interpreting a JSON specification, this function (in its first form) is called to construct a concrete regulation model on encountering a {"{regulation/random-differentiation}": {...}} literal. It will first destructure the parsed JSON into a Definition and then proceed from there.

The result is constructed by first making a concrete Differentiation.Definition from definition.template to obtain the corresponding Model and then wrapping that up in a Models.Wrapped with definition. This will result in the following stack of abstractions:

Note that typically, using Differentiation models require preparation of the system state; see Differentiation.bootstrap, which should also be used for RandomDifferentiation models.

Specification

Randomly differentiating networks are specified in JSON as {"{regulation/random-differentiation}": <definition>} where <definition> specifies a Definition as described there.

For an example, see examples/specification/random-differentiation.json.

source
GeneRegulatorySystems.Models.RandomDifferentiation.TemplateType
Template

Defines how to sample a randomly differenting model from the specified priors.

build uses these definitions to construct a differentiation tree as well as a peripheral network and its regulation by the differentiator genes. The construction is as follows:

  1. A Vector{Float64} is sampled from differentiation.ratios and normalized. It defines the target ratios (and count) of the terminal states, each of which will be represented by a signalling "differentiator" gene.
  2. The differentiators will be organized into a Huffman tree (resulting in mostly balanced split ratios in the upper level) with one Differentiation.Transient for each inner node. The other parameters are set or sampled independently according to the specifications in differentiation. This constitutes the "core" network facilitating the differentiation.
  3. Optionally, a Kronecker-linked peripheral network is sampled from peripheral.
  4. Optionally, regulation of the peripheral genes is added from the set of all differentiator genes, transient or terminal, according to the specifications in activation and repression. For each peripheral gene and both kinds, the link count is sampled from the specified prior, and then that many inbound links are placed, sampling the regulator uniformly from the set of differentiator genes (with replacement) and the regulation constants independently from the corresponding priors.
  5. The deposit instructions for the (top-level) trigger species are attached to the resulting Differentiation.Definition.

Specification

In JSON, a RandomDifferentiation.Template is specified as a JSON object

{
    "differentiation": <differentiation>,
    "peripheral": <peripheral>,
    "activation": <activation>,
    "repression": <repression>
}

where <differentiation> specifies a DifferentiationTemplate, <peripheral> specifies a KroneckerNetworks.Template and <activation> and <repression> each specify an InterRegulationTemplate respectively for transcriptional activation and repression. Only <differentiation> is mandatory, the other mappings are optional.

(Note that the JSON object specifying the Template will typically also contain a "seed" mapping if it is specified as part of a RandomDifferentiation.Definition.)

source
GeneRegulatorySystems.Models.RandomDifferentiation.DifferentiationTemplateType
DifferentiationTemplate

Defines how to sample a Differentiation.Definition from the specified priors.

Specification

In JSON, a DifferentiationTemplate is specified by a JSON object

{
    "ratios": <ratios>,
    "differentiator_base_rates": <differentiator_base_rates>,
    "timer_base_rates": <timer_base_rates>,
    "duration": <duration>,
    "trigger": <trigger>,
    "trigger_deposit": <trigger_deposit>,
    "buffer": <buffer>,
    "timer_deposit": <timer_deposit>,
    "buffer_deposit": <buffer_deposit>
}

where:

  • <ratios> specifies a multivariate distribution by a JSON array, either
    • of the form [<distribution>, <parameters>...] where <distribution> is a JSON string naming a Distributions.jl MultivariateDistribution, and <parameters>... will be passed to its constructor, for example ["Dirichlet", 6, 5.0], or otherwise
    • listing the JSON numbers to be jointly returned on sampling, that is, specifying a Product of Dirac distributions, for example [1, 2, 3, 4, 5].
    The Vector{Float64} sampled from this distribution will then define the differentiation tree and split ratios as described in Template.
  • <differentiator_base_rates> specifies the differentiator gene base rates' prior by a BaseRatesTemplate.
  • <timer_base_rates> specifies the timer genes' prior by a BaseRatesTemplate.
  • <duration> specifies created Differentiation.Transient's duration prior by a Nonnegative{UnivariateDistribution}.
  • <trigger> optionally specifies the name of the root Transient's upstream differentiator by a JSON string, defaulting to "trigger".
  • The optional mappings for <trigger_deposit>, <buffer>, <timer_deposit> and <buffer_deposit> all specify (exact) values for the respective properties shared by all the created Differentiation.Transients.
source
GeneRegulatorySystems.Models.RandomDifferentiation.InterRegulationTemplateType
InterRegulationTemplate

Defines how to sample regulatory links from the core differentiation network into the peripheral network.

The total number of links will be sampled from count, and their parameters will be sampled independently from at.

Specification

In JSON, an InterRegulationTemplate is specified by a JSON object

{
    "count": <count>,
    "at": <at>
}

where <count> specifies a Nonnegative{DiscreteUnivariateDistribution} prior for the number of inbound links independently for each peripheral gene, and <at> specifies a Nonnegative{UnivariateDistribution} prior for each link's parameter.

source