10
...... ' ;,m ELSEVIER Journal of Neuroscience Methods 55 (1994) 89-98 JOURNALOF NEUROSCIENCE METHODS Low-cost data acquisition and analysis programs for electrophysiology George B. Grant a,,, Frank S. Werblin b a Biological Laboratories, Harvard University, 16 Divinity Avenue, Cambridge, MA 02138, USA b Division of Neurobiology, Department of Molecular and Cell Biology, 145 Life Sciences Annex, Uniuersity of California at Berkeley, Berkeley, CA 94720, USA Received 7 September 1993;revised 25 April 1994; accepted 2 May 1994 Abstract In the laboratory, powerful personal computers are invaluable tools for data acquisition and analysis. The commercially available software for these purposes is often very expensive and does not always conform to the experimenter's needs. In our laboratory, we have developed two programs for acquisition and analysis of electrophysiological data from retinal neurons, although they can be used for many other types of data acquisition and analysis as well. These programs were written for IBM PC-compatible computer systems and are being distributed as shareware. Thus they are available for users to try out free of charge; if they are found to be of use, they can be purchased for a minimal cost. PATCHIT, the data-acquisition program can use one of several popular data-acquisition boards to simultaneously stimulate and record from an experimental preparation. TACK, the data analysis program was developed to analyze data recorded by PATCHIT and other data-acquisition programs. PATCHIT and TACK are powerful programs which are competitive with similar commercially available programs, but are sold at a much lower cost. Details on the development and operation of these programs are presented in this paper. Keywords: Data acquisition; Electrophysiology; Voltage-clamp; Analog-to-Digital conversion; IBM personal computer; Retina 1. Introduction We here describe two programs for data acquisition and analysis. These programs were written to fill our need for a powerful and easily configurable system that took full advantage of our IBM PC-compatible com- puter systems. They allow the experimenter to easily design, perform and analyze experiments involving patch-clamp recordings from vertebrate retinal neu- rons. These programs are applicable to a wide variety of other purposes as well. The code was written in a combination of the C and Intel 80x86 assembly lan- guage using the Borland C ++ programming environ- ment. Assembly language was used for sections of the code that require very rapid execution. Both programs run on IBM-compatible personal computers. The data-acquisition program, PATCHIT works with several commonly used data-acquisition boards. The * Corresponding author. Tel.: (617) 495-2599; Fax: (617) 496-3321; E-mail: [email protected]. 0165-0270/94/$07.00 © 1994 Elsevier Science B.V. All rights reserved SSDI 0165-0270(94)00080-Z section of the program that controls data acquisition was written in a modular fashion. Calls to the data- acquisition hardware are made through a hardware- independent software layer. This layer of abstraction facilitates support for new data-acquisition boards. The data analysis program, TACK was written to analyze data files written by PATCHIT or by Axon Instrument's CLAMPEX program (rev. 5.1 and greater) (Axon Instruments, 1989). Using TACK, the user can perform many useful manipulations on data and can analyze the relation between current, voltage or what- ever physical parameter the data encodes. Data can be exported from TACK in formats that can be read by many commercially available programs, for further analysis or for generation of publication quality figures. The two programs have much in common. In partic- ular, both operate exclusively in graphics mode and have a similar user interface. This user interface sup- ports a Microsoft-compatible mouse and uses a menu bar on the top of the screen with pull-down menus that control all aspects of the program's function. The de- sign of this menuing system is consistent with that used in many modem application programs. This makes it

Low-cost data acquisition and analysis programs for electrophysiology

Embed Size (px)

Citation preview

Page 1: Low-cost data acquisition and analysis programs for electrophysiology

...... ' ;,m ELSEVIER Journal of Neuroscience Methods 55 (1994) 89-98

JOURNAL OF NEUROSCIENCE

METHODS

Low-cost data acquisition and analysis programs for electrophysiology

George B. Grant a,,, Frank S. Werblin b a Biological Laboratories, Harvard University, 16 Divinity Avenue, Cambridge, MA 02138, USA

b Division of Neurobiology, Department of Molecular and Cell Biology, 145 Life Sciences Annex, Uniuersity of California at Berkeley, Berkeley, CA 94720, USA

Received 7 September 1993; revised 25 April 1994; accepted 2 May 1994

Abstract

In the laboratory, powerful personal computers are invaluable tools for data acquisition and analysis. The commercially available software for these purposes is often very expensive and does not always conform to the experimenter's needs. In our laboratory, we have developed two programs for acquisition and analysis of electrophysiological data from retinal neurons, although they can be used for many other types of data acquisition and analysis as well. These programs were written for IBM PC-compatible computer systems and are being distributed as shareware. Thus they are available for users to try out free of charge; if they are found to be of use, they can be purchased for a minimal cost. PATCHIT, the data-acquisition program can use one of several popular data-acquisition boards to simultaneously stimulate and record from an experimental preparation. TACK, the data analysis program was developed to analyze data recorded by PATCHIT and other data-acquisition programs. PATCHIT and TACK are powerful programs which are competitive with similar commercially available programs, but are sold at a much lower cost. Details on the development and operation of these programs are presented in this paper.

Keywords: Data acquisition; Electrophysiology; Voltage-clamp; Analog-to-Digital conversion; IBM personal computer; Retina

1. Introduction

