-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRidgeFBA_test.jl
43 lines (28 loc) · 1.33 KB
/
RidgeFBA_test.jl
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
# This script can be used to test the funcionality of RidgeFBA
# Here, the metabolic model 'e_coli_core' is downloaded and by assumption of biomass as objective function,
# flux dixtribution is computed and the value for objective function is tested
using JuMP, Ipopt
using SBML
using HTTP
using Test
# Downloading the metabolic model
ecoli_model=HTTP.get("http://bigg.ucsd.edu/static/models/e_coli_core.xml")
write("e_coli_core.xml",ecoli_model.body)
ecoli_metabolic_model=readSBML("e_coli_core.xml")
#The name of the reactions are extracted as a vector.
reaction_names_keySet=keys(ecoli_metabolic_model.reactions)
reaction_names=[]
for item in reaction_names_keySet
push!(reaction_names,item)
end
#Obtaining the biomass reaction index
for n in 1:length(ecoli_metabolic_model.reactions)
if occursin("BIOMASS" , reaction_names[n])
global biomass_index=n
end
end
#As biomass is set as objective function the corresponding element in c vector is set to 1
c_test=zeros(1,length(ecoli_metabolic_model.reactions))
c_test[biomass_index]=1
flux_vector=RidgeFBA(ecoli_metabolic_model,c_test,10^-5)
@test isapprox(flux_vector[biomass_index] ,46.17244338638067; atol=0.001)