Dynamic Clamp

From QuB

Jump to: navigation, search
Prev: Scripts Outline Next: Action Reference


A practical tutorial by Lorin S. Milescu


Image:Dyn_Clamp.gif

Example: replacing voltage-gated Na channels with dynamic clamp


Contents

Overview

The aim of this tutorial is to teach you how to run dynamic clamp experiments with QuB. The assumptions are that you know enough electrophysiology to be able to run current clamp experiments, and have reasonable modeling skills to be able to code and run dynamic clamp scripts. My current research is focused on voltage gated Na channels, and so are the examples discussed here.

Why QuB?

There are several advantages to using QuB for dynamic clamp experiments. Possibly the most critical advantage is that QuB runs under MS Windows, and it is easy to install and run. In contrast, dynamic clamp software running under different flavors of real-time Linux is more challenging. If you want to try Linux, go to http://rtxi.org/, and download the RTXI software. Although it is not running under hard real-time constraints, the dynamic clamp in QuB reaches very good real-time performance, mostly due to exploiting parallel processing on multi-core or multi-processor machines. Another important advantage is that the dynamic clamp in QuB relies on a powerful scripting language ([1]), which I developed over many years, matched with a comprehensive graphical user interface. The scripting language allows to define complex models of ion channels, while the GUI displays user-defined quantities in real-time, detects action potentials, saves data to disk, etc.

At the moment, the full dynamic clamp functionality is available only in a specialized version of QuB, which I develop and maintain. This version is available for download at this page.

Hardware and software requirements

Data acquisition card

Any National Instruments [2] card that is compatible with their new NIDAQmx driver. Of course, the card should have at least one AI and one AO channels. I tested several NI cards, some older (e.g., PCI 6052E), some of the newer generation (e.g., PCI-6251). With the most recent NIDAQmx driver (8.9), the PCI-6251 card is very fast: it takes less than 6 microseconds per I/O cycle, resulting in at least 150 kHz rates, when the I/O is set to run in a different thread. For comparison, the PCI-6052E takes ~10 microseconds. When you buy the card, don't forget to buy the connecting cable and the BNC connector box (e.g., BNC 2110).

Computer

A multi-core or multi-processor PC. A dual-core is great, a quad-core is better. At the very minimum, you can use an Intel processor with hyperthreading. Do not attempt to run QuB on a single core machine! It will work, but it will freeze the computer for as long as the script runs. If money is not a problem, I recommend a dual-core dual-processor Xeon. We bought a custom made one from ASL ([3]) for a good price. Not cheap, but you get one of the fastest machines for the money. Good for graphics, optimizations etc. Of course, any dual-core off-the-shelf computer will do, for slightly less performance, and significantly less money. Both AMD and Intel work fine.

Amplifier

A good amplifier capable of true, fast current clamp. I tested QuB with HEKA EPC 9 and 10, and with Axon Multiclamp 700B.

Software

You will need to run Windows XP SP2. I haven't tested SP3 but probably it works. You need to install the newer NIDAQmx driver. QuB has been tested with version 8.3, but I expect newer versions will work as well. If you had success with a more recent version, please let me know so I can update this information. Remember, QuB doesn't work with Vista!

Tweaking the computer

I found that the real-time performance is very good without any optimizations to the computer. The CD/DVD drive and the presence of a USB memory stick in an USB port might cause some interrupts. You may try to disable the CD/DVD drive from My Computer/Properties/Hardware/Device Manager, and remove memory sticks from USB ports. I found network activity to be of no concern. I also found that nVidia graphics drivers may cause interrupts. If they really bother you, remove the graphics driver. Windows' driver will work fine, although the refresh rate may be very slow.


Setting up the system

Installing the National Instruments data acquisition card

Follow the procedure outlined by NI in their card installation brochure. Basically, you have to install the driver first, then reboot, then shut down, physically install the NI card in the computer, then reboot. The NIDAQmx driver will automatically detect the card and install it. Using Automation Explorer, make sure the card works properly. You can check it using the NI Test Panels utility.

Connecting the NI card to the patch-clamp amplifier

You need to make two connections: one from the voltage output of the amplifier to one of the analog input channels of the NI card (actually, the connnector box), such as AI1, and one from the current command input of the amplifier to one of the analog output channels of the NI card, such as AO0. HEKA EPC 10 amplifiers have separate BNC connectors for current and voltage external commands. Unfortunately, Axon MultiClamp amplifiers have only one BNC connector for external commands. I use a mechanical switch to connect either the DigiData interface or the NI card to the MultiClamp amplifier.

Installing the QuB software

To download and install QuB, go to http://lambda.med.buffalo.edu/milescu, and follow the instructions there. Also, download the example files.

Preparing the graphical interface in QuB

A useful interface layout should display the Scripts, the Trigger Graph and the Dynamic Clamp windows. Additionallly, you may want the Reports and the Scriptlets windows visible. QuB will look like this:

