{% extends "base.html" %} {% block title %}Install{% endblock %} {% block content %}
GFViewer ships a single console command, gfviewer, that turns
gene coordinates plus a genome into publication-quality chromosome
ideograms and a battery of localization statistics. This page covers
installing it with pip and running it from a terminal.
| Python | 3.8 – 3.12 (CPython) |
|---|---|
| pip | 21.3 or newer — python -m pip install --upgrade pip |
| OS | Linux, macOS, Windows |
| Compiler | none — every dependency installs from a pre-built wheel |
Installing gfviewer pulls in Biopython, matplotlib, pandas,
NumPy, openpyxl, Pillow, reportlab, PyPDF2 and PyYAML. The Flask web
portal is an optional extra and is not needed for the command
line.
python -m pip install --upgrade pip
python -m pip install gfviewer
This installs the library and puts the gfviewer executable on
your PATH.
# venv (standard library)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install gfviewer
# or, one isolated command:
pipx install gfviewer
# latest development version
python -m pip install "git+{{ links.github }}.git"
# a specific release tag
python -m pip install "git+{{ links.github }}.git@v2.0.1"
Or download a release tarball from
the releases page
and python -m pip install gfviewer-2.0.1.tar.gz.
git clone {{ links.github }}.git
cd GFViewer
python -m pip install -e . # CLI only
python -m pip install -e ".[web]" # + Flask web portal
python -m pip install -e ".[dev]" # + pytest
conda create -n gfviewer -c conda-forge python=3.11 \
biopython matplotlib pandas numpy openpyxl pillow reportlab pypdf2 pyyaml
conda activate gfviewer
python -m pip install gfviewer
A ready-made spec is in environment.yml
(conda env create -f environment.yml).
gfviewer --version # -> GFViewer 2.0.1
gfviewer --help # full option list
gfviewer --color-guide # the built-in 20-colour palette
If gfviewer is not found even though the install succeeded,
your Python scripts directory is not on PATH — call it
through the interpreter with python -m gfviewer.cli --version,
or add the bin/Scripts folder under
python -m site --user-base to PATH.
pipx avoids this entirely.
python -m pip install --upgrade gfviewer
python -m pip show gfviewer
python -m pip uninstall gfviewer
Synopsis
gfviewer -d DATA [DATA ...] -g GENOME -o OUTDIR [options]
-d/--data, -g/--genome and
-o/--output are required for a render;
--color-guide and --save-style are the only
actions that do not need them.
Common invocations
# minimal render (PDF + SVG are always produced)
gfviewer -d genes.csv -g genome.fasta -o out/
# extra formats and a title
gfviewer -d genes.csv -g chrom.sizes -o out/ -f pdf svg png jpg eps --title "A. thaliana"
# centromeres, vertical layout, lollipop marks, one label per cluster
gfviewer -d genes.tsv -g genome.fai -o out/ \
-cen --orientation vertical --tick-style lollipop --label-mode family
# full analytics with a fixed permutation seed
gfviewer -d genes.csv -g genome.fasta -o out/ --analytics --permutations 1000 --seed 42 -cen
# analytics only, no figure
gfviewer -d genes.csv -g genome.fasta -o out/ --analytics-only
# several BED files -> one family per file
gfviewer -d families/*.bed -g genome.fasta -o out/
# one BED + an explicit gene->family map
gfviewer -d all_genes.bed -m gene_to_family.tsv -g genome.fasta -o out/
# GFF3 with the family in a custom attribute
gfviewer -d annotation.gff3 -g genome.fasta -o out/ --family-attr locus_type
# many families: fold rare ones into "Other" above the 40-family cap
gfviewer -d big.csv -g genome.fasta -o out/ --collapse-rare --keep MGF1 MGF7
# save a style and reuse it
gfviewer -d genes.csv -g genome.fasta -o out/ --tick-style triangle --save-style mystyle.yaml
gfviewer -d other.csv -g other.fasta -o out2/ --style mystyle.yaml
Input files
| Type | Extensions | Coordinates | Family from |
|---|---|---|---|
| Table | .xlsx .xls .csv .tsv .txt |
1-based, inclusive | gene_family column |
| BED | .bed (.gz ok) |
0-based, half-open | column 4 — or the file base name (several files)
— or -m mapping |
| GFF3 / GTF | .gff .gff3 .gtf |
1-based, inclusive | --family-attr (default search:
gene_family, Family,
gene_biotype, Name, …) |
Table columns (case-insensitive, synonyms accepted):
gene_id, gene_family, chromosome, start, end, strand. A row
whose gene_family is centromere and
strand is 0 marks a centromere. The genome
(-g) is a FASTA, a .fai, a
chrom.sizes, or a chromosome,length table;
names must match the annotation exactly.
Option groups (run gfviewer --help for the full list):
input / output (-d -g -o -c -m --family-attr --id-attr
--gff-types --basename -f --on-unknown-chrom --coord-bounds),
gene families (--collapse-rare --keep),
analytics (--analytics --analytics-only
--subtelomere-fraction --subtelomere-bp --cluster-gap --proximal-window
--ripley-scales --hotspot-window --hotspot-step --proximity-clusters
--permutations --seed --colocalization) and
style (--style --save-style --orientation -t -p --columns
--row-height --length-cm --single-page --show-unplaced --title --subtitle
--dpi --page-size --background --tick-style --no-split-strand -cen
--label-mode --label-size --font -l --legend-columns --legend-size
--legend-title --legend-frame --legend-separate-page --no-legend).
What gets written into OUTDIR/: the ideogram as
gfviewer.pdf, gfviewer.svg and any extra
-f formats (multi-page raster/SVG get .p1,
.p2… suffixes; PDF stays one file). With
--analytics you also get analytics_*.csv,
analytics_hotspots.bed, analytics_summary.json
and four figures. Column layouts are on the
Help page.
Exit codes: 0 success · 1 a
GFViewer error (bad input; message on stderr) · 2
usage error (missing -d/-g/-o or an unknown flag).
Run python tests/make_fixtures.py from a source checkout to
build the bundled datasets under static/tests/ (the three
Babesia sets, a 6-family set in every input format, and synthetic
10-family Arabidopsis and 20-family C. elegans sets), or
download them all as a ZIP and from the
home page.
gfviewer -d static/tests/synthetic/arabidopsis_10/genes.tsv \
-g static/tests/synthetic/arabidopsis_10/genome.txt \
-o out/arabidopsis --analytics -cen
python -m pip install -e ".[web]"
python flaskapp.py # dev: http://localhost:5001
gunicorn -w 1 --threads 4 -b 0.0.0.0:5001 "gfviewer_web:create_app()" # prod
| Symptom | Fix |
|---|---|
gfviewer: command not found |
Scripts dir not on PATH. Use
python -m gfviewer.cli …, add the folder from
python -m site --user-base, or
pipx install gfviewer. |
ModuleNotFoundError right after install |
Installed into a different interpreter. Compare
python -m pip show gfviewer (its Location)
with python -c "import sys;print(sys.executable)";
use a venv. |
matplotlib display / TclError on a headless server |
export MPLBACKEND=Agg (GFViewer selects Agg
internally, but a stray matplotlibrc can override
it). |
pip tries to build NumPy/pandas from source |
python -m pip install --upgrade pip setuptools wheel
first. |
| Fonts differ from the paper | Pass --font "DejaVu Sans" (bundled with matplotlib)
for a portable result. |
Legacy .xls won't read |
pip install xlrd, or convert to CSV/TSV. |
The full, always-current version of this guide lives at
docs/INSTALL.md
in the repository (also
downloadable here).
For anything else, open an issue at
the tracker.