Overview
We developed the VERTEX simulation tool for simulating LFPs produced by large (>100,000) populations of neurons. We first investigated a suitable neuron model for generating LFPs from such populations while remaining computationally tractable. To illustrate VERTEX’s capabilities, we used it to position populations of these neuron models into a neocortical slice arrangement, with neuron positions constrained by cortical layer and slice boundaries, and connected them according to current knowledge about the local anatomy of neocortical circuits (Binzegger et al. 2004). We simulated a persistent gamma frequency oscillation in the network, using a simplified model of spike generation in each neuron to generate the network dynamics (Brette and Gerstner 2005). Finally, we compared the simulated LFPs to experimental MEA recordings from macaque temporal neocortex.
LFP generation
The extracellular potential at a point in brain tissue is given by the sum of all neuronal membrane currents, weighted by their distance from the point (Nunez and Srinivasan 2006) assuming constant tissue conductivity (Logothetis et al. 2007; Nicholson and Freeman 1975). Recent theoretical studies have shown that the spatial and frequency-scaling properties of the LFP are affected by the particular spatial arrangement of neurons’ dendrites (Lindén et al. 2010, 2011). We therefore looked for a reduced compartmental model that would generate extracellular potentials capturing the spatial and frequency-scaling properties elucidated by Lindén et al.’s investigations using detailed cell reconstructions, while remaining computationally tractable to simulate in large numbers.
The reduced compartmental model should create a similar spread of currents across its compartments to an equivalent morphologically reconstructed neuron given the same input. A compartment’s membrane current depends on the neuron’s axial resistance as well as on its membrane resistance and capacitance. We therefore chose a reduced model that conserved these quantities, while containing a minimal number of compartments. The compartmental reduction method of Bush and Sejnowski (1993) fulfils these requirements, producing compartments with a length equal to the mean length of the compartments they are representing in the full model. This creates a reduced model of the same length as the original reconstruction, but with a smaller membrane area, smaller lateral spread of the dendrites, and fewer than ten compartments (Online Resource, Fig. ESM2).
Validating the reduced LFP generation model
We tested the effects of this reduction on the generated LFP by reproducing the experiments detailed by Lindén et al. (2011). Ten thousand model neurons with passive membrane dynamics and the same morphology were positioned randomly within a 1-mm radius cylinder, with uniform spatial distribution and constant soma depth. One thousand synapses (excitatory, current-based, single-exponential type with time constant 2 ms and fixed amplitude 50 pA) were placed randomly on the compartments of each neuron, with uniform density with respect to membrane area. Each synapse received an independent Poisson spike input train with a rate of 5 Hz. LFPs were calculated at the centre of the population, at five depths. The magnitude of an LFP signal was defined as its standard deviation. The LFP range was calculated by varying the population radius from 0 to 1 mm and measuring the radius at which the LFP magnitude reached 95 % of its value at the maximum 1-mm radius (Lindén et al. 2011). We repeated this procedure for the three neuron types used by Lindén et al.: layer 2/3 (L2/3) pyramidal, layer 4 (L4) spiny stellate, and layer 5 (L5) pyramidal. We compared LFPs generated by the morphological reconstructions of these neuron types described by Mainen and Sejnowski (1996)—hereafter referred to as Mainen cells—with the LFPs from reduced versions of these models created using Bush and Sejnowski’s method (1993)—hereafter referred to as Bush cells.
The results of these experiments are shown in Fig. 1. For each neuron type, the LFP range and magnitude in each layer for the population of Bush cells are close to those for the population of Mainen cells. The LFP range is smallest in the soma layer (<250 μm) with the range increasing in the layers above and below the soma, while the LFP magnitude is largest in the soma layer and decreases in the layers above and below the soma. The differences between the results for the L4 spiny stellate models are small, so we concentrate on the pyramidal neuron population results. For the L2/3 pyramidal neurons, the LFP spatial range in the soma layer is very similar between the Bush and Mainen populations, but above and below this layer the discrepancy increases, with the largest difference of 200 μm in L1. The range differences in all other layers are ≤110 μm. For the L5 pyramidal neurons, the LFP spatial range difference is again smallest in the soma layer, and <100 μm in layers 4 and 1. The largest difference is 320 μm in L2/3.
To see how important these discrepancies were within the context of the general biological variability of neuronal morphology, we repeated the simulations with neuron populations containing pyramidal cells reconstructed from several different real neurons. These were downloaded from the NeuroMorpho.Org database (Ascoli et al. 2007)—further details on the models we used are provided in the Online Resource (Table ESM10). We used ten further groups of L2/3 cat pyramidal neurons, and one further group of L5 cat pyramidal neurons (this was the only other cat L5 pyramidal neuron currently available in the database; we did not use L5 pyramidal cells from other species as the size differences in neurons between species could have provided misleading results). The results of these simulations are plotted in Fig. 1b as light-red dashed lines for the extra L2/3 pyramidal populations, and light blue circles for the extra L5 pyramidal population. The extra simulation results show that the LFP range and magnitude in the Bush neuron populations generally fall within a biologically reasonable range; while the reduced models are not ideal substitutes for the morphological reconstructions, the errors incurred by the reduction method are similar to those introduced by neglecting morphological diversity in reconstructed neuron model populations. The general profile of the LFP across the layers, at least, is preserved adequately.
We also checked the power spectra of the simulated LFPs to make sure the Bush model populations reproduced similar frequency-scaling properties to the Mainen cell populations. Figure 1c shows that, in each layer, the 95 % confidence intervals for each model type overlap over the range of frequencies from 2 to 450 Hz (the overlap continues down to 1 Hz; this is not shown to improve the plot resolution at higher frequencies).
The results in Fig. 1 were generated using uncorrelated synaptic inputs over the entire dendritic tree of each neuron in each population, with neurons all positioned at the same height in their respective layers. This simplified setup was used so that a comparison could be made with the results previously reported by Lindén et al. (2011), but we also wanted to check whether the reduced models would still be suitable approximations to use for a more realistic situation, with neurons placed at varying depths within their layer, receiving correlated inputs. As our particular interest was simulating network gamma oscillations, in which pyramidal neurons receive highly correlated inhibitory synaptic input to their perisomatic regions, we repeated the previously described experiments measuring the LFP magnitude and range, but positioned each neuron’s 1,000 synapses onto its soma compartment [we only repeated the simulations for the pyramidal neuron morphologies, as the LFP spatial profile for the spiny stellate cells was shown not to change significantly with correlated input (Lindén et al. 2011)]. In the previous experiments with no correlations between synaptic inputs, each synapse was assigned an independent Poisson spike train, for a total of 10,000 × 1,000 = 107 independent spike trains at 107 synapse locations. To introduce input correlations, we followed the same method as Lindén et al. (2011). Each synapse in the model was now assigned a spike train drawn without replacement from a finite pool of pre-generated spike trains. By reducing the number of Poisson spike trains in the pool so that some synapses shared a common input pattern, we could control the level of input synchrony to the neurons. The resulting input correlation is given by the total number of synapses per neuron divided by the number of independent spike trains (Łęski et al. 2013). To simulate highly correlated input, we used 2,000 independent spike trains, resulting in an input correlation of 1,000/2,000 = 0.5 (i.e. any two neurons share on average 1,000 × 0.5 = 500 common input spike trains).
For these simulations, we also introduced random variability in the soma depth of the neurons. We distributed L2/3 pyramidal neuron somas between −334 and −534 μm, and L5 pyramidal neuron somas between −970 and −1,170 μm from the cortical surface. These ranges ensured that the neuron somas remained within the correct layer boundaries, and that their apical dendrites were not positioned above the cortical surface.
Figure 2 shows the spatial profiles of the LFP for the different populations. In these simulations, we measured the LFP at 50 intervals, to see how well the Bush models preserved the LFP at this level of detail. We used 11 electrode points in L1 and L2/3 for the L2/3 populations, and 26 electrode points spanning all layers for the L5 populations. Both the range and magnitude profiles show that the LFP from the Bush population matched the LFP from the Mainen population well, again within the bounds of the LFP profile of the extra comparison populations. The minimum range and magnitude in the L2/3 populations are just above the minimum soma depth, and a few 100 μm above the minimum soma depth in the L5 population. This depth is where the synaptic currents at the soma are approximately balanced by the opposite return currents in the dendrites; below and above this minimum point, the somatic or the apical dendritic currents dominate the LFP signal, respectively. These simulations also show substantial overlap of the 95 % confidence intervals for the power spectra at each electrode (Fig. 2b). The biggest discrepancy between the LFP power spectra for each model occurs around the level of the LFP range minimum. The LFP power up to 100 Hz is reliably reproduced at every measurement point, and up to 450 Hz at all but one point with the L2/3 populations. This point corresponds to the point at which the LFP range and magnitude are lowest. The reduced accuracy at higher frequencies in the L5 models should be taken into account if frequencies above 100 Hz are analysed in models containing L5 pyramidal cells.
Our results suggested that we could use the reduced neuron models in VERTEX simulations with some confidence that the resulting simulated LFPs would be close to LFPs simulated from equivalent morphologically reconstructed neurons, in magnitude, spatial extent, and frequency content.
The VERTEX simulation tool
To simulate large networks, we wrote custom Matlab software to setup neuron populations, position them, connect them together, and simulate their dynamics and the resultant LFPs. We designed this simulation tool to be easily adaptable to create models of any layered brain tissue containing populations of spiking neurons (Fig. 3). Model parameters are specified by the user in Matlab structures, defining:
-
1.
Neuron group properties (for each group: the neurons’ compartmental structures, dimensions and positions, electrotonic properties, spiking model parameters)
-
2.
Connectivity (for each presynaptic group: number of efferent synapses per layer per postsynaptic group, allowed postsynaptic compartments to connect to contact, axonal conduction speeds, neurotransmitter release times, synapse dynamics)
-
3.
Tissue properties (dimensions, layer boundaries, neuron density, tissue conductivity)
-
4.
Recording settings (IDs of neurons to record intracellularly, extracellular electrode positions, sampling rate)
-
5.
Simulation settings (simulation length, time-step, number of parallel processes)
A model is initialised by positioning the specified number of neurons from each group within the slice and layer boundaries, pre-calculating distances from the neuron compartments to the virtual electrodes, generating each neuron’s connections based on its position, axonal arborisation extent in each layer, and expected number of efferent connections, and initialising the synapses (see “Experimental Procedures”). At this point, the initialised model can, optionally, be saved to disk as MAT files. Functionality to export to NeuroML (Gleeson et al. 2010) is currently under development.
When the simulation is run, recordings (intracellular, LFPs, spike times) are automatically saved to disk at user-specified time intervals. The simulation run can be performed in serial or parallel (requires Matlab Parallel Computing Toolbox). After the simulation is finished, these files are loaded and recombined for analysis. Our design allows the model to be used with minimal programming knowledge, though as Matlab is a high-level, interpreted language, more experienced programmers can make modifications relatively easily.
Simulation speed and memory usage
While Matlab code may run more slowly than equivalent code in compiled programming languages, performance can be dramatically improved through code vectorisation, which minimises the impact of code interpretation overheads (Brette and Goodman 2011). The Matlab Parallel Computing Toolbox allows further performance improvements by providing a simple way to parallelise computations on multicore computers or over networks. These factors, as well as its ease of use, popularity in the neuroscience community, the ability to perform simulations and analysis in the same environment, and the well-developed interface for integrating C or Fortran functions for future performance enhancements influenced our decision to write VERTEX in Matlab. To give the user an idea of the performance improvement over using the other current extracellular potential simulation tool LFPy (Lindén et al. 2014)—a Python package for simulating extracellular potentials with NEURON (Hines and Carnevale 1997; Hines et al. 2009)—we performed equivalent simulations using layer 5 Bush pyramidal neurons in LFPy and in VERTEX (no synapses, one random fluctuating current per neuron, 0.03125 ms step size and 32 000 Hz sample rate). LFPy took ~278 min to simulate the LFP from 10,000 neurons at 50 electrode points, while VERTEX running in serial mode took ~18 min to simulate the LFP from 10,000 neurons at 50 electrode points (both running on an Intel Xeon E5640 2.66 GHz workstation). While this performance improvement is important for our purposes, it should be noted that LFPy is designed to simulate extracellular potentials from single cells rather than large populations. Indeed, as the code interpretation overhead begins to dominate VERTEX’s calculation times in small simulations, running the same model but with only one neuron in the population took ~227 s in VERTEX but <2 s in LFPy. VERTEX is also not suited to running models containing neurons with very many compartments, because the Runge–Kutta integration method becomes unstable as the number of compartments increases (though we aim to address this limitation by implementing implicit integration methods in future releases). LFPy, therefore, remains the superior tool for modelling extracellular potentials around single neurons, while VERTEX’s strength lies in simulating LFPs in large-scale networks.
To show how performance improves in parallel mode, we compared the run times for two network models, one large (123,517 neurons with on average 1,835 synapses per neuron) and one small (9,881 neurons with on average 256 synapses per neuron), using VERTEX on a single multicore computer (Fig. 4). Each model contained two populations: layer 5 pyramidal (P5) neurons and layer 5 basket (B5) interneurons. Spike rates in each small model (large model) simulation were ~6 Hz (~7 Hz) and ~24 Hz (~31 Hz) for the P5 and B5 neurons, respectively. The large model shows linear speed-up with increasing number of cores for model initialisation and close-to-linear speed-up in simulation time. The speed-up for the small model is sub-linear: as the interpretation overhead for a vectorised operation on a small matrix is the same as on a large matrix, this overhead starts to dominate the calculation times below a certain number of neurons (Brette and Goodman 2011). Therefore, splitting already small neuron state matrices between more processes does not significantly improve performance. This limit is not reached in larger models.
Figure 4 also shows how increasing the number of virtual electrodes affects simulation speed. Model initialisation times are affected proportionally more than model run times using more electrodes, in both large and small models, though in the small model the proportional impact from adding electrodes to initialisation time was greater than in the large model. This is because the large model not only has more neurons, but also more synapses per neuron. The increase in time spent connecting the neurons is proportional to the number of synapses, while the increase in time spent calculating constants for the LFP measurements is proportional to the number of compartments (roughly proportional to the number of neurons).
The size of the simulated network is limited by the amount of RAM available. As an example, we tested scaled configurations of our neocortical slice model (described below) using single-core and multi-core computers: an iMac with 4 GB RAM supported a serial simulation with ~25,000 neurons, a 16 GB Linux machine supported a simulation of ~100,000 neurons in both serial and parallel modes, and our Linux server with 120 GB RAM supported a simulation of ~700,000 neurons. In addition to increasing the memory on a single machine, VERTEX could be run across a network of computers using the Matlab Distributed Computing Server. On a network of 16 of our 4 GB RAM iMacs, for example, the simulation size could scale to ~400,000 neurons. In summary, existing processing environments of experimental and computational laboratories can be sufficient for running detailed simulations of brain tissue activity.
Spike import
Network dynamics can be simulated directly by providing the model neurons with a spiking mechanism—we used the adaptive exponential (AdEx) mechanism (Brette and Gerstner 2005), which we include in VERTEX. Alternatively, previously generated spike times (output from another simulator, for example) can be imported into the simulation. The neurons whose spike times are imported are then specified with purely passive membrane dynamics. We used the spike import feature to run the control experiment to confirm that the AdEx spiking mechanism has a negligible impact on the simulated LFP (Online Resource, Fig. ESM1).
Running models using imported spike times is similar to the approach used by Lindén et al. (2011) to link spiking output from a cortical model implemented in the NEST simulator (Gewaltig and Diesmann 2007) to their LFP generating model implemented in LFPy. However, we consider imported spikes to have been emitted by neurons from within the population we are modelling; imported spikes are delivered to target neurons according to the generated connectivity matrix rather than pre-assigned to postsynaptic targets. By contrast, Lindén et al. (2011) considered the spikes from NEST-simulated neurons as external inputs to the neurons in the LFPy simulation, so they were delivered to synapses without a connectivity model within the LFPy-simulated population. The practical effect of this is that our software is better suited to modelling the LFP resulting from intrinsic network dynamics, when connectivity is known or when different spatial connectivity models are to be tested. Input from external populations can be simulated by specifying a population of single-compartment neurons and setting this population’s output using the spike import functionality. As single-compartment neurons do not contribute to the extracellular potential (Pettersen et al. 2012), VERTEX ignores them in its LFP calculations. This population can, therefore, be considered as providing “external” input from a distant population.
Neocortical slice model
To demonstrate the capabilities of VERTEX for simulating LFPs in large neuron populations, we created a neocortical slice model to use in conjunction with MEA experiments in vitro (Fig. 5). The model comprises fifteen neuron groups, defined in Table 1. It is designed to contain a similar number of neurons to the comparison experimental slice. This was calculated to be 175,421 neurons, based on the slice dimensions and neuron density. The slice has clear spatial boundaries: neurons cannot be positioned outside of the slice edges, and axons cannot ‘wrap around’ these boundaries. We therefore required a connectivity model that would produce a suitable number of synapses given the large number of neurons, and that took into account each neuron’s position in relation to the slice boundaries. We used anatomical data from Binzegger et al. (2004) to specify the numbers of connections between neuron groups, and a 2D Gaussian spatial profile to model the decay in connection probability with increasing distance from a presynaptic neuron (Hellwig 2000). The standard deviation parameter of the Gaussian profile was set using axonal arborisation radius measurements reported by Blasdel et al. (1985); Fitzpatrick et al. (1985), as adapted by Izhikevich and Edelman (2008). These were different for each neuron group in each layer (see Online Resource, Table ESM4). Finally, we modelled the effect of slice cutting on connectivity by reducing the number of connections a presynaptic neuron could make by the proportion of the integral of its Gaussian connectivity profile that fell outside the slice boundaries (Eq. 3). The connectivity generation code in VERTEX implements this connectivity model automatically, though the user can also specify a uniform spatial connection probability and/or ignore slice cutting effects. VERTEX also allows users to specify specific target compartments on postsynaptic neurons that presynaptic neurons are allowed to connect to. We used this feature to incorporate known details about the dendritic regions targeted by different presynaptic neuron types—basket interneurons only make connections with pyramidal cell somas and their two adjacent compartments, for example. We used a similar pattern of connectivity to that described by Traub et al. (2005b); details are provided in the Online Resource (Supplementary Methods: Connectivity and Table ESM7). Incorporating this detail into the model is important, as the locations of synaptic inputs onto the neurons will affect the locations and sizes of the currents that contribute to the simulated LFP.
Table 1 Neuron groups, abbreviations, and number of compartments within our model
Figure 6 shows the number of connections between neuron groups compared with the original numbers specified by Binzegger et al. (2004). The proportional reduction in synapses is not the same for each connection type because of the varying axonal arborisation radii. These reductions are important to consider when assessing the effect of connectivity changes on dynamics, but they illustrate that the general profile of connections between neuron groups is not substantially altered—connections from P2/3 to P2/3 and P5 neurons remain the most numerous, for example. Modelling thinner slices, or different axon arborisation profiles, could lead to the over- or under-representation of particular connections in the model.
Modelling persistent gamma oscillations
To make a comparison with experimental data, we generated a persistent gamma oscillation in the model by applying random currents to all neurons (Börgers and Kopell 2005), and adding an AdEx spiking mechanism to the somatic compartments (see Online Resource). In slice experiments with nanomolar kainate concentrations, this activity regime is driven by L2/3, where neurons receive noisy excitatory drive from the excited axonal plexus of L2/3 pyramidal neurons (Ainsworth et al. 2011; Cunningham et al. 2003, 2004b). We simulate this by providing a relatively large noisy current to P2/3 neurons, similar to Ainsworth et al. (2011); Börgers and Kopell (2005). We set synaptic strengths (based on Traub et al. 2005b) and noise currents to match the spiking activity and observed membrane potential fluctuation sizes reported in previous studies in vitro. Model parameters are given in tables ESM1–ESM9.
As described in previous experiments (Ainsworth et al. 2011; Cunningham et al. 2003, 2004b; Traub et al. 2005a, b), P2/3 neurons spike infrequently, while B2/3 neurons spike on most oscillation periods. Excitatory neurons in L4 do not take part in the oscillation (though still spike infrequently), while L4 interneurons are weakly entrained to the oscillation. In addition to the L2/3 gamma, the comparison slice exhibited increased gamma power in part of the infra-granular layers (see Fig. 9a, electrodes 6, 7, 16, 17, 26, 27), presumably caused by L5 as described by Ainsworth et al. (2011). We therefore used a relatively high coupling strength of P5 to B5 and NB5 neurons and a larger noisy drive current to L5 neurons to enable the L2/3 gamma to generate gamma in L5. The L5 gamma oscillation also weakly entrained L6 neurons to the oscillation.
The resulting spiking behaviour is shown in Fig. 7, which shows a spike raster for 5 % of the neurons in the model, along with example somatic membrane potential traces for each neuron group. The spike raster reveals that neurons near the slice x-boundaries (neurons nearest the cyan boundary markers in Fig. 7) are less strongly entrained to the oscillation than neurons in the centre of the slice, because they receive fewer inhibitory inputs than more central neurons (neurons closer to the edge of the slice have more connections removed by slice cutting than those towards the middle of the slice, because they lose proportionally more of their axonal arborisation).
To demonstrate how the oscillation is generated by the interaction of the excitatory and inhibitory populations, we simulated activity in the model under four different conditions: firstly the original case described above (connection weights in Table ESM5), secondly with P2/3 to B2/3 synapses reduced to 1 % of their original weight, thirdly with B2/3 to P2/3 synapses reduced to 1 % of their original weight, and fourthly with the original synapse weights but increased input current to the B2/3 population (1.5 times the mean and standard deviation used in the original simulation values given in Table ESM9). Simulation results using these different configurations are plotted in Fig. 8, which shows that both P2/3 to B2/3 synapses and B2/3 to P2/3 synapses are necessary for the generation of a population gamma oscillation in the model. Without these connections—or with their strengths severely reduced—no oscillation emerges. This oscillation mechanism is the same as the “weak” pyramidal-interneuron network gamma (PING) model described by Börgers et al. (2005). Firing in a subset of P2/3 cells, which are densely connected with B2/3 neurons with strong synapses, causes a population spike from the B2/3 cells. This suppresses the network until the P2/3 neurons that receive the most input from the stochastic drive reach threshold. This subset of P2/3 neurons then fires, causing another B2/3 cell population spike, and so the oscillation continues (Börgers et al. 2005). Figure 8m–p shows that the oscillation is also suppressed in our model when the driving current to B2/3 cells is increased, allowing them to suppress P2/3 cell firing. This is in line with the gamma suppression mechanism described by Börgers and Kopell (2005). Figure 8 also demonstrates that the gamma oscillation in layer 5 is dependent on a gamma oscillation occurring in layer 2/3: layer 5 gamma is suppressed in each of the cases where layer 2/3 gamma is suppressed. Firing rates for each population in each case are given in Table ESM11.
Having verified that the model produced the expected spiking output and that the gamma oscillation was being generated by the correct mechanism, we looked at the simulated LFPs and compared them with those recorded in vitro. Figure 9 shows a comparison over the whole electrode array between the model and the experimental recordings. Figure 9a shows the shape of the experimental neocortical slice with, as predicted by previous research, strong gamma power in the supra-granular layers. The gamma power at each electrode is highly variable, resulting in a patchy power map. This is not captured by the model, whose structure is homogeneous along the x-axis. However, the phase inversion between layer 1 and layer 2, illustrated in Fig. 9b, c, emerges in the model (Fig. 9e, f) from the positioning of current sinks and sources on the P2/3 neurons during the gamma oscillation. This is in agreement with the source–sink interaction mechanism of phase inversion demonstrated experimentally in kainate-induced gamma oscillations in entorhinal cortex in vitro (Cunningham et al. 2003). The cross-correlations between electrodes shown in Fig. 9c, f also reveal how the strong gamma oscillation in L2/3 dominates the across the electrodes more than in the experimental recordings. This is, again, a result of the relatively homogeneous activity along the x-axis in the model, meaning that the LFP signal created by the gamma oscillation is not degraded by influences from the non-oscillating areas in the slice as occurs in vitro. Our model, though not capturing all the details of the experimentally measured network dynamics, provides a starting point for further investigations into cortical dynamics on this spatial scale, allowing for better integration of theory and experiment.