Skip to main content

Test and build codecov Docs

Welcome to pyKinGenie!, a python package for analysing binding kinetics data

Features

  • Import Octet files (.frd)
  • Import Gator files (Assay_#_Channel#.csv, Setting.ini and ExperimentStep.ini)
  • Import custom CSV files
  • Process the traces (alignment, baseline correction)
  • Calculate binding kinetics (kon, koff, KD)
  • Global fitting of multiple traces
  • One-to-one, one-to-one with mass transport limitation, and one-to-one with induced fit models

Installation

Install PyKinGenie with pip:

pip install pykingenie

If you use uv, install it into the current environment with:

uv pip install pykingenie

Or add it to an existing uv-managed project:

uv add pykingenie

For development:

git clone https://github.com/osvalB/pykingenie
cd pykingenie
uv sync --extra dev

Quickstart

from pykingenie import *

bli = OctetExperiment('test')
# Replace with your own folder containing .frd files !!! The .frd files can be exported from the Octet software
files = ['230309_00'+str(x+1)+'.frd' for x in range(8)]
files = [folder + file for file in files]

files.sort()

bli.read_sensor_data(files)

bli.align_association(bli.sensor_names)
bli.align_dissociation(bli.sensor_names)

# We use the sensor #8 as the reference sensor for baseline correction. Remember than python indexing starts at 0.
bli.subtraction(bli.sensor_names[:7], bli.sensor_names[7])

pyKinetics = KineticsAnalyzer()
pyKinetics.add_experiment(bli, 'test')

labels = pyKinetics.get_experiment_properties('sensor_names')
ids    = pyKinetics.get_experiment_properties('sensor_names_unique')

# Flatten the lists
labels = [item for sublist in labels for item in sublist]
ids    = [item for sublist in ids for item in sublist]

df = get_plotting_df(ids, labels)

figure = plot_traces_all(pyKinetics,df)
figure.write_image('test_bli_traces.png')

pyKinetics.merge_ligand_conc_df()
pyKinetics.init_fittings()

pyKinetics.generate_fittings(pyKinetics.combined_ligand_conc_df)

fig = plot_association_dissociation(pyKinetics,split_by_smax_id=True)
fig.write_image('test_bli.png')

pyKinetics.submit_steady_state_fitting()
pyKinetics.submit_kinetics_fitting()

fig = plot_association_dissociation(pyKinetics)
fig.write_image('test_bli_fitted.png')

XY plotting

An alternative implementation uses Reflex XY. Try the complete sample workflow in notebooks/10_reflex_xy_plotting.ipynb. XY is installed with pyKinGenie on Python 3.11 or newer:

pip install pykingenie
# Development checkout:
uv sync --extra dev

XY helpers use reusable dataclasses for styling and rendering settings:

from pykingenie.utils.plotting_xy import (
    PlotConfig,
    AxisConfig,
    LayoutConfig,
    LegendConfig,
    TraceConfig,
    config_fig,
    plot_plate_info,
    plot_traces,
    plot_traces_all,
    plot_steady_state,
    plot_association_dissociation,
)

plot_config = PlotConfig(plot_width=1000, plot_height=550, font_size=14)
axis_config = AxisConfig(showgrid_x=True, showgrid_y=False, x_bounds='data')
layout_config = LayoutConfig(ncols=2, gap=16, shared_yaxes=True)
legend_config = LegendConfig(loc='upper right', font_size=12)
trace_config = TraceConfig(marker_size=1, line_width=2, exact_lines=False)

fig = plot_traces_all(
    pyKinetics,
    pyKinetics.get_legends_table(),
    plot_config=plot_config,
    axis_config=axis_config,
    layout_config=layout_config,
    legend_config=legend_config,
    trace_config=trace_config,
)
fig.show()  # Interactive notebook display
fig.to_html('sensor_traces.html')  # Standalone interactive chart
fig.write_image('sensor_traces.png')
fig.write_image('sensor_traces.svg')

fig = plot_association_dissociation(
    pyKinetics,
    plot_config=plot_config,
    layout_config=LayoutConfig(split_by_smax_id=True),
    trace_config=TraceConfig(show_fit=True, fit_color='black', max_points=2000),
)
fig = config_fig(fig, 'kinetics', plot_config=PlotConfig(plot_type='png'), save=True)

All dimensions are pixels. Unset fields (None) retain the helper's defaults, and configuration objects can be reused without being modified by plotting. Use dataclasses.replace(config, ...) to derive a variant.

Dataclass Settings
PlotConfig Pixel dimensions, font size, title, export format, initial x/y ranges
AxisConfig Grid lines, ticks, line widths, labels, scales, reversal, navigation bounds
LayoutConfig Columns or stacked panels, spacing, shared domains, subplot titles, Smax grouping
LegendConfig Visibility, placement, columns, title, typography, interactions
TraceConfig Markers, lines, opacity, fitted overlays, smoothing, sampling, exact lines

For example, PlotConfig(x_range=(0, 1000)) sets the initial time range and AxisConfig(x_bounds='data') prevents panning far beyond the experiment. plot_steady_state(..., trace_config=TraceConfig(show_fit=True)) adds fitted curves.

Plate layouts and individual sensor plots return xy.Chart; subplot helpers return xy.facets.FacetGrid composed from independent XY panels. Configure sizes before displaying live widgets, and keep the value returned by config_fig. Both types support the display and export methods above. PNG and SVG exports use XY's native renderer. Kinetics plots retain logarithmic Viridis concentration colors and use labeled concentration legends in place of the Plotly colorbar. Concentration legends and sensor legends with both lines and markers are informational; use the legends table's Show column to select sensors. PlotConfig.plot_type sets the download/export format. Saving is explicit through write_image or config_fig(..., save=True).

The existing top-level plotting imports continue to use Plotly.

Raw XY traces use automatic line simplification by default. When zooming into standalone HTML, lines can skip some displayed markers. Use plot_traces_all(..., trace_config=TraceConfig(exact_lines=True)) or the same trace_config in plot_traces to connect every displayed sample. Exact lines increase HTML size and rendering work; the initial sampling limit remains the same for lines and markers.

Contributing

Contributions are welcome! Please contact me at oburastero@embl-hamburg.de

Citation

If you use pyKinGenie, please cite it as:

Burastero, O. (2026). pyKinGenie (Version 1.0) [Computer software]. GitHub. https://github.com/osvalB/pykingenie

@software{burastero_2026_pykingenie,
  author = {Burastero, Osvaldo},
  title = {pykingenie},
  version = {1.0},
  year = {2026},
  url = {https://github.com/osvalB/pykingenie}
}

Acceptable usage of AI assistants

AI coding assistants may be used for code that does not affect numerical results, for example:

  • plotting and figure styling,
  • import and export helpers, file handling and formatting,
  • documentation, examples and boilerplate tests.

Files containing AI-generated code start with a note saying so (e.g. src/pykingenie/utils/plotting_xy.py).

Code that affects the results needs human oversight: a person must write it, or review, understand and validate it before it is merged. This covers:

  • mathematical models, rate equations and signal simulations,
  • fitting routines, initial guesses, constraints and error estimates,
  • data processing that changes signal values (alignment, reference subtraction, baseline and inter-step corrections),
  • the interpretation of fitted parameters such as kon, koff and KD.

Changes to these parts must be checked against known results, such as simulated data with known parameters or previously validated datasets, before they are accepted.

The same applies when an AI assistant runs analyses for you (for example through the pyKinGenie MCP server): check the processing steps it chose and inspect the fits yourself before you report any parameters.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for pykingenie 1.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykingenie 1.0.19
File Size Uploaded Provenance Actions
pykingenie-1.0.19.tar.gz 175.1 kB Without provenance Details for pykingenie-1.0.19.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pykingenie 1.0.19
File Interpreter ABI Platform Actions
pykingenie-1.0.19-py3-none-any.whl Python 3 none any Details for pykingenie-1.0.19-py3-none-any.whl

Total release size: 290.4 kB

Release files / pykingenie-1.0.19.tar.gz

Download URL pykingenie-1.0.19.tar.gz
Size 175.1 kB
Tags Source
SHA-256 checksum
How to use checksums
981de9d832500ba25589700ff05a008530f63eb12768fdc6be514f775d7bd2fb
BLAKE2b-256 checksum
How to use checksums
7ec328d4efa3b908fb03d970e4693a73ed7cccd185256941b0b7a21d6e02534d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pykingenie-1.0.19-py3-none-any.whl

Download URL pykingenie-1.0.19-py3-none-any.whl
Size 115.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b5ef93dad5b499fb5d385e7e6b39b14996e4c389a72e543e6732098540435a3
BLAKE2b-256 checksum
How to use checksums
f08a5b5aad3c0d581671f288fda4ebd0852de02fc3c55e60882bfd615b9081dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pykingenie 1.0.19

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page