Skip to main content

saurus-fsspec

fsspec backend for streaming the SAURUS Staphylococcus aureus genomic surveillance database into pandas.

Stream the SAURUS master table and individual typing modules directly from saurus-db.org without installing the 15 MB SAURUS-CLI data bundle. Uses the standard fsspec protocol interface, so saurus:// URLs work anywhere fsspec does: pandas, dask, pyarrow, and any other consumer of the registry.

PyPI Python License: MIT


The SAURUS ecosystem

SAURUS has three entry points. Each covers a different usage pattern.

Resource What it is When to use
saurus-db.org Interactive web resource with 15 query pages, statistics, trends, and side-by-side comparison Exploring the data, verifying a lineage, exporting a one-off accession list
saurus-cli Command-line interface with the full dataset bundled inside the wheel Repeated queries in scripts and pipelines, offline work, version-pinned reproducibility
saurus-fsspec (this package) fsspec protocol for the static files that saurus-db.org serves One-off pandas analyses, CI jobs, notebook sessions where the full bundle is not worth installing

The three share the same underlying data. A query run through any of them returns the same accessions. Pick the one that matches how you are working.

Choosing between them

If you run one analysis today and may not touch the data again for weeks, saurus-fsspec is the right pick. You pip install a small package and read the table on demand. The 2 MB compressed transfer is cheaper than a 15 MB wheel plus a 15 MB data bundle.

If you run the same query every week, or work on a pipeline that should be reproducible in five years, saurus-cli is the right pick. The data is bundled, the version is pinned, and nothing depends on the site being up.


Install

pip install saurus-fsspec

Dependencies: fsspec, requests, pandas. Nothing else.


Usage

import saurus_fsspec

df = saurus_fsspec.read_table("master")
print(df.shape)              # (134273, 20)
print(df["mlst_cc"].value_counts().head())

The helper applies the TSV separator automatically, so you never need to remember sep="\t".

With pandas directly

import pandas as pd

df = pd.read_csv("saurus://master", sep="\t")

With fsspec directly

import fsspec

with fsspec.open("saurus://mlst", "rt") as f:
    for line in f:
        ...

Available aliases

Alias File served Content
master mrsa_all.tsv.gz Combined master table (134,273 rows x 20 columns)
mlst mlst_all.tsv.gz MLST sequence types
spa spa_all.tsv.gz spa types
sccmec or sccmec/cge sccmec_cge_all.tsv.gz SCCmec calls (CGE caller)
sccmec/rpet sccmec_rpet_all.tsv.gz SCCmec calls (RPet caller)
capsule capsule_all.tsv.gz Capsule serotypes
agr agr_all.tsv.gz agr types
metadata metadata.tsv.gz BioSample-derived metadata
amr amr_all.tsv.gz AMR gene content
amr_freq amr_gene_freq.tsv.gz AMR gene frequencies
vfdb vfdb_all.tsv.gz Virulence factor content
vfdb_freq vfdb_gene_freq.tsv.gz Virulence factor frequencies
plasmid plasmid_all.tsv.gz Plasmid replicon content
plasmid_freq plasmid_gene_freq.tsv.gz Plasmid replicon frequencies
cc cc.txt.gz ST to CC lookup table

Any other filename can be passed as a path relative to the base URL. For example, saurus://custom_file.tsv.gz fetches https://saurus-db.org/data/custom_file.tsv.gz.


Common workflows

Count MRSA genomes by clonal complex

import saurus_fsspec

df = saurus_fsspec.read_table("master", usecols=["mlst_cc", "mrsa_status"])
mrsa_by_cc = (
    df[df["mrsa_status"] == "MRSA"]
    .groupby("mlst_cc")
    .size()
    .sort_values(ascending=False)
    .head(10)
)
print(mrsa_by_cc)

Filter by lineage and geography

import saurus_fsspec

df = saurus_fsspec.read_table("master")
usa300_blood = df[
    (df["mlst_cc"] == "CC8") &
    (df["country"] == "United States") &
    (df["source"] == "blood")
]
print(f"USA300 blood-USA isolates: {len(usa300_blood):,}")

Pull only the MLST table

import saurus_fsspec

mlst = saurus_fsspec.read_table("mlst")
print(f"ST distribution: {mlst['ST'].value_counts().head(5).to_dict()}")

How it works

