Team:Newcastle/Modeling/Population/Pseudo/Bacteria Code

= Cells Pseudo code = This will give a brief outline of what our simulated bacterial cells will do throughout their 'lives'. The life cycles shown here loop continuously, until it has a reason to stop (eg if it is dead).

This will also give a brief description of the methods which are called during the life cycle. Methocs and variables are inherited from the superclass.



Methods

 * takeTurn - allow the cell's states to run their life cycles.
 * hasSufficentFood - check if there is enough food to duplicate.
 * importCadmium - import cadmium from the environment (MntH)
 * exportCadmium - export cadmium to the environment (CadA)
 * importFood - import nutrients from the environment.
 * isLiving - checks to see if it is alive, and using CPU power.
 * log - write timestamped log data to the database.
 * run - run as a thread (ie looping).
 * setState - set a textual representation of the current state of the cell.
 * suicide - death of a cell - makes the thread inactive.

Variables

 * alive - if it is alive or not
 * availableCadmium - cadmium available.
 * availableFood - nutrients available.
 * bugRecord - access to the database record for this cell.
 * canGerminate - if it is a sequestering cell.
 * dao - a database access object.
 * debug - a debug message printer.
 * divideFoodReq - size that the cell needs to grow to do divide.
 * internalCadmium - cadmium inside the cell.
 * internalFood - nutrients inside the cell (used).
 * parent - identification number of parent cell.
 * random - random number generator.
 * x - spacial coordinate.
 * y - spacial coordinate.
 * z - spacial coordinate.

Life Cycle

 * Checks if the current run has been ended.
 * Checks if the cell is going to die from an overdose of cadmium.
 * Imports some nutrients and cadmium, etc from the environment.
 * Checks to see if cadmium has been detected inside the cell.
 * If detected, it will make a decision to be a metal sequestering cell, or not.
 * Runs a JSim instance using parameters from the cell and runs the Sin Operon CellML model.
 * If it is in the 'sporulating' state, advance closer to sporulating.
 * If there is not sufficient nutrients, size, etc to duplicate, it may decide to enter other states such as Biofilm, Motile or Spore.
 * If there is sufficient nutrients, size, etc to duplicate, make a daughter cell
 * Creates a database request that in turn makes Microbase create a new 'job' (cell).

Methods

 * taketurn - perform one loop of life cycle.
 * findSpace - try to find a space to divide into.
 * getSet - various sequestering and sporulating checks.
 * hasCadmiumOD - checks if there is an amount of cadmium in the cell that would kill it.
 * isSequestering - checks if it is going to be sequestering.
 * isSporulating - checks if it is sporulating.
 * isRunOver - checks the database to bee if the run has been terminated.
 * sporulatingTurn - advances through sporulation.
 * willSequester - decides if it is going to sequester cadmium.
 * willSporulate - decides if it will sporulate this turn currently runs JSim model.

Variables

 * allSet - state check.
 * hasSpaceForDaughter - can it divide.
 * isSequestering - if it is sequestering.
 * isSporulating - if it is spourlating.
 * sporeCounter - sporulation stage number.

Life Cycle

 * Checks if the current run has been ended.
 * It may decide to become change back into the vegetative state.

Methods

 * taketurn - perform one loop of life cycle. Decide to vegetate.

Life Cycle

 * Checks if the current run has been ended.
 * It may decide to become change back into the vegetative state.

Methods

 * taketurn - perform one loop of life cycle. Decide to disperse the cells.

Life Cycle

 * Checks if the current run has been ended.
 * If it is able to germinate (ie not a cadmium sequestering spore) and correct conditions.
 * Advance through a germination step.
 * If all germination steps have taken place, change back into the vegetative state.

Methods

 * taketurn - perform one loop of life cycle.
 * isCanGerminate - Checks if the spore can germinate (not a metal sequester spore).
 * willGerminate - Determines if it is to germinate on this turn.

Variables

 * germCounter - germination stage number.