- Количество слайдов: 73
Biological and Biomedical Modeling Using Compu. Cell 3 D Tutorial Indiana University Bloomington, Indiana Maciej Swat, James Glazier
Tutorial Goals • Introduce Glazier Graner Hogeweg Model (GGH) aka Cellular Potts Model (CPM) and its potential applications • Introduce Compu. Cell 3 D – GGH based Modeling Environment • Teach how to design, build and run GGH models using Compu. Cell 3 D Recommended but not required: Laptop computer with MS Windows, OS X or latest Ubuntu/Debian Linux
Timeline • • GGH model introduction – 30 minutes Introduction to Compu. Cell 3 D – 40 minutes Demo of Compu. Cell models - 30 minutes Hands on tutorials – 120 minutes
Somitogenesis In most animal species, the anteroposterior (AP) body axis is generated by the formation of repeated structures: segments. The brain, thorax and limbs are formed through segmentation. In vertebrates segmentation, mesodermal structures called somites gives rises to the skeletal muscles, occipital bone, vertebrae, ribs, some dermis and vascular endothelium.
Dictyostelium morphogenesis Slug Formation (from Nick Savill)
Contact Inhibition of Motility “Context-dependent” effect of VEGF-A (Vascularendothelial growth-factor A: stimulates vasculogenesis) • VE-Cadherin clusters at adherens junctions between endothelial cells • VE-Cadherin-binding → dephosporylation of VEGFR-2 • VEGF-A signaling: – in presence of VE-Cadherin: AKT/PKB ↑ • cell survival – In absence of VE-Cadherin: ERK/MAPK ↑ • Actin polymerization: cell motility / filopodia In model: suppress chemotaxis at cell interfaces
Vasculogenesis Roeland Merks, Abbas Shirinifard
Vascular System Development in 3 D Abbas Shirinifard
GGH Model - an Introduction Context • How does the pattern of gene expression act through physical and chemical mechanisms to result in the structures we observe? Genetics is just the beginning. • Same mechanisms occur repeatedly in different developmental examples. • Begin by using phenomenological descriptions. In many cases very complex pathways have fairly simple effects under conditions of interest.
Main Processes in Development • • • Cell Differentiation Cell Polarization Cell Movement Cell Proliferation and Death Cellular Secretion and Absorption
Key Questions Concerning Differentiation • What are the types of cells in a given process? • What signals cause cells to change types? – – Due to diffusible substances? Due to Cell-Cell Contacts? Due to Cell History? Due to Cell-Extracellular Matrix Contact? • What are thresholds for these transitions? • How do these signals interact? • What are the rates or probabilities of these transitions?
Cell Movement and Adhesion • Cells Move Long Distances During Development. • Move by Protruding and Retracting Filopodia or Lamellipodia (Leading Edge) • Shape Changes During Movement May be Random or Directed. • Move By Sticking Selectively to Other Cells (Differential Adhesion) • Move By Sticking to Extracellular Material (Haptotaxis) • Move By Following External Chemical Gradients (Chemotaxis) • Can also have Bulk Movement: • Secretion of ECM • Differential Cell Division • Oriented Cell Division Chemotaxis: Play Movies
Cells Adhesion • Cells of a given type have characteristic adhesion strengths to cells of the same or different types. • The cells comprising an aggregate are motile. • The equilibrium configuration of cells minimizes their interfacial energy summed over all the adhesive contacts in the aggregate.
Key Questions • How strongly do cells of one type adhere to cells of another type? • How strongly do cells of a given type adhere to ECM? • How does cell adhesion change in time?
Cells Send and Respond to Signals—Chemotaxis (Haptotaxis) • Cell moves up (down) a gradient of a diffusible (non-diffusible) chemical. • Cell senses diffusible chemicals through their receptors on surface. • Intracellular signal transduction and cytoskeleton rearrangement.
Regular Chemotaxis Gunther Gerisch (JHU)
Key Questions • How do cells move in response to chemical signals in their environment? • How do cells change type in response to these signals?
Cell Growth and Death • What signals cause cells to grow? • What signals cause cells to die? (In many cases very little cell growth or death during a given developmental phase)
Secretion and Absorption • What chemicals do cells secrete and absorb? • If they diffuse, how rapidly do these chemicals diffuse? • If they do not diffuse, what are their mechanical properties? • How stable are they (what is their decay rate)?
Feedback Loops • Not Simply: Signal Differentiation Pattern (Known as Prepatterning). • Cells Create Their Own Environment, by Moving and Secreting New Signals, so Signaling Feeds Back on Itself. • Hence Self-Organization and Robustness.
Cell-Centered Modeling • Genetics primarily drives the individual cell – Response to extracellular signals; secretion of signaling agents and extracellular matrix proteins. • To understand how genetics drive multicellular patterning, distinguish two questions: – How does genetics drive cell phenomenology? – How does cell phenomenology drive multicellular patterning?
Why a Cell Level Model? • Most mammalian cells are fairly limited in their behaviors. They can: – – – Grow Divide Change Shape Move Spontaneously Move in Response to External Cues (Chemotaxis, Haptotaxis) Stick (Cell Adhesion) Absorb External Chemicals (Fields) Secrete External Chemicals Exert Forces Change their Local Surface Properties (Send Electrical Signals) A long list, but not compared to 1010 gene product interactions. Many cells have relatively simple phenomenological behaviors most of the time.
Physical and Mathematical Background • The Glazier-Graner-Hogeweg Model (GGH) is a Metropolis-Type Lattice-Based Pseudo. Hamiltonian Model • Monte Carlo Methods – Metropolis Algorithm (Statistical Kinetic) • Pseudo-Hamiltonian Lattice-Based Methods – Ising Model
• Monte Carlo Methods Use Statistical Physics Techniques to Solve Problems that are Difficult or Inconvenient to Solve Deterministically. • Two Basic Applications: – Evaluation of Complex Multidimensional Integrals (e. g. in Statistical Mechanics) [1950 s] – Optimization of Problems where the Deterministic Problem is Algorithmically Hard (NP Complete—e. g. the Traveling Salesman Problem) [1970 s]. • Both Applications Important in Biology.
GGH Model Basics Lattice based model where cells are represented as spatially extended objects occupying several lattice sites x 20 Experiment Mathematical/Computer Representation
Cell Id=20 Type Id=1 Cell Id=21 Type Id=2 s(x) –denotes id of the cell occupying position x. All pixels pointed by arrow have same cell id , thus they belong to the same cell Cell Id=25 Type Id=4 Cell Id=23 Type Id=3 t(s(x)) denotes cell type of cell with id s(x). In the picture above blue and yellow cells have different cell types and different cell id. Arrows mark different cell types
Cell motility – GGH dynamics GGH is Monte Carlo algorithm where cells randomly are trying to extend their boundaries by overwriting neighboring pixels. This results in volume increase of expanding cell and volume decrease for cell whose pixel is being overwritten Change pixel Spin copy “blue” pixel (new. Cell) replaces “yellow” pixel (old. Cell)
Not All Pixel Copy Attempts Are Created Equal – Energy of Cellular System GGH Model is based on energy minimization using Metropolis algorithm. Most biological interactions between cells are encapsulated in the Effective Energy, E. • H is generally the sum of many separate terms. • Each term in H encapsulates a single biological mechanism. • Additional Cell Properties described as Constraints. • Metropolis algorithm: probability of configuration change
• The key to the GGH is its use of an Effective Energy or Hamiltonian, H, and Modified Metropolis Dynamics to provide the Cell Lattice Dynamics. • This Dynamics means that cells fluctuate, with an Intrinsic Motility T, representing their cytoskeletally-induced motility. • The Cell Lattice evolves at any time to gradually reduce the Effective Energy with a velocity proportional to the gradient of the Energy (Perfect Damping). For a given DH, the Acceptance Probability is: Y is a Dissipation Threshold. Also introduce concept of Copy or Protrusion Direction , which May Affect the Acceptance Probability.
invalid attempt reject valid attempt accept
Constraints • Most Important Constraints: – Cell Volume – Cell Surface Area • Additional Examples: – Cell Elongation – Viscous Drag
Volume Constraints • Most Cells (except Generalized Cells representing fluid media) have defined volumes. • Provides an easy way to implement Cell growth: • And Cell Death:
Surface Constraints • Many Cells also have defined membrane areas. • The ratio: (d=dimension) controls the Cell’s general shape: • Small R means the Cell is floppy (underinflated basketball) • Large R means the Cell is spherical and rigid.
Field Equations • Most Fields evolve via diffusion, secretion and absorption and cells and by decay. Diffusion Decay Secretion Absorption • Sometimes we couple two or more Fields via Reaction-Diffusion Equations of Form:
In GGH we can couple evolving fields to cell properties/behaviors • Chemotaxis/Haptotaxis • Chemical Concentration Dependent Cell Growth rate - mitosis • Chemical Concentration Dependent Cell Differentiation
Chemotaxis Term – Most Basic Form If concentration at the spin-copy destination pixel (c(xdestination)) is higher than concentration at the spin-copy source (c(xsource)) AND l is positive then DE is negative and such spin copy will be accepted. The cell chemotacts up the concentration gradient C(x) Lower concentration Higher concentration x Chemorepulsion can be obtained by making l negative
Chemotaxis – Example Compu. Cell 3 D simulation
What Is Compu. Cell 3 D? 1. Compu. Cell 3 D is a modeling environment used to build, test, run and visualize GGH-based simulations 2. Compu. Cell 3 D has built-in scripting language (Python) that allows users to quite easily write extension modules that are essential for building sophisticated biological models. 3. Compu. Cell 3 D thus is NOT a specialized software 4. Running Compu. Cell 3 D simulations DOES NOT require recompilation 5. Compu. Cell 3 D model is described using Compu. Cell 3 D XML syntax and in the case of using Python language , a Python script(s) 6. Compu. Cell 3 D platform is distributed with a GUI front end – Compu. Cell Player or simply Player. The Player provides 2 - and 3 -D visualization capabilities. 7. Models developed by one Compu. Cell 3 D user can be “replayed” by another user regardless the operating system/hardware on which Compu. Cell is installed. 8. Compu. Cell 3 D is a cross platform application that runs on Linux/Unix, Windows, Mac OSX
Why Use Compu. Cell 3 D? What Are the Alternatives? 1. Compu. Cell 3 D allows users to set up and run their simulations within minutes, maybe hours. A typical development of a specialized GGH code takes orders of magnitudes longer time. 2. Compu. Cell 3 D simulations DO NOT need to be recompiled. If you want to change parameters (in XML or Python scripts) or logic (in Python scripts) you just make the changes and re-run the simulation. With hand-compiled simulations there is much more to do. Recompilation of every simulation is also error prone and often limits users to those who have significant programming background. 3. Compu. Cell 3 D is actively developed , maintained and supported. On www. compucell 3 d. org website users can download manuals, tutorials and developer documentation. Compu. Cell 3 D has approx. 10 releases each year – some of which are bug-fix releases and some are major 4. Compu. Cell 3 D has many users around the world. This makes it easier to collaborate or exchange modules and results saving time spent on developing new model. 5. The Biocomplexity Institute organizes training workshops and mentorship programs. Those are great opportunities to visit Bloomington and learn biological modeling using Compu. Cell 3 D. For more info see www. compucell 3 d. org
Compu. Cell 3 D Architecture Object oriented implementation in C++ and Python Visualization, Steering, User Interface Python Interpreter Biologo Code Generator Kernel Runs Metropolis Algorithm Plugins Calculate change in energy PDE Solvers Lattice monitoring
Typical “Run-Time” Architecture of Compu. Cell. Player Compu. Cell can be run in a variety of ways: • Through the Player with or without Python interpreter Python • As a Python script Compu. Cell 3 D Kernel Plugins • As a stand alone computational kernel+plugins
Compu. Cell 3 D terminology 1. Pixel-copy attempt is an event where program randomly picks a lattice site in an attempt to copy its value to a neighboring lattice site. 2. Monte Carlo Step (MCS) consists of series pixel-copy attempts. Usually the number of pixel copy-attempts in single MCS is equal to the number of lattice sites, but this is can be customized 3. Compu. Cell 3 D Plugin is a software module that either calculates an energy term in a Hamiltonian or implements action in response to pixel copy (lattice monitors). Note that not all spin-copy attempts will trigger lattice monitors to run. 4. Steppables are Compu. Cell 3 D modules that are run every MCS after all pixelcopy attempts for a given MCS have been exhausted. Most of Steppables are implemented in Python. Most cell behavior alterations are done in steppables 5. Steppers are modules that are run for those pixel-copy attempts that actually resulted in energy calculation. They are run regardless whether actual pixelcopy occurred or not. For example cell mitosis is implemented in the form of stepper. 6. Fixed Steppers are modules that are run every pixel-copy attempt.
Compu. Cell 3 D Terminology – Visual Guide Change pixel Pixel copy - “blue” pixel (new. Cell) replaces “yellow” pixel (old. Cell) 100 x 1 square lattice = 10000 lattice sites (pixels) MCS 21 MCS 22 10000 pixelcopy attempts MCS 23 10000 pixelcopy attempts MCS 24 10000 pixelcopy attempts Run Run Steppables
Nearest neighbors in 2 D and their Euclidian distances from the central pixel 4 4 3 2 4 1 1 4 1 2 1 4 4 3 2 3 3 2 2 4 4 2 D Square Lattice 2 D Hexagonal Lattice Neighbo r Order Number of Neighbors Euclidian Distance Number of Neighbors 1 4 1 6 2 4 3 4 4 8 6 6 12 Euclidian Distance 2 3 4 2 1 1 4 4 3 2 3 4 4 4
Your First Compu. Cell 3 D Simulation – Cell Sorting • Users can describe their simulations using XML, Python, or both XML and Python • Most recent version (development version) of Compu. Cell 3 D has Java interface => support of many scripting languages through Java Script. Engine
def configure. Simulation(sim): import Compu. Cell. Setup ppd=Compu. Cell. Potts. Parse. Data() ppd. Steps(20000) ppd. Temperature(5) ppd. Neighbor. Order(2) ppd. Dimensions(Compu. Cell. Dim 3 D(100, 1)) ctpd=Compu. Cell. Type. Parse. Data() ctpd. Cell. Type("Medium", 0) ctpd. Cell. Type("Condensing", 1) ctpd. Cell. Type("Non. Condensing", 2) cpd=Compu. Cell. Contact. Parse. Data() cpd. Energy("Medium", 0) cpd. Energy("Non. Condensing", 16) cpd. Energy("Condensing", 2) cpd. Energy("Non. Condensing", "Condensing", 11) cpd. Energy("Non. Condensing", "Medium", 16) cpd. Energy("Condensing", "Medium", 16) vpd=Compu. Cell. Volume. Parse. Data() vpd. Target. Volume(25. 0) vpd. Lambda. Volume(1. 0) Configure lattice and general simulation parameters Tell Compucell 3 D what cell types you will use. Remember to list Medium with type id 0 Type Id Type Name
Specifying initial configuration of cells bipd=Compu. Cell. Blob. Initializer. Parse. Data() region=bipd. Region() region. Center(Compu. Cell. Point 3 D(50, 0)) region. Radius(40) region. Types("Condensing") region. Types("Non. Condensing") region. Width(5) Cell types use to fill region Width of a single cell Register Parse. Data objects #remember to register Parse. Data Compu. Cell. Setup. register. Potts(sim, ppd) Register lattice configuration section Compu. Cell. Setup. register. Plugin(sim, ctpd) Compu. Cell. Setup. register. Plugin(sim, cpd) Compu. Cell. Setup. register. Plugin(sim, vpd) Compu. Cell. Setup. register. Steppable(sim, bipd) Register energy functions and cell type specification Register initial configuration steppable
Complete listing def configure. Simulation(sim): import Compu. Cell. Setup ppd=Compu. Cell. Potts. Parse. Data() ppd. Steps(20000) ppd. Temperature(5) ppd. Neighbor. Order(2) ppd. Dimensions(Compu. Cell. Dim 3 D(100, 1)) ctpd=Compu. Cell. Type. Parse. Data() ctpd. Cell. Type("Medium", 0) ctpd. Cell. Type("Condensing", 1) ctpd. Cell. Type("Non. Condensing", 2) cpd=Compu. Cell. Contact. Parse. Data() cpd. Energy("Medium", 0) cpd. Energy("Non. Condensing", 16) cpd. Energy("Condensing", 2) cpd. Energy("Non. Condensing", "Condensing", 11) cpd. Energy("Non. Condensing", "Medium", 16) cpd. Energy("Condensing", "Medium", 16) vpd=Compu. Cell. Volume. Parse. Data() vpd. Lambda. Volume(1. 0) vpd. Target. Volume(25. 0) bipd=Compu. Cell. Blob. Initializer. Parse. Data() region=bipd. Region() region. Center(Compu. Cell. Point 3 D(50, 0)) region. Radius(40) region. Types("Condensing") region. Types("Non. Condensing") region. Width(5) #remember to register Parse. Data Compu. Cell. Setup. register. Potts(sim, ppd) Compu. Cell. Setup. register. Plugin(sim, ctpd) Compu. Cell. Setup. register. Plugin(sim, cpd) Compu. Cell. Setup. register. Plugin(sim, vpd) Compu. Cell. Setup. register. Steppable(sim, bipd) 35 lines of straightforward code vs at least 1000 lines of C++/Java/Fortran code
To finish the simulation code - reuse boiler-plate code from Compu. Cell 3 D examples import sys from os import environ import string sys. path. append(environ["PYTHON_MODULE_PATH"]) import Compu. Cell. Setup sim, simthread = Compu. Cell. Setup. get. Core. Simulation. Objects() configure. Simulation(sim) Compu. Cell. Setup. initialize. Simulation. Objects(sim, simthread) from Py. Steppables import Steppable. Registry steppable. Registry=Steppable. Registry() Compu. Cell. Setup. main. Loop(sim, simthread, steppable. Registry)
Opening a Python-based simulation in the Player Go to File->Open Simulation ; Click Python script “Browse…” button to select python script. Do not forget to check “ Run Python script” checkbox!
Cell-sorting in XML - cellsort_2 D. xml
Exercise 1 • Modify simulation so that cells produce checkerboard pattern
Crawling Neutrophil Chasing Bacterium Richard Firtel (UCSD)
Simulation Building Blocks in Compu. Cell 3 D • Four Cell Types: Bacterium, Macrophage, Wall, Red Blood Cells • Assumption 1: Bacterium secretes chemoattractant (call it ATTR) which diffuses and Macrophage responds to the ATTR gradient • Assumption 2: Macrophage secretes chemorepellant (REPL) which affects Bacterium
ppd=Compu. Cell. Potts. Parse. Data() ppd. Steps(20000) ppd. Temperature(15) ppd. Flip 2 Dim. Ratio(1. 0) ppd. Dimensions(Compu. Cell. Dim 3 D(100, 1)) ctpd=Compu. Cell. Type. Parse. Data() ctpd. Cell. Type("Medium", 0) ctpd. Cell. Type("Bacterium", 1) ctpd. Cell. Type("Macrophage", 2) ctpd. Cell. Type("Wall", 3, True) cpd=Compu. Cell. Contact. Parse. Data() cpd. Energy("Medium", 0) cpd. Energy("Macrophage", 15) cpd. Energy("Macrophage", "Medium", 8) cpd. Energy("Bacterium", 15) cpd. Energy("Bacterium", "Macrophage", 15) cpd. Energy("Bacterium", "Medium", 8) cpd. Energy("Wall", 0) cpd. Energy("Wall", "Medium", 0) cpd. Energy("Wall", "Bacterium", 50) cpd. Energy("Wall", "Macrophage", 50) cpd. Neighbor. Order(2) vpd=Compu. Cell. Volume. Parse. Data() vpd. Lambda. Volume(15. 0) vpd. Target. Volume(25. 0) spd=Compu. Cell. Surface. Parse. Data() spd. Lambda. Surface(4. 0) spd. Target. Surface(20. 0) Make Wall cells frozen
chpd=Compu. Cell. Chemotaxis. Parse. Data() chfield=chpd. Chemical. Field() chfield. Source("Fast. Diffusion. Solver 2 DFE") chfield. Name("ATTR") chbt=chfield. Chemotaxis. By. Type() chbt. Type("Macrophage") chbt. Lambda(2. 0) fdspd=Compu. Cell. Fast. Diffusion. Solver 2 DFEParse. Data() df=fdspd. Diffusion. Field() diff. Data=df. Diffusion. Data() secr. Data=df. Secretion. Data() diff. Data. Diffusion. Constant(0. 1) diff. Data. Decay. Constant(0. 001) diff. Data. Field. Name("ATTR") diff. Data. Do. Not. Diffuse. To("Wall") secr. Data. Secretion("Bacterium", 200) pifpd=Compu. Cell. PIFInitializer. Parse. Data() pifpd. PIFName("bacterium_macrophage_2 D_wall. pif") Compu. Cell. Setup. register. Potts(sim, ppd) Compu. Cell. Setup. register. Plugin(sim, ctpd) Compu. Cell. Setup. register. Plugin(sim, vpd) Compu. Cell. Setup. register. Plugin(sim, spd) Compu. Cell. Setup. register. Plugin(sim, chpd) Compu. Cell. Setup. register. Steppable(sim, pifpd) Compu. Cell. Setup. register. Steppable(sim, fdspd) Chemotaxis: choosing PDE solver and chemical field name Setting chemotacting type and chemotaxis strength Diffusion field ATTR Diffusion and decay constants Preventting ATTR from entering Wall cels Bacterium secretion constant
Exercise 2 - Making simulation look more realistic • Introduce moving Red Blood Cells instead of rigid walls • Make Bacterium small and Macrophage large • Introduce few Macrophages and Bacteria • Introduce new chemorepellant (REP) secreted by Macrophage and afecting bacterium (Exercise 2 a)
Using PIFInitilizer Use PIFInitializer to create sophisticated initial conditions. PIF file allows you to compose cells from single pixels or from larger rectangular blocks The syntax of the PIF file is given below: Cell_id Cell_type x_low x_high y_low y_high z_low z_high Example (file: amoebae_2 D_workshop. pif): 0 amoeba 10 15 0 0 This will create rectangular cell with x-coordinates ranging from 10 to 15 (inclusive), y coordinates ranging from 10 to 15 (inclusive) and z coordinates ranging from 0 to 0 inclusive. 0, 0 Python syntax: pifpd=Compu. Cell. PIFInitializer. Parse. Data() pifpd. PIFName(“amoebae_2 D_workshop. pif")
Let’s add another cell: Example (file: amoebae_2 D_workshop. pif): 0 Amoeba 10 15 0 0 1 Bacteria 35 40 0 0 Notice that new cell has different cell_id (1) and different type (Bacterium) Let’s add pixels and blocks to the two cells from previous example: Example (file: amoebae_2 D_workshop. pif): 0 Amoeba 10 15 0 0 1 Bacteria 35 40 0 0 0 Amoeba 16 16 15 15 0 0 1 Bacteria 35 37 41 45 0 0 To add pixels, start new pif line with existing cell_id (0 or 1 here ) and specify pixels.
This is what happens when you do not reuse cell_id Example (file: amoebae_2 D_workshop. pif): 0 Amoeba 10 15 0 0 1 Bacteria 35 40 0 0 0 Amoeba 16 16 15 15 0 0 2 Bacteria 35 37 41 45 0 0 Introducing new cell_id (2) creates new cell. PIF files allow users to specify arbitrarily complex cell shapes and cell arrangements. The drawback is, that typing PIF file is quite tedious task and , not recommended. Typically PIF files are created using scripts. In the future release of Compu. Cell 3 D users will be able to draw on the screen cells or regions filled with cells using GUI tools. Such graphical initialization tools will greatly simplify the process of setting up new simulations. This project has high priority on our TO DO list.
PIFDumper - yet another way to create initial condition PIFDumper is typically used to output cell lattice every predefined number of MCS. It is useful because, you may start with rectangular cells, “round them up” by running Compu. Cell 3 D , output cell lattice using PIF dumper and reload newly created PIF file using PIFInitializer. pifpd=Compu. Cell. PIFDumper. Parse. Data() pifpd. PIFName(“amoebae. 100. pif") pifpd. frequency=100 Above syntax tells Compu. Cell 3 D to store cell lattice as a PIF file every 100 MCS. The files will be named amoebae. 100. pif , amoebae. 200. pif etc… To reload file , say amoebae. 100. pif use already familiar syntax: pifpd=Compu. Cell. PIFInitializer. Parse. Data() pifpd. PIFName(“amoebae. 100. pif")
Writing Python Extension Modules for Compu. Cell 3 D • Most of Compu. Cell 3 D simulations will require certain level of customization. • Using “traditional” approach , this would be done in C++/Java/Fortran and would require recompilation • Compu. Cell 3 D allows users to conveniently develop their own extension modules using Python that DO NOT NEED to be recompiled • Typically users develop steppable modules (called every MCS) which alter cellular behavior as simulation progresses.
Printing information about all the cells present in the simulation class Info. Printer. Steppable(Steppable. Py): def __init__(self, _simulator, _frequency=10): Steppable. Py. __init__(self, _frequency) self. simulator=_simulator self. inventory=self. simulator. get. Potts(). get. Cell. Inventory() self. cell. List=Cell. List(self. inventory) def step(self, mcs): for cell in self. cell. List: print "CELL ID=", cell. id, " CELL TYPE=", cell. type, " volume=", cell. volume Class constructor – used to initialize Steppable object. Creating iterable cell inventory Iterating through cell inventory and printing basic cell information Code of the constructor is a boiler-plate code and typically is reused without any alterations in many steppables.
class Info. Printer. Steppable(Steppable. Py)………… #include earlier code def configure. Simulation(sim)……………. . #include earlier code #import useful modules import sys from os import environ from os import getcwd import string #setup search patths sys. path. append(environ["PYTHON_MODULE_PATH"]) sys. path. append(getcwd()+"/demo") #add search path import Compu. Cell. Setup sim, simthread = Compu. Cell. Setup. get. Core. Simulation. Objects() Compu. Cell. Setup. initialize. Simulation. Objects(sim, simthread) #Add Python steppables here steppable. Registry=Compu. Cell. Setup. get. Steppable. Registry() info. Printer. Steppable=Info. Printer. Steppable(_simulator=sim, _frequency=10) steppable. Registry. register. Steppable(info. Printer. Steppable) Compu. Cell. Setup. main. Loop(sim, simthread, steppable. Registry)
Info Printer results
Exercise 3 • Enhance cell-sorting simulation by writing a Python steppable that at the beginning of the simulation assigns Type ID=1 to cells in the upper half of the lattice and Type ID=2 to cells in the lower half of the lattice. Hint: you have to include compd=Compu. Cell. Center. Of. Mass. Parse. Data() To ensure that Compu. Cell 3 D updates COM position for each cell: center. Of. Mass. X = cell. x. CM / float(cell. volume)
Exercise 4 • For cell-sorting simulation, write Python Steppable that every 100 MCS switches cell types 2 -> 1 and 1 ->2
Summary • Compu. Cell 3 D is indeed environment rather than specialized program • It can be extended by writing modules in Python, C++, Java. • Actively developed and supported • Annual Training Workshops in Bloomington, Indiana • www. compucell 3 d. org