Files
organism/elements/astrocyte/appunti/tripartite_synapse_budget_pseudocode.md
T

17 KiB
Raw Blame History

Tripartite Synapse — Full Budget-Aware Pseudocode

Color key: PRE = presynapse · POST = postsynapse · ASTRO = astrocyte · SIG = signal/neuromodulator · BUD = budget/resource pool


Shared Resource Pools — one per territory

// ── Axonal arbor: shared across all boutons on one axon ───────────────
BUD axon_vesicle_protein_pool     // RIM, Munc13, VGCC subunits for AZ expansion
BUD axon_mitochondria_capacity    // ATP ceiling for vesicle release and refill
BUD axon_tagged_boutons           // set of boutons competing for drifting proteins

// ── Dendritic segment: shared across all spines on one branch ─────────
BUD dendrite_receptor_reserve     // local endosomal AMPA pool — not instantly replenished
BUD dendrite_actin_machinery      // Rac1/RhoA + actin monomers for spine enlargement
BUD dendrite_protein_flux         // plasticity proteins arriving from soma via CREB
BUD dendrite_tagged_spines        // set of spines competing for protein flux

// ── Astrocyte territory: shared across all wrapped synapses ───────────
BUD astro_serine_racemase_cap     // enzyme ceiling for D-serine synthesis rate
BUD astro_EAAT_pool               // transporter protein for glutamate clearance
BUD astro_ECM_protein_pool        // Glypicans, Thrombospondins for sealing
BUD astro_process_extensions      // finite perisynaptic processes — selectively allocated
BUD astro_ATP_budget              // total ATP — drives clearance, synthesis, motility
BUD astro_lactate_ceiling         // hard cap set by capillary glucose supply

// ── Soma: shared across the entire neuron ─────────────────────────────
BUD soma_protein_synthesis_rate   // CREB-driven — peaks during sleep
BUD soma_receptor_synthesis_rate  // new AMPA subunits per hour

Global State Variables

// ── Fast (mss): wave propagation ─────────────────────────────────────
// Presynapse
PRE pre_Ca_residual          // leftover Ca²⁺ between spikes — short-term trace
PRE vesicle_release_prob     // P(0.11.0) per docking slot
PRE RRP_pool                 // readily-releasable vesicle pool
PRE reserve_pool             // chained vesicles in deep storage

// Postsynapse
POST membrane_potential      // Vm — depolarization state
POST NMDA_Mg_block           // bool — mechanical clamp on/off
POST post_Ca_amplitude       // peak [Ca²⁺] rise in spine
POST post_Ca_rise_speed      // d(Ca)/dt — fast=LTP signal, slow=LTD signal

// Astrocyte
ASTRO glutamate_cleft        // [glu] in synaptic cleft
ASTRO glutamate_spillover    // extrasynaptic [glu] — saturates mGluRs
ASTRO astro_Ca_local         // IP3-triggered local rise near synapse
ASTRO astro_Ca_global        // soma-wide wave — network overload flag
ASTRO D_serine_release       // gliotransmitter — NMDA co-agonist pulse
ASTRO lactate_out            // fuel export rate to pre and post

// ── Intermediate (smin): temporary tuning ────────────────────────────
SIG mGluR2_3_activation      // presynaptic Gi — autoinhibitory brake
SIG mGluR5_activation        // astrocytic Gq — IP3→Ca²⁺→D-serine cascade
SIG cAMP_level               // set by dopamine/NE via Gs → adenylyl cyclase
SIG PKA_activity             // downstream of cAMP
SIG GluA1_Ser845_primed      // bool — AMPA insertion threshold lowered by PKA
SIG DARPP32_phospho          // bool — PP1 (LTD phosphatase) silenced by PKA
SIG CREB_active              // bool — structural gene expression enabled

// ── Slow (hweeks): structural architecture ───────────────────────────
POST AMPA_count              // surface receptors — postsynaptic sensitivity
POST spine_volume            // physical size of dendritic spine
PRE  active_zone_size        // docking slot count
PRE  RRP_pool_capacity       // max readily-releasable pool
PRE  VGCC_clustering         // Ca²⁺ channels beneath active zone
ASTRO perisynaptic_distance  // how close astrocyte walls are to synapse
ASTRO ECM_integrity          // extracellular matrix density
ASTRO D_serine_tonic_level   // baseline co-agonist supply (sustained)
ASTRO glutamate_clearance_rate // EAAT transporter density

