Skip to main content

Spirogram

Documentation: User Manual · Source Code: GitHub · Report Issues: Issues

Spirogram is a Python package for creating spiral chronograms, a spiral visualization designed for chronological data. The package is intended for datasets containing pairs of collection dates together with an associated quantitative measurement. The measurement may represent quantities such as genetic distances, similarity scores, temperature differences, or any other numeric value defined between two time points.

The package accepts multiple input formats, performs data validation and preprocessing, transforms the data into spiral coordinates, and generates customizable spiral chronograms.

Installation

Install the package using pip.

pip install spirogram

Requirements

  • Python 3.10 or later

The following packages are installed automatically when installing spirogram:

  • NumPy
  • pandas
  • matplotlib

Supported File Formats

Input data may be provided as .csv, .dat, or .json files, or as a pandas DataFrame passed directly.

Quick Start

Import the package.

from spirogram import spirogram

Supported Input Formats

Long-format

Each row represents one pairwise comparison.

Required columns:

  • Later collection date
  • Earlier collection date
  • Quantitative measurement

Example

LaterDate EarlierDate Distance
2020-04-10 2020-03-15 0.0024
2020-04-15 2020-03-20 0.0031

Matrix-format

The input consists of a square distance matrix whose rows and columns correspond to collection dates. The package accepts

  • Full matrices
  • Upper triangular matrices
  • Lower triangular matrices

The matrix is automatically converted internally into the standard long format before generating the spirogram.

Examples

The examples below use SARS-CoV-2 spike protein sequence data downloaded from the National Center for Biotechnology Information (NCBI). The sequences were collected in Illinois between March 2020 and April 2026, and pairwise genetic distances were calculated between collection dates.

Long-format data

spirogram(file="data/spiroExample_long.csv", dataFormat="long", 
laterDate="Date", earlierDate="EarlierDate", distance="Meankdistance")

Long-format Example

Matrix-format data

spirogram(file="data/spiroExample_matrix.json", dataFormat="matrix",matrixType="full", invalidDates="drop", cmap="Spectral", turns=5)

Matrix-format Example

Main Function

spirogram(...)

The package provides numerous options for customizing the visualization, including

  • spiral spacing
  • number of turns
  • angular correction
  • color maps
  • point size
  • color scale
  • plot title
  • colorbar label
  • data coverage summary
  • returning the processed data

See the User Manual for a complete description of every argument.

License

This project is distributed under the GNU General Public License v3.0.

Acknowledgements

We would like to express our gratitude to Dr. Mengfei Ho, Assistant Research Professor, and Dr. Brenda Wilson, Professor, Department of Microbiology, School of Molecular & Cellular Biology, University of Illinois Urbana-Champaign, for their guidance, many helpful discussions and feedback throughout this project.

We thank Professor Douglas Simpson, Director of the Institute for Mathematical and Statistical Innovation (IMSI), and acknowledge the support of the IMSI Summer Internship Program, funded by the National Science Foundation Grant No. DMS-2425650.

Download files

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

Source Distribution

spirogram-1.0.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

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

spirogram-1.0.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file spirogram-1.0.0.tar.gz.

File metadata

  • Download URL: spirogram-1.0.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for spirogram-1.0.0.tar.gz
Algorithm Hash digest
SHA256 772018737427a733170431861785d3f730e23bef76874e8ba4bf19009344082a
MD5 c6c625c7f6e19df3be214e11070eba13
BLAKE2b-256 a4009acbd52a84115450269f74a7e4b211d02e1dfbcdde5926953eb295801531

See more details on using hashes here.

Provenance

The following attestation bundles were made for spirogram-1.0.0.tar.gz:

Publisher: release.yml on sfmensah/spirogram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spirogram-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: spirogram-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for spirogram-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6700d3ac19abc55d6aee5cf92ba5a59f522925a9cd474ccf2606f5dbb7dc9048
MD5 88f748622ee7db9fc8402f2ee2c6554d
BLAKE2b-256 79727179112b8f3d4f624d0d2d8b0a1c8e44ff38f65bb17b9a57da31fdbc3576

See more details on using hashes here.

Provenance

The following attestation bundles were made for spirogram-1.0.0-py3-none-any.whl:

Publisher: release.yml on sfmensah/spirogram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

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