Skip to main content

GFViewer

Visualize the localization of multigene families across the chromosomes of a genome, and quantify how those families are distributed.

GFViewer draws round-capped chromosome ideograms with each family in its own colour (+ strand above the axis, - below), optionally marks centromeres, and can compute localization statistics. Output is fully vector and can be saved as PDF, SVG, PNG, JPG, TIFF or EPS.

Version 2 rewrites the rendering engine on top of matplotlib (the old BioPython/BasicChromosome engine is kept at gfviewer.legacy for one release), removes the 19-family ceiling, adds BED / GFF3 / GTF input, a style system, an analytics module, and an interactive web portal.

Install

pip install gfviewer                      # the `gfviewer` command-line tool

From a source checkout (development, tests, or the web portal):

conda env create -f environment.yml      # or: python -m venv .venv && source .venv/bin/activate
conda activate gfviewer
pip install -e ".[web,dev]"               # editable, with Flask + pytest

A full pip-installation and command-line walkthrough — isolated environments, every flag with worked examples, troubleshooting — is in docs/INSTALL.md, and is mirrored on the web portal's Install page. Build distributable artifacts with scripts/build_wheel.sh.

Command line

gfviewer -d genes.tsv -g genome.fasta -o out/ \
         -f pdf svg png --analytics -cen \
         --tick-style lollipop --title "My organism"

Key options (gfviewer --help for the full list):

Flag Meaning
-d/--data one or more annotation files (.xlsx/.csv/.tsv/.bed/.gff3/.gtf)
-g/--genome FASTA, .fai, chrom.sizes, or chrom,length table
-c/--colors colour-map file (family,index / family,#hex / family,r,g,b)
-m/--mapping gene_id,gene_family map (single BED/GFF input)
--family-attr GFF3/GTF attribute that holds the family
-f/--format export formats
--collapse-rare fold infrequent families into "Other" above the 40-family cap
--style / --save-style load / write a YAML/JSON style file
--analytics also write per-family statistics as CSV/JSON
--no-titles omit titles from the exported figure and analytics-chart images
--no-fit / --margin-cm keep the full reserved page / set the white border (default: crop to the drawing, 0.3 cm border)
-cen draw centromeres

Input formats

  • Table — columns gene_id, gene_family, chromosome, start, end, strand (1-based, inclusive; header synonyms accepted). A centromere value in gene_family (strand 0) marks a centromere.
  • BED — 0-based half-open, converted automatically. One file → column 4 is the family; several files → each file's base name is the family; one file plus a mapping file → family from the map.
  • GFF3 / GTF — 1-based; gene-like feature types kept; family taken from --family-attr (default search: gene_family, Family, gene_biotype, Name, …).

Analytics

--analytics writes analytics_*.csv / .bed, analytics_summary.json and four figures (analytics_genes_per_family, analytics_positional_profile, analytics_ripley, analytics_family_proximity — one per requested figure format). It computes:

  • per-family counts split into genes on chromosomes vs. unplaced/stray contigs, linear density, gene length, strand fraction;
  • permutation tests for telomere- and (with a centromere track) centromere-proximal bias, plus p-arm / q-arm occupancy;
  • tandem-array detection and a tandem / proximal / dispersed duplication mode per family;
  • multi-scale clustering — edge-corrected 1-D Ripley's K/L with a permutation envelope (--ripley-scales);
  • chromosome-enrichment (binomial, per family × chromosome), strand bias, and per-chromosome family diversity (Shannon / evenness);
  • a binned positional density profile ("metachromosome" plot);
  • a family × family proximity matrix with average-linkage clustering;
  • multigene-family hotspots — a Poisson window scan, merged and written as a table and a BED file (--hotspot-window);
  • optional pairwise co-localization (--colocalization).

Every per-family / per-pair / per-window test carries a Benjamini–Hochberg q_value. See the Downloadable outputs section of the Help page for the column-by-column layout of each file.

Web portal

# development
python flaskapp.py                       # http://localhost:5001

# production
gunicorn -w 1 --threads 4 -b 0.0.0.0:5001 "gfviewer_web:create_app()"

Uploads are rendered on a background thread pool behind an async job API (POST /api/jobsGET /api/jobs/<id>/status → results page). The results page embeds the SVG with an editor for choosing which families and chromosomes to draw, recolouring, moving the legend and labels, changing fonts and mark style, toggling whether titles are baked into the image files, then re-rendering and exporting. Analytics figures are shown inline, and two buttons download everything as a ZIP — either as produced, or re-rendered in every figure format. GET /api/health is a readiness probe.

Usage monitor. A privacy-respecting counter (/stats, or JSON at /api/stats) tracks page views, unique visitors per day (a salted daily hash — no IPs, cookies or other personal data are stored), jobs submitted / completed / failed, example-dataset runs and downloads, with a rolling ~120-day daily series. Counters persist to instance/usage.json.

Configuration (environment variables): GFVIEWER_DATA_DIR, GFVIEWER_MAX_UPLOAD_MB (25), GFVIEWER_WORKERS (2), GFVIEWER_JOB_TTL_HOURS (24), GFVIEWER_USAGE_FILE, GFVIEWER_STATS_TOKEN (require ?token= on /stats), SECRET_KEY, PORT.

Example datasets

python tests/make_fixtures.py builds every bundled dataset into static/tests/: the three Babesia sets, the 6-family set re-expressed in every input format (formats/ — BED, per-family BED, BED + mapping, GFF3, GTF), and two synthetic sets — 10 random gene families on the Arabidopsis (TAIR10) chromosomes and 20 on C. elegans (WBcel235). The web home page lists them all with Run (submits the job) and Download buttons, plus Download every dataset (ZIP).

Tests

python tests/make_fixtures.py            # once, to build the example datasets
pytest -q

Citation

Chakravarty S. & Lonardi S. Visualizing the localization of multigene families with GFViewer. Development supported by NIH grant 1-R01-AI169543-01.

Release files for gfviewer 2.0.3

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

Source distribution (sdist)

Source distribution for gfviewer 2.0.3
File Size Uploaded
gfviewer-2.0.3.tar.gz 765.2 kB Details

Built distribution (wheel)

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

Total release size: 845.8 kB

Release files / gfviewer-2.0.3.tar.gz

Download URL gfviewer-2.0.3.tar.gz
Size 765.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1c646919278d517618e09ae4521b4686096b8033c99ba0b03fb37be6ba6e2c13
BLAKE2b-256 checksum
How to use checksums
906e157323a27f1cf5375ea203b68e81ce4191fae1939376ce61290ff2845647
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / gfviewer-2.0.3-py3-none-any.whl

Download URL gfviewer-2.0.3-py3-none-any.whl
Size 80.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b9f4335e281b3053101492a68a2de603f28cb38317dd37aa49742f592d05b89
BLAKE2b-256 checksum
How to use checksums
d0531b670e5cf1c28a7e5594e160a7263d7db4e4f3d3cc3cc6a5613c698728f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.4

2 release files

This release

2.0.3 This release

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release 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