Budget Allocation Functions

function request_axon_resources(bouton_id, req_AZ):
    available = axon_vesicle_protein_pool × tag_priority(bouton_id, axon_tagged_boutons)
    granted   = min(req_AZ, available)
    axon_vesicle_protein_pool -= granted
    if granted < req_AZ:
        trigger(heterosynaptic_depression, neighbors(bouton_id))  // passive depletion
    return granted

function request_dendrite_resources(spine_id, req_AMPA, req_actin):
    priority  = tag_priority(spine_id, dendrite_tagged_spines)
    g_AMPA    = min(req_AMPA,  dendrite_receptor_reserve × priority)
    g_actin   = min(req_actin, dendrite_actin_machinery  × priority)
    dendrite_receptor_reserve -= g_AMPA
    dendrite_actin_machinery  -= g_actin
    if g_AMPA < req_AMPA:
        queue(spine_id, deficit, dendrite_protein_flux)  // wait for soma delivery
        trigger(heterosynaptic_depression, neighbors(spine_id))
    return (g_AMPA, g_actin)

function request_astro_resources(syn_id, req_Ds, req_ECM, req_proc):
    g_Ds   = min(req_Ds,   astro_serine_racemase_cap)
    g_ECM  = min(req_ECM,  astro_ECM_protein_pool)
    g_proc = min(req_proc, astro_process_extensions)
    ATP_cost = compute_ATP(g_Ds, g_ECM, g_proc)
    if ATP_cost > astro_ATP_budget:
        scale_down(g_Ds, g_ECM, g_proc)  // proportional rationing
    astro_serine_racemase_cap -= g_Ds
    astro_ECM_protein_pool    -= g_ECM
    astro_process_extensions  -= g_proc
    astro_ATP_budget          -= ATP_cost
    return (g_Ds, g_ECM, g_proc)

function replenish_budgets(Δt):
    // Pools recover over time — rates set by metabolic and synthetic capacity
    axon_vesicle_protein_pool  += protein_transport_rate(axon) × Δt
    dendrite_receptor_reserve  += soma_receptor_synthesis_rate × delivery_fraction() × Δt
    dendrite_actin_machinery   += actin_recovery_rate() × Δt
    dendrite_protein_flux       = soma_protein_synthesis_rate   // set by CREB, peaks during sleep
    astro_serine_racemase_cap  += enzyme_synthesis_rate() × Δt
    astro_ECM_protein_pool     += ECM_synthesis_rate() × Δt
    astro_process_extensions   += process_recovery_rate() × Δt  // slow — hours timescale
    astro_ATP_budget           += glycolysis(astro_lactate_ceiling) × Δt
    astro_lactate_ceiling       = capillary_glucose_supply()     // vascular hard ceiling
    soma_protein_synthesis_rate = CREB_driven_expression()       // elevated during sleep replay

Fast Time Scale — Wave Propagation (ms → s)

function fire_action_potential(input_freq):

    // Presynapse: release gated by ATP budget
    if axon_mitochondria_capacity > release_ATP_cost:
        pre_Ca_residual      += spike_influx(input_freq)
        pre_Ca_residual      *= decay(τ ≈ 100ms)
        vesicle_release_prob *= facilitation(pre_Ca_residual)
        released              = binomial(RRP_pool, vesicle_release_prob)
        glutamate_cleft       = released × quantal_content
        RRP_pool             -= released
        axon_mitochondria_capacity -= release_ATP_cost
    else:
        suppress(release)    // ATP-depleted bouton goes silent

    // Astrocyte: overflow sensing — D-serine draw budget-checked
    glutamate_spillover = extrasynaptic_diffusion(glutamate_cleft)
    if glutamate_spillover > spillover_threshold:
        mGluR5_activation   = True
        astro_Ca_local     += IP3_cascade(PLC)
        (g_Ds, _, _)        = request_astro_resources(syn_id, proportional_to(astro_Ca_local), 0, 0)
        D_serine_release   += g_Ds            // may be less than ideal if budget low
        mGluR2_3_activation = True            // Gi arm: brake presynapse regardless
        cAMP_level         -= Gi_inhibition(adenylyl_cyclase)
        vesicle_release_prob -= VGCC_suppression()

    // Astrocyte: global overload check
    astro_Ca_global = soma_wave(astro_Ca_local > OVERLOAD_threshold)
    if astro_Ca_global: trigger(shockwave_lockdown)

    // Postsynapse: AMPA current + NMDA coincidence gate
    membrane_potential  += glutamate_cleft × AMPA_count
    if membrane_potential > -40mV and D_serine_release > threshold:
        NMDA_Mg_block      = False
        post_Ca_amplitude += NMDA_influx(glutamate_cleft)
        post_Ca_rise_speed = d(post_Ca_amplitude) / dt

    // Astrocyte: clearance + fuel — capped at vascular ceiling
    glutamate_cleft -= glutamate_clearance_rate × Δt
    lactate_out      = min(glycolysis_rate(glutamate_clearance_rate), astro_lactate_ceiling)
    membrane_potential  restored by NaK_ATPase(lactate_out)
    RRP_pool            refilled  by VATPase(lactate_out)
    astro_ATP_budget   -= clearance_ATP_cost(glutamate_clearance_rate)

