Skip to main content

A simplified package for cosinor analysis of circadian bioluminescent, fluorescent and omics datasets

Project description

cosinor-lite

cosinor-lite is a lightweight toolkit for exploring circadian oscillations across multiomics and live-cell imaging experiments. It relies on widely used statistical models and offers two modes of use.

  • Interactive Gradio dashboard to drag & drop your data files.
  • Python package for fine-grained customisation beyond the settings offered in the Gradio UI.

🚀 Try the interactive analysis pipeline on Hugging Face Spaces → cosinor-lite.

Why cosinor-lite?

  • Unified workflow for live cell data: Perform detrending and fit cosinor models with either a fixed 24 h, free-period or damped oscillation with consistent APIs across data modalities (i.e. bioluminescence, cytokines, qPCR etc.).
  • Differential rhythmicity across any omics type: Compare two conditions for differential rhythmicity for any type of omics data using BIC model-selection strategies with widespread use in the circadian literature.
  • Create publication-ready analysis with a simple UI: Launch a browser-based analysis console for visual quality control, plots, and parameter export.

Extracting circadian parameters from live-cell data

For live-cell data (see tutorial in notebooks/live_cell_tutorial), cosinor-lite offers the choice between three different cosinor models:

  • a) Fixed 24-h period

  • b) Free period

  • c) Free period with damped amplitude

Model selection

Once a model is chosen, it is fitted independently to each sample. The fitted parameters can be exported for downstream statistical analysis.

Differential rhytmicity analysis of omics datasets

cosinor-lite includes a toolbox for performing differential rhytmicity analysis of omics datasets (ee notebooks/omics_tutorial) for tutorial. The details of the method are nicely explained in the article:

Pelikan A, Herzel H, Kramer A, Ananthasubramaniam B. 2022. Venn diagram analysis overestimates the extent of circadian rhythm reprogramming. The FEBS Journal 289:6605–6621. doi:10.1111/febs.16095

Here is an adaptation of their figure explaining the methdology:

Model selection

The tool is very similar to the dryR package in R, but implemented in Python for ease of use with other Python-based data analysis pipelines. Please see the dryR tool for more details, and if you prefer implementing in R (https://github.com/naef-lab/dryR/tree/master).

For condition 1 (i.e. alpha cells) and condition 2 (i.e. beta cells), we fit 5 different models:

  • Model 1) Arrhythmic in alpha and beta cells

  • Model 2) Rhythmic in beta cells only

  • Model 3) Rhythmic in alpha cells only

  • Model 4) Rhythmic in alpha and beta cells with the same rhythmic parameters (i.e. phase and amplitude)

  • Model 5) Rhythmic in both but with differential rhythmicity in alpha vs beta cells

Installation

# clone the repository
git clone https://github.com/nick-e-p/cosinor-lite.git
cd cosinor-lite

# create and populate the local uv environment
uv sync

# activate the environment
source .venv/bin/activate

Quick Start

Launch the interactive app

uv run python app.py

Open the printed local URL to explore:

  • Live cell: Upload CSVs with participant, replicate, and time-series data, then compare detrending strategies or cosinor fits across groups.
  • Omics: Load expression matrices, build time vectors automatically or manually, compute differential rhythmicity, and download publication-ready plots.

Use the Python API

from cosinor_lite.livecell_dataset import LiveCellDataset
from cosinor_lite.livecell_cosinor_analysis import CosinorAnalysis

dataset = LiveCellDataset(
    ids=["mouse_a", "mouse_b"],
    group=["treated", "control"],
    replicate=[1, 1],
    time_series=my_expression_matrix,
    time=my_timepoints,
)

analysis = CosinorAnalysis(dataset=dataset)
fit = analysis.fit(group="treated", model="damped")
print(fit.parameters)

Sample Datasets

The data/ directory includes curated examples to help you get started:

  • bioluminescence_example.csv: Bioluminescence time series for live-cell analysis.
  • cytokine_example.csv: Cytokine time series for live-cell analysis.
  • qpcr_example.csv: qPCR time series for live-cell analysis.
  • GSE95156_Alpha_Beta.txt: RNA-seq data used in the omics differential rhythmicity workflow.

Each file is formatted to drag & drop into app.py as well as the library APIs.

Contributing

  1. Fork the repository and create a feature branch.
  2. Install dependencies with uv sync and activate the environment.
  3. Implement your changes with tests.
  4. Verify via pre-commit run --all-files and uv run pytest.
  5. Open a pull request describing the motivation and results.

Bug reports and feature proposals are welcome through GitHub issues. Please include reproducible examples whenever possible.

License

Licensed under the Apache License 2.0. See LICENSE for details.

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

cosinor_lite-0.1.5.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

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

cosinor_lite-0.1.5-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file cosinor_lite-0.1.5.tar.gz.

File metadata

  • Download URL: cosinor_lite-0.1.5.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cosinor_lite-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c44df0ab272c594f2b94f1a734dccd574c039fe0ad03c4c99bf2a6682796e943
MD5 fc98d5a02a3fe819d10bd680855ff53f
BLAKE2b-256 2394af5ec9d7a7833b9c7fc51acfbab275796f9401f67e5ea0e9f6acd8323728

See more details on using hashes here.

File details

Details for the file cosinor_lite-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: cosinor_lite-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cosinor_lite-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ad547a2e88e5d0e95b081e0f3fa889fda1ed93ec9c458df40a04629580c9739d
MD5 14d6921fec77745f2d46d270b40ea5be
BLAKE2b-256 86c1816b755bcbe4298ce6fa205e9bc367c8d1d3516f7bc4c3e8ffda1c6a6e49

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