wholecell.utils.toya

Utilities for working with TOYA data

wholecell.utils.toya.adjust_toya_data(data, cell_masses, dry_masses, cell_density)[source]

Adjust fluxes or stdevs for dry mass fraction, density, units.

The provided data are multiplied by the average dry mass fraction and by the cell density.

Parameters:
  • data (ndarray[Any, dtype[float64]]) – Flux or standard deviation data vector to process.

  • cell_masses (ndarray[Any, dtype[float64]]) – Vector of cell mass over time. Units should be stored elementwise.

  • dry_masses (ndarray[Any, dtype[float64]]) – Vector of cell dry mass over time. Units should be stored elementwise.

  • cell_density (float) – Constant density of cell.

Returns:

Vector of adjusted data. Units are applied to the whole vector.

Return type:

Unum

wholecell.utils.toya.get_common_ids(toya_reaction_ids, root_to_id_indices_map)[source]
wholecell.utils.toya.get_root_to_id_indices_map(sim_reaction_ids)[source]

Get a map from ID root to indices in sim_reaction_ids

The reaction root is the portion of the ID that precedes the first underscore or space.

Parameters:

sim_reaction_ids (ndarray[Any, dtype[str_]]) – Simulation reaction IDs

Returns:

Map from ID root to a list of the indices in sim_reaction_ids of reactions having that root.

Return type:

dict[str, list[int]]

wholecell.utils.toya.process_simulated_fluxes(output_ids, reaction_ids, reaction_fluxes)[source]

Compute means and standard deviations of flux from simulation

For a given output ID from output_ids, find the mean and stdev of simulated fluxes of the reaction with the matching ID.

Parameters:
  • output_ids (Iterable[str]) – IDs of reactions to include in output

  • reaction_ids (Iterable[str]) – IDs of the reactions in the order that they appear in reaction_fluxes

  • reaction_fluxes (Unum) – 2-dimensional matrix of reaction fluxes where each column corresponds to a reaction (in the order specified by reaction_ids) and each row is a time point. Should have units FLUX_UNITS and be a numpy matrix.

Returns:

Tuple of the lists of mean fluxes and standard deviations for each reaction ID in output_ids. List elements are in the same order as their associated reaction IDs in output_ids. Both lists will have units FLUX_UNITS.

Return type:

tuple[Unum, Unum]

wholecell.utils.toya.process_toya_data(output_ids, reaction_ids, data)[source]

Filter toya fluxes or standard deviations by reaction ID

Parameters:
  • output_ids (Iterable[str]) – IDs of reactions to include in the output.

  • reaction_ids (Iterable[str]) – IDs of the reactions whose fluxes and standard deviations are provided, in the order in which the rections’ values appear in fluxes and stdevs.

  • data (Unum) – 1-dimensional numpy array (with units FLUX_UNITS) with average reaction fluxes or standard deviations.

Returns:

List of data in the order specified by output_ids. List is of units FLUX_UNITS.

Return type:

Unum