Average Firing Rate of a Cell

I have downloaded a file cell_types_specimen_details.csv from the cell type database, which has a column “ef__avg_firing_rate”. From the electrophysiology white paper, it seems like “cell-wide spike train features were based on a representative suprathreshold sweep”, indicating the “ef__avg_firing_rate” of a cell is calculated from a single sweep recording. However, the f-I curve of a cell is generated from the average firing rates and stimulus amplitudes of multiple sweeps, indicating that average firing rates have been calculated for multiple sweeps of each cell.

I would like to make sure if “ef__avg_firing_rate” of each cell is from a single sweep, or is it averaged across multiple sweeps of the cell? Also, is there a place where I can get the individual average firing rates used for calculating the slope of the f-I curve?

You are correct that ef__avg_firing_rate is calculated from a single sweep. In the electrophysiology white paper, there’s a section that says how that sweep is selected (which it seems like you may have already seen, but just for clarity):

Cell-wide spike train features were based on a representative suprathreshold sweep that was chosen by selecting the lowest amplitude long square sweep with a stimulus amplitude between 40 pA and 60 pA higher than rheobase.

As you said, though, we do calculate the number of spikes for every sweep (which is how the f-I curve is calculated). You can access that information in a couple of ways.

One way you can do it is via the Allen SDK software package. Here’s an example of getting that information for an example cell (specimen ID 464212183):

# Use the CellTypesCache object to access the data
from allensdk.core.cell_types_cache import CellTypesCache
ctc = CellTypesCache()

# Get a list of information about all the sweeps for the example cell
my_specimen_id = 464212183
ephys_sweep_info = ctc.get_ephys_sweeps(specimen_id=my_specimen_id)

# ephys_sweep_info is a list of dictionaries - one for each sweep
# we can loop through and print relevant information about each one
for swp_info in ephys_sweep_info:
    print(
        swp_info["sweep_number"], # sweep number
        swp_info["stimulus_duration"], # duration in seconds
        swp_info["stimulus_name"], # readable name of stimulus
        swp_info["stimulus_absolute_amplitude"], # amplitude in pA
        swp_info["num_spikes"] # number of spikes found in the sweep
    ) 

That will return information about all the sweeps, so you will need to filter to just the one-second-long “Long Square” sweeps to get the ones used to construct the f-I curve. You can do that by filtering on things like stimulus_duration or stimulus_name.

As an alternative to the Allen SDK, you can also use the API to access the data. This is the same thing you see if you click the “This data is also available as XML” link at the bottom of each electrophysiology details page. A query for that same example cell looks like this:

https://celltypes.brain-map.org/api/v2/data/Specimen/query.xml?criteria=model::Specimen,rma::criteria,%5Bid$eq464212183%5D,specimen_types%5Bid$eq305008011%5D,rma::include,donor(transgenic_lines%5Btransgenic_line_type_code$eq%27D%27%5D),structure,cell_soma_locations,ephys_features,ephys_sweeps,ephys_result(well_known_files),neuronal_models(neuronal_model_template,neuronal_model_runs(well_known_files%5Bwell_known_file_type_id$eq481007198%5D))

A simplified version of the query that would return just the information for the electrophysiology sweeps would be:

https://celltypes.brain-map.org/api/v2/data/Specimen/query.xml?criteria=model::Specimen,rma::criteria,%5Bid$eq464212183%5D,specimen_types%5Bid$eq305008011%5D,rma::include,ephys_sweeps

And again, for each sweep, you would look for entries like num-spikes, stimulus-duration, stimulus-absolute-amplitude , and stimulus-name to find the sweeps and information you’re after.

I hope that helps!

1 Like