Files
organism/neuron/appunti/2026-03-16-nuovo-modello-tripartita-semplificato.md
T
2026-03-21 18:41:37 +01:00

321 lines
18 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# The Biological "Cascade of Failure"
This model now demonstrates **Metabolic Silencing**, which is a highly consistent biological behavior:
1. High firing rate → **Vesicle Depletion** (Fast).
2. High firing rate → **ATP Depletion** (Slow).
3. Low ATP → **Pump Failure** (JPMCA slows down).
4. Pump Failure → **Residual Calcium** stays high.
5. Residual Calcium → **CDI stays active** (The VGCCs lock shut).
6. **Result:** The synapse stops firing to save itself from excitotoxicity.
**CASCADE 1 — Vesicle Depletion** appears at `Max_RRP`, `Max_RP`, `p_release_base`, `k_rec_fast/slow`, `stochastic_release`, `map_trace_to_speed`, and the recruitment block in Loop 1. The key annotation explains the asymmetry: `p_release_base * Ca_micro` makes each spike draw *more* vesicles as Ca_micro rises early in a burst — a positive feedback that accelerates the collapse before recruitment can respond.
**CASCADE 2 — ATP Depletion** is anchored at `Glucose_level` (the root input) and at `compute_astrocyte_metabolic_health` in Loop 3, where it explains that `ATP_level` is the bridge variable that carries minute-scale metabolic state into the millisecond Ca²⁺ world.
**CASCADE 3 — Pump Failure** is annotated at `k_PMCA`, `k_NCX`, `k_SERCA`, `ATP_half`, and `compute_pump_atp_factor`. The NCX comment explicitly notes its role as a floor-not-rescue — it keeps clearing during failure and enables the auto-reset, but cannot prevent accumulation alone.
**CASCADE 4 — Residual Ca²⁺** appears at `B_total`, `tau_buffer_rebind`, the `capture_fraction` block, and the buffer recharge lines. The buffer saturation note explains the two-phase dynamic: buffer is protective early but becomes invisible once `B_free → 0`.
**CASCADE 5 — CDI Lock-out** is annotated at `k_CDI_rise`, `Ca_micro_saturation`, `k_CDI_rec`, and both the rise and recovery lines in Loop 1. The recovery comment spells out the self-locking logic explicitly as a chain.
**CASCADE 6 — Silence** sits at `effective_conductance` with a timing note showing that mGluR fires first, eCB second, and CDI last but irreversibly. The eCB and mGluR annotations in Loop 2 explain their roles as early partial brakes versus the terminal lock.
## 5. Model Summary Checklist
- \[x\] **Timing:** Spans 0.1 ms (AP) to 300,000 ms (Metabolism).
- \[x\] **Conservation:** Vesicles and Neurotransmitters are conserved through the Gln→RP→RRP→Cleft→Astro loop.
- \[x\] **Stability:** CDI and mGluR/eCB provide three layers of negative feedback to prevent runaway excitation.
- \[x\] **Resource Constraints:** ATP and Pool guards prevent physically impossible negative values or infinite accumulation.
---
This pseudocode serves as a comprehensive blueprint for a biologically consistent tripartite synapse. It is structured into three nested temporal loops to handle the transition from microseconds to minutes.
---
### **Variable Reference Table**
| Variable | Definition | Scale | Role |
|---------------|------------------------------------|--------|-----------------------------|
| **Ca_micro** | Free calcium in the active zone | 0.1 ms | Triggers release and CDI |
| **B_free** | Available buffer sites (Calbindin) | 0.1 ms | Immediate calcium "sponge" |
| **N_RRP** | Readily Releasable Pool | 1 ms | Immediate vesicle supply |
| **N_RP** | Reserve Pool | 100 ms | Long-term vesicle warehouse |
| **Tr_Ca** | Calcium Trace | 10 ms | Memory of recent activity |
| **CDI_fac** | Inactivation Factor | 50 ms | Internal negative feedback |
| **mGluR_pre** | Autoreceptor activation | 500 ms | Cleft-sensing inhibition |
| **ATP_level** | Metabolic energy state | 1 min | Gates calcium clearance |
### **The Multi-Scale Engine**
```python
# --- SIMULATION CONFIGURATION ---
# dt = 0.1 ms (Fine-grained step)
# Total_Time = 300,000 ms (5 minutes)
while t < Total_Time:
# ============================================================
# 1. FINE-GRAINED NEURAL LOOP (Every 0.1ms)
# Handles: Electrical spikes, Buffering, and Influx
# ============================================================
# --- ACTION POTENTIAL & WAVEFORM ---
if is_AP_active(t):
# Layered Inhibition logic:
# CDI (Internal), eCB (Retrograde/Post), mGluR (Autoreceptor/Cleft)
total_inhibition = (1 - CDI_fac) * (1 - eCB_level) * (1 - mGluR_pre * alpha_mGluR)
# Calculate Influx via VGCC
# V_pre_pulse(t) accounts for the finite duration of the spike window
raw_influx = N_VGCC * total_inhibition * V_pre_pulse(t)
# --- FAST BUFFERING BEHAVIOR ---
# Immediate capture of influx by buffer proteins (e.g., Calbindin)
captured = raw_influx * (B_free / B_total)
B_free = max(0, B_free - captured)
Ca_bound += captured
# Resulting free Calcium that actually reaches the sensors
Ca_micro += (raw_influx - captured)
# --- STOCHASTIC RELEASE ---
if N_RRP > 0:
# Release probability is a function of Ca_micro
p_release = compute_stochastic_p(Ca_micro, N_RRP)
if random_uniform(0, 1) < p_release:
N_RRP -= 1 # Deplete one vesicle
Glu_cleft += 1 # Release NT into cleft
CDI_fac += k_CDI_rise # Increment inactivation per release
# --- CONTINUOUS CALCIUM CLEARANCE ---
# NCX (Sodium-Calcium Exchanger) - Fast, gradient driven
# PMCA (Plasma Membrane Ca-ATPase) - Slow, ATP dependent
atp_efficiency = ATP_level**2 / (ATP_level**2 + 0.3**2)
cleared = (k_NCX * Ca_micro) + (k_PMCA * Ca_micro * atp_efficiency)
Ca_micro = max(0.0, Ca_micro - cleared)
# --- RECOVERY MECHANISMS ---
# CDI Recovery: Decay of inactivation as Ca_micro falls
CDI_fac = max(0.0, CDI_fac - (dt / tau_CDI_rec))
# Buffer Recovery: Re-release of bound ions into microdomain
re_release = Ca_bound * (dt / tau_buf_release)
Ca_bound -= re_release
Ca_micro += re_release
B_free = B_total - Ca_bound
# ============================================================
# 2. MID-GRAINED INTEGRATION (Every 10ms - 100ms)
# Handles: Recruitment Traces and Autoreceptor Feedback
# ============================================================
if t % 10 == 0:
# TRACE INTEGRATOR: The memory of recent spikes
Tr_Ca = update_leaky_integrator(Tr_Ca, Ca_micro, tau_trace)
# RECRUITMENT LOGIC (RP -> RRP)
# Recruitment speed (k_rec) scales non-linearly with Tr_Ca
k_rec = compute_k_rec(Tr_Ca)
# Apply HARD CAPS and GUARDS:
# 1. Cannot take more than what is in RP
# 2. Cannot exceed the ceiling of RRP
refill_qty = k_rec * N_RP * (Max_RRP - N_RRP)
refill_qty = max(0, min(refill_qty, N_RP))
N_RRP += refill_qty
N_RP -= refill_qty
# AUTORECEPTOR FEEDBACK: Presynapse sensing its own NT
mGluR_pre += (Glu_cleft / (Glu_cleft + Km) - mGluR_pre) * (10 / tau_mGluR)
# ============================================================
# 3. COARSE-GRAINED METABOLIC LOOP (Every 1s - 1min)
# Handles: Astrocyte support, eCB Brake, and Sustainability
# ============================================================
if t % 1000 == 0:
# ASTROCYTE GLUTAMATE CLEARANCE
# Astrocytes clean the cleft; NT is recycled into the Glutamine pool
cleared_glu = Glu_cleft * EAAT_clearance_rate
Glu_cleft -= cleared_glu
Gln_pool += cleared_glu
# RETROGRADE BRAKE (eCB from Postsynapse)
# Postsynapse synthesizes eCB based on its own V_post activity
eCB_level = update_retrograde_brake(V_post_history)
# METABOLIC REPLENISHMENT
# Astrocyte health determines ATP; Glutamine refills the Reserve Pool
ATP_level = compute_atp_from_astro_health(Gln_pool, Metabolic_State)
# Long-term Refill of the Reserve Pool (The Warehouse)
N_RP = min(N_RP + (Gln_pool * metabolic_shuttle_rate), Max_RP)
Gln_pool *= 0.9 # Account for metabolic overhead/loss
t += dt # Increment simulation time
```
---
### 3. Biological Consistency Summary
1. **Metabolic Coupling:** The `atp_efficiency` variable creates a physical link between the 5-minute astrocyte clock and the 0.1ms calcium clock. If the astrocyte is exhausted, the pumps fail, and the `CDI_fac` locks the synapse into **silence**.
2. **Double-Lock Inhibition:** You have two distinct brakes. The `mGluR_pre` is "homosynaptic" (local self-check), while the `eCB_level` is "heterosynaptic" (feedback from the receiver). This prevents runaway excitation and excitotoxicity.
3. **Conservation of Mass:** Neurotransmitters follow a closed loop: `Gln_pool` -> `N_RP` -> `N_RRP` -> `Glu_cleft` -> `Astrocyte` -> `Gln_pool`.
4. **Buffer Buffer:** The `B_free` mechanism prevents numerical instability during high-frequency bursts by absorbing excess calcium influx instantly.
---
The missing presynaptic behaviors are:
1. **Ca²⁺ clearance** (PMCA, NCX pumps) — without this, Ca²⁺ accumulates indefinitely
2. **Calcium buffer proteins** (calbindin, calmodulin) — fast buffering before pumps clear
3. **VGCC inactivation recovery** — CDI is mentioned but the recovery (de-inactivation) is missing
4. **RRP hard cap** — the refill logic can overshoot without a ceiling
5. **Reserve Pool (RP) depletion guard** — refill can go negative
6. **Presynaptic autoreceptors** (mGluR/CB1R feedback closing the loop from NT in cleft → presynaptic suppression) — separate from eCB which comes from postsynapse
7. **Spike refractory / AP waveform duration** — the effective window for Ca²⁺ entry is finite
Let me build an annotated code diagram and then write the enhanced model.Here is a full analysis of every missing loop, followed by the updated code for each section.
![image.png](.attachments.1175009/image.png)
---
## Missing behaviors and the reasoning behind each
**Why Ca²⁺ clearance is the most critical gap.** `Ca_micro` currently has no exit route — it only grows. Without PMCA pumps, NCX exchangers, and SERCA (ER uptake), every spike leaves residual Ca²⁺ that accumulates across the simulation and eventually locks the synapse in a permanently over-activated (or CDI-locked) state. The clearance mechanisms also run at different speeds: NCX is fast (tens of ms), PMCA is slower but higher-capacity, SERCA is slowest and stores calcium for later use as an internal buffer.
**Why Ca²⁺ buffer proteins must precede clearance.** Calbindin and calmodulin bind free Ca²⁺ within microseconds and act as a fast, temporary "sponge". They blunt the initial `Ca_micro` peak, protecting against excess CDI. They also slowly release Ca²⁺ back into the cytosol, which feeds the trace integrator more smoothly. Without buffers, the microdomain pulse is unrealistically sharp.
**Why CDI recovery closes a loop without itself.** The model already writes `CDI_factor` but never resets it. A VGCC that inactivated on spike N stays inactivated on spike N+1. CDI recovery is simply a decay back toward zero, with a time constant of \~100 ms, driven by Ca²⁺ falling (i.e., it depends on clearance — another reason clearance comes first).
**Why mGluR autoreceptors are needed.** The eCB pathway is a *retrograde* signal synthesized by the *postsynapse*. But the presynapse also has its own direct cleft-sensing system: presynaptic mGluR2/3 receptors bind glutamate in the cleft and suppress VGCC conductance and cAMP. This is a homosynaptic feedback loop that is entirely local to the presynapse and missing from the current model.
**Why pool guards matter.** The `refill_amount` calculation can produce `N_RP < 0` if `current_recruitment_rate * N_RP > N_RP`. The `N_RRP` overshoot is subtler but also real: if two slow-loop updates stack before the fast loop consumes RRP, you can exceed `Max_RRP`.
---
## Updated code, section by section
### Loop 1A — Ca²⁺ dynamics (replaces the current `Ca_micro +=` block)
```python
# --- PRESYNAPTIC Ca2+ DYNAMICS ---
if V_pre == 1: # AP arrives
effective_conductance = N_VGCC * (1 - eCB_level) * (1 - CDI_factor)
raw_influx = compute_flux(effective_conductance, V_pre_voltage)
# ADDED: Buffer proteins capture a fraction of influx immediately.
# Buffering capacity (B_free) depletes on capture, recovers slowly.
# VARIABLE: B_free free buffer sites (calbindin/calmodulin)
# TIMING: rebinds saturated buffer in ~200 ms
captured = raw_influx * (B_free / B_total) # fraction caught
B_free = max(0, B_free - captured) # buffer saturates
Ca_micro += (raw_influx - captured) # only free Ca2+ counts
# --- ADDED: Ca2+ CLEARANCE (runs every ms, not just on spike) ---
# Three parallel mechanisms, each with its own rate constant:
# k_PMCA ~0.03 /ms (plasma membrane Ca-ATPase, ATP-dependent)
# k_NCX ~0.10 /ms (sodium-calcium exchanger, voltage-sensitive, fast)
# k_SERCA ~0.01 /ms (ER pump, slowest, fills internal Ca2+ store)
# ADDED: ATP gates pump speed — shared with metabolic loop below
pump_scale = compute_pump_atp_factor(ATP_level) # 0→1
cleared_PMCA = k_PMCA * Ca_micro * pump_scale
cleared_NCX = k_NCX * Ca_micro # NCX is not ATP-dependent
cleared_SERCA = k_SERCA * Ca_micro * pump_scale
Ca_micro -= (cleared_PMCA + cleared_NCX + cleared_SERCA)
Ca_micro = max(0.0, Ca_micro) # hard floor
# ADDED: SERCA fills an internal ER store (Ca_ER).
# This store can be released later (e.g. mGluR activation triggers IP3→ER release).
# For now it is simply a sink; ER-release can be wired later.
Ca_ER += cleared_SERCA
# ADDED: Buffer recharge — captured Ca2+ slowly re-releases back to cytosol,
# and free buffer sites recover as Ca2+ is extruded.
# TIMING: tau_buffer_rebind ~200 ms
Ca_micro += Ca_buffer_bound * dt / tau_buffer_rebind
Ca_buffer_bound *= (1 - dt / tau_buffer_rebind)
B_free = B_total - Ca_buffer_bound # bookkeeping
```
### Loop 1B — CDI recovery (adds a reset that was missing)
```python
# --- CDI INACTIVATION + RECOVERY ---
# EXISTING: CDI_factor rises with Ca_micro on each spike.
CDI_factor += map_calcium_to_inactivation(Ca_micro)
# ADDED: CDI_factor decays back to zero as Ca2+ is cleared.
# VARIABLE: tau_CDI_recovery ~100 ms
# LOGIC: Recovery tracks Ca_micro level — low Ca2+ → fast de-inactivation.
CDI_recovery_rate = k_CDI_rec * (1 - Ca_micro / Ca_micro_saturation)
CDI_factor = max(0.0, CDI_factor - CDI_recovery_rate * dt)
```
### Loop 1C — Pool arithmetic with guards
```python
# --- RRP RELEASE (with hard cap) ---
if N_RRP > 0:
released_NT = stochastic_release(N_RRP, Ca_micro)
N_RRP = max(0, N_RRP - released_NT)
add_NT_to_cleft(released_NT)
# --- RP → RRP RECRUITMENT (with floor and ceiling guards) ---
current_recruitment_rate = map_trace_to_speed(Tr_Ca)
refill_amount = current_recruitment_rate * N_RP * (Max_RRP - N_RRP)
refill_amount = max(0.0, refill_amount) # ADDED: never negative
refill_amount = min(refill_amount, N_RP) # ADDED: can't take more than RP holds
N_RRP = min(N_RRP + refill_amount, Max_RRP) # ADDED: hard ceiling
N_RP = max(0.0, N_RP - refill_amount) # ADDED: hard floor
```
### Loop 2 — mGluR autoreceptor (new, 1 s loop)
```python
# --- ADDED: HOMOSYNAPTIC AUTORECEPTOR FEEDBACK ---
# VARIABLE: mGluR_activation presynaptic mGluR2/3 occupancy (0→1)
# TIMING: rises in ~500 ms when NT_cleft is high, decays in ~2 s
# LOGIC: Directly reduces VGCC conductance AND suppresses cAMP
# (cAMP pathway gates RRP docking speed — can be added later).
# This loop is distinct from eCB: it is local, homosynaptic, and faster.
mGluR_activation += (NT_cleft / (NT_cleft + Km_mGluR) - mGluR_activation) * (dt_slow / tau_mGluR)
# The suppression factor enters the high-freq loop at Line 1A:
# effective_conductance = N_VGCC * (1 - eCB_level) * (1 - CDI_factor) * (1 - mGluR_activation * alpha_mGluR)
#
# alpha_mGluR: max fractional suppression (~0.4 for mGluR2/3 at physiological concentrations)
```
### Loop 3 — ATP dependency on pumps (links metabolic health to Ca²⁺ clearance)
```python
# --- ADDED: ATP GATES CA2+ PUMP SPEED ---
# VARIABLE: ATP_level normalized 0→1 (computed from astrocyte metabolic health)
# LOGIC: PMCA and SERCA are ATP-dependent.
# When ATP_level drops, Ca2+ clearance slows → Ca_micro stays elevated →
# CDI rises → effective VGCC conductance collapses → synapse silences.
# This is the realistic metabolic-silence cascade.
def compute_pump_atp_factor(ATP_level):
# Hill function: half-maximal at ATP_half = 0.3
return ATP_level**2 / (ATP_level**2 + ATP_half**2)
# The slowest metabolic loop already writes ATP_level via compute_astrocyte_metabolic_health().
# No further wiring needed — pump_scale above picks it up automatically.
```
---
## The closed loop, stated plainly
Every Ca²⁺ that enters now has exactly one exit: PMCA, NCX, or SERCA. Buffers slow the peak. CDI rises with Ca²⁺ and falls as Ca²⁺ falls — it can no longer lock permanently. The cleft-sensing mGluR autoreceptor gives the presynapse its own, faster brake independent of the postsynapse. Pool arithmetic is bounded on both ends. And ATP depletion now cascades naturally: less ATP → slower pumps → higher residual Ca²⁺ → more CDI → fewer effective VGCCs → silence — which is precisely the metabolic-fatigue endpoint the deep loop was trying to express but couldn't reach without the pump link.