We here describe two programs for data acquisition and analysis. These programs were written to fill our need for a powerful and easily configurable system that took full advantage of our IBM PC-compatible com- puter systems. They allow the experimenter to easily design, perform and analyze experiments involving patch-clamp recordings from vertebrate retinal neu- rons. These programs are applicable to a wide variety of other purposes as well. The code was written in a combination of the C and Intel 80x86 assembly lan- guage using the Borland C ++ programming environ- ment. Assembly language was used for sections of the code that require very rapid execution. Both programs run on IBM-compatible personal computers.

The data-acquisition program, PATCHIT works with several commonly used data-acquisition boards. The

* Corresponding author. Tel.: (617) 495-2599; Fax: (617) 496-3321; E-mail: [email protected].

0165-0270/94/$07.00 © 1994 Elsevier Science B.V. All rights reserved SSDI 0165-0270(94)00080-Z

section of the program that controls data acquisition was written in a modular fashion. Calls to the data- acquisition hardware are made through a hardware- independent software layer. This layer of abstraction facilitates support for new data-acquisition boards.

The data analysis program, TACK was written to analyze data files written by PATCHIT or by Axon Instrument's CLAMPEX program (rev. 5.1 and greater) (Axon Instruments, 1989). Using TACK, the user can perform many useful manipulations on data and can analyze the relation between current, voltage or what- ever physical parameter the data encodes. Data can be exported from TACK in formats that can be read by many commercially available programs, for further analysis or for generation of publication quality figures.

The two programs have much in common. In partic- ular, both operate exclusively in graphics mode and have a similar user interface. This user interface sup- ports a Microsoft-compatible mouse and uses a menu bar on the top of the screen with pull-down menus that control all aspects of the program's function. The de- sign of this menuing system is consistent with that used in many modem application programs. This makes it

Page 2: Low-cost data acquisition and analysis programs for electrophysiology

90 G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98

easier for novice users to learn the program. However, we have assigned many important program functions, such as that to initiate data acquisition to individual function keys. This allows advanced users to bypass the pull-down menus if they so desire. These programs make the design, execution and analysis of experiments quite simple for the user. Throughout the development process we have strived to ensure that these programs are very reliable while at the same time allowing the user to personally configure the program's operation.

We are distributing these programs as shareware. This means that a user may try these programs and if he or she finds them useful and continues to use them for more than 30 days, they should then pay a nominal fee to the developer. This allows potential users to try the full product risk-free in order to see if it fits their needs.

2. System description

2.1. Hardware requirements

2.1.1. System Both programs work on IBM PC-AT-compatible

computers. A computer with a clock rate of 16 MHz or above is recommended.

2.1.2. Memory When loaded both the data-acquisition program

P A T C H I T (rev. 2.34) and the data analysis program TACK (rev. 3.21) occupy 186 kbytes of system memory. Both programs require more memory to load data or parameter files, a realistic minimum amount of mem- ory for these programs is 512 kbytes.

The programs can access memory above the 1 Mbyte boundary (extended memory) for temporary data stor- age. The eXtended Memory Specification (XMS) pro- tocol is used for this purpose, allowing the programs to access more than 15 Mbytes of memory. By using the industry standard XMS memory interface these pro- grams operate smoothly with other, memory- and CPU-intensive applications software (e.g., Microsoft Windows and Quarterdeck 's Desqview operating envi- ronments).

To fit more features into P A T C H I T and TACK without making the programs use too much conven- tional memory, we have used the Borland V R O O M overlay system. Using this system, modules of the pro- gram (overlays) that have not been used recently are swapped out to EMS (expanded memory) or disk, allowing more free conventional memory for the pro- gram. In order for overlays to be stored in EMS memory an EMS driver (such as Microsoft 's EMM386 or Quarterdeck's QEMM386) need be installed. If the user does not have EMS installed, overlays will be

swapped to the disk, a RAM-based disk cache will improve performance of overlay swapping.

2.1.3. Graphics display Both programs operate entirely in graphics mode

and thus require a graphics display adapter. Since the graphics routines were written using the Borland C library, all graphics adapters supported by this library are available to these programs. These include all standard graphics display types (Hercules, CGA, E G A and VGA), many super VGA display adapters and several more obscure display adapters. Both color and monochrome displays are supported and a user can configure the colors of the display to their own prefer- ence.

2.1.4. Disk storage A hard disk is not required. Both programs can run

off a single floppy disk, making them suitable for minimal system configurations (e.g., teaching laborato- ries).

2.1.5. Math coprocessor An 80x87 math coprocessor is not required for the

programs, but it will speed up certain functions. If either program detects a coprocessor it will be used, otherwise floating-point mathematical instructions will be emulated in software.

2.1.6. Mouse Both programs share a common user interface that

is easily controlled with a Microsoft-compatible mouse. A mouse is not required but speeds up certain aspects of controlling the program and can simplify data analy- sis.

2.1.7. Data-acquisition hardware P A T C H I T was written to work with the Tecmar

Labmaster and Labmaster D M A (Scientific Solutions, 1985) and the Data Translation DT2828 and DT2821 data-acquisition boards (Data Translation, 1992). It will work with all of the boards in the DT2821 family (except the DT2829) and we will refer to all boards in this family generically as the DT2821. At this time these are the only data-acquisition boards supported.

All of the boards supported by P A T C H I T use 12-bit digital-to-analog (DAC) and analog-to-digital convert- ers (ADC). These data-acquisition boards have from 4 to 16 A / D (analog input) channels and 2 D / A (analog output) channels. Both the DT2821 series boards and the Labmaster D M A board can be programmed to transfer analog input data directly to system memory (without CPU intervention) using direct memory access (DMA). This frees the CPU of having to perform these data transfers, leaving more processor time available to handle other functions. All supported data-acquisition

Page 3: Low-cost data acquisition and analysis programs for electrophysiology

G.B. Grant, F. S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98 91

boards have at least 16 binary input/output lines. PATCHIT uses fourteen of these binary output lines as individually configurable outputs that are available to the experimenter to control triggers, shutters and other laboratory equipment during an experiment.

On all data-acquisition boards tested, PATCHIT will acquire data as rapidly as the board can sample. For the DT2821 family the fastest available board is the DT2828, which can sample data at a maximum rate of 4 MHz, but is limited by the host computer's bus interface to a maximum data transfer rate of 100 kHz. Data thus can be sampled on a single channel as rapidly as every 10 /xs. Other boards in the DT2821 family sample at lower rates. Using the 40 kHz model of the Tecmar Labmaster board data acquisition can occur on a single channel at sampling intervals of 25 /xs. Recording on multiple channels decreases the max- imum sampling rate.

2.1.8. Graphics printers/plotters TACK (the data analysis program) can generate

plots and printouts of data on the following printers (and compatibles): Hewlett Packard LaserJet II (PCL-4 printer language), IBM Proprinter (Epson control lan- guage), and any Hewlett Packard plotter (HPGL plot- ter language).

2.1.9. Experimental apparatus Fig. 1 shows a block diagram of a typical configura-

tion used with PATCHIT for experimental data acqui-

' Data " Voltage Clamp Amplifier Host Computer ~Acquisitior ~ RAM ~ -- Board

g pot .) V om 'o.

