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.1.tar.gz (23.0 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.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cosinor_lite-0.1.1.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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.1.tar.gz
Algorithm Hash digest
SHA256 dab449d264512ebfac5adbb32efcf41d21424e5d3ce9787d9c3892676de4e2a7
MD5 b6026a2ed33948f427f78a8d28ef9ff1
BLAKE2b-256 d0867da33ca544dfe814f58c8299bbad139e4da336be057d91b57051abf0594e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cosinor_lite-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da553a3f90609232f1be52c3f087a0317d9179356d409dd52bdcb41555d54ac7
MD5 fe043cddb94fa0ad373f12000a404208
BLAKE2b-256 1ba57aae59a4769b6b86f800db6f1f84e56435a01073d867994b227919fb68aa

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