Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
167e0e79
Unverified
Commit
167e0e79
authored
May 21, 2021
by
St. Elmo
Browse files
added timer temporarily
parent
1a9d0a80
Pipeline
#42092
passed with stages
in 12 minutes and 5 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Project.toml
View file @
167e0e79
...
...
@@ -18,6 +18,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SBML
=
"e5567a89-2604-4b09-9718-f5f78e97c3bb"
SparseArrays
=
"2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics
=
"10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TimerOutputs
=
"a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
[compat]
Clp
=
"0.8"
...
...
src/COBREXA.jl
View file @
167e0e79
...
...
@@ -13,6 +13,7 @@ using Random
using
SparseArrays
using
Statistics
using
Base
.
Threads
using
TimerOutputs
import
Base
:
findfirst
,
getindex
,
show
import
Pkg
...
...
src/base/types/StandardModel.jl
View file @
167e0e79
...
...
@@ -294,65 +294,91 @@ function Base.convert(::Type{StandardModel}, model::MetabolicModel)
return
model
end
timer
=
TimerOutput
()
@timeit
timer
"instantiate dicts"
begin
id
=
""
# TODO: add accessor to get model ID
modelreactions
=
OrderedDict
{
String
,
Reaction
}()
modelmetabolites
=
OrderedDict
{
String
,
Metabolite
}()
modelgenes
=
OrderedDict
{
String
,
Gene
}()
metids
=
metabolites
(
model
)
end
gtask
=
Base
.
Threads
.
@spawn
begin
@timeit
timer
"access model details"
begin
gids
=
genes
(
model
)
metids
=
metabolites
(
model
)
rxnids
=
reactions
(
model
)
S
=
stoichiometry
(
model
)
lbs
,
ubs
=
bounds
(
model
)
ocs
=
objective
(
model
)
end
@timeit
timer
"assign genes"
begin
# gtask = Base.Threads.@spawn begin
for
gid
in
gids
notes
=
@timeit
timer
"gene_notes"
gene_notes
(
model
,
gid
)
annotations
=
@timeit
timer
"gene_annotations"
gene_annotations
(
model
,
gid
)
modelgenes
[
gid
]
=
Gene
(
gid
;
notes
=
gene_notes
(
$
model
,
gid
)
,
annotations
=
gene_
annotations
(
$
model
,
gid
)
,
notes
=
notes
,
annotations
=
annotations
,
)
# TODO: add name accessor
end
end
mtask
=
Base
.
Threads
.
@spawn
begin
@timeit
timer
"assign metabolites"
begin
# mtask = Base.Threads.@spawn begin
for
mid
in
metids
charge
=
@timeit
timer
"charge"
metabolite_charge
(
model
,
mid
)
formula
=
@timeit
timer
"formula"
_maybemap
(
_unparse_formula
,
metabolite_formula
(
model
,
mid
))
compartment
=
@timeit
timer
"compartment"
metabolite_compartment
(
model
,
mid
)
notes
=
@timeit
timer
"notes"
metabolite_notes
(
model
,
mid
)
annotations
=
@timeit
timer
"annotations"
metabolite_annotations
(
model
,
mid
)
modelmetabolites
[
mid
]
=
Metabolite
(
mid
;
charge
=
metabolite_charge
(
model
,
mid
)
,
formula
=
_maybemap
(
_unparse_formula
,
metabolite_formula
(
model
,
mid
))
,
compartment
=
metabolite_compartment
(
model
,
mid
)
,
notes
=
metabolite_notes
(
model
,
mid
)
,
annotations
=
metabolite_annotations
(
model
,
mid
)
,
charge
=
charge
,
formula
=
formula
,
compartment
=
compartment
,
notes
=
notes
,
annotations
=
annotations
,
)
end
end
rtask
=
Base
.
Threads
.
@spawn
begin
rxnids
=
reactions
(
model
)
S
=
stoichiometry
(
model
)
lbs
,
ubs
=
bounds
(
model
)
ocs
=
objective
(
model
)
@timeit
timer
"assign reactions"
begin
# rtask = Base.Threads.@spawn begin
for
(
i
,
rid
)
in
enumerate
(
rxnids
)
grr
=
@timeit
timer
"grr"
reaction_gene_association
(
model
,
rid
)
notes
=
@timeit
timer
"notes"
reaction_notes
(
model
,
rid
)
annotations
=
@timeit
timer
"annotations"
reaction_annotations
(
model
,
rid
)
subsys
=
@timeit
timer
"subsystem"
reaction_subsystem
(
model
,
rid
)
@timeit
timer
"get reaction equation"
begin
rmets
=
Dict
{
String
,
Float64
}()
for
(
j
,
stoich
)
in
zip
(
findnz
(
S
[
:
,
i
])
...
)
rmets
[
metids
[
j
]]
=
stoich
end
end
modelreactions
[
rid
]
=
Reaction
(
rid
;
metabolites
=
rmets
,
lb
=
lbs
[
i
],
ub
=
ubs
[
i
],
grr
=
reaction_gene_association
(
model
,
rid
)
,
grr
=
grr
,
objective_coefficient
=
ocs
[
i
],
notes
=
reaction_notes
(
model
,
rid
)
,
annotations
=
reaction_
annotations
(
model
,
rid
)
,
subsystem
=
reaction_subsystem
(
model
,
rid
)
,
notes
=
notes
,
annotations
=
annotations
,
subsystem
=
subsys
,
)
# TODO: add name accessor
end
end
wait
(
rtask
)
wait
(
mtask
)
wait
(
gtask
)
# wait(rtask)
# wait(mtask)
# wait(gtask)
show
(
timer
)
println
()
return
StandardModel
(
id
;
reactions
=
modelreactions
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment