Skip to main content

Curve fitting algorithms for bio-assays with scikit-learn api

Project description

bio-curve-fit

A Python package for fitting common dose-response and standard curve models. Designed to follow the scikit-learn api.

Quickstart

Installation

pip install bio-curve-fit

We recommend using python virtual environments to manage your python packages in an isolated environment. Example:

python -m venv venvname
source venvname/bin/activate

Example usage:

from bio_curve_fit.logistic import FourPLLogistic

# Instantiate model
model = FourPLLogistic()

# create some example data
standard_concentrations = [1, 2, 3, 4, 5]
standard_responses = [0.5, 0.55, 0.9, 1.25, 1.55]


# fit the model
model.fit(
	standard_concentrations, 
	standard_responses, 
)

# interpolate the response for new concentrations
model.predict([1.5, 2.5])

# interpolate the concentration for new responses
model.predict_inverse([0.1, 1.0])

Calculate and plot the curve and limits of detection:

plot_standard_curve(standard_concentrations, standard_responses, model, show_plot=True)

standard curve

You can also customize the plot arbitrarily using matplotlib. For example, adding labels to the points:

from adjustText import adjust_text

fig, ax = plot_standard_curve_figure(standard_concentrations, standard_responses, model)
texts = []
for x, y in zip(standard_concentrations, standard_responses):
	texts.append(ax.text(x, y, f"x={x:.2f}, y={y:.2f})", fontsize=13, ha="right"))
# Adjust text labels to avoid overlap
adjust_text(texts, ax=ax)

standard curve with labels

Examples

See the example notebooks for more detailed usage.

Contributing

Contributions are welcome! We built this package to be useful for our own work, but we know there is more to add. Please see CONTRIBUTING.md for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bio_curve_fit-0.2.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

bio_curve_fit-0.2.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file bio_curve_fit-0.2.1.tar.gz.

File metadata

  • Download URL: bio_curve_fit-0.2.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for bio_curve_fit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b89a9335f0ab5af93c9fc21471b35b8c63fad35eb4bd13473999aed587c8d251
MD5 3d3228498cae520515a71f299e5c0177
BLAKE2b-256 9f91705de84a1a99e28ee56af0f70ee2dcb243eb0a8fc8b3de5e8c60ac1ea888

See more details on using hashes here.

File details

Details for the file bio_curve_fit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: bio_curve_fit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for bio_curve_fit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3c40126ec83626f03ab7a22749cb384c4b8dd57f3b611091477814e01eda298
MD5 5c397fbe6e3c4993802cdb2c69e2dd05
BLAKE2b-256 b0a3d7557620623b9b8635f15b2651ba1cc31f111ba07dfdacd440520c02b56a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page