Intermediate Time Scale — Temporary Tuning (s → min)

function short_term_plasticity(input_freq, duration):

    // Presynapse: facilitate or depress — pool-limited
    if input_freq > 20Hz:
        vesicle_release_prob *= 1.3
        mobilize(reserve_pool → RRP_pool)   // only if reserve_pool > 0
    elif input_freq < 5Hz:
        vesicle_release_prob *= 0.7         // pool depletes faster than refill

    // Postsynapse: NMDA priming + plant synaptic tag
    if input_freq >= 50Hz and duration > 1s:
        NMDA_Mg_block      = False
        post_Ca_amplitude    accumulates
        dendrite_tagged_spines.add(spine_id)  // enters competition for drifting proteins

    // Astrocyte: escalate D-serine — budget-checked
    if astro_Ca_local > local_threshold:
        (g_Ds, _, _) = request_astro_resources(syn_id, gliotransmitter_pulse(), 0, 0)
        D_serine_release += g_Ds

    // Neuromodulators: set context gate + plant axonal tag
    if dopamine_level > D1_threshold or NE_level > β_threshold:
        cAMP_level   += Gs_activation(adenylyl_cyclase)
        PKA_activity  = proportional_to(cAMP_level)
        phosphorylate(GluA1, Ser845)  →  GluA1_Ser845_primed = True
        phosphorylate(DARPP32)        →  DARPP32_phospho      = True
        translocate(PKA → nucleus)    →  CREB_active          = True
        axon_tagged_boutons.add(bouton_id)  // captures drifting axonal proteins

    LTP_threshold *= (1 / (1 + ACh_level × mAChR_gain))

Slow Time Scale — Structural Commit (h → weeks)