,. ' , l I N D ".° I * * n,. i l'n"u' '

[ Hard Disk 1 ~ "~ Biuntap~t~~-~,/1 " ~ ~

Fig. 1. General diagram of a PATCHIT-based experimental set up. A data-acquisition board is installed in a PC-AT class computer. Analog data can be recorded from up to 16 inputs (in this example, 2 inputs are in use, both connected to a voltage-clamp amplifier). The data are recorded on the data-acquisition board 's analog input ports and are transferred directly to memory by the host computer ' s D M A circuit. Analog and binary outputs from the data-acquisition board are simultaneously clocked out to external devices. The 2 analog outputs can independently control the voltages sent to 2 separate devices, the binary output can control up to 14 separate devices accepting TTL level trigger inputs. Experimental data acquisition may either be triggered internally (under program control) or exter- nally.

sition. The computer (with a data-acquisition board inside) is shown schematically on the left side of the figure a~nd connections between it and other laboratory equipment are shown. This represents a typical, simple configuration. PATCHIT can control many more de- vices than are shown here, such as another patch-clamp amplifier, iontophoresis units, perfusion systems, etc.

Z2. Software development

These programs were developed using the Borland (Scott's Valley, CA) C ÷÷ version 3.1 and Turbo As- sembler version 3.1 programming languages. We chose the C programming language because it is a high-level compiled language that easily allows a programmer to control machine-specific hardware. The combination of C and assembler language typically produces smaller and faster code than are generated with a program- ming language like BASIC. We chose to use Borland's language products because they were of good value and their implementation of the C language provides an excellent graphics library.

Several functional blocks of the programs were writ- ten in assembly language to speed up execution times. In both programs, the routines that display data traces on the screen were thus coded. For each of the com- monly used graphics display adapters, there is a unique routine that has been optimized to display on the graphics screen the 12 bit data recorded by the data- acquisition board. In these routines, integer math oper- ations are used exclusively to improve execution times. Many other sections of the programs were written in assembler including the routines that control access to the XMS memory interface, the mouse and the data- acquisition boards.

The programs have been tested thoroughly under MS-DOS operating system versions 3.1-6.2. Both pro- grams can be run under the Quarterdeck Desqview or the Microsoft Windows operating environments as standard DOS programs. We routinely run these pro- grams under Microsoft Windows version 3.1 as DOS programs. Note that during individual data-acquisition cycles, PATCHIT disables all CPU interrupts leaving itself in control of the processor, thus temporarily disallowing multitasking.

3. Results (program operations)

These programs have been used primarily for recording and analyzing voltage-clamp currents from retinal neurons using the whole-cell patch clamp tech- nique (Hamill et al., 1981). Although they have been used almost exclusively for these purposes, the pro- grams can gather and analyze data from a variety of sources with no modification.

Page 4: Low-cost data acquisition and analysis programs for electrophysiology

92 G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98

4 . PATCHIT: the d a t a - a c q u i s i t i 0 n program

PATCHIT stores data in files that consist of one or more records, each record consisting of one or more channels of analog data. The user controls a wide variety of parameters that determine how the data is to be sampled. For a single data file the number of records that can be acquired is effectively limited by the amount of storage (in RAM and on disk) available on the computer. A single data record may contain up to 32766 data points. Depending on the data-acquisi- tion board used, data can be sampled at intervals up to 10/zs (100 kHz sampling frequency) for a single input channel. A user-specified delay between each record- ing can be specified. Any number and combination of analog and binary outputs may occur at any time during a data-acquisition cycle. Fig. 2 shows a sample screen display from PATCHIT. In this example the user is selecting the analog input channels from which PATCHIT will record data.

Once the experimental parameters have been set by the user, PATCHIT allocates several buffers in mem- ory. These blocks of memory are used to hold data to be sent to and received from the data-acquisition board. First, a DMA Buffer large enough to contain a single data record is allocated. The DMA circuit on an IBM AT will write within only one physical page at a time (Nolan, 1990). PATCHIT checks the starting and end-

ing addresses of the DMA buffer to ensure that it lies entirely within a single physical page, several algo- rithms are used to guarantee that a valid DMA buffer is allocated. Second, storage is allocated to hold all of the data to be recorded during an experiment. De- pending on how PATCHIT has been configured, this storage will be in conventional memory, XMS memory or on disk, or divided among these. It is into this storage that data will be copied from the DMA buffer following each data-acquisition cycle. Finally a buffer is allocated for storing the output vector. The output vector holds the analog and binary values that are to be sent by PATCHIT to the data-acquisition board. These values will be output on the analog and binary outputs at appropriate times during the recording session.

4.1. Output waueform description

Under PATCHIT, user-specified analog and binary output waveforms are described as a series of 'events'. Events describe changes in the state of an output (as many as 2 analog and 14 binary outputs can be used), such as a step change in analog voltage, an analog ramp or a change in a binary output state. Events can be placed at any time during a record, there is no limit on the number of events that can occur during a record. The timing of all outputs can be independently

I I O o l e 2 1 I I I I I C o n t i n u e F 3 I I INluI~ I R i i c o r d s e F t I I L e n g t h o f R e c e F 2 I I C l o c k P e r i o d ~ F 3 I

-- L ~ l e ' , 8 T i imn a F 4 1 ..j,,,ell I o u t p u t s . e e l ~ M

i ~ J I f - • t S t l 4 O I n l o u t O D i s a b l e d I " " - - 1 1 I n p u t t O i l m b l e d 1 1 2 I rmmut 2 D e e ' s ' l e d

-- | i 3 l n m J t 3 D i ' ~ ' U b l e d 1 1 1 1 4 InPut 4 Dis~wbled ~ 1 5 I n p u t 5 D i s a b l e d 1 ~ / 6 Input 6 D i m l b l e d | l ~ 7 I r m u t 7 D i s . i b l a d ll+L,,,,.'r'18 I n p u t 8 D i a a b l a d

- i! I S I n i ) u t 9 Disabled 511 I A Irw~ut t 0 D i a m b l e d

I B l r m u t t l D i s a b l e d r-~C l r m u t 1 2 D i a a b l e d

I~ J I O I n p u t 1 3 D i s a b l e d _ I q ~ _ + J E l l q ~ u t 1 4 D i e . b l e d

I L _ ~ m n m ~ IEr'l, e b l e d ( 0 t ^ ) IU . . . . n J + , , : - : : : - " : - ' - - :

p l ~ ' - J C a r ~ ~ E n a b l e d I ~ + ~ ' / " + ' + ' + ' + ~ - + ~ , ~ . _ , . . _ ~ - : . ~ Ik~..~, " M i r , , " , ~ I I-,,-.--J~-'+- . . . . . . . . . . . . . : - -

- - I I : j - S c a l e F a c t o r 1 . 0 0 I f ~ ~ O f f s e t 0 1 f ~ ~'- -~" S a v e O h a n s a s

i I I I I I L a s t F i l e : ( N o n e )

Fig. 2. A screen display from the PATCHIT data-acquisition program. Whole-cell currents, recorded under voltage-clamp conditions from a rod photoreceptor in the tiger salamander retinal slice are shown. The cell was held at - 60 mV and a series of command pulses from - 70 mV up to + 20 mV were applied in 10 mV increments. The experimenter is currently configuring the channels of analog input from which to record.

Page 5: Low-cost data acquisition and analysis programs for electrophysiology

G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98 93

controlled at a temporal resolution that is limited to the sampling frequency used for analog input. The algorithm that converts the event descriptors into the output waveform ensures that output timing is consis- tent with respect to the input timing from record to record.

Internally, these events are described by PATCHIT using 'event descriptors' and are stored as character strings because this allows for ease of future expansion and efficiency of storage. All event descriptors contain parameters that describe the time at which an event is to occur and a time increment. The time increment parameter allows the timing of an output to shift with each successive data record. Other parameters used for event descriptors encode the starting amplitude of an analog step or ramp, the slope of a ramp and the increment value for an analog step. This increment value allows the amplitude of an analog output to be incrementally changed for each successive data-acquisi- tion cycle. For a binary output, the event descriptor describes whether the output is to go to a (TTL) logic high or low level at a given time. Binary outputs are very useful as triggers for shutters, iontophoresis units and other laboratory equipment.

For example, in order to describe a - 8 0 mV pulse of width 50 ms, which starts at time 25 ms and is incremented by 10 mV with each successive record, the user would enter two events. The first event occurs at time 25 ms, and specifies a voltage step to -80 mV with a voltage increment of + 10 mV. The second event specifies a voltage step at time 75 ms, returning to the default (holding) potential.

4.2. Data acquisition

Once the user has set the input and output parame- ters to the values needed and PATCHIT has initialized its buffers, experimental data can be acquired. Prior to acquisition of a data record, a routine is executed that translates the list of event descriptors into an output vector. The output vector is an array containing a list of interleaved values that are sequentially output by the data-acquisition board at its sampling clock rate. For instance, if one analog and one binary output were being used, the output vector would contain a list of pairs of values, one value each for the analog and binary outputs. With each tick of the data-acquisition board's clock a pair of these values would be sent to the proper output section of the data-acquisition board.

PATCHIT supports several types of data-acquisition boards. We describe here how a data-acquisition cycle proceeds on one particular board, the DT2821. The DT2821 uses DMA to transfer analog input data di- rectly to memory. On boards without this feature (e.g., the Tecmar Labmaster) analog input cycles are inter- leaved with analog output cycles. Despite this differ-

ence, the general flow of the data-acquisition routine is quite similar between the different types of data- acquisition boards supported by PATCHIT.

The A / D section of the DT2821 is programmed into A / D Clocked DMA mode. This allows the DT2821 to sample data from the user-selected analog input channels for a given number of iterations. Once acti- vated, the DMA interface between the DT2821 and the host computer transfers all acquired data directly to system memory. To accomplish this, PATCHIT ini- tializes the DMA interface and programs the analog input section of the DT2821 into a mode in which a trigger pulse on the external trigger input line will cause it to begin sampling.

PATCHIT uses one of the binary output lines on the DT2821 to send a sync pulse to the DT2821's external trigger input to start the A / D Clocked DMA operation. This self-triggering feature ensures that in- put and output operations are started at the same time (and in phase with the DT2821's internal clock). The synchronization pulse remains at a logic low level for the entire data-acquisition cycle and can be used to trigger an oscilloscope or other laboratory equipment. Alternatively, the data-acquisition cycle may be syn- chronized to an external signal by supplying a synchro- nization pulse to the external trigger input on the DT2821.

