Work / Case study

Computational biology · 2026

ImmunoMind

Watch innate and adaptive immunity unfold in real time.

ImmunoMind

A textbook can show you a neutrophil. It cannot show you one change its mind. Immunology, as it is usually taught, is a sequence of labelled plates: innate, then adaptive, then memory, as if they were chapters. In a tissue they share the same hour.

A teaching instrument, not a patient

I am a biotechnology student. The gap I kept walking into was not a missing diagram. It was the lack of a system you can perturb. Chemotaxis, phagocytosis, fever, and a drug with a half-life happen together. Students rarely get to add thirty bacteria, withhold the antibiotic, and watch the HUD go from innate to severe.

ImmunoMind is a Python and Pygame simulator for that hour in class. The model is intentionally simplified. If a constant in config.py is round, that is because a round number is teachable. It is not medical software. It will not dose anyone. It will not predict a real infection. E. coli here is a yellow circle with a doubling clock. Say that first, or the rest is dishonest.

The canvas

The world is a two-dimensional vascular field, 1000 by 900 pixels, at 60 frames per second, in a 1400 by 900 window with a 400-pixel HUD. One real second is about one simulated minute; + and - stretch that from 1× to 60×. Red cells drift so the vessel is not an empty dark. Neutrophils and macrophages hunt. Bacteria and viruses divide. Later, T and B lymphocytes, then antibodies. Temperature, phase, and drug concentration sit on the right, where you cannot pretend not to see them.

Innate first. A neutrophil lives about 300 simulated seconds, detects inside a radius of 100 pixels, phagocytoses with probability 0.8, holds about ten prey, and spends about 20 seconds digesting. Macrophages last longer, see farther, eat more. Pathogens binary-divide: bacteria on a 1200-tick clock, viruses on 900, each spending energy to do it. Follow one neutrophil from patrol to death and the abstraction stops being a slide.

Time is the pedagogy

Fever is a function of load. Baseline 37 °C, fever 38.5, cap 42. Adaptive immunity is late on purpose: about 1800 simulated seconds before T and B activation — half an hour of model time, long enough that a first infection is mostly innate. That delay is the lesson. Memory is a second scenario, not a checkbox on the first run.

Drugs are not magic wands. Penicillin, oseltamivir, and acyclovir each have an efficacy, a half-life, and a standard dose. Penicillin is for bacteria (efficacy 0.85, half-life 1800 ticks). The antivirals are for the viral scenario. Concentration decays. One keypress is one dose. Three doses thirty seconds apart is a different experiment from one dose and hope. That is lab 6 in EXPERIMENTS.md, not a feature list.

Four rooms, then the labs

Bacterial: E. coli, innate response, antibiotics. Viral: why penicillin does not help a virus. Vaccine and memory: antibodies and a faster second look. Wound and inflammation: the environment as a variable, not a backdrop. Left click adds pathogens. 1, 2, 3 dose. N recruits neutrophils. E writes a CSV into exported_data/ after at least one log interval (30 simulated seconds). R is the honest kind of undo.

The software is only half of the course. EXPERIMENTS.md is the other half, in Italian and English. First infection: one click, no drugs, clearance in a few simulated minutes. Severe untreated: thirty bacteria and a fever. Early versus late penicillin, with a table of resolution time you can actually reproduce. Pure growth with neutrophils zeroed in config.py. Half-life by reading the HUD with no pathogens in the field, against C(t) = C₀ × 0.5^(t/half-life). Classroom challenges: one dose, thirty bacteria, under five simulated minutes; innate only; a “pandemic” load of fifty.

Batch mode exists because a lab should be able to run replicas. python run_experiment.py --durata 7200 --repliche 10 --seed-base 100 is the line. Seeds are for arguments, not for cinema.

What the model is not

Phagocytosis here is a probability and a timer, not membrane biology. There is no tissue architecture, no MHC, no real pharmacokinetics beyond exponential decay. The in-app wiki is a glossary. The references in the README point at Wikipedia and a Nature Reviews Immunology paper on phagocytosis; they are starting points, not a claim that the simulation implements them.

Python 3.8+, Pygame 2.5.2, MIT, version 1.0.0. If the window stutters, lower the populations in config.py. The parameters are all in one file so a student can change them and own the consequence. That is the whole design.

ImmunoMind is not medical software and is not a clinical predictive model.