smoment.jl 1.29 KB
Newer Older
St. Elmo's avatar
St. Elmo committed
1
2
@testset "SMOMENT" begin
    model = load_model(StandardModel, model_paths["e_coli_core.json"])
St. Elmo's avatar
St. Elmo committed
3

4
    get_gene_product_mass = gid -> get(ecoli_core_protein_masses, gid, 0.0)
St. Elmo's avatar
St. Elmo committed
5

6
7
8
9
10
11
12
13
14
15
    get_reaction_isozyme =
        rid ->
            haskey(ecoli_core_reaction_kcats, rid) ?
            argmax(
                smoment_isozyme_speed(get_gene_product_mass),
                Isozyme(
                    Dict(grr .=> ecoli_core_protein_stoichiometry[rid][i]),
                    ecoli_core_reaction_kcats[rid][i]...,
                ) for (i, grr) in enumerate(reaction_gene_association(model, rid))
            ) : nothing
St. Elmo's avatar
St. Elmo committed
16

17
18
19
20
21
22
23
24
    smoment_model =
        model |>
        with_changed_bounds(
            ["EX_glc__D_e", "GLCpts"],
            lower = [-1000.0, -1.0],
            upper = [nothing, 12.0],
        ) |>
        with_smoment(
St. Elmo's avatar
St. Elmo committed
25
            reaction_isozyme = get_reaction_isozyme,
26
27
28
            gene_product_molar_mass = get_gene_product_mass,
            total_enzyme_capacity = 100.0,
        )
St. Elmo's avatar
St. Elmo committed
29

St. Elmo's avatar
St. Elmo committed
30
    rxn_fluxes = flux_balance_analysis_dict(
31
        smoment_model,
St. Elmo's avatar
St. Elmo committed
32
33
34
35
36
37
38
39
40
41
        Tulip.Optimizer;
        modifications = [change_optimizer_attribute("IPM_IterationsLimit", 1000)],
    )

    @test isapprox(
        rxn_fluxes["BIOMASS_Ecoli_core_w_GAM"],
        0.8907273630431708,
        atol = TEST_TOLERANCE,
    )
end