Once the DT2821 has been triggered, the analog input section of the board begins sampling data and transferring it to memory via the DMA interface. Si- multaneously, the routine controlling output begins sending the contents of the output vector to the analog and binary outputs of the DT2821. The program is designed to handle any combination of analog or bi- nary outputs. We have taken great care to synchronize the flow of output with the flow of input. This is ensured by having the data-acquisition routine poll the DAC Ready bit in the DT2821's D / A Control/Status register before loading the DT2821 with the next set of values to be output. When this bit is set it indicates that the board has clocked previously loaded data to the proper output and new data can be loaded into the D / A Data register. The bit will set only once the DT2821's internal clock has ticked, which also indi- cates that analog input data has been clocked onto the board.

During the entire data-acquisition cycle all CPU interrupts are disabled. This is necessary to prevent the data-acquisition cycle being disrupted by another inter- rupt (e.g., Clock, Mouse, Keyboard, etc.). The flow of simultaneous input and output operations during the data-acquisition cycle continues until the DT2821 has recorded the desired amount of analog input data. The DMA transfer will automatically stop at this time, the data-acquisition routine terminates and program con- trol is returned to the main level of PATCHIT for

Page 6: Low-cost data acquisition and analysis programs for electrophysiology

94 G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98

Initialize Output Vector from I Table of Event Descriptors I

