structs.jl 1.32 KB
Newer Older
1

Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
2
3
4
5
6
7
8
9
"""
Part of a measurement unit definition that corresponds to the SBML definition of `Unit`. For example, "per square megahour", Mh^(-2), is written as:

    UnitPart("second", # base unit of time
             -2, # exponent, says "per square"
             6, # scale in powers of 10, says "mega"
             1/3600) # second-to-hour multiplier
"""
10
11
12
13
14
15
16
17
struct UnitPart
    kind::String
    exponent::Int
    scale::Int
    multiplier::Float64
    UnitPart(k, e, s, m) = new(k, e, s, m)
end

Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
18
19
20
21
22
"""
Reaction with stoichiometry that assigns reactants and products their relative
consumption/production rates, lower/upper bounds (in tuples with unit names),
and objective coefficient.
"""
23
24
25
26
27
28
29
30
struct Reaction
    stoichiometry::Dict{String,Float64}
    lb::Tuple{Float64,String}
    ub::Tuple{Float64,String}
    oc::Float64
    Reaction(s, l, u, o) = new(s, l, u, o)
end

Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
31
32
33
"""
Species metadata -- human-readable name and compartment identifier
"""
34
35
36
37
38
39
struct Species
    name::String
    compartment::String
    Species(n, c) = new(n, c)
end

Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
40
41
42
43
"""
Structure that collects the model-related data. Dictionaries are indexed by
identifiers of the corresponding objects.
"""
44
45
46
47
48
49
50
struct Model
    units::Dict{String,Vector{UnitPart}}
    compartments::Vector{String}
    species::Dict{String,Species}
    reactions::Dict{String,Reaction}
    Model(u, c, s, r) = new(u, c, s, r)
end