---
include_toc: true
---

# soma.md

## SOMA: Comprehension

Expansions and modulations:
- is expanded by: [NEURON](neuron.md)
- expands: VGCC_SOMA

```Gen
SOMA
  type: comprehension

  expansion: 
    _@VGCC_SOMA: TUB [ comprehension: VGCC_SOMA, full: 50x, active: 20x, empty: 10x ] 

  intrication:

    # Scope
    !DAY: INTRICATION [ ref: &ORGANISM.!DAY ]
    !NIGHT: INTRICATION [ ref: &ORGANISM.!NIGHT ]

    # Tub
    _SpikeTrainTraces: INTRICATION [ ref: &NEURON._SpikeTrainTraces ]

instantiation:
    
    # Context  
    *AP: CONTEXT []
    *bAP: CONTEXT []
    *VDBMax: CONTEXT []
    *VDBMedium: CONTEXT []
    *VDBLow: CONTEXT []
    *NaSpill: CONTEXT []

    # Tub
    _VDB: TUB [ full: 60x, active: 30x, empty: 0x ]
    _Na: TUB [ full: 60x, active: 30x, empty: 0x ]
    _Ca2: TUB [ full: 60x, active: 30x, empty: 0x ]
    _SomaRefractory: TUB [ full: 60x, active: 30x, empty: 0x ]

    # Behaviour
    $: BEHAVIOUR [ behaviour: MAIN-SOMA ]
    $: BEHAVIOUR [ behaviour: VGCC_SOMA_TUN ]  
```

**Tubs:**
- **_VDB**: dendrites deliver current
- **_Na**: are a proxy for the Coulombs of charge building up on the somatic membrane. They are used to check threshold, but also to mimic Na+ and K+ pumping
- **_Ca2**: Medium term traces to guide tuning and Night development. It is a local trace, ATP is a global (Astrocyte)
- **_SpikeTrainTraces**: sono le tracce che consentono al neurone di far partire il Tuning neuronale, quando e' lontano da uno spike-train, ovvero e' in riposo.
- **_SomaRefractory**: tracce di refractory

### MAIN-SOMA: Container

```Gen
MAIN-SOMA
  type: behaviour
  
  within_scope: !DAY
  
  snippet:
    # *Fixed
    @: CONTEXTOR [ snippet: SomaSpike, rf: active 30x ]
    @: ACCUMULATOR [ snippet: SomaRefractorySpill, rf: active 16x ]
    @: ACCUMULATOR [ snippet: NASpill, rf: active 20x ]
     # *AP
    @: ACCUMULATOR [ snippet: ActiveAP, rf: active 8x ]
    @: ACCUMULATOR [ snippet: ActiveAP, rf: active 8x ]
```
#### *Fixed

##### SOMA-Status: ( active: 60x ) contextor

As dendrites deliver current (VDB​), the soma acts like a capacitor. It "stores" this charge in the form of membrane potential. This contextualizes VGCC_SOMA to open ion channels that let Na+ ions in.

This only applies if not ApCtx, or in other words, SOMA is not in refractory period.

```Gen
SOMA-Status:
  type: contextor

  in_context: any
    condition: _VDB fullness AND NOT AP_ctx
      out_context: *VDBMax
    condition: ( VDB mediumness ) AND NOT AP_ctx
      out_context: *VDBMedium
    condition: _VDB emptiness AND NOT _Ap
      out_context: *VDBLow
    condition: NOT _Na empty
      out_context: *NaSpill
```

##### SomaSpike

Il fatto che mettiamo il check di AP separato dal check del Soma-Status, e' perche' vogliamo poter avere un RF specifico per AP, eventualmente tunabile.

Qui siamo nella fase effettiva di spike, non refractory che viene dopo. Fa da contesto di durata fra un RF ed un altro.

La fullness di Na rappresenta il threshold e puo' essere modificato. La fullness di SomaRefractory rappresenta la lunghezza del refractory.

```Gen
SomaSpike
  type: contextor

  in_context: *Fixed
    condition: _Na fullness AND _SomaRefractory emptiness
      out_context: *AP
      out_context: *bAp
```

##### SomaRefractorySpill

Lo spill deve essere piu' lento dell'increase che avviene in ActiveAP

```Gen
SomaRefractorySpill
  type: accumulator

  in_context: *Fixed
    hypothesis: NOT _SomaRefractory empty
      action: [ decrease _SomaRefractory ]
      trace: 
```

##### NaSpill

```Gen
NaSpill
  type: accumulator

  in_context: *Fixed
    hypothesis: NOT _Na empty
      action: [ decrease _Na ]
      trace:
```

#### *Ap

##### ActiveAP

Durante la fase effettiva di spike:

- eliminiamo Na accumulati. Qui ad un RF molto maggiore che con NaSpill. In teoria qui dovremmo eliminare tutti gli Na e NaSpill potrebbe non servire.
- riempiamo SomaRefractory per fase di refractory
- riempiamo _Ca2 per le tracce medio termine di potenziamento/depotenziamento.

```Gen
ActiveAP
  type: accumulator

  in_context: *AP
    hypothesis: NOT _Na empty
      action: [ decrease _Na ] ## This is addition to the _NASpill
      trace: 
    hypothesis: NOT _SomaRefractory full
      action: [ increase SomaRefractory ]
      trace: 
    hypothesis: NOT _Ca2 full
      action: [ increase _Ca2 ]
      trace: 
```


## VGCC_SOMA

Voltage Gated Sodium Channel: difficult to open (High)

```Gen
VGCC_SOMA
  type: comprehension

  expansion:
  
  intrication:

    # Scope
    !DAY: INTRICATION [ ref: &ORGANISM.!DAY ]
    !NIGHT: INTRICATION [ ref: &ORGANISM.!NIGHT ]

    # Context  

    # Tub
    _Na: INTRICATION [ ref: &SOMA._Na ]
  
  instantiation:
  
    # Context
    *VDBMaxCtx: CONTEXT []
    *VDBMediumCtx: CONTEXT []
    *VDBMLowCtx: CONTEXT []
    
    # Tub
    _VGSCRefractoryH: TUB [ full: 60x, active: 30x, empty: 0x )
    _VGSCRefractoryM: TUB [ full: 60x, active: 30x, empty: 0x )
    _VGSCRefractoryL: TUB [ full: 60x, active: 30x, empty: 0x )

    # Behaviour
    $: BEHAVIOUR [ behaviour: VGCC_SOMA_BEH_H]
    $: BEHAVIOUR [ behaviour: VGCC_SOMA_BEH_M]
    $: BEHAVIOUR [ behaviour: VGCC_SOMA_BEH_L]
    
```
### VGCC_SOMA_BEH_H: !DAY

```Gen
VGCC_SOMA_BEH_H
  type: behaviour

  within_scope: !DAY
  
  snippets:
    @: CONTEXTOR [ snippet: VGSC-H_Status, rf: active 60x ]
    @: ACCUMULATOR [ snippet: NaEnterH, rf: active 1x ]
    @: ACCUMULATOR [ snippet: VGSCRefractoryHSpill, rf: active 1x ]
```

### sec: VGCC_SOMA-H

#### VGSC-H_Status: ( active: 60x ) contextor

Il check su refractory deve essere fatto ad un RF maggiore della eliminazione di VGSCRefractory. Questo perche' e' un era nella quale avviene l'episodio.

```Gen
VGSC-H_Status: ( active: 60x )
  type: contextor

  in_context: any
    condition: VDBMaxCtx AND ( VGSCRefractoryH emptiness ) 
      out_context: NaEnterH_Ctx

    condition: ( VGSCRefractoryH mediumness ) OR ( VGSCRefractoryH fullness )
      out_context: VGSCRefractoryHSpill_ctx
```

#### NaEnterH: ( active: 1x ) accumulator

Se metto il controllo sulla (NOT Ready fullness) il VGSC puo' far entrare un numero di Na non superiore ad un massimo.
Questo sopra è il commmento della versione precedente, ora la quantità di NA increase dipende dal rf di VGSC-H_TPC dato che li c'è la condition sulla presenza delle traccie di refractory

```Gen
NaEnterH: ( active: 1x )
  type: accumulator
  contained_by: VGCC_SOMA-H

  in_context: NaEnterH_ctx
    hypothesis: ( NOT Na full )
      action: [ Na increase]
      trace: None

    hypothesis: ( NOT VGSCRefractoryH full )
      action: [ VGSCRefractoryH increase ]
      trace: None
```

#### VGSCRefractoryHSpill: ( active: 1x ) accumulator

Lo Spill deve avere un rf maggiore dell'interacting che incrementa VGSCRefractoryH (interactor precedente)

```Gen
VGSCRefractoryHSpill: ( active: 1x )
  type: accumulator
  contained_by: VGCC_SOMA-H

  in_context: VGSCRefractoryHSpill_ctx
    hypothesis: NOT ( VGSCRefractoryH empty )  
      action: [ VGSCRefractoryH decrease ]
      trace: None
```



## VGCC_SOMA-M: container

Voltage Gated Sodium Channel: less difficult to open (Medium)

```Gen
container: VGCC_SOMA-M

  tub_local:
    VGSCRefractoryM ( full: 60x, active: 30x, empty: 0x )

  tub_intricated:
    Na ( contained_in: SOMA)

  context_intricated:
    VDBMedCtx ( contained_by: SOMA ) 
```

### sec: VGCC_SOMA-M

