Skip to main content

sdre - Stochastic Divison Rate Estimations

A lightweight tool for performing divison rate estimation of cellular populations based using the multi-stage birth process model proposed by David Kendall, 1948. Forward simulations of the stochastic model are performed using a C++-implemented $\tau$-leaping algorithm.

Installation

This package is available on PyPI, so you can just run

pip install sdre

Usage

import sdre
import matplotlib.pyplot as plt

# artifical data
n_cells = [1, 1, 1, 2, 2, 2, 3, 4, 4, 5, 6, 8]
data = {i: [n] for i, n in enumerate(n_cells)}

# plot the data
plt.figure(figsize=(3.2, 3.2))
plt.scatter(data.keys(), data.values(), color='black')
plt.show()

png

# set up the model with the data from before
target = sdre.LikelihoodModel(data, n_samples=64)

fig, axs = plt.subplots(1, 2, figsize=(6.4, 3.2))

# we define two parameter combinations which by default are the cell cycle time, 
# log number of stages, and initial population size
x0, x1 = [.9, 2, 1], [1.2, 1, 1]

for i, x in enumerate([x0, x1]):
    # we perform forward simulation by drawing 64 samples
    t, n = target.sample(x)
    
    # computes the synthetic log likelihood loss
    nll = target.compute_negative_log_likelihood(x)
    
    axs[i].set_title('NLL='+str(round(nll, 2)))
    
    axs[i].step(t, n.T, alpha=.2, color=plt.cm.tab10(i))
    axs[i].scatter(data.keys(), data.values(), color='black', zorder=10)
    
plt.show()

png

A lower negative log-likelihood (NLL) suggests a better fit, as we can confirm visually.

Metadata

Release files for sdre 0.0.4

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

Built distribution (wheel)

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

Release files / sdre-0.0.4-py3-none-any.whl

Download URL sdre-0.0.4-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e34911443cf911b44168565b8fdebc053ee89e3913dc0f10dc14a08b9e9db2b
BLAKE2b-256 checksum
How to use checksums
625b9146067af7b69fda8802d6d4a401a7fc571d843f28e6a0e473bea4ea6d06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/6.6.0 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.65.2 urllib3/1.26.13 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

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