The plugin is a minimal fsspec.AbstractFileSystem subclass that:

  1. Maps saurus:// paths to HTTPS URLs under the base URL
  2. Downloads the file with requests
  3. Decompresses on the fly if the file ends in .gz
  4. Returns a BytesIO or TextIOWrapper that pandas and fsspec consumers can read normally

No server, no database, no authentication layer. The plugin reads the same static files that saurus-db.org already serves. That design mirrors the sustainability argument in the SAURUS paper: there is nothing to maintain after the grant ends, because nothing in the query path depends on live infrastructure.

Why not a REST API

A REST API would provide server-side filtering and reduce bandwidth for repeated queries. It would also reintroduce a server, a database, an auth layer, and a maintenance budget. The static-site architecture exists specifically so that nothing in the platform requires ongoing operations. saurus-fsspec gives pandas users the same programmatic ergonomics without the operational cost.

For workloads that need repeated queries with local filtering, use saurus-cli instead. The two tools are complementary, not redundant.


Configuration

Environment variable Default Purpose
SAURUS_BASE_URL https://saurus-db.org/data/ Override the data source
SAURUS_TIMEOUT 60 Request timeout in seconds

Or pass a custom filesystem:

import fsspec
from saurus_fsspec import SaurusFileSystem

fs = SaurusFileSystem(base_url="https://mirror.example.org/saurus/")
with fs.open("master", "rt") as f:
    ...

Requirements

  • Python 3.9+
  • fsspec >= 2023.1.0
  • requests >= 2.28.0
  • pandas >= 1.5.0

Development

git clone https://github.com/bbeckley-hub/saurus-fsspec.git
cd saurus-fsspec
pip install -e ".[dev]"

# Offline tests (fast, no network)
pytest -m "not network"

# Network tests (requires internet)
pytest -m "not slow"

# Full suite (includes a 134,273-row read)
pytest

Citation

If you use saurus-fsspec in your research, please cite the underlying SAURUS resource:

Beckley B, Olalekan A, Afeke I, Amarh V. SAURUS: an interactive web resource for typing-based genome retrieval in Staphylococcus aureus. BMC Genomic Data [under review]. 2026.

The companion command-line interface:

Beckley B. SAURUS-CLI: a reproducible command-line interface for typing-based genome retrieval in Staphylococcus aureus. Zenodo. 2026. doi:10.5281/zenodo.24084554


Credits

The fsspec backend was suggested by bgruening during review of the SAURUS-CLI Bioconda recipe. His point was that a saurus:// filesystem plugin would let pandas users stream the master table directly, without downloading the full 15 MB data bundle. That suggestion is what this package implements.

Björn is a long-time maintainer of Bioconda, Galaxy, and conda-forge, and his feedback on the SAURUS-CLI packaging directly shaped the current release.

Additional credits:

  • fsspec for the filesystem abstraction that makes the protocol possible
  • pandas for the DataFrame engine
  • The SAURUS web resource for serving the static data files this plugin consumes

License

MIT. See LICENSE.


Metadata

Release files for saurus-fsspec 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for saurus-fsspec 0.1.0
File Size Uploaded Provenance Actions
saurus_fsspec-0.1.0.tar.gz 11.1 kB Without provenance Details for saurus_fsspec-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for saurus-fsspec 0.1.0
File Interpreter ABI Platform Actions
saurus_fsspec-0.1.0-py3-none-any.whl Python 3 none any Details for saurus_fsspec-0.1.0-py3-none-any.whl

Total release size: 20.2 kB

Release files / saurus_fsspec-0.1.0.tar.gz

Download URL saurus_fsspec-0.1.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
672093e7fd38e219bb541698a62cfa0586eef04f87aee8ae99be41d4b162416b
BLAKE2b-256 checksum
How to use checksums
89e6f8e4cb9eb728d24a4c168642fe29558b7d20e0d096032e8a8a589341b8f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / saurus_fsspec-0.1.0-py3-none-any.whl

Download URL saurus_fsspec-0.1.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22109fd366e3357411b2615d8ad108be4949e24061e6878db0d85f26f4441b8c
BLAKE2b-256 checksum
How to use checksums
f9cc7e7757f3c22412cad46aac6bd7ecd872933a6fe3e08e1d0e3ccc71188edb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Security for saurus-fsspec 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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