function commit_to_structural_change(bouton_id, spine_id, syn_id):

    // Three-layer hierarchical filter
    event_detected    = post_Ca_amplitude > Ca_HIGH
    overflow_sensed   = mGluR5_activation == True
    context_validated = DARPP32_phospho and GluA1_Ser845_primed

    // ── Branch 1: LTP — all budgets requested simultaneously ──────────
    if event_detected and overflow_sensed and context_validated:

        g_AZ                = request_axon_resources(bouton_id, AZ_expansion_cost)
        (g_AMPA, g_actin)   = request_dendrite_resources(spine_id, AMPA_cost, actin_cost)
        (g_Ds, g_ECM, g_pr) = request_astro_resources(syn_id, Ds_cost, ECM_cost, proc_cost)

        // Postsynapse: commit proportional to granted resources
        activate(CaMKII)
        AMPA_count        += receptor_insertion(CaMKII, g_AMPA)
        spine_volume      *= (1 + spine_scale(g_actin))

        // Presynapse: commit proportional to granted resources
        active_zone_size      += g_AZ
        RRP_pool_capacity     += pool_expansion(active_zone_size)
        VGCC_clustering       += cluster_beneath_AZ(g_AZ)
        vesicle_release_prob  += scale_with(g_AZ)

        // Astrocyte: commit proportional to granted resources
        perisynaptic_distance    -= g_pr      // walls IN → tighter wrap
        ECM_integrity            += g_ECM
        D_serine_tonic_level     += g_Ds
        glutamate_clearance_rate *= (1 - clearance_scale(g_pr))

        // Partial grants: queue deficit — fulfilled when soma replenishes pools
        if g_AMPA < AMPA_cost or g_AZ < AZ_expansion_cost:
            queue(bouton_id, spine_id, deficit, dendrite_protein_flux)

        axon_tagged_boutons.remove(bouton_id)
        dendrite_tagged_spines.remove(spine_id)
        return "potentiated"  // may be partial if budgets constrained

    // ── Branch 2: temporary only — no structural budget drawn ─────────
    elif event_detected and not context_validated:
        AMPA_count           += transient_insertion()   // reverses — reserve not permanently drawn
        vesicle_release_prob += transient_facilitation()
        dendrite_tagged_spines.remove(spine_id)  // tag expires without save signal
        axon_tagged_boutons.remove(bouton_id)
        return "temporary facilitation only"

    // ── Branch 3: LTD — resources returned to pool ────────────────────
    elif event_detected and not overflow_sensed and not context_validated:

        // Postsynapse: internalize receptors — returned to reserve
        activate(PP1)
        rec_AMPA              = receptor_internalization(PP1)
        AMPA_count           -= rec_AMPA
        dendrite_receptor_reserve += rec_AMPA        // returned to local pool
        spine_volume         *= 0.7
        dendrite_actin_machinery  += actin_depolymerization()  // freed actin returned

        // Presynapse: dismantle launchpad — proteins returned to axonal pool
        rec_AZ                = docking_slot_removal()
        active_zone_size     -= rec_AZ
        axon_vesicle_protein_pool += rec_AZ          // returned for reuse elsewhere
        RRP_pool_capacity    -= pool_contraction()
        VGCC_clustering      -= scatter_VGCCs()
        vesicle_release_prob *= 0.6

        // Astrocyte: dissolve matrix — resources partially recycled
        rec_ECM               = secrete(MMPs)
        ECM_integrity        -= rec_ECM
        astro_ECM_protein_pool    += rec_ECM × recycling_fraction  // partial recovery
        D_serine_tonic_level  = 0
        perisynaptic_distance += process_extension()
        astro_process_extensions  += freed_process   // process freed for reallocation
        glutamate_clearance_rate *= 1.2
        return "depressed"

    // ── Branch 4: baseline ────────────────────────────────────────────
    else:
        return "baseline — no change"

Heterosynaptic Depression — Passive Resource Depletion

function heterosynaptic_depression(neighbor_ids):
    // Triggered when a tagged synapse exhausts the shared pool
    // No active signal required — purely a consequence of budget depletion
    for n in neighbor_ids:
        if n not in dendrite_tagged_spines and n not in axon_tagged_boutons:
            AMPA_count[n]           -= passive_depletion_rate()
            vesicle_release_prob[n] -= passive_depletion_rate()

Special Case — Shockwave Lockdown (>100Hz uncoordinated)

function shockwave_lockdown():
    astro_Ca_global      = GLOBAL_WAVE
    release(GABA, ATP)   // emergency flood — bypasses normal budget gate
    rec_AMPA             = mass_internalization()
    AMPA_count          -= rec_AMPA
    dendrite_receptor_reserve += rec_AMPA   // receptors returned to reserve
    membrane_potential   = HYPERPOLARIZED
    cluster(VGCC → beneath_active_zone)     // overdrive — bypasses normal budget gate
    astro_ATP_budget    -= emergency_response_cost()  // rapid budget depletion

Energy Supply Chain — Metabolic Gating (continuous)

function metabolic_loop(Δt):
    glucose_uptake      = blood_capillary_supply()    // hard vascular ceiling
    lactate_out         = min(glycolysis(glucose_uptake, glutamate_clearance_rate),
                              astro_lactate_ceiling)
    lactate_out        *= load_factor(glutamate_clearance_rate)
    RRP_pool refill rate    ∝ VATPase(lactate_out)
    membrane_potential reset ∝ NaK_ATPase(lactate_out)
    astro_ATP_budget   += glycolysis(lactate_out) × Δt
    replenish_budgets(Δt)

Key Asymmetry — Perisynaptic Distance Amplifies Both Directions

// LTP: walls IN  → clearance_rate ↓,  D_serine_tonic ↑  — self-reinforcing
// LTD: walls OUT → clearance_rate ↑,  D_serine_tonic = 0 — self-reinforcing

// Both directions cost astro_process_extensions budget.
// A budget-depleted astrocyte delivers partial changes only — until replenish_budgets runs.
// This is why sleep matters: soma_protein_synthesis_rate peaks during slow-wave sleep,
// replenishing all pools and completing deferred structural commits held in the queue.