How to use the cameo.visualization.plotting.plotter function in cameo

To help you get started, we’ve selected a few cameo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github biosustain / cameo / cameo / strain_design / deterministic / flux_variability_based.py View on Github external
dataframe = pandas.DataFrame(columns=["lb", "ub", "strain", "reaction"])
        for reaction_id, row in wt_fva_res.iterrows():
            _df = pandas.DataFrame([[row['lower_bound'], row['upper_bound'], "WT", reaction_id]],
                                   columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        for reaction_id, row in strain_fva_res.iterrows():
            _df = pandas.DataFrame([[row['lower_bound'], row['upper_bound'], "Strain %i" % index, reaction_id]],
                                   columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        plot = plotter.flux_variability_analysis(dataframe, grid=grid, width=width, height=height,
                                                 title=title, x_axis_label="Reactions", y_axis_label="Flux limits",
                                                 palette=palette)

        plotter.display(plot)
github biosustain / cameo / cameo / flux_analysis / analysis.py View on Github external
upper, lower, description, unit = possible_estimates[estimate]
        if title is None:
            title = "Phenotypic Phase Plane ({})".format(description)
        if len(self.variable_ids) == 1:

            variable = self.variable_ids[0]
            y_axis_label = self._axis_label(self.objective, self.nice_objective_id, unit)
            x_axis_label = self._axis_label(variable, self.nice_variable_ids[0], '[mmol gDW^-1 h^-1]')

            dataframe = pandas.DataFrame(columns=["ub", "lb", "value", "strain"])
            for _, row in self.iterrows():
                _df = pandas.DataFrame([[row[upper], row[lower], row[variable], "WT"]],
                                       columns=dataframe.columns)
                dataframe = dataframe.append(_df)

            plot = plotter.production_envelope(dataframe, grid=grid, width=width, height=height,
                                               title=title, y_axis_label=y_axis_label, x_axis_label=x_axis_label,
                                               palette=palette, points=points, points_colors=points_colors)

        elif len(self.variable_ids) == 2:
            var_1 = self.variable_ids[0]
            var_2 = self.variable_ids[1]
            x_axis_label = self._axis_label(var_1, self.nice_variable_ids[0], '[mmol gDW^-1 h^-1]')
            y_axis_label = self._axis_label(var_2, self.nice_variable_ids[1], '[mmol gDW^-1 h^-1]')
            z_axis_label = self._axis_label(self.objective, self.nice_objective_id, unit)

            dataframe = pandas.DataFrame(columns=["ub", "lb", "value1", "value2", "strain"])
            for _, row in self.iterrows():
                _df = pandas.DataFrame([[row[upper], row[lower],
                                         row[var_1], row[var_2], "WT"]],
                                       columns=dataframe.columns)
                dataframe = dataframe.append(_df)
github biosustain / cameo / cameo / strain_design / deterministic / flux_variability_based.py View on Github external
title = "Compare WT solution %i" % index if title is None else title

        wt_fva_res = self.reference_fva.loc[variables]
        strain_fva_res = self.nth_panel(index).loc[variables]
        dataframe = pandas.DataFrame(columns=["lb", "ub", "strain", "reaction"])
        for reaction_id, row in wt_fva_res.iterrows():
            _df = pandas.DataFrame([[row['lower_bound'], row['upper_bound'], "WT", reaction_id]],
                                   columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        for reaction_id, row in strain_fva_res.iterrows():
            _df = pandas.DataFrame([[row['lower_bound'], row['upper_bound'], "Strain %i" % index, reaction_id]],
                                   columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        plot = plotter.flux_variability_analysis(dataframe, grid=grid, width=width, height=height,
                                                 title=title, x_axis_label="Reactions", y_axis_label="Flux limits",
                                                 palette=palette)

        plotter.display(plot)
github biosustain / cameo / cameo / flux_analysis / analysis.py View on Github external
def plot(self, index=None, grid=None, width=None, height=None, title=None, palette=None, **kwargs):
        if index is None:
            index = self.data_frame.index[0:10]
        fva_result = self.data_frame.loc[index]
        if title is None:
            title = "Flux Variability Analysis"

        dataframe = pandas.DataFrame(columns=["lb", "ub", "strain", "reaction"])
        for reaction_id, row in fva_result.iterrows():
            _df = pandas.DataFrame([[row['lower_bound'], row['upper_bound'], "WT", reaction_id]],
                                   columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        plot = plotter.flux_variability_analysis(dataframe, grid=grid, width=width, height=height,
                                                 title=title, y_axis_label="Reactions", x_axis_label="Flux limits",
                                                 palette=palette)
        if grid is None:
            plotter.display(plot)
github biosustain / cameo / cameo / strain_design / deterministic / linear_programming.py View on Github external
mt_production = phenotypic_phase_plane(self._model, objective=self._target, variables=[self._biomass.id])
        if title is None:
            title = "Production Envelope"

        dataframe = DataFrame(columns=["ub", "lb", "value", "strain"])
        for _, row in wt_production.iterrows():
            _df = DataFrame([[row['objective_upper_bound'], row['objective_lower_bound'], row[self._biomass.id], "WT"]],
                            columns=dataframe.columns)
            dataframe = dataframe.append(_df)
        for _, row in mt_production.iterrows():
            _df = DataFrame([[row['objective_upper_bound'], row['objective_lower_bound'], row[self._biomass.id], "MT"]],
                            columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        plot = plotter.production_envelope(dataframe, grid=grid, width=width, height=height, title=title,
                                           x_axis_label=self._biomass.id, y_axis_label=self._target, palette=palette)
        plotter.display(plot)
github biosustain / cameo / cameo / flux_analysis / analysis.py View on Github external
_df = pandas.DataFrame([[row[upper], row[lower],
                                         row[var_1], row[var_2], "WT"]],
                                       columns=dataframe.columns)
                dataframe = dataframe.append(_df)

            plot = plotter.production_envelope_3d(dataframe, grid=grid, width=width, height=height,
                                                  title=title, y_axis_label=y_axis_label, x_axis_label=x_axis_label,
                                                  z_axis_label=z_axis_label, palette=palette, points=points,
                                                  points_colors=points_colors)

        else:
            notice("Multi-dimensional plotting is not supported")
            return

        if grid is None:
            plotter.display(plot)
github biosustain / cameo / cameo / strain_design / pathway_prediction / pathway_predictor.py View on Github external
def plot_production_envelopes(self, model, objective=None, title=None):
        rows = int(ceil(len(self.pathways) / 2.0))
        title = "Production envelops for %s" % self.pathways[0].product.name if title is None else title
        grid = plotter.grid(n_rows=rows, title=title)
        with grid:
            for i, pathway in enumerate(self.pathways):
                ppp = pathway.production_envelope(model, objective=objective)
                ppp.plot(grid=grid, width=450, title="Pathway %i" % (i + 1))
github biosustain / cameo / cameo / strain_design / deterministic / flux_variability_based.py View on Github external
def plot(self, grid=None, width=None, height=None, title=None, *args, **kwargs):
        if title is None:
            title = "FSEOF fluxes"

        plot = plotter.line(self.data_frame, grid=grid, width=width, height=height, title=title, **kwargs)

        if grid is None:
            plotter.display(plot)
github biosustain / cameo / cameo / strain_design / heuristic / evolutionary_based.py View on Github external
if title is None:
            title = "Production Envelope"

        dataframe = DataFrame(columns=["ub", "lb", "value", "strain"])
        for _, row in wt_production.iterrows():
            _df = DataFrame([[row['objective_upper_bound'], row['objective_lower_bound'], row[self._biomass.id], "WT"]],
                            columns=dataframe.columns)
            dataframe = dataframe.append(_df)
        for _, row in mt_production.iterrows():
            _df = DataFrame([[row['objective_upper_bound'], row['objective_lower_bound'], row[self._biomass.id], "MT"]],
                            columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        plot = plotter.production_envelope(dataframe, grid=grid, width=width, height=height, title=title,
                                           x_axis_label=self._biomass.id, y_axis_label=self._target.id, palette=palette)
        plotter.display(plot)
github biosustain / cameo / cameo / flux_analysis / analysis.py View on Github external
index = self.data_frame.index[0:10]
        fva_result = self.data_frame.loc[index]
        if title is None:
            title = "Flux Variability Analysis"

        dataframe = pandas.DataFrame(columns=["lb", "ub", "strain", "reaction"])
        for reaction_id, row in fva_result.iterrows():
            _df = pandas.DataFrame([[row['lower_bound'], row['upper_bound'], "WT", reaction_id]],
                                   columns=dataframe.columns)
            dataframe = dataframe.append(_df)

        plot = plotter.flux_variability_analysis(dataframe, grid=grid, width=width, height=height,
                                                 title=title, y_axis_label="Reactions", x_axis_label="Flux limits",
                                                 palette=palette)
        if grid is None:
            plotter.display(plot)