SyMBac.cell
- class SyMBac.cell.Cell(length, width, resolution, position, angle, space, dt, growth_rate_constant, max_length, max_length_mean, max_length_var, width_var, width_mean, parent=None, daughter=None, lysis_p=0, pinching_sep=0)[source]
Cells are the agents in the simulation. This class allows for instantiating Cell object.
Note
Typically the user will not need to call this class, as it will be handled by
SyMBac.cell_simulation()
, specifically all cell setup happens when instantiating a simulation usingSyMBac.simulation.Simulation()
- __init__(length, width, resolution, position, angle, space, dt, growth_rate_constant, max_length, max_length_mean, max_length_var, width_var, width_mean, parent=None, daughter=None, lysis_p=0, pinching_sep=0)[source]
Initialising a cell
For info about the Pymunk objects, see the API reference. http://www.pymunk.org/en/latest/pymunk.html Cell class has been tested and works with pymunk version 6.0.0
- Parameters
length (float) – Cell’s length
width (float) – Cell’s width
resolution (int) – Number of points defining cell’s geometry
angle (float) – rotation in radians of cell (counterclockwise)
space (pymunk.space.Space) – The pymunk space of the cell
dt (float) – Timestep the cell experiences every iteration
growth_rate_constant (float) – The cell grows by a function of dt*growth_rate_constant depending on its growth model
max_length (float) – The maximum length a cell reaches before dividing
max_length_mean (float) – should be the same as max_length for reasons unless doing advanced simulations
max_length_var (float) – The variance defining a normal distribution around max_length
width_var (float) – The variance defining a normal distribution around width
width_mean (float) – For reasons should be set equal to width unless using advanced features
body (pymunk.body.Body) – The cell’s pymunk body object
shape (pymunk.shapes.Poly) – The cell’s pymunk body object
ID (int) – A unique identifier for each cell. At the moment just a number from 0 to 100_000_000 and cross fingers that we get no collisions.
- create_pm_cell()[source]
Creates a pymunk (pm) cell object, and places it into the pymunk space given when initialising the cell. If the cell is dividing, then two cells will be created. Typically this function is called for every cell, in every timestep to update the entire simulation.
Note
The return type of this function is dependent on the value returned by
SyMBac.cell.Cell.is_dividing()
. This is not good, and will be changed in a future version.- Returns
If
SyMBac.cell.Cell.is_dividing()
returns True, then a dictionary of values for the daughter cell is returned. A daughter can then be created. E.g:>>> daughter_details = cell.create_pm_cell() >>> daughter = Cell(**daughter_details)
If
SyMBac.cell.Cell.is_dividing()
returns False, then only a tuple containing (pymunk.body, pymunk.shape) will be returned.- Return type
dict or (pymunk.body, pymunk.shape)
- get_angle()[source]
Gets the angle of the cell’s pymunk body.
- Returns
angle – The cell’s angle in radians.
- Return type
- get_centroid()[source]
Calculates the centroid of the cell from the vertices.
- Returns
centroid – The cell’s centroid in coordinates relative to the pymunk space which the cell exists in.
- Return type
- get_vertex_list()[source]
Calculates the vertex list (a set of x,y coordinates) which parameterise the outline of the cell
- is_dividing()[source]
Checks whether a cell is dividing by comparing its current length to its max length (defined when instnatiated).
- Returns
output – True if
self.length > self.max_length
, else False.- Return type
- update_length()[source]
A method, typically called every timepoint to update the length of the cell according to
self.length = self.length + self.growth_rate_constant*self.dt*self.length
.Contains additional logic to control the amount of cell pinching happening according to the difference between the maximum length and the current length.
- Return type
None
- update_parent(parent)[source]
- Parameters
parent (
SyMBac.cell.Cell
) – The SyMBac cell object to assign as the parent to the current cell.- Return type
None