Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Versions follow [semantic versioning](https://semver.org). While the version is 0.x the project is in early development: anything may change from one version to the next, configurations and results included. Each version says what changed in what a run does, so that a result can be tied to the version that produced it.

## Unreleased

- **A fuller cell.** `examples/networks/fuller-cell.toml` fills in what the RAS/ERK network and the stress response leave out: EGFR, RAF and MEK before ERK; cyclin D, RB, E2F, cyclin E and the brake p27 between hypoxia and the arrest; MDM2, p21 and BAX around p53. Its rates are set so that a cell asks for the same size, stops dividing at the same oxygen, dies of anoxia at the same oxygen and of a stress at the same rate as in the simpler networks, which tests hold (chapter 28). `spheroid-fuller.toml` and `cord-stress-fuller.toml` run it. Under a stress the cord dies out where the simpler one holds, through p21. No other run changes.
- **A term that switches off.** `inhibited_by` joins the catalogue of terms, the mirror of `activated_by`: `- rate * source * self`. No run changes.
- **One cell opened.** In the viewer, a click on a cell opens a window that draws its network as it stands, what it reads, and what it decides; `--open`, `--open-at`, `--follow`, `--protein` and `--window` do the same from the command line, for recordings. The camera turns only while the window has the pointer and the focus.
- **Networks by name.** `cellweave_io::shipped_network` reads a network shipped under `examples/networks`, such as `fuller-cell`, with everything it extends, from copies compiled into the program, so that a program built on cellweave carries it without the repository beside it. No run changes.
- **The course.** Chapter 28 is the fuller cell and the window; what the model does not say is now chapter 29.

## 0.2.0 (2026-11-01)

A tissue that grows in a volume, and a spheroid in it that stops near the size measured spheroids reach, once its dead core breaks down and the medium of its well is still. Experimental.
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ cargo run --release -- --config ../examples/epithelium-mutating.toml --view clon

Space pauses, N takes one step, R restarts, H flattens the relief, A turns the camera, the mouse turns and zooms it. The panel colours the cells by fate, protein, oxygen, stress, the call for vessels, clone or blood flow, and plots the population as it goes.

A click on a cell opens it. A window draws the cell's network as it stands, every protein at its level and every link as thick as it is pushing, says in words what the cell does with them and why, and colours the tissue by any protein clicked. `spheroid-fuller.toml` is the calibrated spheroid with a fuller cell: eighteen proteins, from the growth factor's receptor through RAF and MEK to the cell cycle, and from damage through p53, MDM2, p21 and BAX to apoptosis, tuned to decide where the simpler network does ([chapter 28](docs/28-inside-one-cell.md)). This opens the cell at its centre at step 300 and follows it as it is arrested and starved:

```bash
cargo run --release -- --config ../examples/spheroid-fuller.toml --open 400,400 --open-at 300 --follow --zoom 3
```

`--record <dir>` saves every step as an image, taken from what the viewer draws rather than from the screen, and `--until <step>` stops there; with `--no-panel`, `--spin` and `--batch <steps>`, that is how the animations above were made:

```bash
Expand All @@ -92,11 +98,11 @@ ffmpeg -framerate 30 -pattern_type glob -i 'frames/*.png' run.mp4

## Learn how it works

[The course](docs/README.md) explains the program from the biology up, in 28 chapters, each answering one question: what a thing is in the body, what cellweave makes of it, which choices were made and why, where in the code it lives, and what is still a placeholder. It is kept in step with the code, and its last chapter lists what the model does not say.
[The course](docs/README.md) explains the program from the biology up, in 29 chapters, each answering one question: what a thing is in the body, what cellweave makes of it, which choices were made and why, where in the code it lives, and what is still a placeholder. It is kept in step with the code, and its last chapter lists what the model does not say.

## Under the hood

Rust, in four crates whose dependency graph enforces the layering: `cellweave-core` (types, no I/O, no computation), `cellweave-engine` (the lattice, the networks, the fields, the loop), `cellweave-io` (configuration and output) and the command line; the viewer sits on top in a workspace of its own. The same seed gives the same run, byte for byte, on any machine and any number of threads, and the CI checks it on every push, with fmt, clippy, docs, 209 tests green on Linux, macOS and Windows, the oldest supported Rust, and `cargo-deny`.
Rust, in four crates whose dependency graph enforces the layering: `cellweave-core` (types, no I/O, no computation), `cellweave-engine` (the lattice, the networks, the fields, the loop), `cellweave-io` (configuration and output) and the command line; the viewer sits on top in a workspace of its own. The same seed gives the same run, byte for byte, on any machine and any number of threads, and the CI checks it on every push, with fmt, clippy, docs, 223 tests green on Linux, macOS and Windows, the oldest supported Rust, and `cargo-deny`.

```bash
cargo fmt --all -- --check
Expand Down
15 changes: 15 additions & 0 deletions crates/core/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ pub enum Term {
#[serde(default)]
hill: Option<Hill>,
},
/// `- rate * source * self`, Hill in place of `source` when `hill` is set.
/// The source switches this node off, in proportion to how much there is
/// of each: MDM2 marking p53 for destruction, a cyclin-dependent kinase
/// phosphorylating RB. The mirror of `ActivatedBy`, and like it the usual
/// shape of one protein acting on another, here to undo it.
InhibitedBy {
/// Node or input that switches it off.
source: String,
/// How fast, per unit time.
rate: f64,
/// Cooperative response instead of a proportional one.
#[serde(default)]
hill: Option<Hill>,
},
/// `rate * (1 - source) * (1 - self)`. The node accumulates when the source
/// is scarce: HIF-1α as oxygen falls, whose destruction slows rather than
/// whose production rises.
Expand Down Expand Up @@ -125,6 +139,7 @@ impl Term {
pub fn source(&self) -> Option<&str> {
match self {
Self::ActivatedBy { source, .. }
| Self::InhibitedBy { source, .. }
| Self::ActivatedByAbsenceOf { source, .. }
| Self::ProducedBy { source, .. }
| Self::DamagedBelow { source, .. }
Expand Down
21 changes: 20 additions & 1 deletion crates/engine/src/coupling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use crate::cpm::{CpmLattice, OBSTACLE};
use crate::pde::ScalarField;
use cellweave_core::{CellKind, DiffusionField};
use cellweave_core::{CellId, CellKind, DiffusionField};

/// Whether a cell of this kind draws on the field at all. A dead cell does
/// not, and neither does one breaking up in apoptosis.
Expand Down Expand Up @@ -181,6 +181,25 @@ pub fn mean_per_cell(field: &ScalarField, lattice: &CpmLattice) -> Vec<f64> {
.collect()
}

/// The mean of `field` over the pixels of one cell, or zero for a cell that
/// holds none: [`mean_per_cell`] for a single cell, as a picture of one cell
/// asks for it.
pub fn mean_in(field: &ScalarField, lattice: &CpmLattice, id: CellId) -> f64 {
let (sum, count) = lattice
.grid
.iter()
.enumerate()
.filter(|&(_, &occupant)| occupant == id.0)
.fold((0.0, 0u32), |(sum, count), (i, _)| {
(sum + field.value_at(i), count + 1)
});
if count == 0 {
0.0
} else {
sum / f64::from(count)
}
}

#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub mod vessels;
pub use cpm::CpmLattice;
pub use evolution::CloneRecord;
pub use measure::{DEPTH_SHARE, Measurements};
pub use network::{Mutation, Network};
pub use network::{Influence, Mutation, Network};
pub use pde::ScalarField;
pub use simulation::{Fate, Scenario, Simulation};
pub use sisters::SisterFates;
Expand Down
Loading
Loading