Action Potential Analysis
Source:vignettes/articles/action-potential-analysis.Rmd
action-potential-analysis.Rmd
Note: This package does not yet contain functions to analyze and plot action potential data. However, I am including this vignette here to show you how to perform raw data analysis in Clampfit. The resulting data will be ready to use in future versions of patchclampplotteR.
This vignette will demonstrate how to analyze action potential properties using a raw .abf file. You will identify the first current injection that resulted in action potentials and then select the first action potential within this sweep for further analyses.
You will identify the threshold using the first derivative method. This means that the threshold corresponds to the membrane potential where the action potential velocity is 10 mV/ms or greater (Farries et al., 2010).
Set up data sheet
Before you begin, you should set up a .csv file. I would suggest
using a consistent naming scheme that includes the date. I use the
YYYYMMDD-title.csv
format, such as
20250113-AP-analysis.csv
. This makes it easy to identify
when I last analyzed my data, and the files sort easily.
In your .csv file, fill row 1 with the following column titles.
Notice that all (except for ID
are in lowercase.
-
letter
The unique letter identifier of a single cell. You can use this to link data from different recordings taken from the same cell. -
state
A character value. In this example, the values areBaseline
andInsulin
, indicating a current clamp protocol taken after the cell had been exposed to 500 nM insulin for 25 minutes. -
time_of_threshold
A numerical value (in ms) used to determine properties like the latency to fire. -
t_x
The membrane potential at the moment that an action potential is initiated, also known as the threshold. -
t11
The derivative of the trace you are analyzing. Must be 10 mV/ms or greater to properly identify the threshold. -
ID
A character value indicating the recording number. This corresponds to theFile Name
column that is automatically generated in the Results sheet in Clampfit. -
first_sweep_with_APs
A number representing the earliest sweep number where action potentials first appeared. -
trace_start
This is an automatic value calculated by Clampfit, and it corresponds to the sweep number. It is not used in any analyses, but it will automatically be included in the Results sheet in Clampfit. It’s faster to just copy all the data rather than try to exclude this value. -
peak_amplitude
The membrane potential (in mV) during maximum depolarization. -
time_to_peak
The time of the peak amplitude (in ms), which should also be relative to thetime_of_threshold
if you have repositioned Cursor 1 to thetime_of_threshold
. -
antipeak_amplitude
The afterhyperpolarization amplitude (in mV) -
time_of_antipeak
The time of the after-hyperpolarization (in ms), which should be relative to thetime_of_threshold
. -
half-width
The width of the action potential when the membrane potential is half of thepeak_amplitude
.
Get derivative
- Open the .abf file containing the current clamp step protocol in
Clampfit. Ensure that the x-axis shows time in milliseconds. If it shows
seconds, double-click the x-axis, and change the
Elapsed Time
fromAutomatic
toMilliseconds
.
Warning! The y-axis values should generally be around -70 mV during the flat regions outside of the current injection. Sometimes the scaling factor in Clampfit is distorted (for unknown reasons) and the y-axis may be in the thousands range. If this happens, follow step 1b).
1b. If the y-axis scale is off (see the warning box above),
double-click on the y-axis to open the
Modify Signal Parameters
box. Change the V/pA
ratio to 0.01, and click “OK”. This will re-scale the y-axis to the
correct units relative to the current injections. Double-check that the
x-axis is in milliseconds!
Press the “Enter” key to show just one sweep at a time. It will begin at the sweep corresponding to the lowest current injection. Use greater than symbol (
>
) to cycle up through the sweeps.Move up to sweeps corresponding to higher current injections until you identify the first sweep that contains an action potential. I will call this
t_x
, since it may bet5
in one recording, ort6
in another, etc.Position Cursors 1 and 2 around the first action potential in
t_x
. Cursor 1 should be before the threshold (aim for the area before the slope of the curve increases steeply). Cursor 2 should be in the after-hyperpolarization region.
Warning! It is important that Cursor 2 touches the curve at a value that is lower than the voltage value for Cursor 1. If Cursor 1 is lower, then Clampfit may identify the location at Cursor 1 as the after-hyperpolarization region if you forget to move the cursor to the threshold (see step 11).
Click on the arithmetic button (it is the button with basic math symbols), then Add Traces. Write “1” and click OK. This will add a new empty trace, called
t11
.t11
should be the derivative oft_x
. In theExpression
box, writet11=diff(t6)
(replacet6
with your value fort_x
).
Find threshold
Click on
Edit
->Transfer Traces
and set theRegion to transfer
asCursors 1..2
. In theTrace Selection
category, choose onlyVm_primary ()
as the signal. Selectt_x
andt11
for the traces, then click OK.Click on the Results sheet (
Window
->Results1
). TheResults
page will display three columns:Time (ms)
,Trace #6 (or #5, #7, etc.)
, andTrace #11
.Trace #x
is the membrane potential in mV, andTrace #11
is the derivative ofTrace #x
.
Warning! The Results page of the transferred traces does not delete data between files. If you are doing several analyses in one session, ensure that you are looking at the correct columns corresponding to the active recording.
- Scroll down the
Trace #11
column (the derivative column) until you see a series of positive values with increasing magnitude (e.g. > 100 or more). This is where the derivative is increasing. Select the first value within this series that is greater than or equal to 10 mV/ms. Copy the value of all three columns in this row.
Note There may be isolated peaks within the derivative that are greater than 10 mV/ms. Only select this value if it is part of a series of increasingly larger positive values, followed by a series of negative values.
- If the scaling is correct, the threshold (
t_x
) should be around -30 mV for a healthy cell. Your .csv file should now look like this:
Measure action potential properties
- Double-click on Cursor 1 and change its x-position value
(
time
) to match thetime_of_threshold
.
Warning! If you do not reposition Cursor 1 to be at the time of threshold, the values for
time_of_peak
andtime_of_antipeak
will be incorrect!
Click on the Statistics button (a small icon with a summation symbol on top of it) or press
Alt+s
.Set the following settings:
- Trace Selection: Choose
Vm_primary ()
andt_x
(in this case,t6
) ONLY. Do NOT includet11
. - Peak Polarity:
Vm_primary
,Positive-going
- Baseline Region: Fixed at
[paste in the threshold value (column t_x in your sheet) here]
- Search Region 1: Range:
Cursors 1..2
- Destination Option:
Replace results in sheet
(prevents you from accidentally copying old data - Column Order:
Measurement, Region, Signal
- Measurements:
peak_amplitude
,time of peak
,antipeak amplitude
,time of antipeak
,half-width
Click OK and then Window
-> Results1
to
see the Results page.
Select all data except for the
File Path
column (unless you think you will need it later) and paste it into the .csv file. You’ll notice that the .csv column names are different than the column names in theResults
sheet. I changed these column names to make them easier to use in R code.Your .csv file should now look like this.
While you still have this file open, you may want to count action potentials (see the section on counting action potentials below).
A completed dataset should look something like the spreadsheet below.
Note If there are no action potentials in the later recording, insert the values for the columns
letter
andstate
and leave all the others blank.
Count action potentials
The next step is to count the number of action potentials in each sweep. This will allow you to later make a plot of action potential frequency vs. current injection and see how a treatment affect action potential frequency.
- Create a separate .csv file (for example
20250113-AP-count-data.csv
). This file should have four columns:
-
letter
The unique letter identifier of a single cell. -
state
A character value (“Baseline” or “Insulin” in this example) -
sweep
A number from 1 to 10 (see step 18a to generate this) -
no_of_APs
a numerical value indicating the number of action potentials
18a. To generate a repeated sequence from 1-10 quickly, type the
number 1 in cell C2
. Then, type the number 2 in cell
C3
.
18b. Select C2
and C3
together, then hover
your mouse over the bottom right corner of the group until you see a
small black plus symbol.
18c. Click and hold down the mouse key and drag the selection down to
C11
to generate a sequence from 1 to 10.
18d. The entire range from C2
to C11
should
be selected. Move your mouse to the bottom right corner of the cell
until you see the +
symbol again. Hold down the
Ctrl
key and drag this selection down. This will generate
the sequence from 1-10 repeatedly (e.g. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3…)
18e. You can then copy and paste this range repeatedly to fill your column.
Open a current clamp steps recording in Clampfit (you may be coming directly from step 16 when you measured action potential properties).
Press the
Enter
key to view one sweep at a time, and use<
and>
to cycle through the sweeps. Count the number of action potentials in each sweep, and record them in theno_of_APs
column.
Yes, this step may seem super simple, but that’s because it is - look at each sweep and count the number of action potentials present!
- Here is an example of what one recording could look like:
FAQ
What do I do if there are no action potentials following treatment?
Do not discard this cell; this is important and meaningful data! Fill
in only the letter and state, and leave all other columns blank. R will
fill this with NA values, since there are no action potential properties
to measure. However, for your AP count data, please just indicate
0
for all current injections.
What do I do if there are action potentials outside of the time when a current injection was applied?
This can happen with very excitable cells. Only count the action potentials that occurred within the injection period.
Should I count an action potential that looks very wavy?
Only include the action potential if it clearly crosses the threshold, comes to a sharp peak, and has an after-hyperpolarization period.
References
Farries, M. A., Kita, H., & Wilson, C. J. (2010). Dynamic Spike Threshold and Zero Membrane Slope Conductance Shape the Response of Subthalamic Neurons to Cortical Input. Journal of Neuroscience, 30(39), 13180–13191. https://doi.org/10.1523/JNEUROSCI.1909-10.2010