Skip to content

Commit 8b1adb7

Browse files
KristianJensenKristianJensenKristian Jensencarrascomj
authored
GrowthCouplingPotential (#215)
* FSEOF improvements * feat: implement GrowthCouplingPotential optimization * fix: flake8 * test: add test for GrowthCouplingPotential * feat: add gurobi solution pool capability * fix: remove blocked reactions from reaction lists * fix: flake8 * chore: bring branch up to date * fix: avoid adding list and set * test: update GrowthCouplingPotential tests * fix: remove commented line * test: assert that target is not growth coupled in wild-type Co-authored-by: KristianJensen <krisje@nnfcb-l0275.local> Co-authored-by: Kristian Jensen <dkkrje@chr-hansen.com> Co-authored-by: carrascomj <carrascomurielj@gmail.com>
1 parent 598b0a0 commit 8b1adb7

3 files changed

Lines changed: 438 additions & 35 deletions

File tree

cameo/strain_design/deterministic/flux_variability_based.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474

7575
class DifferentialFVA(StrainDesignMethod):
7676
r"""Differential flux variability analysis.
77-
7877
Compares flux ranges of a reference model to a set of models that
7978
have been parameterized to lie on a grid of evenly spaced points in the
8079
# n-dimensional production envelope (n being the number of reaction bounds
@@ -89,10 +88,8 @@ class DifferentialFVA(StrainDesignMethod):
8988
| . . . . . . \
9089
o--------------*- >
9190
growth
92-
9391
Overexpression, downregulation, knockout, flux-reversal and other
9492
strain engineering targets can be inferred from the resulting comparison.
95-
9693
Parameters
9794
----------
9895
design_space_model : cobra.Model
@@ -113,7 +110,6 @@ class DifferentialFVA(StrainDesignMethod):
113110
will be normalized by.
114111
points : int, optional
115112
Number of points to lay on the surface of the n-dimensional production envelope (defaults to 10).
116-
117113
Examples
118114
--------
119115
>>> from cameo import models
@@ -283,7 +279,6 @@ def _init_search_grid(self, surface_only=False, improvements_only=True):
283279
def run(self, surface_only=True, improvements_only=True, progress=True,
284280
view=None, fraction_of_optimum=1.0):
285281
"""Run the differential flux variability analysis.
286-
287282
Parameters
288283
----------
289284
surface_only : bool, optional
@@ -299,7 +294,6 @@ def run(self, surface_only=True, improvements_only=True, progress=True,
299294
A value between zero and one that determines the width of the
300295
flux ranges of the reference solution. The lower the value,
301296
the larger the ranges.
302-
303297
Returns
304298
-------
305299
pandas.Panel
@@ -482,25 +476,18 @@ def __init__(self, solutions, phase_plane, reference_fva, **kwargs):
482476
def _generate_designs(cls, solutions, reference_fva):
483477
"""
484478
Generates strain designs for Differential FVA.
485-
486479
The conversion method has three scenarios:
487480
#### 1. Knockout
488-
489481
Creates a ReactionKnockoutTarget.
490-
491482
#### 2. Flux reversal
492-
493483
If the new flux is negative then it should be at least the upper
494484
bound of the interval. Otherwise it should be at least the lower
495485
bound of the interval.
496-
497486
#### 3. The flux increases or decreases
498-
499487
This table illustrates the possible combinations.
500488
* Gap is the sign of the normalized gap between the intervals.
501489
* Ref is the sign of the closest bound (see _closest_bound).
502490
* Bound is the value to use
503-
504491
+-------------------+
505492
| Gap | Ref | Bound |
506493
+-----+-----+-------+
@@ -509,15 +496,12 @@ def _generate_designs(cls, solutions, reference_fva):
509496
| + | - | UB |
510497
| + | + | LB |
511498
+-----+-----+-------+
512-
513-
514499
Parameters
515500
----------
516501
solutions: pandas.Panel
517502
The DifferentialFVA panel with all the solutions. Each DataFrame is a design.
518503
reference_fva: pandas.DataFrame
519504
The FVA limits for the reference strain.
520-
521505
Returns
522506
-------
523507
list
@@ -620,7 +604,6 @@ def __getitem__(self, item):
620604
def nth_panel(self, index):
621605
"""
622606
Return the nth DataFrame defined by (biomass, production) pairs.
623-
624607
When the solutions were still based on pandas.Panel this was simply
625608
self.solutions.iloc
626609
"""
@@ -704,23 +687,18 @@ def plot_scale(self, palette="YlGnBu"):
704687
"""
705688
Generates a color scale based on the flux distribution.
706689
It makes an array containing the absolute values and minus absolute values.
707-
708690
The colors set as follows (p standsfor palette colors array):
709691
min -2*std -std 0 std 2*std max
710692
|-------|-------|-------|-------|-------|-------|
711693
p[0] p[0] .. p[1] .. p[2] .. p[3] .. p[-1] p[-1]
712-
713-
714694
Parameters
715695
----------
716696
palette: Palette, list, str
717697
A Palette from palettable of equivalent, a list of colors (size 5) or a palette name
718-
719698
Returns
720699
-------
721700
tuple:
722701
((-2*std, color), (-std, color) (0 color) (std, color) (2*std, color))
723-
724702
"""
725703
if isinstance(palette, str):
726704
palette = mapper.map_palette(palette, 5)
@@ -868,20 +846,17 @@ def _set_bounds(self, point):
868846
class FSEOF(StrainDesignMethod):
869847
"""
870848
Performs a Flux Scanning based on Enforced Objective Flux (FSEOF) analysis.
871-
872849
Parameters
873850
----------
874851
model : cobra.Model
875852
enforced_reaction : Reaction
876853
The flux that will be enforced. Reaction object or reaction id string.
877854
primary_objective : Reaction
878855
The primary objective flux (defaults to model.objective).
879-
880856
References
881857
----------
882858
.. [1] H. S. Choi, S. Y. Lee, T. Y. Kim, and H. M. Woo, 'In silico identification of gene amplification targets
883859
for improvement of lycopene production.,' Appl Environ Microbiol, vol. 76, no. 10, pp. 3097–3105, May 2010.
884-
885860
"""
886861

887862
def __init__(self, model, primary_objective=None, *args, **kwargs):
@@ -909,7 +884,6 @@ def run(self, target=None, max_enforced_flux=0.9, number_of_results=10, exclude=
909884
simulation_kwargs=None):
910885
"""
911886
Performs a Flux Scanning based on Enforced Objective Flux (FSEOF) analysis.
912-
913887
Parameters
914888
----------
915889
target: str, Reaction, Metabolite
@@ -920,17 +894,14 @@ def run(self, target=None, max_enforced_flux=0.9, number_of_results=10, exclude=
920894
number_of_results : int, optional
921895
The number of enforced flux levels (defaults to 10).
922896
exclude : Iterable of reactions or reaction ids that will not be included in the output.
923-
924897
Returns
925898
-------
926899
FseofResult
927900
An object containing the identified reactions and the used parameters.
928-
929901
References
930902
----------
931903
.. [1] H. S. Choi, S. Y. Lee, T. Y. Kim, and H. M. Woo, 'In silico identification of gene amplification targets
932904
for improvement of lycopene production.,' Appl Environ Microbiol, vol. 76, no. 10, pp. 3097–3105, May 2010.
933-
934905
"""
935906
model = self.model
936907
target = get_reaction_for(model, target)
@@ -1004,7 +975,6 @@ def run(self, target=None, max_enforced_flux=0.9, number_of_results=10, exclude=
1004975
class FSEOFResult(StrainDesignMethodResult):
1005976
"""
1006977
Object for storing a FSEOF result.
1007-
1008978
Attributes:
1009979
-----------
1010980
reactions: list
@@ -1015,7 +985,6 @@ class FSEOFResult(StrainDesignMethodResult):
1015985
A pandas DataFrame containing the fluxes for every reaction for each enforced flux.
1016986
run_args: dict
1017987
The arguments that the analysis was run with. To repeat do 'FSEOF.run(**FSEOFResult.run_args)'.
1018-
1019988
"""
1020989

1021990
__method_name__ = "FSEOF"

0 commit comments

Comments
 (0)