I

Initialize DMA Circuit I Set DT2821 for A/D Clocked DMA Mode I Load Input Channel Sequence to DT2821

I

I Disable CPU Interrupts I Generate Trigger Pulse for DT2821

I Load Next Analog and/or Binary Output I Value from Output Vector to the Proper Register on DT2821 Board

No No

I Re-Enable CPU Interrupts I Display Data in DMA Buffer on screen

~ Copy Data from DMAL___. Buffer to Disk File |

~ ' - ' = ' N ~ Copy Data from D M A L ~ Buffer to XMS Buffer |

No~ ICopyOatafromDMABuffer I

to Conventional Memory Buffer

Fig. 3. Flow chart from the PATCHIT data-acquisition program. This segment demonstrates the logic of the program's operations for simultaneous analog/binary output and analog input used during each data-acquisition cycle for the Data Translation DT2821 series board. This algorithm is implemented in a combination of C and 80x86 assembly language, sections of code requiring the most rapid execution were written in assembly language. In this diagram, the trigger for the DT2821 is generated internally by the subroutine that controls output generation. This trigger starts the DT2821's A / D Clocked DMA (input) operation, ensuring that input and output operate in lock-step. An external trigger may be used in place of the internal trigger. Details of error checking are not shown here.

4.3. Pulse generator mode

In addition to the standard data-acquisition mode described above, PATCHIT can be configured to oper- ate as a programmable pulse generator. In this operat- ing mode PATCHIT sends out voltage pulses of a given amplitude and duration on an analog output while sampling data on a single channel. Using the function keys, the user can change the amplitude of the voltage pulse quickly. This function is very useful dur- ing the process of attaining the whole-cell patch clamp recording configuration. The current recorded in re- sponse to the voltage pulse protocol can be used to monitor both the development of a 'gigaseal' and entry into the whole-cell recording mode configuration. In the pulse generator mode, data is only displayed on the screen and is not stored to disk.

4.4. Data storage

