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)
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)
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
Built Distribution
File details
Details for the file bio_curve_fit-0.2.0.tar.gz
.
File metadata
- Download URL: bio_curve_fit-0.2.0.tar.gz
- Upload date:
- Size: 9.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3ae6026e28025909d0e42b5486a6bc5094612e570759b53609c9415e063d071 |
|
MD5 | b3932c5defcf41447223f68fc5949aa7 |
|
BLAKE2b-256 | 857f4826d81e69bcc03609ebbe68044d655f634c1f6c42796f8c2735403a58e0 |
File details
Details for the file bio_curve_fit-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: bio_curve_fit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.8 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a5e9540d1d500c713c5b1029a570b95acf7aa6653d888705f2d2570e1ebb999 |
|
MD5 | c9112f6deed7165637ae526e7aee4294 |
|
BLAKE2b-256 | 00e5bf7590b57aa8be75eea85aa139c7afefbf5df7849c265f2665fb63b24479 |