Code Monkey home page Code Monkey logo

heka_patchmaster_importer's Introduction

HEKA Patchmaster Importer

View HEKA Patchmaster Importer on File Exchange

Class to import HEKA Patchmaster files into Matlab. The core functionality is based on the HEKA importer from sigTool (Publication and GitHub Repository) with modifications from Sammy Katta (GitHub Repository).

This stand-alone importer works independent of sigTool and will additionally extract the stimulus (reconstructed from the pgf) and solutions (when solution base was active during recording).

The recordings will be sorted into a table together with various parameters e.g series resistance (Rs), cell membrane capacitance (Cm), holding potential (Vhold), stimulus and solutions. Note: Currently, not all possible stimuli are supported. If your stimulus contains ramps or alternating segments, it won't be reconstructed properly. However, it should work fine for most stimuli and support for new stimuli will be added in the future.

How to use:

Add the folder "@HEKA_Importer" containing all the corresponding files to your Matlab directory.

Input:

  • full file path and name of HEKA Patchmaster file that is to be loaded, e.g. to load HEKA Patchmaster file "MyData.dat" located in "C:\PatchClamp" run HEKA_Importer('C:\PatchClamp\MyData.dat').

Alternative: run HEKA_Importer.GUI which will open the file dialog box from which the Patchmaster file can be selected.

Output:

Heka_Importer creates object containing the following properties:

  • trees: structure containing the dataTree (from the .pul file), the stimTree (from the .pgf file) and solTree (from the .sol file). These tree structures are how HEKA saves the metadata for different recordings. For details on the HEKA file format check ftp://server.hekahome.de/pub/FileFormat/Patchmasterv9/ and ftp://server.hekahome.de/pub/FileFormat/Patchmasterv1000/.

  • opt: structure containing different options when loading the file, currently it only contains the filepath of the HEKA Patchmaster file which was loaded and some temporary information used during loading the files.

  • RecTable: Matlab table containing the recordings and several parameters associated with them. Each row represents a different recording. The recorded data are stored in RecTable.dataRaw and sorted by channel within, e.g. RecTable.dataRaw{1}{2} contains all sweeps of the first series/recording for the second channel. The corresponding name of the channels is stored in RecTable.chNames{1}. Accordingly, the cell capacitance for each sweep of this recording is stored in RecTable.Cm{1}{2}. Note that this is slightly different from how Patchmaster stores the data internally. In Patchmaster, the data tree is nested by Series > Sweep > Channel, whereas the data table in Matlab will be sorted as Series > Channel > Sweep.

  • solutions: Matlab table containing the solutions and composition (chemicals & concentration) used during the experiments. This table is read-out from the solTree of the HEKA Patchmaster file and requires that the recordings were associated with a solution base (otherwise this variable will be empty). The names of solutions correspond to the columns "ExternalSolution" and "InternalSolution" of the RecTable.

UPDATE: As of Patchmaster version 2x90.3 (including Patchmaster Next), HEKA made minor changes to how data is stored in the tree structures. The amplifier settings are now always stored in a separate ".amp" file (which is part of the DAT bundle file). In previous versions, such a separate file was created only for EPC/n amplifiers. The HEKA_Import function has been updated accordingly and should work with older 2x90 versions and newer (>2x90.3/PMN) alike, but the amplifier settings might be stored differently.

heka_patchmaster_importer's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

heka_patchmaster_importer's Issues

Mismatch (offset?) of data where zero=1 in PGF

This is a very great tool. However, I have found that for some of the protocols I inherited, the data read from .dat files were offset. For example, here's the file as loaded within PatchMaster
from_PM

And here was the same data read in using the importer and plotted with MATLAB
from_MAT

At first I thought it was somehow multiplied by a factor of 2, but looking closely I realized it was shifted around -70mV (for example, the AP amplitude). I tried exporting these traces to an ITX file and it was fine.

I noticed that I had this particular issue with protocols that has this:
pgf_zero1

whereas protocols with Zero=0 are fine (as in no offset).

Do you know what's happening?

System info:
PatchMaster v2x90.1 on Windows 7
MATLAB R2018b on Windows 10

EDIT:
Apparently the data have already been zeroed when saved (I think). I have turned this line assignment to 0.

tr.TrZeroData = fread(fh, 1, 'double=>double');% = 88; (* LONGREAL *)

tr.TrZeroData = 0; % instead of fread(fh, 1, 'double=>double');%

And it worked for some reason. Is this right? Is there a place that we can check for that?

add support for non-standard stimuli

Currently, only a limited number of stimuli can be reconstructed and the stimulus channel names are somewhat arbitrary.
Add support for ramps, alternating segments, sine waves etc.

New error when attempting to run HEKA Importer

I've successfully incorporated your HEKA_Importer code into another of my codes for about a year, but recently, I've been encountering an unexpected issue. It only appears to happen on select files, but when I attempt to import a .dat file into MATLAB, I receive the following error:

"Output argument "ser_row" (and maybe others) not assigned during call to
"HEKA_Importer.HI_ImportHEKAtoMat>getSeriesHeaders".

Error in HEKA_Importer/HI_ImportHEKAtoMat>LocalImportGroup

Error in HEKA_Importer/HI_ImportHEKAtoMat (line 144)
matData2{iGr}=LocalImportGroup(fh, obj.trees.dataTree, iGr, grp_row);

Error in HEKA_Importer/HI_loadHEKAFile (line 23)
obj.HI_ImportHEKAtoMat;

Error in HEKA_Importer (line 107)
obj.HI_loadHEKAFile;

Error in Heka_importer (line 9)
HEKA_Importer(file)

This is by far the best code for importing HEKA files for my own analysis and I'd prefer not to export out all the individual traces if possible. Any ideas on what may be going wrong? It seems I can't upload the .dat file, but I can email it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.