enzyme.jl 1.15 KB
Newer Older
St. Elmo's avatar
St. Elmo committed
1
2
3
"""
    protein_dict(model::GeckoModel, opt_model)

St. Elmo's avatar
St. Elmo committed
4
5
6
Return a dictionary mapping protein concentrations to their ids. The argument
`opt_model` is a solved optimization problem, typically returned by
[`flux_balance_analysis`](@ref).
St. Elmo's avatar
St. Elmo committed
7
"""
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
8
protein_dict(model::GeckoModel, opt_model) = let gids = genes(model)
St. Elmo's avatar
format    
St. Elmo committed
9
10
    is_solved(opt_model) ?
    Dict(
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
11
        [gids[gidx] for (gidx,_) = model.coupling_row_gene_product] .=> _gecko_gene_product_coupling(model) * value.(opt_model[:x]),
St. Elmo's avatar
format    
St. Elmo committed
12
    ) : nothing
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
13
end
St. Elmo's avatar
St. Elmo committed
14

St. Elmo's avatar
St. Elmo committed
15
16
17
"""
    protein_dict(model::GeckoModel)

Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
18
A pipe-able variant of [`protein_dict`](@ref).
St. Elmo's avatar
St. Elmo committed
19
20
21
"""
protein_dict(model::GeckoModel) = x -> protein_dict(model, x)

22

St. Elmo's avatar
St. Elmo committed
23
"""
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
24
    mass_group_dict(model::GeckoModel, opt_model)
St. Elmo's avatar
format    
St. Elmo committed
25

Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
26
Extract the mass utilization in mass groups from a solved [`GeckoModel`](@ref).
St. Elmo's avatar
St. Elmo committed
27
"""
Miroslav Kratochvil's avatar
Miroslav Kratochvil committed
28
29
30
31
32
mass_group_dict(model::GeckoModel, opt_model) = 
    is_solved(opt_model) ?
    Dict(
        (group for (group,_)=model.coupling_row_mass_group) .=> _gecko_mass_group_coupling(model) * value.(opt_model[:x])
    ) : nothing
St. Elmo's avatar
St. Elmo committed
33

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

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