Experimental data is sampled by PATCHIT using the data-acquisition routine described above. Each record can be stored to disk as it is acquired (this causes a delay of 150 ms minimum), or all acquired records can be stored to file in one operation at the end of each experiment. In addition to containing the experimental data, PATCHIT data files have a header that contains all of the parameters used by PATCHIT to acquire the data, plus a user-specified comment of any length. Data is stored in the 12-bit format native to the data-acquisition board.

5. TACK: the data analysis program

The program TACK was written for the analysis of data generated by PATCHIT and other software devel- oped in our laboratory. It can also read data written in the CLAMPEX version 5.1 format. The initial purpose for writing this program was to measure currents or voltages from experimental data and to generate graphs from this data. With time we have added features to TACK that allow it to modify data directly, to perform operations between data files and to output this data in a format useable by presentation graphics programs. Particular effort was put into minimizing the amount of repetitive operations that often accompany the analysis of experimental data.

display and storage of the data. A data trace is only displayed once the entire data record has been ac- quired, it is not displayed in real-time. Fig. 3 shows a simplified flow-chart of the operation of PATCHIT's data-acquisition routine for the DT2821 family of data-acquisition boards. Details of error-checking are not shown for simplicity.

5.1. Measurements from data

Frequently, the main purpose of loading a data file into TACK is to measure currents or voltages from the raw data. For simplicity we will discuss currents al- though the raw data could encode other physical pa- rameters (e.g., voltage, temperature, pressure, etc.).

Page 7: Low-cost data acquisition and analysis programs for electrophysiology

G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98 95

From the data the average, minimum, maximum, inte- gral or value at a single point in t ime can be measured. For all of these cases the user specifies the desired X-axis range and whether to record the actual value of the current or relative to some baseline value. The user then selects the region of time over which to measure the data. This region can be selected either numeri- cally or graphically (under cursor control). If the mea- surement is being made relative to some baseline, the timing of this is also cursor-selectable, but will default automatically to previously used baseline timing (this can be easily overridden). Once the timing has been selected, T A C K will measure and display the values as a graph. The user can then view the numerical data (and relevant statistics) and copy these to an ASCII text file. We chose to write this file in ASCII format because almost all commercially available spreadsheets can import these files. We generally use spreadsheets to generate final quality graphs as they offer a wide variety of options and features that we have not chosen to duplicate in TACK.

5.2. Data modifications

T A C K allows the user to modify data in many ways. Any combination of unwanted channels or records can

be deleted from the data file and the timing range of the data can be narrowed. Each record in a data file can be modified individually, for instance to normalize data relative to the value of a baseline current. An automatic normalization function is available for this purpose. For presentat ion of data, records may be smoothed with a gaussian filter to eliminate high fre- quency components. Finally, data records may be scaled or offset by arbitrary numerical values. This is useful for vertically staggering data traces for illustrative pur- poses.

5.3. Multiple data files

A very valuable feature of T A C K is the ability to load any number of data files simultaneously, the quantity being effectively limited by available memory. T A C K stores each file in a buffer that contains all the data and parameters from that file. The parameters , comments and data can be easily viewed. Individual buffers can be copied, modified or erased. The con- tents of any number of buffers may be added, sub- tracted or averaged. The results of these operations can be stored in new buffers that can be written to disk as data files.

i l m r ~ B u f f e r L o a d F i l e F 8 I I S a v e F i l e

OS B u f f e r A : H 2 2 8 A 3 P | o F i l e t L ~ t p . p r n C o n E x p o r t A s c i i . " ' . ' " D e l i R i t e d R D O C h a n n e l 0 O u i R e c o r d s t - ) t

T l ~ e 0 . 0 0 - > 4 0 0 6 . D 0 ~SL-C R l a i U e l u e s

X U T i n e -- S a n E v e r y P o i n t

Quit

E d i t D i s p l a w H e a s u r e O e l l I 4 1 6 K R A H i I I I 1

i ! 2 0

5 0 0 ~ S

I I I I I I 5o ~ I . Re¢ : I/ I .

Fig. 4. A screen display from the T A C K data analysis program. The user is exporting raw data from the program in ASCII text format. The displayed data traces are current clamp light responses from a horizontal cell in the tiger sa lamander retina. The st imulus trace is shown in the upper part of the screen, partially obscured by the drop-down menus. Each of the displayed traces are stored in a separate file and are all simultaneously loaded in TACK.

Page 8: Low-cost data acquisition and analysis programs for electrophysiology

96 G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98

5.4. Measurement of cell parameters

For data recorded from cells under voltage-clamp, T A C K can measure certain cell parameters. These are the input resistance, series resistance and membrane capacitance of the cell. To measure these values from the data, the user selects a range of data records that contain no voltage-dependent currents. For determina- tion of the input resistance, the user selects a range of time during the record(s) over which the current is time-invariant. The user also enters the range of volt- ages that were applied to the cell to generate the currents. TACK will then calculate the input resistance from the data.

The value of the input resistance can then be used to subtract from the raw data that component of the current that is carried by the voltage-independent leak (leak subtraction). In much the same way the series resistance and membrane capacitance can be calcu- lated from the data.

5.5. Exporting data

