Python client for weighed buffer recipes with temperature-corrected pH via the Pepkio API
Project description
Pepkio pH Buffer Recipe Calculator
Python client for the Pepkio pH Buffer Recipe Calculator API: weighed buffer recipes with temperature-corrected pH, ionic strength, and stock dilution from scripts or notebooks.
What It Does
Preparing Tris, phosphate, HEPES, and other biological buffers at a target pH requires the correct acid/base ratio, masses for the final volume, and—when prep and use temperatures differ—a realistic estimate of pH at the bench.
Manual Henderson-Hasselbalch calculations and spreadsheets often use pKa at 25 °C only, omit ionic strength, and do not warn when a buffer made at room temperature will read a different pH on ice. Diluting a concentrated stock without re-checking pH is another common source of error.
This package calls the same Pepkio Tools calculation engine as the hosted web application. Use PepkioClient.run() from Python, Jupyter, or automation pipelines to obtain grams of acid and base forms, temperature-corrected pKa, predicted working pH, ionic strength, gravimetric and titration routes, stock dilution volumes, protocol steps, and shareable run links.
Programmatic runs require a network connection and a Pepkio API key. Calculations are not bundled for offline use.
Features
- Buffer systems: Tris, sodium phosphate, HEPES, and other common laboratory buffers (
buffer_id) - Modes:
calculator(weigh from dry reagents) andstock(dilute concentrated stock) - Separate preparation and working temperatures with van't Hoff pKa correction and predicted pH at use temperature
- Weighed recipes: acid and base masses (g) plus gravimetric and titration preparation routes
- Ionic strength estimate (mM) with optional
target_ionic_strength_mMoradded_salt_mMfor NaCl adjustment - Stock dilution:
stock_volume_mL,diluent_volume_mL, and pH re-check guidance - Compatibility warnings for common assay conflicts
- Manifest and named examples:
get_manifest,list_examples,get_example_input - CLI:
pepkio-ph-buffer-recipe-calculator manifestandrun - Configuration via
PEPKIO_API_KEYandPEPKIO_API_BASE_URL
Installation
pip install pepkio-ph-buffer-recipe-calculator
Set an API key with tools:run scope before calling run():
export PEPKIO_API_KEY="your-key"
Create a key in your Pepkio account API keys settings.
Quick Example
from pepkio_ph_buffer_recipe_calculator import PepkioClient
with PepkioClient() as client:
inp = client.get_example_input("tris_50mM_1L")
result = client.run(inp)
inner = result.result["result"]
print(inner["acid_mass_g"], inner["acid_form_label"])
print(inner["base_mass_g"], inner["base_form_label"])
print(result.result["metadata"]["predicted_working_ph"])
CLI:
pepkio-ph-buffer-recipe-calculator run --example tris_50mM_1L
Manifest inspection does not require an API key.
Typical Use Cases
- 50 mM Tris-HCl pH 7.5 in 1 L with preparation at 25 °C and use at 4 °C
- 100 mM sodium phosphate pH 7.4 for biochemistry or enzyme assays
- Diluting 1 M Tris stock to 50 mM working concentration
- Matching ionic strength across buffers with optional NaCl
- Gravimetric vs titration buffer preparation planning
- Copy-ready protocol steps for lab notebooks or Methods sections
Scientific Background
For a weak acid buffer, pH = pKa + log([base]/[acid]). Given a target pH and temperature-corrected pKa, the calculator determines the acid/base ratio and masses for the requested concentration and volume.
Tris and some other buffers have a large pH shift with temperature. A solution adjusted to pH 7.5 at 25 °C can read substantially higher when cooled to 4 °C. Verify pH with a calibrated meter at the temperature of use when precision matters.
Ionic strength affects effective pKa and enzyme behavior. Stock dilution reduces concentration by C_working = C_stock × (V_stock / V_final); pH should be re-measured after dilution rather than assumed unchanged.
Web Application
For researchers who prefer a graphical interface, an interactive pH Buffer Recipe Calculator is available in the browser.
The web interface provides live-updating results, optional ionic strength adjustment, stock dilution mode, compatibility notes, copy-ready protocol text, a Methods-style sentence, and shareable links that restore the same recipe as API permalink values.
Documentation and Resources
Full documentation, examples, and issue tracking: github.com/pepkio/pepkio-ph-buffer-recipe-calculator
Web tool: pepkio.com/tools/ph-buffer-recipe-calculator
About Pepkio
Pepkio develops software tools and provides bioinformatics analysis services for life science research. See https://www.pepkio.com for additional tools and services.
Keywords
pH buffer calculator, buffer recipe calculator, Tris buffer calculator, Tris-HCl preparation, phosphate buffer pH 7.4, HEPES buffer recipe, Henderson-Hasselbalch calculator, buffer pKa temperature correction, ionic strength buffer, NaCl buffer adjustment, gravimetric buffer preparation, buffer titration, stock buffer dilution, dilute Tris stock, Good's buffer, biological buffer preparation, molecular biology buffer, biochemistry buffer, protein buffer pH, enzyme assay buffer, cold room buffer pH, sodium phosphate buffer, buffer protocol generator, pepkio-ph-buffer-recipe-calculator, Python buffer API, shareable buffer recipe, laboratory buffer calculator, Pepkio, how to calculate Tris buffer grams for pH 7.5, prepare 50 mM Tris buffer recipe, phosphate buffer 100 mM pH 7.4 preparation, dilute 1 M Tris to 50 mM volume, Tris pH change with temperature explained, match ionic strength between buffers, gravimetric vs titration buffer prep, re-check pH after diluting buffer stock, Python script buffer recipe API, temperature corrected pKa Tris, weigh Tris hydrochloride and Tris base amounts, buffer recipe for protein purification, HEPES buffer cell culture preparation, stock buffer dilution calculator laboratory
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 pepkio_ph_buffer_recipe_calculator-0.1.0.tar.gz.
File metadata
- Download URL: pepkio_ph_buffer_recipe_calculator-0.1.0.tar.gz
- Upload date:
- Size: 35.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1594c2a4dcecad6e028cf8b793533b27dbf467a6e2225e065139204acc0a4938
|
|
| MD5 |
5d3a75ace42f974ad14ea05985271db5
|
|
| BLAKE2b-256 |
b71396ad0a2f717dbd06a9ec37eabd14e02215ccab9e1ee06e500e6d88d097d1
|
File details
Details for the file pepkio_ph_buffer_recipe_calculator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pepkio_ph_buffer_recipe_calculator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97de77b34cef9256f753d41bf2154df49a97dc3cbf509de63616e491f698984d
|
|
| MD5 |
3489b4e7fb83ee379d4008fff79d462a
|
|
| BLAKE2b-256 |
231e35ddf9ad1760c721cbd6085769a22fceb2a8700b0f8b28918b0a8f724b37
|