Cli for fitting macromolecule pH titration or binding assays data e.g. fluorescence spectra.
Project description
ClopHfit
This package provides a command line interface for fitting pH titration or binding assay data for macromolecules, such as fluorescence spectra. With this tool, users can easily analyze their data and obtain accurate fitting results.
Features
- Plate Reader Data Parser: Support for Tecan and EnSpire (PerkinElmer) file formats
- Non-linear Least Square Fitting: Advanced fitting algorithms with uncertainty estimation
- pH and Chloride Titration Analysis: Specialized tools for GFP library analysis
- Multi-wavelength analysis (e.g., 400, 485 nm) with separate and global fitting options
- Bootstrap uncertainty estimation
- Automatic buffer subtraction for each titration point
- Control variant reporting (S202N, E2, V224Q)
- Dilution correction for titration additions
- Robust error handling with automatic plot and data export
Fitting Methods
ClopHfit provides multiple fitting algorithms validated on 364+ real experimental wells:
- ODR-Recursive: Orthogonal Distance Regression (best error bar precision) ✅ Recommended. ODR is provided by
odrpack. - outlier2: Two-stage outlier detection (good precision, fast)
- IRLS: Iteratively Reweighted Least Squares
- Recursive: Iterative reweighting
- Bayesian (PyMC): MCMC for rigorous uncertainty quantification
- Standard LM and Robust Huber also available
See: FITTING_METHODS_SUMMARY.md for guidance on method selection.
Full analysis: FITTING_METHODS_COMPARISON.md
Installation
From PyPI
Using pip:
pip install clophfit
Recommended: Using pipx
For isolated installation (recommended):
pipx install clophfit
Shell Completion
Enable shell completion for the clop command:
Bash
_CLOP_COMPLETE=bash_source clop > ~/.local/bin/clop-complete.bash
source ~/.local/bin/clop-complete.bash
# Add to your ~/.bashrc to make it permanent:
echo 'source ~/.local/bin/clop-complete.bash' >> ~/.bashrc
Fish
_CLOP_COMPLETE=fish_source clop | source
# Add to fish config to make it permanent:
_CLOP_COMPLETE=fish_source clop > ~/.config/fish/completions/clop.fish
Usage
Docs: https://clophfit.readthedocs.io/
CLI
ClopHfit provides several command line interface tools for fitting and processing data.
prtecan - Tecan File Analysis
Extract and fit titrations from Tecan files collected at various pH or chloride concentrations:
# pH titration analysis
ppr -o output_folder --is-ph tecan list.pH --scheme scheme.txt --norm \
--dil additions.pH --Klim 6.8,8.4
# Chloride titration analysis
ppr -o output_folder tecan list.Cl --scheme scheme.txt --norm \
--dil additions.Cl --Klim 1.0,50.0
Note: Use --no-weight option to reproduce older pr.tecan behavior.
eq1 - Dissociation Constant Prediction
Predict chloride dissociation constant K_d at a given pH:
clop eq1 --help
clop eq1 12 8.2 7.3
prenspire - EnSpire File Parser
Process EnSpire (PerkinElmer) files:
# Basic parsing
ppr -o output_folder enspire data.csv
# With annotation file for titration analysis
ppr -o output_folder enspire data.csv note.csv
Destination folder (default: "./Meas-${version}") will contain for each Measurement:
- a table (csv) in wide tabular form e.g. <lambda, A01, ..., H12>;
- corresponding graphical (png) representation of spectra from all wells.
By adding a note.csv file:
ppr -o folder enspire file.csv note.csv
destination folder (default: "./Meas-${version}") will also contain:
- a pdf for each titration and label;
- a pdf for global (multiband) analysis pdfalong with global and all_SVD;
- a pdf for SVD analysis of all concatenated spectra.
note_to_csv - Note File Converter
Convert and combine note files for different experimental conditions:
# Convert notes for different temperatures
note_to_csv -t 37.0 -l "B E F" -o temp_37 NTT-G03-Cl_note
note_to_csv -t 20.0 -l "A C D" -o temp_20 NTT-G03-Cl_note
# Combine temperature conditions
cat temp_20 temp_37 > G03_Cl_note.csv
Python
ClopHfit can be imported and used as a Python package. The following modules are available:
clophfit.prenspire - parser for EnSpire (PerkinElmer) files
clophfit.prtecan - perform fitting of pH titration or binding assay data
clophfit.binding - perform fitting of macromolecule binding assay data
To use clophfit in your python:
from clophfit import prenspire, prtecan, binding
Development
Requires Python uv.
With uv:
# one-time
pre-commit install
# dev tools and deps
uv sync --group dev
# lint/test
uv run ruff check . (or: make lint)
uv run pytest -q (or: make test)
Dependency updates (Renovate)
We use Renovate to keep dependencies current.
Enable Renovate:
- Install the GitHub App: https://github.com/apps/renovate (Settings → Integrations → GitHub Apps → Configure → select this repo/org).
- This repo includes a
renovate.jsonpolicy. Renovate will open a “Dependency Dashboard” issue and PRs accordingly.
Notes:
- Commit style:
build(deps): bump <dep> from <old> to <new> - Pre-commit hooks are grouped and labeled; Python version bumps in
pyproject.tomlare disabled by policy.
Migrating from Dependabot:
- You may keep “Dependabot alerts” ON for vulnerability visibility, but disable Dependabot security PRs.
Template updates (Cruft)
This project is linked to its Cookiecutter template with Cruft.
- Check for updates:
cruft check - Apply updates:
cruft update -y(resolve conflicts, then commit)
CI runs a weekly job to open a PR when template updates are available.
First-time setup if you didn’t generate with Cruft:
pipx install cruft # or: pip install --user cruft
cruft link --checkout main https://github.com/darosio/cookiecutter-python.git
Notes:
- The CI workflow skips if
.cruft.jsonis absent. - If you maintain a stable template branch (e.g.,
v1), link with--checkout v1. You can also update within that line usingcruft update -y --checkout v1.
License
We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.
All code is licensed under the terms of the revised BSD license.
Contributing
If you are interested in contributing to the project, please read our contributing and development environment guides, which outline the guidelines and conventions that we follow for contributing code, documentation, and other resources.
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 clophfit-0.13.0.tar.gz.
File metadata
- Download URL: clophfit-0.13.0.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31cb1af3f8e7e99c9067aeedc125a3984d788473ed87711e039e817f6b7bad8b
|
|
| MD5 |
34178a919c1457f1d540607ba6105a48
|
|
| BLAKE2b-256 |
4b443f681a04c4a51008e22911fa0db83cb0456c1f8095c772740b455619f4ed
|
File details
Details for the file clophfit-0.13.0-py3-none-any.whl.
File metadata
- Download URL: clophfit-0.13.0-py3-none-any.whl
- Upload date:
- Size: 141.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c35b4cbff97d774dd63d7f56c0b409a58e6ff8f1e70b7b6dbe533e65a90617a9
|
|
| MD5 |
d09b425b3b83d7fd74e46cbc036aadbf
|
|
| BLAKE2b-256 |
da7a64432f26b38f667e6c824d17e34ba108916e29f2ea061842f616a6be03d6
|