T A C K was written to be a front end program to analyze data from P A T C H I T and other data-acquisi- tion software. As such, T A C K can translate data into a format useable by other applications software. The most flexible format for transferring numerical data between programs is in ASCII text files. For many operations TACK exports numerical data as a file filled with comma-delimited numerical values (6 signif- icant figures). These data can be read into all spread- sheets and graphing programs that we have used. The user may also translate the raw data from the binary format used by P A T C H I T into ASCII values to import into other applications. Fig. 4 shows a sample screen display from TACK. Here, the user is exporting data in an ASCII text file, using a comma-delimited format suitable for loading the data into a spreadsheet.

For exporting data traces in a format other than ASCII we use the Hewlett Packard Graphics Language (HPGL). This is a vector-based drawing language used for controlling pen plotters. Many DOS-based drawing programs (e.g., Corel Draw) have import filters that allow files written in this format to be imported di- rectly. H P G L has proven to be an excellent format for the generation of presentation-quality plots of data records. TACK can also print out data traces to any of the printers supported.

5.6. Command files

We often need to measure currents from large num- bers of data files and save these values in a file for manipulation in other programs. This sort of operation is very repetitive and can temporarily take the fun out

of science. To help to alleviate this, T A C K can process characters entered into a command file as if they were keystrokes being entered by the user. Properly used, this facility allows the experimenter to configure TACK to automatically grind through large sets of data. The measured data can then be read into another program, such as a spreadsheet, for further analysis.

6. Discussion

6.1. Advantages of patchit and tack

In this paper we have presented details of two programs that we have developed in our laboratory. These programs were written to allow an experimenter to utilize their existing data-acquisition hardware to its full extent for a very reasonable cost. While there are many other data-acquisition and analysis packages available, most of these are quite expensive. For exper- imenters who are trying to control costs, our programs allow them better use of their hardware and time.

P A T C H I T and TACK provide some valuable fea- tures that are not available elsewhere. In terms of cost and features available, we feel that our programs are competitive with other data-acquisition and analysis systems that use the same hardware. We here contrast our programs with some similar systems available for IBM PC-compatibles and point out some of the advan- tages of our solution.

6.2. Comparison with clampex

CLAMPEX, part of the pClamp suite of programs for electrophysiology (Kegel et al., 1985; Axon Instru- ments, 1989) is one of the most commonly used pro- grams for voltage-clamp experiments. With the release of version 6.0 of this program, Axon instruments has released a new proprietary data-acquisition card and chosen to no longer support the non-DMA version of the Tecmar Labmaster. This leaves owners of this board with no upgrade path other than to purchase a new data-acquisition board. P A T C H I T supports both the D M A and non-DMA version of the Labmaster, this section will only compare P A T C H I T with CLAM- PEX running on the Tecmar Labmaster data-acquisi- tion board.

PATCHIT ' s use of event descriptors to describe output waveforms is more flexible than description of output waveforms under CLAMPEX (5.x), where the user is limited to only 4 changes in output state during a single recording. P A T C H I T has several other advan- tages over CLAMPEX that have made it particularly useful for our needs. P A T C H I T can record data from as many analog input channels as there are on a given board. CLAMPEX only supports 4 channels (8 for

Page 9: Low-cost data acquisition and analysis programs for electrophysiology

G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98 97

version 6.0) while PATCHIT supports all 16. Similarly PATCHIT can control all of the analog output chan- nels on the data-acquisition board. CLAMPEX can control only 1 (CLAMPEX 6.0 can set the holding potential on the other analog output, but cannot con- trol 2 output waveforms simultaneously). This feature has allowed us to perform dual-patch clamp experi- ments (in which 2 cells are recorded from, each using individual patch-clamp amplifiers). Finally, PATCHIT can control up to 14 binary outputs, each of which can change state repeatedly during a data-acquisition cycle, CLAMPEX can only control 2 such outputs. This fea- ture has been invaluable for us, as during the course of our experiments we often have to trigger many devices such as puffers, shutters and perfusion systems. Two binary outputs are often not sufficient.

A seemingly arbitrary limitation of CLAMPEX 5.x is that it can record a maximum of 2048 points during a data-acquisition cycle (> 16,000 for version 6.0), PATCHIT can record more than 32,000 points each cycle, being limited by the size of a real-mode memory segment on Intel 80x86 microprocessors (Intel Corpo- ration, 1987).

6.3. Comparison with VCAN

The VCAN (Voltage Clamp ANalysis) program (De- mpster, 1993) is a part of the Strathclyde Electrophysi- ology Software package of software. This was devel- oped at the University of Strathclyde and is distributed free of charge to academic users. A licensed version of this program is also sold by the Dagan Corporation (Minneapolis, MN). Like PATCHIT, VCAN can work with a variety of different data-acquisition boards. VCAN is a single program, which integrates both the acquisition and analysis functions into one program. We have divided the data-acquisition and analysis functions into 2 separate programs, some users may find this inconvenient. VCAN shares some of the limi- tations of CLAMPEX since a single data record can contain no more than 2048 points, and it can record on only 2 channels of analog input. It uses a fairly simple output description format, that is not as flexible as that used by PATCHIT. VCAN has some powerful data analysis features and is available free of cost to aca- demic users.

6.4. Comparison with development environments

Other data-acquisition programs are based on devel- opment environments such as AXOBASIC and ASYST. With these programs, end-users can develop data-acquisition programs to their own liking. How- ever, this solution is only attractive to experimenters who feel comfortable programming. Not every user wants to develop and debug their own data-acquisition

