summaryrefslogtreecommitdiff
path: root/synapse.hh
blob: 43390c196b6e26a34dbcb44256cec01edea0786f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
  © Copyright 2008 Randal A. Koene <randalk@netmorph.org>
  
  With design assistance from J. van Pelt & A. van Ooyen, and support
  from the Netherlands Organization for Scientific Research (NWO)
  Program Computational Life Sciences grant CLS2003 (635.100.005) and
  from the EC Marie Curie Research and Training Network (RTN)
  NEURoVERS-it 019247.

  This file is part of NETMORPH.

  NETMORPH is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  NETMORPH is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with NETMORPH.  If not, see <http://www.gnu.org/licenses/>.
*/
// synapse.hh
// Randal A. Koene, 20041118
//
// Classes the define synapse types.

#ifndef __SYNAPSE_HH
#define __SYNAPSE_HH

// Required class headers

#include "templates.hh"
#include "Fig_Object.hh"
#include "state_storable.hh"
#include "Txt_Object.hh"
#include "event.hh"

// Class pointer forward declarations (to avoid recursive inclusion)
#ifndef __SPATIAL_HH
class spatial;
#endif
#ifndef __CONNECTION_HH
class connection;
#endif
#ifndef __SYNAPSE_STRUCTURE_HH
class synapse_structure;
#endif
#ifndef __NEURON_HH
class neuron;
#endif

enum synapse_type { syntype_AMPAR, syntype_NMDAR, syntype_GABAR, syntype_candidate, syntype_GluR, syntype_iGluR, syntype_mGluR, syntype_IDs }; // To avoid base classes that are not used directly, syntype_candidate acts as the maximum type index, otherwise syntype_IDs indicates the number of valid IDs

extern const char synapse_type_name[syntype_IDs][10];

extern bool figattr_receptor[syntype_candidate];

#ifdef SYNAPTOGENESIS_AND_LOSS_INVENTORY
#define SYNGENESIS 0
#define SYNLOSS 1
extern long unsigned int synapse_inventory[syntype_IDs][2];
extern long unsigned int candidates_conversion_attempted;
#endif

// [***NOTE] The values defined here were picked without a physiological basis.
#define INITIAL_STRENGTH_AMPA 10.0
#define INITIAL_STRENGTH_NMDA  2.0
#define INITIAL_STRENGTH_GABA 10.0

class synapse: public PLLHandle<synapse>, public state_storable {
protected:
  synapse_type type_id;
  connection * c;
  synapse_structure * s; // defines spatial information about the synapse
  // (stages of the details may also consist of nodes at branch points)
  // presynaptic detail
  // postsynaptic detail
  synapse(connection & conn, synapse_type id, synapse_structure * synstruc = NULL); // Only derived classes may be instantiated.
public:
  ~synapse();
  synapse_type type_ID() { return type_id; }
  connection * Connection() { return c; }
  synapse_structure * Structure() { return s; }
  neuron * Presynaptic_Neuron();
  neuron * Postsynaptic_Neuron();
  //virtual double Strength() { return 0.0; }
  virtual double Peak_Response() { return 0.0; }
  virtual double Reversal_Potential() { return 0.0; }
  void move_add(spatial & addvec);
  void fanin_rot();
  Fig_Object * net_Fig();
  Txt_Object * net_Txt();
};

typedef synapse * synapseptr;

class synaptogenesis_data {
  // This data structure keeps track of synaptogenesis information, such as the time at which a specific synapse was created.
protected:
  double * data;
  synapseptr * synlist;
  unsigned int datalen;
  unsigned int dataidx;
public:
  synaptogenesis_data(): datalen(10240), dataidx(0) { data = new double[10240]; synlist = new synapseptr[10240]; }
  ~synaptogenesis_data() { delete[] synlist; delete[] data; }
  void add(synapse * s, double t);
  synapseptr get_synapse(unsigned int i) { if (i<dataidx) return synlist[i]; else return NULL; }
  double get_t_genesis(unsigned int i) { if (i<dataidx) return data[i]; else return -1.0; }
  double find_t_genesis(synapse * s);
};

extern synaptogenesis_data * SynaptoGenesis_Data;

class candidate_synapse: public synapse {
protected:
  double likelihood;
public:
  candidate_synapse(connection & conn, double l, synapse_structure * synstruc = NULL): synapse(conn,syntype_candidate,synstruc), likelihood(l) {}
  double Likelihood() { return likelihood; }
};

class glutamate_receptors: public synapse {
protected:
  double strength; // (probably) measured here in nano Siemens
public:
  glutamate_receptors(connection & conn, double initvalue = 0.0, synapse_structure * synstruc = NULL, synapse_type id = syntype_GluR): synapse(conn,id,synstruc), strength(initvalue) {
    if (SynaptoGenesis_Data) SynaptoGenesis_Data->add(this,eq->T());
  }
  virtual double Strength() { return strength; }
  virtual double Peak_Response() { return strength; } // See eq.3 in the STM-FIFO paper.
  //virtual double Reversal_Potential() { return 0.0; }
};

class ionotropic_glutamate_receptors: public glutamate_receptors {
public:
  ionotropic_glutamate_receptors(connection & conn, double initvalue = 0.0, synapse_structure * synstruc = NULL, synapse_type id = syntype_iGluR): glutamate_receptors(conn,initvalue,synstruc,id) {}
  //virtual double Reversal_Potential() { return 0.0; }
};

class metabotropic_glutamate_receptors: public glutamate_receptors {
public:
  metabotropic_glutamate_receptors(connection & conn, double initvalue = 0.0, synapse_structure * synstruc = NULL, synapse_type id = syntype_mGluR): glutamate_receptors(conn,initvalue,synstruc,id) {}
};

class AMPA_receptors: public ionotropic_glutamate_receptors {
public:
  AMPA_receptors(connection & conn, double initvalue = INITIAL_STRENGTH_AMPA, synapse_structure * synstruc = NULL, synapse_type id = syntype_AMPAR): ionotropic_glutamate_receptors(conn,initvalue,synstruc,id) {}
};

class NMDA_receptors: public ionotropic_glutamate_receptors {
public:
  NMDA_receptors(connection & conn, double initvalue = INITIAL_STRENGTH_NMDA, synapse_structure * synstruc = NULL, synapse_type id = syntype_NMDAR): ionotropic_glutamate_receptors(conn,initvalue,synstruc,id) {}
};

class GABA_receptors: public metabotropic_glutamate_receptors {
public:
  GABA_receptors(connection & conn, double initvalue = INITIAL_STRENGTH_GABA, synapse_structure * synstruc = NULL, synapse_type id = syntype_GABAR): metabotropic_glutamate_receptors(conn,initvalue,synstruc,id) {}
  virtual double Reversal_Potential() { return -65.0; }
};

#endif