Skip to main content

sdre - Stochastic Divison Rate Estimation

Project description

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.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sdre-0.0.4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file sdre-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: sdre-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for sdre-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6e34911443cf911b44168565b8fdebc053ee89e3913dc0f10dc14a08b9e9db2b
MD5 f563f986f316fc6cc075592dca40efa8
BLAKE2b-256 625b9146067af7b69fda8802d6d4a401a7fc571d843f28e6a0e473bea4ea6d06

See more details on using hashes here.

Supported by

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