Visualize MCA

This module implements functions to visualize the MCA results using altair.

plot_ensemble(data_df: DataFrame, quant_type: str, selected_data: list, x_scale: str = 'linear', y_scale: str = 'linear', x_lim: Optional[tuple] = None, y_lim: Optional[tuple] = None, fig_size: Optional[tuple] = None, save_plot: bool = False, output_file: str = '')

Does the same as plot_ensemble_interactive but using matplotlib instead of altair. Takes in a pandas dataframe with median and 1st and 3rd quartile concentration or flux values calculated over all models in the ensemble for each time point, and plots them using matplotlib. The median is represented by a line, and uncertainty is given by the 25% quantile and the 75% one.

Parameters
  • data_df – dataframe with summarized concentration or flux data for each time point.

  • quant_type – the column name for the concentrations or fluxes to be plotted.

  • selected_data – a list of metabolite or reaction names whose concentrations or fluxes will be plotted.

  • x_scale – whether the x-scale should be log, symlog, or linear.

  • y_scale – whether the y-scale should be log, symlog, or linear.

  • x_lim – the limits for the x-axis.

  • y_lim – the limits for the y-axis.

  • fig_size – figure size in inches.

  • save_plot – whether or not to save the plot.

  • output_file – path to plot file to be saved, if save_plot == True.

Returns

A matplotlib plot with the median, 1st quartile, and 3rd quartile metabolite concentrations or reaction fluxes.

plot_model(data_df: DataFrame, model_i: int, quant_type: str, selected_data: list, x_scale: str = 'linear', y_scale: str = 'linear', x_lim: Optional[tuple] = None, y_lim: Optional[tuple] = None, fig_size: Optional[tuple] = None, save_plot: bool = False, output_file: str = '')

Given a pandas dataframe with metabolite concentrations or reaction fluxes, it plots the selected ones (specified in selected data) for the selected model. The plots are made using matplotlib.

Parameters
  • data_df – dataframe with metabolite concentrations or reaction fluxes.

  • model_i – number of the model to plot.

  • quant_type – the column name for the concentrations or fluxes to be plotted.

  • selected_data – a list of metabolite or reaction names whose concentrations or fluxes will be plotted.

  • x_scale – whether the x-scale should be log, symlog, or linear.

  • y_scale – whether the y-scale should be log, symlog, or linear.

  • x_lim – the limits for the x-axis.

  • y_lim – the limits for the y-axis.

  • fig_size – figure size in inches.

  • save_plot – whether or not to save the plot.

  • output_file – path to plot file to be saved, if save_plot == True.

Returns

An altair plot with the selected metabolite concentrations or reaction fluxes plotted for a given model.