NutMEG.culture.base_organism package

Submodules

NutMEG.culture.base_organism.CHNOPSexchanger module

class NutMEG.culture.base_organism.CHNOPSexchanger.CHNOPSexchanger(host, *args, **kwargs)

Bases: object

Class for managing CHNOPS exchange between an organism and a reactor.

host

host organism. Ensure that the host organism’s locale object is the reactor you want.

Type

base_organism like

uptake_consts

dictionary of uptake constants for C,H,N,O,P,S etc, in units /s. Default is for each to be 10^{-10} (arbitrarily).

Type

dict, kwarg

nutrients

nutrient parameters for each key in C,H,N,O,P,S, there is a list in the format [[rate of moles to be used (/s), % needed (for each cell), amount in reactor (from reactor.composition), max rate constant per cell (from uptake_consts)], [<list of reagents which could be used>]

Type

dict

limter

Name of the most limiting paramters, either a named nutrient or Energy.

Type

str

Notes

This class is still in a basic (albeit convoluted) state. This is because there reamins a lack of literature for this kind of limitation and hopefully one day we will be able to inmprove it considerably.

check_nutrients(E_growth, t, updatenutrients=True, numcells=1)

Given a timestep t and potential growth input E_growth, compute how much of that energy can be used.

Parameters
  • E_growth (float) – Total Energy available for growth in t in J

  • t (float) – Time frame for which this energy is available in s.

  • updatenutrients (bool, optional) – Whether to update the nutrients dict before comparing growth estimates. Default True.

  • numcells (int, optional) – Number of cells to be considering for this growth, if a horde is being used for example. Default 1.

Returns

  • Any E_growth which cannot be converted into biomass because of nutrient

  • limitation.

find_nutrients(init=False, ignore=[])

Look in the host’s locale to find reagents which could work as a nutrient source and update nutrients as appropriate. Pass init as True to set up the nutrients dict from scratch.

Notes

there must be a way to make this faster. It has to look in the reactor every step.

get_default_nutrients()

set up the nutrients dictionary, using cell composition values of E. Coli. This could be adapted in future child classes for specific organisms if the data is available.

get_uptake(numcells=1)

Return a dictionary showing the uptake rate of each nutient

grow_with_nutrients(E_growth, t, updatenutrients=True, checknutrients=True, ret=0.0, numcells=1)

Convert as much of E_growth [J] into biomass as possible in time t [s] based on nutrient availability. Remove the nutrients required from host.locale to build that biomass and pass back any leftover energy.

Parameters
  • E_growth (float) – Total Energy available for growth in t in J

  • t (float) – Time frame for which this energy is available in s.

  • checknutrients (bool, optional) – Whether to check nutreint limitation vs energy limitation before analysis. Pass as False if you want to ignore nutrient limitation or set your own ret for some reason. Default True

  • updatenutrients (bool, optional) – Whether to update the nutrients dict before checking for nutrients. Default True. This only has an effect is checknutrients is also True

  • ret (float, optional) – The amount of E_growth to return in J. Only has effect if checknutrients is passed as False.

  • numcells (int, optional) – Number of cells to be considering for this growth, if a horde is being used for example. Default 1.

Returns

  • E_growth remaining if the host is nutrient limited in J. 0 if the host

  • is energy limited.

Notes

This function does NOT grow the host (e.g. change its volume and mass). That should be done elsewhere.

print_nutrients()

Print the nutrient information in a more readable way.

update_nutrient_yield(numcells=1)

Get the nutrient concentrations available from the host’s locale.

Parameters

numcells (int, optional) – number of cells we need nutrients for, as this will be greater than one for hordes.

uptake_consts = {'C': 1e-10, 'H': 1e-10, 'N': 1e-10, 'O': 1e-10, 'P': 1e-10, 'S': 1e-10}

NutMEG.culture.base_organism.base_organism module

NutMEG.culture.base_organism.base_organism.SAget(v)
class NutMEG.culture.base_organism.base_organism.base_organism(name, locale, metabolism, maintenance=None, CHNOPS=None, workoutID=True, mass=1e-15, dry_mass=3e-16, volume=1e-18, *args, **kwargs)

Bases: object

This is a parent class for all organism-like objects which NutMEG can use. It’s designed to contain everything that both hordes and individual organisms have in common. It has a large number of attributes, but many are optional. The default is usually to behave like E. Coli.

name

name of organism, used for database management and output.

Type

str

locale

Reactor object in which the organism lives

Type

reactor like

metabolism

manage all respiration behaviour

Type

respirator

maintenance

manage all maintnenace behaviour (Default is None, if None is passed on initiation the organism will have a maintainer with not survial costs unless Tdef, pHdef or Basal are passed as kwargs)

Type

maintainer, optional

CHNOPS

manage nutrient access with locale (Default is None, if None is passed the organism will have a CHNOPS created with its own default values)

Type

CHNOPSexchanger, optional

mass

Mass of each individual cell in kg. Default 1e-15

Type

float, optional

dry_mass

Dry mass of each individual cell in kg (e.g. its mass after being dehydrated) this is typically around 30% the mass. Default 2e-16

Type

float

volume

volume of each individual cell in m^3. Default 1e-18

Type

float

base_volume

For use with horde, volume of each individual cell as the volume attribute represents the horde as one. Default equal to Volume.

Type

float

age

Age of the organism in seconds. Default 0.

Type

float, kwarg

E_synth

The amount of energy required to synthesise one cell in the locale. Default is to estimate using the synthesis module, including the cost of synthesising amino acids.

Type

float, kwarg

pH_interior

pH inside the cell. Default 7.

Type

float, kwarg

memb_pot

Membrane potential of the cell wall. Default 1e-5 V

Type

float, kwarg

PermH

Permeability of the cell wall to Hydrogen in m^-1. Default 1e-10

Type

float, kwarg

PermOH

Permeability of the cell wall to Hydroxide in m^-1. Default 1e-10

Type

float, kwarg

surfacearea

surface area of the cell im m^2 Default is to caluclate from volume assuming a spherical organism.

Type

float, kwarg

base_life_span

Maximum age for the organism before it becomes inactive in s. Default is infinite.

Type

float, kwarg

proteinfraction

Fraction of the organisms dry mass which is made up of proteins. Useful for synthesis calculations. Default is 0.55 (E. Coli)

Type

float, kwarg

isactive

Whether the organism is active, e.g. interacting with the locale, metabolising, growing, etc. Starts as True, Changed to False when neccessary.

Type

bool

P_growth

Instantaneous power going into growth in W/cell

Type

float

P_s

Instantaneous power supply in W/cell

Type

float

E_store

Energy currently in storage. Starts at 0.

Type

float

max_metabolic_rate

Maximum metabolic rate in unit reaction / s. If NutMEG predicts a rate faster than this, it will use this maximum instead.

Type

float

dbh

Helper atttribute for database management.

Type

bo_dbhelper

classmethod bo_from_db(name, locale, OrgID, num=1, dbpath='/Users/pete/github2/NutMEG/NutMEG/util/../../NutMEG_db')

Create an instance of a known organism from an entry in a NutMEG database.

Parameters
  • name (str) – Name of organism to extract, determines table to use

  • locale (reactor like) – Reactor object for the organism to exist in

  • OrgID (str) – OrgID of the database entry to base this organism from

  • num (int, optional) – number of organisms, for if this is a horde instance

  • dbpath (str, optional) – path of the dictionary to extract from.

get_ESynth(AA=False, comp=None)

Use the synthesis module to get the synthesis energy for this organism. Pass AA as True to include the cost of Amino Acid synthesis.

By default use E Coli parameters as built into synthesis. A future update might extend this, meaning we’ll have to add comp

get_supplied_power(update_energetics=False)

Using respiration, find the instantaneous power supply by multiplying the molar gibbs yield and the metabolic rate and return it.

If update_energetics is passed, update the thermodynamic parameters of the respiration first.

reproduce()

Return a new organism identical to this one but of age zero.

Also reset the energy stores of the new organism, and ensure its metabolic reaction is maintained in real time (not a complete deep copy).

reset_from_db_dict(dbdict)

Reset this organism’s parameters with the ones in dbdict, which must be a bo_dbhelper output.

take_step(t, update_energetics=True)

Increment the organism’s life by time t.

Updates the organism’s parameters based on its mortality, environment, metabolism, etc. If update_energetics is False, any thermodynamic parameters in locale will not be updated.

update_metabolic_rate()

Update the actual rate of material uptake/dismissal, based on the slowest processes occuring.

NutMEG.culture.base_organism.base_organism_dbhelper module

class NutMEG.culture.base_organism.base_organism_dbhelper.bodb_helper(host, dbpath='/Users/pete/github2/NutMEG/NutMEG/util/../../NutMEG_db')

Bases: object

Class from managing how organisms and their attributes are stored in NutMEG’s database. Each organism/horde with a unique name will have its own table, in case child classes of either have their own attributes they want saving. There is also an organism table, which stores all OrgIDs as pointers to the correct table.

host

host organism/horde to be saving.

Type

base_organism like

dbpath

path to the SQL database. If not passed it will be set to the default (NutMEG_db in your working directory). The default can be changed in NutMEG/utils/NuMEGparams.

Type

str

dbdict

Parameters which will be imported into the database.

Type

dict

createtable(replace=False)

Create a table in the database for this species.

static extract_param_db(orgname, OrgID, params, dbpath='/Users/pete/github2/NutMEG/NutMEG/util/../../NutMEG_db')

Fetch a specific parameter from a simulation, using its ID as passed.

static from_db(name, OrgID, dbdict={'DryMass': ['REAL', 0], 'Esynth': ['REAL', 0], 'MaintenancePower': ['TEXT', ''], 'Mass': ['REAL', 0], 'MembranePot': ['REAL', 0], 'PermH': ['REAL', 0], 'PermOH': ['REAL', 0], 'Respiration': ['TEXT', ''], 'Tdef': ['TEXT', ''], 'Volume': ['REAL', 0], 'base_life_span': ['REAL', inf], 'k_RTP': ['REAL', 0], 'n_ATP': ['REAL', 0], 'pHdef': ['TEXT', ''], 'pHint': ['REAL', 0]}, dbpath='/Users/pete/github2/NutMEG/NutMEG/util/../../NutMEG_db')

Extract the data from the database and return a dictionary of parameters.

get_db_sqlparams(dbdict=None)

Get the parameters to import into the database as a dictionary Pass a dbdict as a dictionary if you want to write your own.

print_table()

Print out the table containing data for the current host species

to_db()

Send the organism’s parameters to be stored in the database’s table for this species.

If this organism is already in the database, reset its OrgID to match.

update_org_db()

Update the organism table, which points to the species tables.

workoutID(dbdict=None)

Find this organisms’ ID from the database, and if there’s no entry create one.

NutMEG.culture.base_organism.maintainer module

class NutMEG.culture.base_organism.maintainer.maintainer(host, net_dict={}, supply=1.0, Tdef='None', pHdef='None')

Bases: object

This class is for computing and calculating the maintenance requirements in the form of powers for a given organism.

All values are PER CELL, so for a Horde, when you use these attributes you will likely need to scale them up.

host

host organism. Ensure that the host organism’s locale object is the reactor you want.

Type

base_organism like

net_dict

dictionary of the net contributions to maintenance in W per cell. By default will include contributions of temperature and pH, according to Tdef or pHdef. You could also include a ‘Basal’ maintenance power.

Type

dict, optional

frac_dict

dictionary of the contributions to maintenance as a fraction of power supply. Shares keys with net_dict.

Type

dict

Tdef

Which temperature defences to use. Current options are are those from Tijhuis (1993), and Lever (2015). See function get_P_T for options which work. For more info, check out the documentation, and if it isn’t there yet contact me!

Type

str, optional

pHdef

Which pH defences to use. See function get_P_pH for options which work. For more info, check out the documentation, and if it isn’t there yet contact me!

Type

str, optional

P_loss

Instantaneous fractional power loss due to all maintenance in W/organism

Type

float

add_mechanism(name, val)

Add a mechanism to the dictionary of coping mechanisms.

compute_P_growth(P_supply)

Compute and return the power that can go into growing new biomass from the incoming power supply P_supply in W/cell.

get_P_T()

Calculate the power cost related to temperature and update the net_dict. Make sure you have set Tdef to the defence that you want to compute! Current options are ‘Tijhuis’ (Tijhuis et al 1993), ‘Lever10pc’, ‘Lever2pc’ (both Lever et al 2015) for 10% and 2% racemization replacement respectively. Alternatively, ‘None’ ignores temperature defenses.

get_P_pH()

Calculate the power cost related to pH and update the net_dict. Make sure you have set pHdef to the defence that you want to compute! Currently, only ‘FluxPerm’ is included. Alternatively ‘None’ ignores pH defences.

get_P_store()

Get the net power stored if there is any

get_netdictstr()

Get the net maintenance dictionary as a sring

set_from_netdictstr(netdictstr)

Set the net maintenance dicitonary from a string

update_P_loss(P_supply)

Use the power loss dictionary to get the current total power lost to maintenance.

update_frac_dict(P_supply)

Update the power loss dictionary by expressing it as a fraction of the passed power supply.

NutMEG.culture.base_organism.respirator module

class NutMEG.culture.base_organism.respirator.respirator(host, net_pathway, n_ATP, celldata=[0.0001, 0.004, 0.005, 7.0], name='pathway', xi=1.0, G_net_pathway=None, pathwaytype=None, *args, **kwargs)

Bases: object

Class for implementing respiration in an organism. Uses Jin and Bethke (2007)’s procedure for estimating the rate of nutrient and energy uptake. Can be extended for specific circumstances e.g. methanogenesis.

host

host organism. Ensure that the host organism’s locale object is the reactor you want.

Type

base_organism like

net_pathway

The overall metabolism to use. In any case it is best to pass a reaction like object (reaction or redox) which will then be unified with host.locale. If a string is passed, look in host.locale for the reaction and set that as the pathway.

Type

reaction like or str

n_ATP

Number of moles of ATP yielded per mole of net_pathway.

Type

float

name

Name of the pathway. Default is ‘pathway’, used for selecting the reaction from host.locale if net_pathway is passed as a str.

Type

str, optional

xi

Stoichiometric coefficient. The averge no of times the rate-determining- step has taken place. Default 1.

Type

float, optional

ATP_production

reaction from the porduction of ATP.

Type

`reaction like

G_A

total free energy of the overall catabolic pathway (per molar overall reaction)

Type

float

G_P

total free energy of each ATP producion (per mol of ATP produced)

Type

float

G_C

total free energy to be conserved by catbolism per molar overall reaction

Type

float

F_T

Scaling factor due to thermodynamic effects.

Type

float

rate

the actual reaction rate, corrected for other limiters in the organism.

Type

float

n_P

relative total number of ATP formed per pathway Default 0.0

Type

float, kwarg

n_HR

realative total number of +ve ions transferred across membrane per pathway. Default 0.0

Type

float, kwarg

n_HP

relative total number of H+ ions translocated per ATP synthesis Default 3.0.

Type

float, kwarg

build_ATP_reaction(celldata)

Create a reaction object describing the formation of ATP using cell parameters.

celldata is in the form [activity ADP, activity P, activity ATP, pH]

get_rate()

Update the rate of reaction in the last state this object was left in.

Module contents