enzymes.jl 1.81 KB
Newer Older
St. Elmo's avatar
St. Elmo committed
1
"""
St. Elmo's avatar
St. Elmo committed
2
    gene_product_dict(model::GeckoModel, opt_model)
St. Elmo's avatar
St. Elmo committed
3

4
5
Return a dictionary mapping protein molar concentrations to their ids. The
argument `opt_model` is a solved optimization problem, typically returned by
St. Elmo's avatar
St. Elmo committed
6
7
[`flux_balance_analysis`](@ref). See [`flux_dict`](@ref) for the corresponding
function that returns a dictionary of solved fluxes.
St. Elmo's avatar
St. Elmo committed
8
"""
St. Elmo's avatar
St. Elmo committed
9
gene_product_dict(model::GeckoModel, opt_model) =
St. Elmo's avatar
St. Elmo committed
10
    is_solved(opt_model) ?
11
    Dict(genes(model) .=> value.(opt_model[:x])[(length(model.columns)+1):end]) : nothing
St. Elmo's avatar
St. Elmo committed
12

St. Elmo's avatar
St. Elmo committed
13
"""
St. Elmo's avatar
St. Elmo committed
14
    gene_product_dict(model::GeckoModel)
St. Elmo's avatar
St. Elmo committed
15

St. Elmo's avatar
St. Elmo committed
16
A pipe-able variant of [`gene_product_dict`](@ref).
St. Elmo's avatar
St. Elmo committed
17
"""
St. Elmo's avatar
St. Elmo committed
18
gene_product_dict(model::GeckoModel) = x -> gene_product_dict(model, x)
St. Elmo's avatar
St. Elmo committed
19

St. Elmo's avatar
St. Elmo committed
20
"""
St. Elmo's avatar
St. Elmo committed
21
    gene_product_mass_group_dict(model::GeckoModel, opt_model)
St. Elmo's avatar
format    
St. Elmo committed
22

Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
23
Extract the mass utilization in mass groups from a solved [`GeckoModel`](@ref).
St. Elmo's avatar
St. Elmo committed
24
"""
St. Elmo's avatar
St. Elmo committed
25
gene_product_mass_group_dict(model::GeckoModel, opt_model) =
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
26
27
    is_solved(opt_model) ?
    Dict(
St. Elmo's avatar
St. Elmo committed
28
        grp.group_id => dot(
St. Elmo's avatar
St. Elmo committed
29
            value.(opt_model[:x])[length(model.columns).+grp.gene_product_idxs],
St. Elmo's avatar
St. Elmo committed
30
31
            grp.gene_product_molar_masses,
        ) for grp in model.coupling_row_mass_group
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
32
    ) : nothing
St. Elmo's avatar
St. Elmo committed
33

St. Elmo's avatar
St. Elmo committed
34
"""
St. Elmo's avatar
St. Elmo committed
35
    gene_product_mass_group_dict(model::GeckoModel)
St. Elmo's avatar
St. Elmo committed
36

37
A pipe-able variant of [`gene_product_mass_group_dict`](@ref).
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
38
"""
39
40
gene_product_mass_group_dict(model::GeckoModel) =
    x -> gene_product_mass_group_dict(model, x)
41

42
"""
St. Elmo's avatar
St. Elmo committed
43
    gene_product_mass(model::SMomentModel)
44
45
46

Extract the total mass utilization in a solved [`SMomentModel`](@ref).
"""
St. Elmo's avatar
St. Elmo committed
47
gene_product_mass(model::SMomentModel, opt_model) =
48
49
50
51
    is_solved(opt_model) ?
    sum((col.capacity_required for col in model.columns) .* value.(opt_model[:x])) : nothing

"""
St. Elmo's avatar
St. Elmo committed
52
    gene_product_mass(model::SMomentModel)
53
54


St. Elmo's avatar
St. Elmo committed
55
A pipe-able variant of [`gene_product_mass`](@ref).
56
"""
St. Elmo's avatar
St. Elmo committed
57
gene_product_mass(model::SMomentModel) = x -> gene_product_mass(model, x)