readsbml.jl 1.01 KB
Newer Older
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
struct UnitPart
    kind :: String
    exponent :: Int
    scale :: Int
    multiplier :: Float64
    UnitPart(k,e,s,m) = new(k,e,s,m)
end

struct Reaction
    stoichiometry :: Dict{String, Float64}
    lb :: Tuple{Float64, String}
    ub :: Tuple{Float64, String}
    oc :: Float64
    Reaction() = new()
end

struct Species
    name :: String
    compartment :: String
    Species(n,c) = new(n,c)
end

struct Model
    units :: Dict{String,Vector{UnitPart}}
    compartments :: Vector{String}
    species :: Dict{String,Species}
    reactions :: Dict{String, Reaction}
    Model() = new()
end

function readSMBL(fn::String)::Model
    mi = readSBML_internal(fn)
    if length(errors(mi))
        @error "Loading failed!" errors(mi)
    end

    m = Model()

    m.compartments = compartments(mi)
    
    return m
end

function getS(m::Model)::Matrix{Float64}
end

function getLBs(m::Model)::Vector{Tuple{Float64,String}}
end

function getUBs(m::Model)::Vector{Tuple{Float64,String}}
end

function getOCs(m::Model)::Vector{Float64}
end