Batch analysis tool for patch-clamp electrophysiology data
Project description
Go to https://github.com/ck852/patchbatch?tab=readme-ov-file#patchbatch---electrophysiology-data-analysis-tool for the most up-to-date README
PatchBatch - Electrophysiology Data Analysis Tool
Installation
Option 1: Download Executable
-
Go to Releases
Windows:
-
Download
PatchBatch-Windows.zip -
Extract and run
PatchBatch.exe
Mac:
-
Download
PatchBatch-macOS.dmg -
Double-click to mount
-
First run: Right-click > Open (to bypass Gatekeeper)
-
Option 2: Install from PyPI (Recommended if you have any installation issues with the executables)
To update:
To update your version if you installed from PyPI, open a terminal and enter pip install --upgrade patchbatch
Prerequisites: Installing Python
If you don't have Python installed:
- Download Python: Visit python.org and download Python 3.9 or newer
- Install Python: Run the installer and check "Add Python to PATH" during installation (Windows) or use the default settings (Mac/Linux)
- Verify Installation: Open a terminal/command prompt and type
python --versionorpython3 --versionto confirm installation
Opening a Terminal/Command Prompt
Windows:
- Press
Win + R, typecmd, press Enter - OR: Right-click in any folder while holding Shift, select "Open PowerShell window here"
Mac:
- Press
Cmd + Space, typeTerminal, press Enter - OR: Finder → Applications → Utilities → Terminal
Linux:
- Press
Ctrl + Alt + T - OR: Right-click desktop, select "Open Terminal"
In your terminal, run these commands:
pip install patchbatch
patchbatch
If pip isn't recognized, instead try
python -m pip install patchbatch
If python is not a recognized command, try replacing python with python3 in all instances.
If you install from PyPI, you will always start the program by opening a terminal in the same directory where you installed it and simply enter patchbatch.
Option 3: Install from Source (Developers)
git clone https://github.com/ck852/patchbatch.git
cd patchbatch
pip install -r requirements.txt
python src/data_analysis_gui/main.py
Contributing
Found a bug or want to contribute? Please open an issue at: https://github.com/ck852/patchbatch/issues
Note that this software is currently in beta. There may be bugs and irregularities that were not seen in development. You are encouraged to validate your initial results against a trusted data analysis program such as WinWCP to ensure that all data processing modules are functioning as expected. See the Validation section at the end of this README for more information.
Introduction
Welcome to PatchBatch! The purpose of this program is to streamline electrophysiology data analysis workflows by enabling batch-analysis of data files that share the same analysis parameters. I developed this after growing impatient with the long, tedious workflows that require defining the same parameters repeatedly for every file, followed by further rote transformations that could be defined algorithmically. This is typically a repetitive process that, while not technically complicated, requires extended periods of focus to do reproducibly without errors. I developed this program because I wanted to conserve this cognitive effort for data interpretation and further experiments.
How to Use
Start by clicking "Open" in the top left corner. Select a single file to analyze. The sweeps should appear in the plot. The right and left arrows next to the "Open" button adjust which sweep is displayed. You can drag the green cursors to desired positions to define your analysis time range, very similar to WinWCP. You can also define them in the "Range 1 Start (ms)" and similar fields under "Analysis Settings". Note that you can check "Use Dual Analysis" to extract data from two regions in one output. Below, adjust "Plot Settings" for your desired analysis. This program includes the same four peak analysis modes (absolute, positive, negative, and peak-peak) available in WinWCP. The peak mode can be adjusted in the corresponding drop-down menu in the main window.
If you'd like to preview the output plot, click "Generate Analysis Plot". From there, you can export a CSV file with the analyzed data. If you only want the data without seeing the plot first, just click "Export Analysis Data" at the bottom of the window.
This program makes it possible to analyze several electrophysiology files with the same analysis parameters. To use this feature, start by setting all of the desired parameters as you would do for a single file. It is optional to open a single file in the main window first - if you know all of your parameters, you can skip loading the single file and go straight to batch analysis. The "Batch Analyze" button is under the "Analysis" menu at the top. A new window will appear which will prompt you to select files for analysis. Click "Start Analysis", then "View Results". A new window will appear that plots the analysis results. From this window, you can export individual CSV files for each analyzed file. These can be directly imported into Graphpad Prism.
IV Analysis
If you are doing I-V analyses, the program allows you to create summary IV curves from batch analyses. When Current and Voltage are chosen as the Plot Settings, the Batch Analysis window will have an option to "Export IV Summary". This will output a single CSV that contains the voltage set from your first analyzed file, rounded to the nearest integer, in the first column. All subsequent columns will contain the analyzed current data from all sweeps from all input files.
IMPORTANT FOR SUMMARY IV: the user is responsible for their own data inputs; input files that use different voltage sets will yield erroneous results. Also note that voltages are rounded to the nearest integer. If the voltage sweeps are leaky, unstable, or otherwise inconsistent, the Summary CSV will likely be missing data points.
You also have the option to generate a current density IV curve. Click the "Current Density IV" button in the Batch Analysis window. You will be prompted to enter Cslow values for all files. Then, a new window will appear that plots the current densities against voltages.
Similarly to the initial batch analysis, you have the option to export individual CSV files for every analyzed file, as well as a single Summary IV that follows the same format described above. The only difference is that these outputs contain current densities, rather than raw currents. All output CSVs are designed to be easily imported into Graphpad Prism.
Time-course Analysis
The workflow for other analyses, such as Time vs Current, proceeds in a very similar manner. For such time-course analyses, it is sometimes desirable to extract data from more than one analysis range per sweep. To this end, the "Use Dual Analysis" box enables the user to define a second analysis range.
This enables the user to quickly plot both analysis ranges against the sweep times. The user can also output a CSV containing this data, ready for import into downstream analysis procedures.
Background Subtraction BETA
You can define a region from any current trace as the background region. The average current in this region will be calculated and subtracted from all current measurements in the sweep. This process repeats for all sweeps in the file.
Ramp IV BETA
If your data uses ramp voltage protocols to measure IV relationships, you can use the "Ramp IV" option in the "Analysis" menu. First, set the cursors around the ramp.
Then you can define the voltage range you are analyzing. The script will find the closest measured voltages within your analysis range and extract the current measurements at those time points. It will do this for all sweeps or a selection of sweeps. This has not been quantitatively tested yet and I highly advise validating against a known data set first.
Better screenshot pending
Dose-Response BETA
Click the "Add Range" buttons then click the plot to add them. This is meant for time vs current output files by the main window. The multi-file analysis lets you make a Prism-ready summary dataset for several files that have the same concentration range. Has not been extensively validated but matches excel-calculated results in tests.
Sweep Extraction BETA
Access from the Analysis menu. Load a file in the main window first. Has not been extensively validated but matches Clampfit results in tests.
Validation
To validate the data processing modules of this program, analyses were performed on sets of real electrophysiology data files. The outputs by this program were compared with outputs by WinWCP, both analyses using identical parameters.
IV Analysis
This program's data processing methods have been validated by comparing PatchBatch outputs to those of WinWCP. Both analyses used the same dataset of 12 patch-clamp recordings. Each analysis used an analysis range of 150.1 ms - 649.2 ms, with the X-axis plotting Average Voltage and the Y-axis plotting Average Current. The input abf files are available in the file repository. The comparison found excellent agreement between both analysis methods. Each recording contained 11 sweeps, thus 132 data points were compared. The maximum discrepancy in the analyzed current values was 0.049694 pA. Similarly, the distinction in the measured voltage was 0.011475 mV. The distinction is due to differences in floating point arithmetic in data averaging operations in WinWCP (written in Pascal) versus Python. WinWCP uses 32-bit floating-point precision (~7 significant digits), while PatchBatch uses Python formulas with 64-bit precision (~15-16 significant digits). Because the raw data is stored as integers before being scaled to practical units, the only real difference is that 64-bit precision actually produces more accurate calculations at the expense of increased computation time, which is negligible for the intended applications of this program. These results are summarized as follows:
To assess the ABF functionality, the same WCP files were converted to ABF. File format conversions were performed in WinWCP. The ABF dataset was analyzed with the same parameters as the WCP dataset. The results were nearly identical to those of the WCP dataset.
For files analyzed in WinWCP, current densities were calculated in Graphpad Prism. A direct comparison of a Current Density vs. Voltage relationship plot produced by WinWCP vs. by PatchBatch shows that the WinWCP results are accurately reproduced by PatchBatch. In this example, the ABF dataset was used:
For current density analysis, the following Cslow values were used:
| File ID | Cslow |
|---|---|
| 250514_001 | 34.4 |
| 250514_002 | 14.5 |
| 250514_003 | 20.5 |
| 250514_004 | 16.3 |
| 250514_005 | 18.4 |
| 250514_006 | 17.3 |
| 250514_007 | 14.4 |
| 250514_008 | 14.1 |
| 250514_009 | 18.4 |
| 250514_010 | 21.0 |
| 250514_011 | 22.2 |
| 250514_012 | 23.2 |
Time Course and Dual Range
To validate the functionality of time course analyses, three WCP files were analyzed in WinWCP and PatchBatch. For these files, there were two analysis ranges of interest. Thus, the dual analysis range functionality was also validated. The first analysis range was 50.45 - 249.8 ms and the second range was 250.45 - 449.5 ms. The files were batch-analyzed in PatchBatch using Time (Voltage) on the X-Axis and Average (Current) on the Y-Axis. There was excellent agreement between the analysis of both programs, with a maximum discrepancy of 0.005005 pA found across all data points (n = 1278). Similarly, the Time values extracted from the WCP files in PatchBatch showed very good agreement with WinWCP, with a maximum discrepancy of 0.005 s in this data set (n = 639).
Peak Analysis
The four peak analysis modes (absolute, positive, negative, and peak-peak) were validated using one of the same WCP files from the time course validation. The analysis range was 50.2 - 164.9 ms. The analysis plotted Peak Voltage versus Peak Current. A similar maximum discrepancy of 0.00497 pA and 0.000485 mV was found across all four peak modes (n = 1278). The discrepancies of the peak current values for all four peak modes are summarized in the following figure.
License
PatchBatch License
PatchBatch is released under the MIT License. See LICENSE.md for details.
Third-Party Components
PatchBatch uses PySide6 (Qt for Python), which is licensed under LGPLv3. This means:
- PatchBatch itself remains MIT-licensed
- PySide6 components remain LGPLv3-licensed
- You can modify and redistribute both, subject to their respective licenses
See LICENSES/THIRD-PARTY-NOTICES.txt for complete attribution and LICENSES/LICENSE-LGPLv3.txt for the full LGPLv3 terms.
Rebuilding with Modified PySide6
Advanced users can replace or modify the PySide6 library. See BUILD-INSTRUCTIONS.md for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file patchbatch-0.9.2b6.tar.gz.
File metadata
- Download URL: patchbatch-0.9.2b6.tar.gz
- Upload date:
- Size: 267.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c60816ac1920ea70951c804ad9925e12137518eca6d4744b333933dd1cf2e98
|
|
| MD5 |
ac13be4ba28fbab219356732da4aebe7
|
|
| BLAKE2b-256 |
a4b515b84528ca9746463c1800a3c9227f4b0b6f38481dbcb5d3989686ffe297
|
File details
Details for the file patchbatch-0.9.2b6-py3-none-any.whl.
File metadata
- Download URL: patchbatch-0.9.2b6-py3-none-any.whl
- Upload date:
- Size: 299.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fa6190a109aeb396a297c6d95848d33e92ea31727d7a882299270376acfa32c
|
|
| MD5 |
4d7c528e0431f5fd22c348b0b5e03096
|
|
| BLAKE2b-256 |
1354bcd0d1a3be2b39167562081603378f7968bf1274567fc6a1fe432904a301
|