@@ -38,7 +38,6 @@
Loading
38 38
from cameo.strain_design.heuristic.evolutionary.processing import process_reaction_knockout_solution, \
39 39
    process_gene_knockout_solution, process_reaction_swap_solution
40 40
from cameo.util import TimeMachine
41 -
from cameo.visualization.plotting import plotter
42 41
from cameo.core.utils import get_reaction_for
43 42
44 43
__all__ = ["OptGene"]
@@ -294,7 +293,7 @@
Loading
294 293
            fluxes = self._simulation_method(self._model, **self._simulation_kwargs)
295 294
            fluxes.display_on_map(map_name=map_name, palette=palette)
296 295
297 -
    def plot(self, index=0, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
296 +
    def plot(self, plotter, index=0, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
298 297
        wt_production = phenotypic_phase_plane(self._model, objective=self._target, variables=[self._biomass])
299 298
        with self._model:
300 299
            for ko in self.data_frame.loc[index, "reactions"]:
@@ -483,7 +482,7 @@
Loading
483 482
            fluxes = self._simulation_method(self._model, **self._simulation_kwargs)
484 483
            fluxes.display_on_map(map_name=map_name, palette=palette)
485 484
486 -
    def plot(self, index=0, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
485 +
    def plot(self, plotter, index=0, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
487 486
        wt_production = phenotypic_phase_plane(self._model, objective=self._target, variables=[self._biomass])
488 487
        with self._model:
489 488
            for ko in self.data_frame.loc[index, "reactions"]:

@@ -98,5 +98,5 @@
Loading
98 98
    -------
99 99
    None
100 100
    """
101 -
    to_remove = [node for node, degree in network.degree_iter() if degree > max_degree and node not in ignore]
101 +
    to_remove = [node for node, degree in network.degree if degree > max_degree and node not in ignore]
102 102
    network.remove_nodes_from(to_remove)

@@ -29,10 +29,9 @@
Loading
29 29
from cobra.util import fix_objective_as_constraint, get_context
30 30
from cobra.exceptions import OptimizationError
31 31
from numpy import trapz
32 -
from sympy import S
33 32
from optlang.interface import UNBOUNDED, OPTIMAL
33 +
from optlang.symbolics import Zero
34 34
35 -
import cameo
36 35
from cameo import config
37 36
from cameo.core.result import Result
38 37
from cameo.flux_analysis.util import remove_infeasible_cycles, fix_pfba_as_constraint
@@ -40,7 +39,6 @@
Loading
40 39
from cameo.ui import notice
41 40
from cameo.util import partition, _BIOMASS_RE_
42 41
from cameo.core.utils import get_reaction_for
43 -
from cameo.visualization.plotting import plotter
44 42
45 43
logger = logging.getLogger(__name__)
46 44
@@ -203,8 +201,9 @@
Loading
203 201
204 202
    Returns
205 203
    -------
206 -
    pandas.DataFrame
207 -
        Pandas DataFrame containing the results of the flux variability analysis.
204 +
    FluxVariabilityResult
205 +
        FluxVariabilityResult with DataFrame data_frame property containing the results of the flux variability
206 +
        analysis.
208 207
209 208
    """
210 209
    if view is None:
@@ -357,7 +356,7 @@
Loading
357 356
    fva_sol = OrderedDict()
358 357
    lb_flags = dict()
359 358
    with model:
360 -
        model.objective = S.Zero
359 +
        model.objective = Zero
361 360
362 361
        model.objective.direction = 'min'
363 362
        for reaction in reactions:
@@ -637,9 +636,9 @@
Loading
637 636
        try:
638 637
            source, source_flux = single_flux(self.source, consumption=True)
639 638
            product, product_flux = single_flux(self.product_reaction, consumption=False)
640 -
        except ValueError:
639 +
            mol_prod_mol_src = product_flux / source_flux
640 +
        except (ValueError, ZeroDivisionError):
641 641
            return numpy.nan
642 -
        mol_prod_mol_src = product_flux / source_flux
643 642
        return (mol_prod_mol_src * product.formula_weight) / source.formula_weight
644 643
645 644
    def __call__(self, points):
@@ -760,7 +759,7 @@
Loading
760 759
    def data_frame(self):
761 760
        return pandas.DataFrame(self._phase_plane)
762 761
763 -
    def plot(self, grid=None, width=None, height=None, title=None, axis_font_size=None, palette=None,
762 +
    def plot(self, plotter, grid=None, width=None, height=None, title=None, axis_font_size=None, palette=None,
764 763
             points=None, points_colors=None, estimate='flux', **kwargs):
765 764
        """plot phenotypic phase plane result
766 765
@@ -882,7 +881,7 @@
Loading
882 881
    def data_frame(self):
883 882
        return self._data_frame
884 883
885 -
    def plot(self, index=None, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
884 +
    def plot(self, plotter, index=None, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
886 885
        if index is None:
887 886
            index = self.data_frame.index[0:10]
888 887
        fva_result = self.data_frame.loc[index]

@@ -23,7 +23,6 @@
Loading
23 23
24 24
from cameo.core.result import Result
25 25
from cameo.core.target import EnsembleTarget, Target
26 -
from cameo.visualization.plotting import plotter
27 26
28 27
from gnomic import Genotype
29 28
@@ -180,7 +179,7 @@
Loading
180 179
    def _repr_html_(self):
181 180
        return self.data_frame._repr_html_()
182 181
183 -
    def plot(self, grid=None, width=None, height=None, title=None, *args, **kwargs):
182 +
    def plot(self, plotter, grid=None, width=None, height=None, title=None, *args, **kwargs):
184 183
        if title is None:
185 184
            title = "Target frequency plot for %s result" % self.__method_name__
186 185

@@ -45,7 +45,6 @@
Loading
45 45
from cameo.flux_analysis.simulation import fba
46 46
from cameo.flux_analysis.structural import find_coupled_reactions_nullspace
47 47
from cameo.util import reduce_reaction_set, decompose_reaction_groups
48 -
from cameo.visualization.plotting import plotter
49 48
50 49
logger = logging.getLogger(__name__)
51 50
@@ -389,7 +388,7 @@
Loading
389 388
            fluxes = fba(self._model)
390 389
            fluxes.display_on_map(map_name=map_name, palette=palette)
391 390
392 -
    def plot(self, index=0, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
391 +
    def plot(self, plotter, index=0, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
393 392
        wt_production = phenotypic_phase_plane(self._model, objective=self._target, variables=[self._biomass.id])
394 393
        with self._model:
395 394
            for ko in self.data_frame.loc[index, "reactions"]:

@@ -176,7 +176,7 @@
Loading
176 176
        left = non_blocked_ns[i]
177 177
        group = next((g for g in groups if reaction_i in g), None)
178 178
        if group:
179 -
            reaction_i = next(l for l, c in group.items() if c == 1)
179 +
            reaction_i = next(reac for reac, c in group.items() if c == 1)
180 180
            left = non_blocked_ns[reaction_index[reaction_i]]
181 181
        else:
182 182
            group = {reaction_i: 1}

@@ -37,7 +37,6 @@
Loading
37 37
from cobra import Reaction, Metabolite
38 38
from cobra.util import fix_objective_as_constraint
39 39
40 -
from cameo.visualization.plotting import plotter
41 40
from cameo import config
42 41
43 42
from cameo.ui import notice
@@ -470,7 +469,7 @@
Loading
470 469
        self.reference_fva = reference_fva
471 470
        self.solutions = solutions
472 471
        self.groups = self.solutions.groupby(
473 -
            ('biomass', 'production'), as_index=False, sort=False
472 +
            ['biomass', 'production'], as_index=False, sort=False
474 473
        )
475 474
476 475
    @classmethod
@@ -509,7 +508,7 @@
Loading
509 508
            A list of cameo.core.strain_design.StrainDesign for each DataFrame in solutions.
510 509
        """
511 510
        designs = []
512 -
        for _, solution in solutions.groupby(('biomass', 'production'), as_index=False, sort=False):
511 +
        for _, solution in solutions.groupby(['biomass', 'production'], as_index=False, sort=False):
513 512
            targets = []
514 513
            relevant_targets = solution[
515 514
                (solution['normalized_gaps'].abs() > non_zero_flux_threshold) & (
@@ -616,7 +615,7 @@
Loading
616 615
        else:
617 616
            self._plot_production_envelope(title=title, grid=grid, width=width, height=height)
618 617
619 -
    def _plot_flux_variability_analysis(self, index, variables=None, title=None,
618 +
    def _plot_flux_variability_analysis(self, plotter, index, variables=None, title=None,
620 619
                                        width=None, height=None, palette=None, grid=None):
621 620
        if variables is None:
622 621
            variables = self.reference_fva.index[0:10]
@@ -977,7 +976,7 @@
Loading
977 976
978 977
    __method_name__ = "FSEOF"
979 978
980 -
    def plot(self, grid=None, width=None, height=None, title=None, *args, **kwargs):
979 +
    def plot(self, plotter, grid=None, width=None, height=None, title=None, *args, **kwargs):
981 980
        if title is None:
982 981
            title = "FSEOF fluxes"
983 982

@@ -48,8 +48,8 @@
Loading
48 48
49 49
add = Add._from_args
50 50
mul = Mul._from_args
51 -
NegativeOne = sympy.singleton.S.NegativeOne
52 -
One = sympy.singleton.S.One
51 +
NegativeOne = sympy.S.NegativeOne
52 +
One = sympy.S.One
53 53
FloatOne = sympy.Float(1)
54 54
RealNumber = sympy.RealNumber
55 55

@@ -39,7 +39,6 @@
Loading
39 39
from cameo.data import metanetx
40 40
from cameo.strain_design.pathway_prediction import util
41 41
from cameo.util import TimeMachine
42 -
from cameo.visualization.plotting import plotter
43 42
44 43
__all__ = ['PathwayPredictor']
45 44
@@ -162,15 +161,19 @@
Loading
162 161
        for i, pathway in enumerate(self.pathways):
163 162
            string += 'Pathway No. {}'.format(i + 1)
164 163
            for reaction in pathway.reactions:
165 -
                string += '{}, {}:'.format(reaction.id, reaction.name,
166 -
                                           reaction.build_reaction_string(use_metabolite_names=True))
164 +
                string += '{}, {}: {}'.format(
165 +
                    reaction.id, reaction.name,
166 +
                    reaction.build_reaction_string(use_metabolite_names=True)
167 +
                )
167 168
        return string
168 169
169 170
    def plot(self, grid=None, width=None, height=None, title=None):
170 171
        # TODO: small pathway visualizations would be great.
171 172
        raise NotImplementedError
172 173
173 -
    def plot_production_envelopes(self, model, objective=None, title=None):
174 +
    def plot_production_envelopes(
175 +
        self, plotter, model, objective=None, title=None
176 +
    ):
174 177
        rows = int(ceil(len(self.pathways) / 2.0))
175 178
        title = "Production envelops for %s" % self.pathways[0].product.name if title is None else title
176 179
        grid = plotter.grid(n_rows=rows, title=title)
Files Coverage
cameo 61.70%
Project Totals (56 files) 61.70%
2448.2
3.6=.6
TRAVIS_OS_NAME=linux
2448.3
3.7=.7
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading