Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
65fbb3d7
Unverified
Commit
65fbb3d7
authored
Jan 24, 2022
by
Miroslav Kratochvil
🚴
Committed by
GitHub
Jan 24, 2022
Browse files
Merge pull request #559 from LCSB-BioCore/develop
Develop → master merge for 1.2.1
parents
cfe20e2a
906477b9
Pipeline
#51564
passed with stages
in 18 minutes and 53 seconds
Changes
9
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.github/workflows/CompatHelper.yml
View file @
65fbb3d7
...
...
@@ -18,7 +18,7 @@ jobs:
-
name
:
"
Run
CompatHelper"
run
:
|
import CompatHelper
CompatHelper.main()
CompatHelper.main(
master_branch="develop"
)
shell
:
julia --color=yes {0}
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
...
...
.gitlab-ci.yml
View file @
65fbb3d7
...
...
@@ -24,9 +24,11 @@ variables:
.global_trigger_build_doc
:
&global_trigger_build_doc
rules
:
-
if
:
$CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME == "master" && $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME == "develop"
-
if
:
$CI_PIPELINE_SOURCE == "external_pull_request_event"
when
:
never
-
if
:
$CI_COMMIT_BRANCH == "develop"
-
if
:
$CI_COMMIT_BRANCH == "master"
-
if
:
$CI_COMMIT_TAG =~ /^v/
.global_trigger_full_tests
:
&global_trigger_full_tests
...
...
@@ -161,11 +163,11 @@ mac:julia1.6:
format
:
stage
:
test
image
:
docker:
19.03
.1
3
image
:
docker:
20.10
.1
2
tags
:
-
privileged
services
:
-
name
:
docker:
19.03
.1
3
-dind
-
name
:
docker:
20.10
.1
2
-dind
command
:
[
"
--tls=false"
,
"
--mtu=1458"
,
"
--registry-mirror"
,
"
https://docker-registry.lcsb.uni.lu"
]
before_script
:
-
docker login -u $CI_USER_NAME -p $GITLAB_ACCESS_TOKEN $CI_REGISTRY
...
...
@@ -209,11 +211,11 @@ format:
documentation-assets:gource:
stage
:
documentation-assets
needs
:
[]
# allow faster start
image
:
docker:
19.03
.1
3
image
:
docker:
20.10
.1
2
tags
:
-
privileged
services
:
-
name
:
docker:
19.03
.1
3
-dind
-
name
:
docker:
20.10
.1
2
-dind
command
:
[
"
--tls=false"
,
"
--mtu=1458"
,
"
--registry-mirror"
,
"
https://docker-registry.lcsb.uni.lu"
]
before_script
:
-
docker login -u $CI_USER_NAME -p $GITLAB_ACCESS_TOKEN $CI_REGISTRY
...
...
Project.toml
View file @
65fbb3d7
name
=
"COBREXA"
uuid
=
"babc4406-5200-4a30-9033-bf5ae714c842"
authors
=
[
"The developers of COBREXA.jl"
]
version
=
"1.2"
version
=
"1.2
.1
"
[deps]
Distributed
=
"8ba89e20-285c-5b6f-9357-94700520ee1b"
...
...
@@ -28,7 +28,7 @@ MAT = "0.10"
MacroTools
=
"0.5.6"
OSQP
=
"0.6"
OrderedCollections
=
"1.4"
SBML
=
"0.
7, 0.8.2
"
SBML
=
"0.
9.1
"
StableRNGs
=
"1.0"
Tulip
=
"0.7"
julia
=
"1.5"
...
...
docs/Project.toml
View file @
65fbb3d7
[deps]
CairoMakie
=
"13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
COBREXA
=
"babc4406-5200-4a30-9033-bf5ae714c842"
ColorSchemes
=
"35d6a980-a343-548e-a6ea-1d62b119f2f4"
Documenter
=
"e30172f5-a6a5-5a46-863b-614d45cd2de4"
Escher
=
"8cc96de1-1b23-48cb-9272-618d67962629"
...
...
src/analysis/modifications/knockout.jl
View file @
65fbb3d7
...
...
@@ -2,7 +2,19 @@
knockout(gene_ids::Vector{String})
A modification that zeroes the bounds of all reactions that would be knocked
out by the specified genes (effectively disables the reactions).
out by the combination of specified genes (effectively disabling the
reactions).
A slightly counter-intuitive behavior may occur if knocking out multiple genes:
Because this only changes the reaction bounds, multiple gene knockouts _must_
be specified in a single call to [`knockout`](@ref), because the modifications
have no way to remember which genes are already knocked out and which not.
In turn, having a reaction that can be catalyzed either by Gene1 or by Gene2,
specifying `modifications = [knockout(["
Gene1
", "
Gene2
"])]` does indeed disable
the reaction, but `modifications = [knockout("
Gene1
"), knockout("
Gene2
")]` does
_not_ disable the reaction (although reactions that depend either only on Gene1
or only on Gene2 are disabled).
"""
knockout
(
gene_ids
::
Vector
{
String
})
=
(
model
,
optmodel
)
->
_do_knockout
(
model
,
optmodel
,
gene_ids
)
...
...
src/base/macros/change_bounds.jl
View file @
65fbb3d7
"""
@_change_bounds_fn ModelType IdxType [plural] [inplace] begin ... end
A helper for creating simple bounds-changing function similar to
[`change_bounds`](@ref).
"""
macro
_change_bounds_fn
(
model_type
,
idx_type
,
args
...
)
body
=
last
(
args
)
typeof
(
body
)
==
Expr
||
throw
(
DomainError
(
body
,
"missing function body"
))
...
...
@@ -41,10 +47,18 @@ macro _change_bounds_fn(model_type, idx_type, args...)
```
"""
return
:
(
@doc
$
docstring
$
fname
(
model
::$
model_type
,
$
idx_var
::$
idx_type
;
lower
=
$
missing_default
,
upper
=
$
missing_default
,
)
=
$
body
)
Expr
(
:
macrocall
,
Symbol
(
"@doc"
),
__source__
,
docstring
,
:
(
$
fname
(
model
::$
model_type
,
$
idx_var
::$
idx_type
;
lower
=
$
missing_default
,
upper
=
$
missing_default
,
)
=
$
body
),
)
end
src/base/macros/remove_item.jl
View file @
65fbb3d7
"""
@ _remove_fn objname ModelType IndexType [plural] [inplace] begin ... end
A helper for creating functions that follow the `remove_objname` template, such
as [`remove_metabolites`](@ref) and [`remove_reaction`](@ref).
"""
macro
_remove_fn
(
objname
,
model_type
,
idx_type
,
args
...
)
body
=
last
(
args
)
typeof
(
body
)
==
Expr
||
throw
(
DomainError
(
body
,
"missing function body"
))
...
...
@@ -24,5 +31,11 @@ macro _remove_fn(objname, model_type, idx_type, args...)
$
(inplace ? "
in
-
place
" : "
and
return
the
modified
model
").
"""
return
:
(
@doc
$
docstring
$
fname
(
model
::$
model_type
,
$
idx_var
::$
idx_type
)
=
$
body
)
Expr
(
:
macrocall
,
Symbol
(
"@doc"
),
__source__
,
docstring
,
:
(
$
fname
(
model
::$
model_type
,
$
idx_var
::$
idx_type
)
=
$
body
),
)
end
src/base/macros/serialized.jl
View file @
65fbb3d7
"""
_serialized_change_unwrap
(fn::Symbol)
@
_serialized_change_unwrap
function
Creates a simple wrapper structure that calls
a
function transparently on
the
internal precached model. Internal type is returned (because this would
break
the consistency of serialization).
Creates a simple wrapper structure that calls
the `
function
`
transparently on
the
internal precached model. Internal type is returned (because this would
break
the consistency of serialization).
"""
macro
_serialized_change_unwrap
(
fn
::
Symbol
)
docstring
=
"""
...
...
@@ -12,6 +12,14 @@ macro _serialized_change_unwrap(fn::Symbol)
Calls [`
$
fn`](@ref) of the internal serialized model type.
Returns the modified un-serialized model.
"""
:
(
@doc
$
docstring
$
fn
(
model
::
Serialized
,
args
...
;
kwargs
...
)
=
$
fn
(
unwrap_serialized
(
model
),
args
...
;
kwargs
...
))
Expr
(
:
macrocall
,
Symbol
(
"@doc"
),
__source__
,
docstring
,
:
(
$
fn
(
model
::
Serialized
,
args
...
;
kwargs
...
)
=
$
fn
(
unwrap_serialized
(
model
),
args
...
;
kwargs
...
)
),
)
end
src/base/types/SBMLModel.jl
View file @
65fbb3d7
...
...
@@ -165,65 +165,54 @@ function Base.convert(::Type{SBMLModel}, mm::MetabolicModel)
rxns
=
reactions
(
mm
)
stoi
=
stoichiometry
(
mm
)
(
lbs
,
ubs
)
=
bounds
(
mm
)
ocs
=
objective
(
mm
)
comps
=
_default
.
(
""
,
metabolite_compartment
.
(
Ref
(
mm
),
mets
))
compss
=
Set
(
comps
)
return
SBMLModel
(
SBML
.
Model
(
Dict
(),
# parameters
Dict
(
""
=>
1
),
# units
Dict
(
comp
=>
SBML
.
Compartment
(
nothing
,
nothing
,
nothing
,
nothing
,
nothing
,
nothing
)
for
comp
in
compss
),
Dict
(
units
=
Dict
(
""
=>
[]),
# units
compartments
=
Dict
(
comp
=>
SBML
.
Compartment
()
for
comp
in
compss
),
species
=
Dict
(
mid
=>
SBML
.
Species
(
nothing
,
# name
_default
(
""
,
comps
[
mi
]),
# compartment
nothing
,
# no information about boundary conditions
metabolite_formula
(
mm
,
mid
),
metabolite_charge
(
mm
,
mid
),
nothing
,
# initial amount
nothing
,
# initial concentration
nothing
,
# only substance unit flags
_sbml_export_notes
(
metabolite_notes
(
mm
,
mid
)),
_sbml_export_annotation
(
metabolite_annotations
(
mm
,
mid
)),
compartment
=
_default
(
""
,
comps
[
mi
]),
# compartment
formula
=
metabolite_formula
(
mm
,
mid
),
charge
=
metabolite_charge
(
mm
,
mid
),
notes
=
_sbml_export_notes
(
metabolite_notes
(
mm
,
mid
)),
annotation
=
_sbml_export_annotation
(
metabolite_annotations
(
mm
,
mid
)),
)
for
(
mi
,
mid
)
in
enumerate
(
mets
)
),
Dict
(
reactions
=
Dict
(
rid
=>
SBML
.
Reaction
(
Dict
(
reactants
=
Dict
(
mets
[
i
]
=>
-
stoi
[
i
,
ri
]
for
i
in
SparseArrays
.
nonzeroinds
(
stoi
[
:
,
ri
])
if
stoi
[
i
,
ri
]
<=
0
),
Dict
(
products
=
Dict
(
mets
[
i
]
=>
stoi
[
i
,
ri
]
for
i
in
SparseArrays
.
nonzeroinds
(
stoi
[
:
,
ri
])
if
stoi
[
i
,
ri
]
>
0
),
(
lbs
[
ri
],
""
),
(
ubs
[
ri
],
""
),
ocs
[
ri
],
_maybemap
(
kinetic_parameters
=
Dict
(
"LOWER_BOUND"
=>
(
lbs
[
ri
],
""
),
"UPPER_BOUND"
=>
(
ubs
[
ri
],
""
),
),
gene_product_association
=
_maybemap
(
x
->
_unparse_grr
(
SBML
.
GeneProductAssociation
,
x
),
reaction_gene_association
(
mm
,
rid
),
),
nothing
,
# no kinetic math
true
,
# reversible by default
_sbml_export_notes
(
reaction_notes
(
mm
,
rid
)),
_sbml_export_annotation
(
reaction_annotations
(
mm
,
rid
)),
reversible
=
true
,
notes
=
_sbml_export_notes
(
reaction_notes
(
mm
,
rid
)),
annotation
=
_sbml_export_annotation
(
reaction_annotations
(
mm
,
rid
)),
)
for
(
ri
,
rid
)
in
enumerate
(
rxns
)
),
Dict
(
gene_products
=
Dict
(
gid
=>
SBML
.
GeneProduct
(
nothing
,
nothing
,
_sbml_export_notes
(
gene_notes
(
mm
,
gid
)),
_sbml_export_annotation
(
gene_annotations
(
mm
,
gid
)),
notes
=
_sbml_export_notes
(
gene_notes
(
mm
,
gid
)),
annotation
=
_sbml_export_annotation
(
gene_annotations
(
mm
,
gid
)),
)
for
gid
in
genes
(
mm
)
),
Dict
(),
# function definitions
objective
=
Dict
(
rid
=>
oc
for
(
rid
,
oc
)
in
zip
(
rxns
,
objective
(
mm
))
if
oc
!=
0
),
),
)
end
cylon-x
🤖
@cylon-x
mentioned in commit
3a33a7c8
·
Jan 24, 2022
mentioned in commit
3a33a7c8
mentioned in commit 3a33a7c808956badaae0771be054dafef7d19c35
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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