GLIF custom input

Hi All,

I am interested in the use of some of the GLIF models provided through the Cell Feature Search. I can download and run the models for the provided inputs without any trouble. What I struggle with however is to understand how make my own custom inputs. Looking at the provided ephys_sweeps.json file gives me some level of insight but not enough. I have two concrete questions:

a) Is there a place where I can find info on the keywords in the ephys_sweeps.json file?

b) How would I go about giving the model a spike train input with a certain frequency?

Kind regards,
Jonas

Hi Jonas,

For your first question, the ephys_sweeps.json file mostly contains sweep metadata and quality control (QC) parameters. It contains information about what kind of stimulus was run during that sweep (stimulus_description, stimulus_absolute_amplitude, etc.) and how noisy/stable/leaky the cell was during that stimulus (leak_pa, post_noise_rms_mv, vm_delta_mv, etc.).

Information about the stimulus protocols and QC metrics is in the Electrophysiology Overview documentation for the Cell Types Database.

When running a GLIF model, the ephys_sweeps.json file is basically just telling the runner script which sweeps to evaluate (sweep_number). However, it is getting the current waveforms that are input into the cell from an NWB file; the sweep_number just tells it which sweeps to pull out from that file.

The GLIF models can be given an arbitrary current waveform, though, which sounds more like what you want to do in your second part of the question. The GLIF models don’t have any intrinsic synaptic dynamics though, so you would need to translate a spike train into a series of synaptic currents before inputting it into the GLIF model. Once you did that, though, you could run the simulation as described here: https://allensdk.readthedocs.io/en/latest/glif_models.html (see the first part of the section “Running a GLIF simulation”). So you would do something like

# import the libraries
import allensdk.core.json_utilities as json_utilities
from allensdk.model.glif.glif_neuron import GlifNeuron

# set up the GLIF model using the configuration from the Cell Types Database
# this is using the example model ID 566302806, which you'd replace with
# whichever model you want to use
neuron_config = json_utilities.read('neuron_config.json')['566302806']
neuron = GlifNeuron.from_dict(neuron_config)

# Here you'd have to construct your synaptic input current 
# from a spike train by your own method.
# The stimulus is an array of current values in amps.
stimulus = make_my_synaptic_currents(my_spike_train)

# Set the time step for the simulation in seconds (has to match your stimulus)
neuron.dt = 5e-6

# Simulate the neuron
output = neuron.run(stimulus)

voltage = output['voltage']
threshold = output['threshold']
spike_times = output['interpolated_spike_times']

If you’re interested in simulating point neuron networks with synaptic inputs, you may also want to investigate the Brain Modeling Toolkit (BMTK), and specifically the PointNet module of BMTK (for simplified models like GLIFs). That contains more functionality for specifically setting up things like trains of synaptic inputs, but it is geared toward larger networks, so its usefulness for you may depend on specifically what you’re trying to do.

HI Gouwens,

Thank you for your extensive answer!

Regards
Jonas

1 Like