Image:Dynamic Clamp Interface 1.gif.

To set up the interface, go to MainMenu.Interface.Additional layouts, and increase the number of additional layouts by one (or more, if you want more layouts).
What you get is an empty interface, so you must turn on the display for all the windows you need.
To display a window, go to MainMenu.View, and click on a window, for example Scripts. That window will now be visible, and it will take up the entire space.
Now select View.Chart. Note that in the older versions, Chart was called Dynamic clamp
The Chart window now becomes visible, and it will take half the space. Also display Report, Trigger graph and Scriptlets.
To change the size of a window, use the spacer bar between that window and the adjacent one. To reposition a window, left-click on the caption bar of that window, hold the mouse button down, and move it around. As you move it around, you will see a rectangle that indicates where the window will be positioned. When you are in the right position, simply release the mouse button. You have to understand that a window can be repositioned by making it share the space with another window: either top-bottom or left-right.
If you have two monitors, you can also grab a window from one monitor and drop it onto another.
If you notice that the layout becomes broken - for example the windows seem to overlap, or you see the background, try to resize a little any of the windows. In most cases, this fixes the layout. If not, you have to reset the layout to its default (go to MainMenu.Interface.Restore interface defaults, and repeat the operation. Sorry!).
If you are not comfortable with this kind of display, using mutually resizable windows, you can switch to a standard mode with individual windows. For this, click MainMenu.Interface.Floating windows.

Calibrating the amplifier

You need to find out the conversion (scaling) factors between the amplifier and the QuB software, and the voltage and current offsets. First, you need to connect the model cell to the amplifier headstage. In Voltage Clamp mode, go through the sequence of steps from Bath, OnCell to WholeCell, and do all the necessary compensations (Pipette Offset, CFast, CSlow, Rs etc). Then switch to Current Clamp, and, if required by the amplifier's software, enable the external command.

Load the Test_IO.kin file in the Scripts window, which should look like this:

Image:Test_IO Script.gif.

This script contains the actual calibration values for my amplifier (MultiClamp 700B). Note that I use the 500 MOhm feedback resistor for Current Clamp. The values that you will need to adjust are the "scale" and "offset" for both input and output. Also, make sure you use the same DAQ channels: AI1 for voltage input and AO0 for current output. If not, change the channel values in the script.

Compile the script, and make sure I_out = 0 in the Parameters window. Run the script. Using your amplifier control software (e.g., MultiClamp Commander for Axon, or Pulse or PatchMaster for HEKA), apply a holding current of, say, 100 pA. Read the resulting voltage value in the amplifier software, say 95.7 mV (I use a model cell with Rm = 1 GOhm). Compare that value with the voltage read in the Dynamic Clamp window:

Image:Test_IO Script Voltage Read 1.gif

The value is 96.78. Now apply a holding current of -100 pA from the amplifier control software, and read the voltage. Say it is -97.4 mV. The voltage read in QuB is:

Image:Test_IO Script Voltage Read 2.gif

The value is -96.58. A quick calculation shows that for a +/- 100 pA holding current, the amplifier reads a voltage range of 193.1 mV, whereas QuB reads a voltage range of 193.36. This is a pretty good match, and it means the scaling factor I used of 0.918e-5 is correct. You will have to calculate your own scaling factor, and replace it in the script.

Correcting the voltage offset is simpler. You only need to make sure that when you apply zero holding current with the amplifier control software, you read approximately the same voltage with the amplifier and with QuB. Simply change the voltage offset in the script until you can match these two values.

Now you need to calibrate the current output. Note that I used an external command sensitivity of 400 pA / V, but you may want to change this if you inject larger currents with the Dynamic Clamp. Set to zero the holding current in the amplifier control software. In QuB, set I_out to a very small value, say 0.001, and read the current in the amplifier. Increase I_out in QuB by a factor of 10, until you see some current reading in the amplifier software. The idea is to start small, in case you got the scaling factor wrong and don't want to fry the amplifier. Then, do the same thing as for the voltage. Inject some current, +/-, calculate the ranges in the amplifier and in QuB, find out the scaling factor and the offset, and change the values in the QuB script.

The I/O assignment and amplifier calibration scripts

For convenience, I use two kinetic scripts to specify the I/O channel assignment and amplifier calibration values. These scripts are "amplifier_cal.kin" and "amplifier_io.kin". You must use the calibration values from the "Test_IO.kin" script and copy them in "amplifier_cal.kin". Whenever you write a dynamic clamp script, make sure you "include" these two files, like this:


includefile "amplifier_cal.kin

includefile "amplifier_io.kin


Alternatively, you can just copy the text from "Test_IO.kin" and paste it into your dynamic clamp script.


An example: implementing a spiking neuron on a model cell