system. It is to these users that our programs are directed.

AXOBASIC (Axon Instruments, Foster City, CA) is an extension to the Microsoft Quickbasic programming language and allows the user to put together data- acquisition and analysis programs to their own liking. Commands are available for simultaneous output waveform generation and data acquisition. Data acqui- sition can occur on up to 16 channels and output can occur on 2 analog outputs. While 4 binary outputs are available for trigger generation, these are not available if both analog outputs are used. This differs from PATCHIT, where both analog outputs and all 14 bi- nary outputs are available. AXOBASIC also provides commands for performing a wide variety of manipula- tions and analysis on experimentally obtained data.

ASYST is a powerful development environment for data acquisition and analysis. ASYST is a general purpose system which is not as applicable to electro- physiology as the other systems described here. An- other serious problem with ASYST is its enormous overhead in terms of system memory and inability to link in user-developed functions written in other pro- gramming languages (such as to draw the data quickly to the screen). Further, the ASYST environment uses its own programming language and development tools. It seems unnecessary to have to become conversant in a new language for such a specific task. This is not true of an environment like AXOBASIC, that is based upon a commonly used programming language.

CLAB and Basic Fastlab (Indec Systems, Capitola, California) are electrophysiology development systems based upon well-known programming languages (C and Basic, respectively). While these systems have been quite popular, they are no longer being supported for new users by their manufacturer. Instead, Indec Sys- tems is now selling to new users a Microsoft Windows Visual-Basic-based system. Since the software that we describe here is a DOS-based system and will run on any DOS computer (not just a Microsoft Windows- based computer) we feel that it is inappropriate to compare PATCHIT and TACK with Microsoft Win- dows-based systems.

6.5. Cost considerations

Software for data acquisition and analysis constitute a niche market, and as such it is consequently very expensive. As we had programming talent available in the laboratory, the cost to our laboratory of develop- ment of these programs was not excessive. Because of this we have decided to distribute these programs at a minimal cost to fellow researchers, this is discussed at the end of the paper.

The primary developer of these programs (the first author) wrote them as a graduate student while con-

Page 10: Low-cost data acquisition and analysis programs for electrophysiology

98 G.B. Grant, F.S. Werblin /Journal of Neuroscience Methods 55 (1994) 89-98

ducting thesis research. The programs represent ap- proximately 5 years of part-time work by 1 program- mer. Due to productive interactions among the mem- bers of the laboratory who have used the software, we have been able to track down and quickly fix errors and limitations in the code. One of the major advantages of this sort of in-house program development has been that we have been able to quickly add new features to the programs as they have become necessary or de- sired.

In this paper we have described 2 programs that we have written and that are in use in several laboratories. While they are both very powerful programs, we have tried to make the programs as easy to understand and control as possible. For that reason they will make the tedious tasks of physiological experiments less onerous.

6.6. Program distribution

We are distributing these programs as shareware. This means that a user may try these programs and if he or she finds them useful and continues to use them for more than 30 days, they should then pay a nominal fee to the developer. The purpose of this fee is to partially repay the developer for his work. At this time the fee is $35.00 (US) per program. Readers interested in evaluating either of these programs may download them by anonymous FI 'P from OAK.Oakland.Edu (141.210.10.117, directory: pub /msdos / sc ience) or download them from Compuserve (Science/Math Fo- rum) or else may contact the authors directly. The source code for these programs is also available.

Acknowledgements

The authors are grateful to Paul Cook, Cun-Jian Dong, Scott Eliasof, Maarten Kamermans, Peter Lukasiewicz, Serge Picaud and Haohua Qian for sug- gestions, complaints, bug finds and helpful advice. Their comments have increased the value of these programs. In addition we acknowledge the fine work of Steve Howe who wrote much of the previous generation of software used in the laboratory. Many features of these programs were incorporated into PATCHIT and TACK. This work was supported by the National Insti- tutes of Health (Grants EY06484, GM07048 and EY00561).

References

Axon Instruments (1989) pClamp User's Manual Version 5.5, Axon Instruments, Foster City, CA, 150 pp.

Data Translation (1992) User Manual for DT2821 Series, Data Translation, Marlboro, MA, 173 pp.

Dempster, J. (1993) Computer Analysis of Electrophysiological Sig- nals, Academic Press, London, 228 pp.

Hamill, O.P., Marty, A., Neher, E., Sakmann, B. and Sigworth, F.J. (1981) Improved patch-clamp techniques for high-resolution cur- rent recording from cells and cell-free membrane patches, Pflugers Arch., 391: 85-100.

Intel Corporation (1987) Intel 80286 and 80287 Programmer's Refer- ence Manual, Intel Corporation Literature Division, Santa Clara, CA, 139 pp.

Kegel, D.R., Wolf, B.D., Sheridan, R.E. and Lester, H.A. (1985) Software for electrophysiological experiments with a personal computer, J. Neurosci. Methods, 12: 317-330.

Nolan, T. (1990) Real-time data acquisition using DMA, Dr. Dobb's J., 15: 28-37.

Scientific Solutions (1985) Users Manual for LabMaster Data Acqui- sition Board, Scientific Solutions, Solon, OH, 128 pp.