Skip to main content

pavvis — Python Gene PAV Matrix Analysis & Visualization

pavvis is a Python package for analysing and visualising gene Presence/Absence Variation (PAV) data from pangenome studies. It is designed to be easy to use and optimised for large-scale genomic datasets.

Installation

pip install pavvis

For a development install from source:

git clone https://github.com/<your-username>/Pavvis.git
cd Pavvis
pip install -e ".[dev]"

Quick start

from pavvis import PavMatrix

pm = PavMatrix(
    matrix_path="pav_matrix.csv",
    metadata_path="metadata.csv",
)
print(pm)
# PavMatrix(34295 genes × 1039 samples)

Gene categories

pavvis classifies every gene into categories based on its presence pattern across all samples:

Category Definition
Core Present in every sample
Soft Core Present in ≥ 95% of samples
Dispensable Present in ≥ 15% and < 95% of samples
Private Present in > 0% and < 15% of samples
Absent Absent from every sample

Thresholds are configurable:

pm = PavMatrix(
    matrix_path="pav_matrix.csv",
    metadata_path="metadata.csv",
    soft_core_min=0.90,
    dispensable_min=0.20,
    private_min=0.05,
)
print(pm.gene_counts)
# {'core': 12, 'soft_core': 84, 'dispensable': 22401, 'private': 6276, 'absent': 5522}

Plots

Presence & frequency

from pavvis.plots import presence, variable_genes

# Frequency distribution coloured by gene category
variable_genes.frequency_histogram(pm).show()

# Gene counts per sample, grouped by a metadata column
presence.per_sample_boxplot(pm, gene_set="variable", x="species").show()

# Gene counts vs a continuous metadata variable
presence.per_sample_scatter(pm, x="latitude", color_by="species").show()

Pangenome curves

from pavvis.plots import curves

# Core & variable gene accumulation curves
curves.variable_gene_curve(pm, permutations=100).show()

# Variable gene accumulation grouped by metadata, in a defined order
curves.grouped_variable_curve(
    pm,
    column="region",
    group_order=["North", "Central", "South"],
    shade_groups=True,
).show()

# Jaccard similarity curve grouped by metadata
curves.jaccard_similarity_curve(
    pm,
    column="species",
    group_order=["Human", "Mouse", "Rat"],
).show()

Exclusive genes

from pavvis.plots import variable_genes

# Number of genes exclusive to each group
variable_genes.exclusive_genes_bar(pm, column="species").show()

# Or retrieve the raw counts
print(pm.exclusive_gene_counts("species"))
# {'Human': 42, 'Mouse': 17, 'Rat': 3}

Heatmaps

from pavvis.plots import heatmap

# Compute pairwise Jaccard similarity matrix (cached on the object)
pm.compute_jaccard()

# Binary PAV matrix heatmap with sample clustering and metadata annotation
heatmap.pav_heatmap(pm, gene_set="variable", col_cluster=True, color_by="species").show()

# Sample × sample Jaccard similarity heatmap
heatmap.sample_similarity_heatmap(pm, color_by="species", cluster=True).show()

UMAP embedding

from pavvis.plots import umap

# Compute embedding once (cached on the object, Jaccard metric by default)
pm.compute_umap(n_neighbors=15, min_dist=0.1, random_state=42)

umap.scatter(pm, color_by="species").show()      # 2D, discrete colour
umap.scatter(pm, color_by="latitude").show()     # 2D, continuous Viridis
umap.scatter3d(pm, color_by="species").show()    # 3D
umap.scatter3d(pm, color_by="species", depth=True).show()  # 3D with depth scaling

Documentation

Full documentation including concepts, API reference, and getting-started guide is available at https://appliedbioinformatics.github.io/pavvis/

To run the docs locally:

mkdocs serve

Metadata

Release files for pavvis 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 pavvis 0.1.0
File Size Uploaded Provenance Actions
pavvis-0.1.0.tar.gz 42.6 kB Without provenance Details for pavvis-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 83.9 kB

Release files / pavvis-0.1.0.tar.gz

Download URL pavvis-0.1.0.tar.gz
Size 42.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7888676005a778a1fbd08a1464dc0d787c340ebbf8793b5eb1b63528bd49e101
BLAKE2b-256 checksum
How to use checksums
eb6f39589dddca3a9d06b23823ff7d926aa87beff63c856316b3d6cf40c80cb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL pavvis-0.1.0-py3-none-any.whl
Size 41.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7606d6dc226607e21349bd0fde40d84b0c8d93fd8c65d065f0a1aee193d7cd8c
BLAKE2b-256 checksum
How to use checksums
e6a1711c44280f3d20e7510da9cfa012fd77ded77505d28ef487155a2d0030c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pavvis 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