The easiest way to understand the principles behind dynamic clamp, as well as the details of implementing dynamic clamp in QuB, is to use, instead of a real neuron, the model cell that comes with your patch clamp amplifier. The MC is equivalent to a neuron that has been stripped of all voltage-gated conductances, except for a leak with a reversal voltage of 0 mV, and a conductance = 1/R_MC. The model cell that comes with the MultiClamp 700B amplifier has Cm = 33 pF and R_MC = 500 MOhm. Also, it has a series resistance Rs = 10 MOhm and a pipette capacitance of 5 pF.

We want to transform the "inert" model cell into a spiking neuron. To do so, we have to add, at the minimum, a Na channel and a K channel. At the same time, we must strip the model cell of its zero-reversal leak, which would otherwise interfere with the spiking behavior of the model. This example should provide practice for real-life application, where currents are added or subtracted to biological cells.

To run this example, download and open the "Test_RT_Spiking_Neuron.kin" script. Make sure the accompanying file, "Test_RT_Spiking.kint" file is downloaded in the same folder. The "*.kint" files contain the most recent values assumed by the parameters declared in the script. After you open the script, give it a quick reading. The comments should be reasonably informative.

First, we want to run the script in simulation mode, which is no different than what you would do with any simulation software, except it runs under real-time constraints. To enable the simulation mode, follow the instructions contained in the script, compile and run. Make sure you set the appropriate values for Cm and R_Lk_MC. Set I_inj = 0 in the Parameters window. The simulation output should look like this:


Image:Test_RT_Spiking_ScreenShot_Sim.gif


In the Dynamic Clamp window you see four traces: the voltage, the Na and the K currents, and the current that is predicted to flow through the model cell's resistor. Not that, in simulation mode, this current is calculated but not injected. In the Trigger Graphic window you see the same four traces.

Now stop the script, change Ch = 5, and restart. This change will display the four traces in the Trigger window starting on channel five, instead of zero. Change the range for each trace so that they overlap. Then stop the script and modify it to run as a simulation with the model cell included in the computation. Once more, make sure you assigned correct values to Cm (in pF) and R_Lk_MC (in GOhm). Restart. The output should look like this:


Image:Test_RT_Spiking_ScreenShot_MC.gif


The cell spikes but with some quantitative differences: the action potential is broader, and spiking is faster. Note that your own simulation might look different. What might cause this difference, appart from imperfections in the amplifier? First, the value of Cm might differ a little from the prescribed value. In my case, it should be 10 pF, but it could be, in fact, 9 or 11 pF. Since I defined the conductances as densities (nS/pF), rather than absolute values, underestimating Cm will result in less total current. In turn, this will cause a broader action potential (think what happens when you add TTX). Changing Cm = 12 results in this output:


Image:Test_RT_Spiking_ScreenShot_MC_Cm12.gif


A little better. So far, the correction for pipette capacitance CFast was turned off. If this correction is enabled (reduce CFast to avoid oscillations), the AP shape improves:


Image:Test_RT_Spiking_ScreenShot_MC_Cm12_CFast.gif


Further changes (Cm = 13 pF and R_Lk_MC = 0.99 GOhm) improve the AP shape and the spiking pattern:


Image:Test_RT_Spiking_ScreenShot_MC_Best.gif


Note the important effect that changing the pipette offset by 1 mV has on spiking frequency:


before Image:Test_RT_Spiking_ScreenShot_MC_.gif after change by 1 mV Image:Test_RT_Spiking_ScreenShot_MC_DC_PO_1mV.gif


When you stop the script, take a look at the time-step histogram, shown in the Reports windw. On my computer it looks like this:


Image:Test_RT_Spiking_TimeStep_Histogram1.gif Image:Test_RT_Spiking_TimeStep_Histogram2.gif


The real-time performance is very good. Of course, the results may be different on your computer. Note that there are some cycles that last a longer time, since the software is not running in hard real-time. However, their fraction relative to the total running time is on the order of 1 in a hundred thousand or less. Thus, for a neuron with a duty cycle where the fraction of the action potential time is about 1%, the chance that one of these longer steps occurs during an AP is quite small.


The results remain very good even at the maxium rate that can be achieved with this particular model, of ~ 75 kHz:


Image:Test_RT_Spiking_TimeStep_Histogram_Max.gif


Note that that this perfomance is achieved while displaying four streams of data in real-time! To let the dynamic clamp run at the maximum possible rate, comment out the minstepsize parameter in the call to the ode.solvert method:


Image:Test_RT_Spiking_MaxRate.gif



History of software development and ackowledgements

I developed the dynamic clamp functionality in QuB while being a postdoc in the lab of Dr. Jeff Smith, at NINDS/NIH.

References

Milescu LS, Yamanishi T, Ptak K, Mogri MZ, Smith JC. 2008. Real-time kinetic modeling of voltage-gated ion channels using dynamic clamp. Biophys J. 95(1):66-87.

Contact

For questions send me an email at: Lorin_Milescu at hms dot harvard dot edu



Prev: Scripts Outline Next: Action Reference