biolgca 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- biolgca-2.0.0/LICENSE.txt +28 -0
- biolgca-2.0.0/PKG-INFO +364 -0
- biolgca-2.0.0/README.md +324 -0
- biolgca-2.0.0/biolgca.egg-info/PKG-INFO +364 -0
- biolgca-2.0.0/biolgca.egg-info/SOURCES.txt +91 -0
- biolgca-2.0.0/biolgca.egg-info/dependency_links.txt +1 -0
- biolgca-2.0.0/biolgca.egg-info/entry_points.txt +2 -0
- biolgca-2.0.0/biolgca.egg-info/requires.txt +20 -0
- biolgca-2.0.0/biolgca.egg-info/top_level.txt +1 -0
- biolgca-2.0.0/lgca/__init__.py +475 -0
- biolgca-2.0.0/lgca/_warnings.py +34 -0
- biolgca-2.0.0/lgca/base.py +1127 -0
- biolgca-2.0.0/lgca/base_extensions.py +24 -0
- biolgca-2.0.0/lgca/builtin_rules.py +1031 -0
- biolgca-2.0.0/lgca/cells.py +608 -0
- biolgca-2.0.0/lgca/cli.py +584 -0
- biolgca-2.0.0/lgca/cubic_ext.py +266 -0
- biolgca-2.0.0/lgca/examples/__init__.py +187 -0
- biolgca-2.0.0/lgca/examples/_helpers.py +39 -0
- biolgca-2.0.0/lgca/examples/_types.py +19 -0
- biolgca-2.0.0/lgca/examples/aggregation.py +62 -0
- biolgca-2.0.0/lgca/examples/alignment.py +65 -0
- biolgca-2.0.0/lgca/examples/chemotaxis.py +87 -0
- biolgca-2.0.0/lgca/examples/contact_guidance.py +94 -0
- biolgca-2.0.0/lgca/examples/custom_rest_or_align.py +128 -0
- biolgca-2.0.0/lgca/examples/evolutionary_go_and_grow.py +79 -0
- biolgca-2.0.0/lgca/examples/evolutionary_go_or_grow.py +80 -0
- biolgca-2.0.0/lgca/examples/excitable_medium.py +74 -0
- biolgca-2.0.0/lgca/examples/go_and_grow.py +75 -0
- biolgca-2.0.0/lgca/examples/go_or_grow.py +108 -0
- biolgca-2.0.0/lgca/examples/identity_go_and_grow.py +79 -0
- biolgca-2.0.0/lgca/examples/identity_tumor_growth.py +80 -0
- biolgca-2.0.0/lgca/examples/multispecies_birth_death.py +70 -0
- biolgca-2.0.0/lgca/examples/nematic_interaction.py +65 -0
- biolgca-2.0.0/lgca/examples/persistent_movement.py +72 -0
- biolgca-2.0.0/lgca/examples/random_walk.py +63 -0
- biolgca-2.0.0/lgca/examples/tumour_spheroid.py +451 -0
- biolgca-2.0.0/lgca/explorer.py +1023 -0
- biolgca-2.0.0/lgca/fields.py +1848 -0
- biolgca-2.0.0/lgca/ib_base.py +1137 -0
- biolgca-2.0.0/lgca/initializers.py +224 -0
- biolgca-2.0.0/lgca/lattice_state.py +1166 -0
- biolgca-2.0.0/lgca/legacy_names.py +611 -0
- biolgca-2.0.0/lgca/lgca_1d.py +950 -0
- biolgca-2.0.0/lgca/lgca_3dmoore.py +144 -0
- biolgca-2.0.0/lgca/lgca_cubic.py +1119 -0
- biolgca-2.0.0/lgca/lgca_hex.py +519 -0
- biolgca-2.0.0/lgca/lgca_square.py +597 -0
- biolgca-2.0.0/lgca/list_utils.py +31 -0
- biolgca-2.0.0/lgca/mayavi_style.py +360 -0
- biolgca-2.0.0/lgca/model.py +2000 -0
- biolgca-2.0.0/lgca/ms_1d.py +18 -0
- biolgca-2.0.0/lgca/ms_cubic.py +19 -0
- biolgca-2.0.0/lgca/ms_hex.py +18 -0
- biolgca-2.0.0/lgca/ms_moore.py +19 -0
- biolgca-2.0.0/lgca/ms_square.py +19 -0
- biolgca-2.0.0/lgca/multispecies_base.py +206 -0
- biolgca-2.0.0/lgca/mutations.py +275 -0
- biolgca-2.0.0/lgca/nove_base.py +242 -0
- biolgca-2.0.0/lgca/nove_ib_base.py +612 -0
- biolgca-2.0.0/lgca/operator_base.py +283 -0
- biolgca-2.0.0/lgca/operator_registry.py +83 -0
- biolgca-2.0.0/lgca/pipeline.py +1270 -0
- biolgca-2.0.0/lgca/plot_data.py +216 -0
- biolgca-2.0.0/lgca/plots.py +861 -0
- biolgca-2.0.0/lgca/plotting.py +341 -0
- biolgca-2.0.0/lgca/plugins.py +320 -0
- biolgca-2.0.0/lgca/provenance.py +143 -0
- biolgca-2.0.0/lgca/research_models.py +328 -0
- biolgca-2.0.0/lgca/rules.py +710 -0
- biolgca-2.0.0/lgca/schemas/__init__.py +1 -0
- biolgca-2.0.0/lgca/schemas/model-spec-v1.schema.json +361 -0
- biolgca-2.0.0/lgca/simulation.py +900 -0
- biolgca-2.0.0/lgca/square_ext.py +403 -0
- biolgca-2.0.0/lgca/square_plotting.py +677 -0
- biolgca-2.0.0/lgca/study.py +905 -0
- biolgca-2.0.0/lgca/switching.py +471 -0
- biolgca-2.0.0/lgca/testing.py +458 -0
- biolgca-2.0.0/lgca/transaction.py +211 -0
- biolgca-2.0.0/lgca/zoo/__init__.py +55 -0
- biolgca-2.0.0/lgca/zoo/_card.py +78 -0
- biolgca-2.0.0/lgca/zoo/_clones.py +121 -0
- biolgca-2.0.0/lgca/zoo/_geometry.py +27 -0
- biolgca-2.0.0/lgca/zoo/allee_effect.py +151 -0
- biolgca-2.0.0/lgca/zoo/clonal_go_or_grow.py +153 -0
- biolgca-2.0.0/lgca/zoo/evolution_modes.py +182 -0
- biolgca-2.0.0/lgca/zoo/evolving_front.py +207 -0
- biolgca-2.0.0/lgca/zoo/excitable_media.py +183 -0
- biolgca-2.0.0/lgca/zoo/jamming.py +310 -0
- biolgca-2.0.0/lgca/zoo/mutational_meltdown.py +269 -0
- biolgca-2.0.0/lgca/zoo/phenotypic_plasticity.py +223 -0
- biolgca-2.0.0/pyproject.toml +101 -0
- biolgca-2.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2026, Technische Universität Dresden
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
biolgca-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: biolgca
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Biological lattice-gas cellular automata simulation tools
|
|
5
|
+
Author-email: Simon Syga <simon.syga@tu-dresden.de>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/sisyga/biolgca
|
|
8
|
+
Project-URL: Issues, https://github.com/sisyga/biolgca/issues
|
|
9
|
+
Project-URL: Documentation, https://biolgca.readthedocs.io/
|
|
10
|
+
Project-URL: Changelog, https://github.com/sisyga/biolgca/blob/master/CHANGELOG.md
|
|
11
|
+
Keywords: cellular automata,lattice gas,biological modelling,simulation
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE.txt
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Requires-Dist: scipy>=1.12
|
|
26
|
+
Requires-Dist: pyamg>=5.1; python_version < "3.14"
|
|
27
|
+
Requires-Dist: threadpoolctl>=3.0
|
|
28
|
+
Requires-Dist: tqdm>=4.64.1
|
|
29
|
+
Requires-Dist: matplotlib>=3.9
|
|
30
|
+
Requires-Dist: pandas>=2.1
|
|
31
|
+
Requires-Dist: ipywidgets>=8.0
|
|
32
|
+
Provides-Extra: yaml
|
|
33
|
+
Requires-Dist: PyYAML>=6; extra == "yaml"
|
|
34
|
+
Provides-Extra: notebooks
|
|
35
|
+
Requires-Dist: jupyterlab>=4.0; extra == "notebooks"
|
|
36
|
+
Provides-Extra: plot3d
|
|
37
|
+
Requires-Dist: mayavi>=4.9; extra == "plot3d"
|
|
38
|
+
Requires-Dist: PySide6>=6.4; extra == "plot3d"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# BioLGCA
|
|
42
|
+
|
|
43
|
+
[](https://github.com/sisyga/biolgca/actions/workflows/ci.yml)
|
|
44
|
+

|
|
45
|
+
[](https://github.com/sisyga/biolgca/blob/master/LICENSE.txt)
|
|
46
|
+
|
|
47
|
+
**Simulate how cells move, align, grow and evolve, in a few lines of Python.**
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<img src="docs/images/readme/alignment_flux.gif" width="640"
|
|
51
|
+
alt="Cells with random headings align with their neighbours and form moving flocks">
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
BioLGCA implements biological lattice-gas cellular automata (BIO-LGCA). Each
|
|
55
|
+
lattice site, or node, has one channel per direction of movement and optional
|
|
56
|
+
rest channels, so the model tracks how many cells are at each node and where
|
|
57
|
+
they are heading. The rules are local and stochastic, so simulations of large
|
|
58
|
+
lattices are fast and the models can be analysed with mean-field and stability
|
|
59
|
+
methods ([Deutsch et al. 2021](https://doi.org/10.1371/journal.pcbi.1009066)).
|
|
60
|
+
|
|
61
|
+
BioLGCA is for researchers and students in mathematical and theoretical
|
|
62
|
+
biology who model collective cell migration, tissue growth, pattern formation
|
|
63
|
+
or the evolution of cell populations, and for courses that teach these topics.
|
|
64
|
+
|
|
65
|
+
With BioLGCA you can:
|
|
66
|
+
|
|
67
|
+
- combine built-in mechanisms: random walk, alignment, chemotaxis, contact
|
|
68
|
+
guidance, aggregation, birth and death, go-or-grow and phenotype switching;
|
|
69
|
+
- write a new interaction as a decorated Python function and use it like a built-in;
|
|
70
|
+
- track individual cells with heritable traits to study evolution;
|
|
71
|
+
- watch a model run in a notebook while you change its parameters with sliders;
|
|
72
|
+
- run on 1D, square, hexagonal and 3D lattices; and
|
|
73
|
+
- save every model as a JSON file that reruns from its seed with the same data
|
|
74
|
+
(given the same BioLGCA and dependency versions).
|
|
75
|
+
|
|
76
|
+
## Why BioLGCA
|
|
77
|
+
|
|
78
|
+
General-purpose frameworks for cell-based models couple cells to fields in
|
|
79
|
+
many ways: Morpheus and CompuCell3D (cellular Potts models), PhysiCell
|
|
80
|
+
(off-lattice agents) and Chaste (several cell-based model types, including an
|
|
81
|
+
on-lattice cellular automaton). They do not offer the velocity-channel state
|
|
82
|
+
space of LGCA. In this state space, alignment, chemotaxis and go-or-grow
|
|
83
|
+
switching are rules for the reorientation of channel states, and mean-field
|
|
84
|
+
equations can be derived systematically from the rules. BioLGCA provides this
|
|
85
|
+
model class as a library: the rules of the BIO-LGCA literature as composable
|
|
86
|
+
building blocks, a checked contract for new rules, model files that rerun from
|
|
87
|
+
their seed, parameter sweeps, and a [model zoo](https://github.com/sisyga/biolgca/blob/master/docs/source/zoo/index.rst) that
|
|
88
|
+
reproduces published LGCA models with these rules.
|
|
89
|
+
|
|
90
|
+
## Quick start
|
|
91
|
+
|
|
92
|
+
1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/), which
|
|
93
|
+
manages Python and all dependencies for you:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# macOS and Linux
|
|
97
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
98
|
+
# Windows (PowerShell)
|
|
99
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
2. Get BioLGCA and open JupyterLab:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git clone https://github.com/sisyga/biolgca.git
|
|
106
|
+
cd biolgca
|
|
107
|
+
uv sync
|
|
108
|
+
uv run jupyter lab
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If uv reports that it cannot find Python (some Linux distribution packages
|
|
112
|
+
do not download it automatically), run `uv python install` first.
|
|
113
|
+
|
|
114
|
+
3. Paste this into a notebook cell to produce the flocks shown above:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from lgca import get_lgca
|
|
118
|
+
|
|
119
|
+
lgca = get_lgca(geometry="hex", dims=(50, 50), interaction="alignment",
|
|
120
|
+
beta=3, density=0.5, seed=2)
|
|
121
|
+
lgca.timeevo(timesteps=100, record=True)
|
|
122
|
+
lgca.plot_flux() # colour shows the direction of motion
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`beta` sets how strongly cells align with their neighbours. Try `beta=0`
|
|
126
|
+
(no alignment) or `density=0.2` (sparser cells) and run again.
|
|
127
|
+
|
|
128
|
+
## Build a model from mechanisms
|
|
129
|
+
|
|
130
|
+
For a study you will want every assumption written down. A `ModelSpec`
|
|
131
|
+
describes the lattice, initial state, time and seed, and the list of
|
|
132
|
+
interactions. Here cells align with their neighbours and follow an attractant
|
|
133
|
+
gradient; both cues enter one stochastic decision per node:
|
|
134
|
+
|
|
135
|
+
<img src="docs/images/readme/chemotaxis_density.png" width="300" align="right"
|
|
136
|
+
alt="Cells accumulate where the attractant peaks, near x = 40">
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
import numpy as np
|
|
140
|
+
from lgca.model import AnalysisSpec, ModelSpec, SpaceSpec, StateSpec, TimeSpec, run_model
|
|
141
|
+
from lgca.pipeline import (InteractionPipelineSpec, ReorientationSpec,
|
|
142
|
+
ReorientationTermSpec)
|
|
143
|
+
from lgca.simulation import DensityRecorder
|
|
144
|
+
|
|
145
|
+
x = np.arange(50)[:, None] * np.ones((50, 50))
|
|
146
|
+
signal = np.exp(-((x - 40) / 15) ** 2) # attractant peaks at x = 40
|
|
147
|
+
|
|
148
|
+
spec = ModelSpec(
|
|
149
|
+
space=SpaceSpec(geometry="square", dims=(50, 50), boundary="reflecting"),
|
|
150
|
+
state=StateSpec(density=0.5, fields={"signal": signal}),
|
|
151
|
+
time=TimeSpec(steps=100, seed=1),
|
|
152
|
+
dynamics=InteractionPipelineSpec(operators=[
|
|
153
|
+
ReorientationSpec(terms=[ # both cues enter one stochastic decision
|
|
154
|
+
ReorientationTermSpec(name="polar_alignment", beta=1.5),
|
|
155
|
+
ReorientationTermSpec(name="chemotaxis", beta=20, parameters={"field": "signal"}),
|
|
156
|
+
]),
|
|
157
|
+
]),
|
|
158
|
+
analysis=AnalysisSpec(observers=[DensityRecorder()]), # what to record
|
|
159
|
+
)
|
|
160
|
+
result = run_model(spec)
|
|
161
|
+
result.lgca.plot_density()
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Save the model with `save_model_spec(spec, "model.json")` from `lgca.model`.
|
|
165
|
+
Anyone with the same versions of BioLGCA and its dependencies can then rerun it
|
|
166
|
+
from the command line and get identical data:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
uv run biolgca run model.json --output runs/chemotaxis-001
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The run directory contains the resolved model, the BioLGCA version and the
|
|
173
|
+
recorded densities in `measurements.npz`.
|
|
174
|
+
|
|
175
|
+
## Growth and phenotype switching
|
|
176
|
+
|
|
177
|
+
<img src="docs/images/readme/go_or_grow_density.png" width="300" align="right"
|
|
178
|
+
alt="A dense spheroid of cells grown from one node">
|
|
179
|
+
|
|
180
|
+
Interactions can also create and remove cells. In the go-or-grow model, cells
|
|
181
|
+
either migrate or rest and divide, and crowding shifts the balance between them. One
|
|
182
|
+
fully occupied node grows into a spheroid:
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
spec = ModelSpec(
|
|
186
|
+
space=SpaceSpec(geometry="hex", dims=(60, 60)),
|
|
187
|
+
state=StateSpec(
|
|
188
|
+
restchannels=6, # resting cells sit in rest channels, moving cells in velocity channels
|
|
189
|
+
initializer={"name": "region", "parameters": {"extent": 1, "density": 12}},
|
|
190
|
+
),
|
|
191
|
+
time=TimeSpec(steps=90, seed=3),
|
|
192
|
+
dynamics=InteractionPipelineSpec(operators=[
|
|
193
|
+
{"name": "go_or_rest", "parameters": {"kappa": -4, "theta": 0.5}},
|
|
194
|
+
{"name": "go_or_grow.growth", "parameters": {"r_b": 0.2, "r_d": 0.01}},
|
|
195
|
+
{"name": "random_walk", "parameters": {"channels": "velocity"}},
|
|
196
|
+
]),
|
|
197
|
+
)
|
|
198
|
+
run_model(spec).lgca.plot_density()
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
In each step, cells switch between moving and resting and may die; resting
|
|
202
|
+
cells divide, and moving cells pick new directions. With `kappa=-4`, crowded
|
|
203
|
+
cells start moving. With `kappa=4` they rest instead, and the same small colony
|
|
204
|
+
shrinks: growth then needs a minimum population, an Allee effect that emerges
|
|
205
|
+
from the switching rule.
|
|
206
|
+
|
|
207
|
+
<br clear="right">
|
|
208
|
+
|
|
209
|
+
## Write your own interaction
|
|
210
|
+
|
|
211
|
+
A new rule is a Python function of the lattice state. The state offers
|
|
212
|
+
operations with a fixed meaning per cell, such as "every cell dies with
|
|
213
|
+
probability p", which work with and without volume exclusion and for any
|
|
214
|
+
number of species. The decorator registers the rule under its name, with its
|
|
215
|
+
parameters taken from the signature. This rule kills cells more often on
|
|
216
|
+
crowded nodes; the loop compares three death rates:
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
from lgca import interaction
|
|
220
|
+
from lgca.simulation import PopulationRecorder
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
@interaction(kind="birth_death", families=("classical", "nove"))
|
|
224
|
+
def crowding_death(state, r_d=0.1):
|
|
225
|
+
"""Each cell dies with probability r_d * (cells on its node) / (node capacity)."""
|
|
226
|
+
state.remove_cells(r_d * state.density / state.capacity)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
for r_d in (0.0, 0.2, 0.5):
|
|
230
|
+
spec = ModelSpec(
|
|
231
|
+
space=SpaceSpec(geometry="square", dims=(40, 40)),
|
|
232
|
+
state=StateSpec(density=1, restchannels=2),
|
|
233
|
+
time=TimeSpec(steps=100, seed=1),
|
|
234
|
+
dynamics=InteractionPipelineSpec(operators=[
|
|
235
|
+
{"name": "birth_death", "parameters": {"birth_rate": 0.1}},
|
|
236
|
+
crowding_death(r_d=r_d),
|
|
237
|
+
{"name": "random_walk"},
|
|
238
|
+
]),
|
|
239
|
+
analysis=AnalysisSpec(observers=[PopulationRecorder()]),
|
|
240
|
+
)
|
|
241
|
+
result = run_model(spec, showprogress=False)
|
|
242
|
+
print(f"r_d = {r_d}: {result.data['population'][-1]} cells after 100 steps")
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
`lgca.testing.check_interaction(crowding_death)` runs a rule on every lattice
|
|
246
|
+
and model family it claims to support and reports what goes wrong, from lost
|
|
247
|
+
cells to unseeded random numbers. Movement biases are written the same way
|
|
248
|
+
with `@reorientation_term`. The
|
|
249
|
+
[custom interaction guide](https://github.com/sisyga/biolgca/blob/master/docs/source/how_to/custom_interactions.rst) shows
|
|
250
|
+
growth rules, movement biases and a deterministic collision rule; tutorial 6
|
|
251
|
+
shows how to test a rule and share it with a model.
|
|
252
|
+
|
|
253
|
+
## Learn
|
|
254
|
+
|
|
255
|
+
Eight notebooks take you from the first random walk to a reproducible project
|
|
256
|
+
and to cells that act on the molecules around them.
|
|
257
|
+
Each notebook builds its models in visible cells, and CI runs every notebook
|
|
258
|
+
against the current code.
|
|
259
|
+
|
|
260
|
+
| Lesson | You will learn to |
|
|
261
|
+
| --- | --- |
|
|
262
|
+
| [1. Fundamentals](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/01_fundamentals.ipynb) | set up a lattice, run a random walk, compare boundaries and seeds |
|
|
263
|
+
| [2. Collective movement](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/02_collective_movement.ipynb) | compare alignment mechanisms and measure order |
|
|
264
|
+
| [3. Combining cues](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/03_combining_interactions.ipynb) | combine alignment, chemotaxis and contact guidance; sweep parameters |
|
|
265
|
+
| [4. Population dynamics](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/04_population_dynamics.ipynb) | add birth, death and phenotype switching; go-or-grow |
|
|
266
|
+
| [5. Evolutionary LGCA](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/05_evolutionary_lgca.ipynb) | track heritable traits across stochastic replicates |
|
|
267
|
+
| [6. Student project](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/06_student_project.ipynb) | write, test and share your own interaction |
|
|
268
|
+
| [7. Oxygen-limited growth](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/07_oxygen_limited_growth.ipynb) | couple cells to a field they take up; let consumption evolve |
|
|
269
|
+
| [8. Aggregation](https://github.com/sisyga/biolgca/blob/master/docs/source/tutorials/08_aggregation.ipynb) | find the onset of chemotactic aggregation toward a secreted signal, and watch it live |
|
|
270
|
+
|
|
271
|
+
The [example gallery](https://github.com/sisyga/biolgca/blob/master/docs/source/example_gallery.rst) collects further
|
|
272
|
+
ready-to-run models, one per question, and an advanced example: a
|
|
273
|
+
[tumour spheroid](https://github.com/sisyga/biolgca/blob/master/docs/source/examples/tumour_spheroid.ipynb) of proliferating,
|
|
274
|
+
quiescent and necrotic cells in the oxygen they consume, in 2D and 3D, with
|
|
275
|
+
parameters from measurements.
|
|
276
|
+
|
|
277
|
+
## Model types
|
|
278
|
+
|
|
279
|
+
| | Classical | Identity-based (individual cell traits) |
|
|
280
|
+
| --- | --- | --- |
|
|
281
|
+
| **Volume exclusion** (at most one cell per channel) | ✓, also with several species | ✓ |
|
|
282
|
+
| **No volume exclusion** (many cells per channel) | ✓, also with several species | ✓ |
|
|
283
|
+
|
|
284
|
+
All model types run on 1D, square and hexagonal lattices, and on cubic and 3D
|
|
285
|
+
Moore lattices. 3D rendering uses Mayavi, which is optional: install it with
|
|
286
|
+
`uv sync --extra plot3d`.
|
|
287
|
+
|
|
288
|
+
## Other ways to install
|
|
289
|
+
|
|
290
|
+
Without uv, install BioLGCA into any Python 3.11+ environment from PyPI, from a
|
|
291
|
+
clone, or directly from GitHub:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
python -m pip install biolgca # from PyPI; also "biolgca[notebooks]", "[yaml]" or "[plot3d]"
|
|
295
|
+
python -m pip install -e ".[notebooks]" # in the clone
|
|
296
|
+
python -m pip install "biolgca @ git+https://github.com/sisyga/biolgca@develop" # newest development version
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
This picks the newest compatible versions of the dependencies. `uv sync` instead
|
|
300
|
+
installs the exact versions in `uv.lock`, which the test suite runs against.
|
|
301
|
+
The runtime dependencies are NumPy, SciPy, pyamg, threadpoolctl, tqdm,
|
|
302
|
+
Matplotlib, pandas and ipywidgets. To check that the installation works, run
|
|
303
|
+
`biolgca examples list`.
|
|
304
|
+
|
|
305
|
+
## Questions and contributing
|
|
306
|
+
|
|
307
|
+
- **Questions** about using BioLGCA, and **bug reports** and **ideas**: open
|
|
308
|
+
an issue on the [issue tracker](https://github.com/sisyga/biolgca/issues),
|
|
309
|
+
which offers templates for each.
|
|
310
|
+
- **Contributions** are welcome: [CONTRIBUTING.md](https://github.com/sisyga/biolgca/blob/master/CONTRIBUTING.md) explains
|
|
311
|
+
how to set up the development environment, run the tests and the docs
|
|
312
|
+
build, and propose a new interaction.
|
|
313
|
+
- Everyone taking part follows the [code of conduct](https://github.com/sisyga/biolgca/blob/master/CODE_OF_CONDUCT.md).
|
|
314
|
+
|
|
315
|
+
Run the checks from the repository root after `uv sync`:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
uv run pytest -q # test suite
|
|
319
|
+
uv run python docs/build.py # documentation, executes all tutorials
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
User-facing changes are recorded in [CHANGELOG.md](https://github.com/sisyga/biolgca/blob/master/CHANGELOG.md).
|
|
323
|
+
|
|
324
|
+
## History
|
|
325
|
+
|
|
326
|
+
BioLGCA has been developed at TU Dresden since 2018. Until version 2.0, the
|
|
327
|
+
code grew alongside the research that used it, with contributions from the
|
|
328
|
+
people listed under [Acknowledgements](#acknowledgements); it was modernised
|
|
329
|
+
in 2025 and is kept on branch [`v1`](https://github.com/sisyga/biolgca/tree/v1).
|
|
330
|
+
Version 2.0 (2026) rewrote the package around declarative model
|
|
331
|
+
specifications, a rule contract and the model zoo.
|
|
332
|
+
|
|
333
|
+
## Citing
|
|
334
|
+
|
|
335
|
+
If you use BioLGCA in published work, please cite:
|
|
336
|
+
|
|
337
|
+
> Syga S, Nava-Sedeño JM, Deutsch A (2026). A novel cellular automaton approach
|
|
338
|
+
> for modeling genotypic and phenotypic heterogeneity in cell systems.
|
|
339
|
+
> *The European Physical Journal Special Topics*.
|
|
340
|
+
> <https://doi.org/10.1140/epjs/s11734-026-02186-1>
|
|
341
|
+
|
|
342
|
+
The BIO-LGCA modelling class is described in:
|
|
343
|
+
|
|
344
|
+
> Deutsch A, Nava-Sedeño JM, Syga S, Hatzikirou H (2021). BIO-LGCA: A cellular
|
|
345
|
+
> automaton modelling class for analysing collective cell migration.
|
|
346
|
+
> *PLoS Computational Biology* 17(6): e1009066.
|
|
347
|
+
> <https://doi.org/10.1371/journal.pcbi.1009066>
|
|
348
|
+
|
|
349
|
+
## Acknowledgements
|
|
350
|
+
|
|
351
|
+
BioLGCA is maintained by Simon Syga. Bianca Güttner
|
|
352
|
+
([@GuettnerBianca](https://github.com/GuettnerBianca)) co-authored the code
|
|
353
|
+
before 2.0. Code was also contributed by
|
|
354
|
+
[@Franzi2729](https://github.com/Franzi2729),
|
|
355
|
+
Marcus Krellner ([@krelli89](https://github.com/krelli89)),
|
|
356
|
+
Harish P Jain ([@harishpjain](https://github.com/harishpjain)) and Mateo
|
|
357
|
+
Larralde ([@mateolarr](https://github.com/mateolarr)). The models build on
|
|
358
|
+
the BIO-LGCA work of Andreas Deutsch, Josué Manik Nava-Sedeño, Haralampos
|
|
359
|
+
Hatzikirou and colleagues.
|
|
360
|
+
|
|
361
|
+
## License
|
|
362
|
+
|
|
363
|
+
BSD 3-clause, see [LICENSE.txt](https://github.com/sisyga/biolgca/blob/master/LICENSE.txt). Copyright (c) 2018–2026
|
|
364
|
+
Technische Universität Dresden.
|