Team:Newcastle/Modeling/Population/Pseudo

= Population modelling overview= This page provides an overview of the code which the Newcastle team has developed for their population simulation model.

Bacterial cells classes

 * See Bacteria Pseudo Code.

For the actual simulation of the bacterial life cycles, we decided to allow each bacterial cell to run as a separate thread. The phenotype of a bacterial cell changes depending on what state they are in, so we decided to have a number of different classes to represent these states. These classes have some common attributes, which can be represented as a superclass in object orientated computing. There is also an additional simple class for easily storing spacial coordinates, ie 3 number values.

Superclass: Subclasses:
 * Cell - contains the common attributes, such as levels of cadmium and nutrients. The Cell class also provides access to the database.
 * Subtilis - represents vegetative cells. From here cells can make various life choices and enter other states accordingly. These can become Spores, Biofilm, Motile, and divide into two.
 * Spore - represents the spore stage of the life cycle. Note that in our project the cells have to choose whether they are going to become a "metal sequestering" spore which cannot germinate.
 * Biofilm - represents the biofilm phenotype of the cells.
 * Motile - represents motility of the cells

Bio-chemical model integration
To split off the code that connects to the JSim application, which runs bio-chemical models, such as the ones that we have written in CellML, we put this code into it's own class, ModelSims. Currently this just uses the Sin Operon Model for influencing sporulation, but this can be easily expanded to cover other aspects of our project which have been modelled, such as metal intake.

This code calls a command line application, jsbatch, with parameters from the bacterial agent cell, parses the JSim output and returns a value which is used by the cell to make decisions. This code is run for each cell thread when it wants to run the appropriate model for the decision that it is currently making.

Database classes
There are a number of classes which deal with communicating with the central database, which stores all of the data about each run of the simulation cell and each cell in that simulation.
 * DAO - a data access object that provides an interface to the database.
 * PopulationDAO - communicates with the table that records data about the current simulation run. This includes all of the parameters such as chances of state changes such as sporulation and germination, various rates of import/export, environment size, etc.
 * BugLog - communicates with the table that records data about all the bacterial cells throughout all of it's life, recording every state change.
 * Bug - communicates with the table that records only the most recent data about all the bacterial cells in each run of the simulation. This includes what state it is in at the moment (eg spore), how much cadmium is contained within, if it can germinate, etc.
 * PendingBug - communicates with the table that records data about bugs that have been created as daughter cells. This is a class which Microbase uses to manage the running of bacterial cells or 'tasks' on many machines.

Microbase classes
Classes written to interface with Microbase include the Responder Implementation. This class manages how the population simulation is run across a distributed system by Microbase.

Appendix

 * Computing Definitions

Throughout this article some programming knowledge is assumed, but here are some selected definitions of terminology:
 * Class - In object orientated programming, such as Java, it is a collection of computer code which is dedicated to one idea or entity. For example a student class may contain information about a student such as their name, date of birth, etc.
 * A Thread of Execution - Inside a computer program or process there may be two or more concurrently running tasks, these tasks, called threads. These threads each compete for time on the computer processor and can communicate with shared objects.
 * Java - One of many object orientated programming languages. Java allows the same code to be run on lots of different types of machines (eg. Windows, Mac or Linux).
 * Database - a collection of data managed by a computer, allowing data access and manipulation.
 * Agent-based model - a computational model for simulating the actions and interactions of autonomous individuals with a view to assessing their effects on the system as a whole.