#### VGSC-M_TPC: ( active: 60x ) contextor

Il check su refractory deve essere fatto ad un RF maggiore della eliminazione di VGSCRefractory. Questo perche' e' un era nella quale avviene l'episodio.

```Gen
VGSC-M_Status: ( active: 60x )
  type: contextor
  contained_by: VGCC_SOMA-M

  in_context: VDBMediumCtx OR VDBMaxCtx
    condition: ( VGSCRefractoryH emptiness ) 
      out_context: NaEnterM_Ctx
```

#### NaEnterM: ( active: 1x ) accumulator

Se metto il controllo sulla (NOT Ready fullness) il VGSC puo' far entrare un numero di Na non superiore ad un massimo.
Questo sopra è il commmento della versione precedente, ora la quantità di NA increase dipende dal rf di VGSC-H_TPC dato che li c'è la condition sulla presenza delle traccie di refractory

```Gen
NaEnterM: ( active: 1x )
  type: accumulator
  contained_by: VGCC_SOMA-M

  in_context: NaEnterM_ctx
    hypothesis: ( NOT Na full )
      action: [ Na increase]
      trace: None

    hypothesis: ( NOT VGSCRefractoryM full )
      action: [ VGSCRefractoryH increase ]
      trace: None
```

#### VGSCRefractoryMSpill: ( active: 1x ) accumulator

Lo Spill deve avere un rf maggiore dell'interacting che incrementa VGSCRefractoryH (interactor precedente)

```Gen
VGSCRefractoryMSpill: ( active: 1x )
  type: accumulator
  contained_by: VGCC_SOMA-M

  in_context: any
    hypothesis: NOT ( VGSCRefractoryM empty )  
      action: [ VGSCRefractoryM decrease ]
      trace: None
```

## VGCC_SOMA_L: container

Voltage Gated Sodium Channel: easy to open (Low)

```Gen
container: VGCC_SOMA_L

  tub_local:
    VGSCRefractoryL ( full: 60x, active: 30x, empty: 0x )

  tub_intricated:
    Na ( contained_in: SOMA)

  context_intricated:
    VDBLowCtx ( contained_by: SOMA ) 
```

### sec: VGCC_SOMA_L

#### VGSC-L_TPC: ( active: 60x ) contextor

Il check su refractory deve essere fatto ad un RF maggiore della eliminazione di VGSCRefractory. Questo perche' e' un era nella qualle avviene l'episodio.

```Gen
VGSC-L_Status: ( active: 60x )
  type: contextor
  contained_by: VGCC_SOMA_L

  in_context: VDBLowCtx OR VDBMediumCtx OR VDBMaxCtx
    condition: ( VGSCRefractoryH emptiness ) 
      out_context: NaEnterL_ctx
```

#### NaEnterL: ( active: 1x ) accumulator

Se metto il controllo sulla (NOT Ready fullness) il VGSC puo' far entrare un numero di Na non superiore ad un massimo.
Questo sopra è il commmento della versione precedente, ora la quantità di NA increase dipende dal rf di VGSC-H_TPC dato che li c'è la condition sulla presenza delle traccie di refractory

```Gen
NaEnterL: ( active: 1x )
  type: accumulator
  contained_by: VGCC_SOMA_L

  in_context: NaEnterL_ctx
    hypothesis: ( NOT Na full )
      action: [ Na increase]
      trace: None

    hypothesis: ( NOT VGSCRefractoryL full )
      action: [ VGSCRefractoryL increase ]
      trace: None
```

#### VGSCRefractoryLSpill: ( active: 1x ) accumulator

Lo Spill deve avere un rf maggiore dell'interacting che incrementa VGSCRefractoryH (interactor precedente)

```Gen
VGSCRefractoryLSpill: ( active: 1x )
  type: accumulator
  
  contained_by: VGSC-L-SOMA

  in_context: any
    hypothesis: NOT ( VGSCRefractoryL empty )  
      action: [ VGSCRefractoryL decrease ]
      trace: None
```


## VGCC_SOMA_TUN: Tuner

```Gen
VGCC_SOMA_TUN
 type: tuner
 contained_by: SOMA

 tunes: SOMA/expansion/VGCC_SOMA

 context_intricated:
  - TunPossible ( contained_by: DAY-N )

 tub_local:

 tub_intricated:
```

### check_tpc: ( active: 60x ) contextor 

```Gen
check_tpc: ( active: 60x )
  type: contextor
  contained_by: VGCC_SOMA-TUN

  in_context: TunPossible
      condition:  ??
        out_context: TunSomaVcgg
```

### ?: ( active: x ) accumulator

```Gen
?: ( active: x )
  type: accumulator
  contained_by: TUN-PRE-VGCC

  in_context: TunSomaVcgg
     hypothesis:  
      action: 
      trace: 
```
