Cladetime

Cladetime is a Python interface for accessing past and present Nextstrain-produced SARS-CoV-2 sequence data, including sequence clade assignments. Cladetime can also “time travel” by using prior versions of reference trees to assign clades to sequences.

Installation

Cladetime can be installed with pip:

$ pip install cladetime

Detailed documentation

  • See the User Guide for more details about working with Cladetime.

  • The API Reference documentation provides API-level documentation.

Usage

Cladetime’s CladeTime class provides a lightweight wrapper around historical and current SARS-CoV-2 GenBank sequence and sequence metadata created by daily Nextstrain workflows.

See the User Guide for examples of creating CladeTime objects that can access past sequence data and use past reference trees to assign clades to sequences.

>>> import polars as pl
>>> from cladetime import CladeTime, sequence

>>> ct = CladeTime()
>>> filtered_sequence_metadata = sequence.filter_metadata(
...    ct.sequence_metadata
... )

>>> filtered_sequence_metadata.head(5).collect()

shape: (5, 6)
┌───────┬─────────┬────────────┬────────────────────────────┬──────────────┬──────────┐
│ clade ┆ country ┆ date       ┆ strain                     ┆ host         ┆ location │
│ ---   ┆ ---     ┆ ---        ┆ ---                        ┆ ---          ┆ ---      │
│ str   ┆ str     ┆ date       ┆ str                        ┆ str          ┆ str      │
╞═══════╪═════════╪════════════╪════════════════════════════╪══════════════╪══════════╡
│ 22A   ┆ USA     ┆ 2022-07-07 ┆ Alabama/SEARCH-202312/2022 ┆ Homo sapiens ┆ AL       │
│ 22B   ┆ USA     ┆ 2022-07-02 ┆ Arizona/SEARCH-201153/2022 ┆ Homo sapiens ┆ AZ       │
│ 22B   ┆ USA     ┆ 2022-07-19 ┆ Arizona/SEARCH-203528/2022 ┆ Homo sapiens ┆ AZ       │
│ 22B   ┆ USA     ┆ 2022-07-15 ┆ Arizona/SEARCH-203621/2022 ┆ Homo sapiens ┆ AZ       │
│ 22B   ┆ USA     ┆ 2022-07-20 ┆ Arizona/SEARCH-203625/2022 ┆ Homo sapiens ┆ AZ       │
└───────┴─────────┴────────────┴────────────────────────────┴──────────────┴──────────┘