Skip to main content

Flexible genome visualization toolkit for publication-ready figures

Project description

Chromoplot

Flexible genome visualization toolkit for publication-ready figures.

Features

  • Track-based composition: Stack multiple data types vertically
  • Format-agnostic: BED, GFF, PAF, BAM, VCF, bedGraph, bigWig
  • Multiple layouts: Single region, whole genome, comparative synteny
  • Publication-ready: Clean defaults optimized for print
  • Fully customizable: Themes, colors, and per-track styling

Installation

pip install chromoplot

# With optional dependencies for BAM/bigWig support
pip install chromoplot[full]

Quick Start

Single Region

import chromoplot as cp

fig = cp.GenomeFigure("genome.fa.fai", region="chr1:1-10000000")
fig.add_track(cp.IdeogramTrack())
fig.add_track(cp.GeneTrack("genes.gff3", label="Genes"))
fig.add_track(cp.HaplotypeTrack("haplotypes.bed", label="Haplotypes"))
fig.add_track(cp.ScaleBarTrack())
fig.save("figure.pdf")

Whole Genome

import chromoplot as cp

coords = cp.GenomeCoordinates.from_fai("genome.fa.fai")
layout = cp.GenomeLayout(coords, arrangement='grid', n_cols=5)
layout.add_track(cp.IdeogramTrack())
layout.add_track(cp.HaplotypeTrack("haplotypes.bed"))
layout.save("genome_wide.pdf")

Comparative Synteny

import chromoplot as cp

ref_coords = cp.GenomeCoordinates.from_fai("ref.fa.fai")
query_coords = cp.GenomeCoordinates.from_fai("query.fa.fai")

layout = cp.ComparativeLayout(
    ref_coords, query_coords,
    ref_region="chr1", query_region="chr1"
)
layout.add_ref_track(cp.IdeogramTrack())
layout.add_ref_track(cp.GeneTrack("ref_genes.gff3"))
layout.add_synteny_track(cp.SyntenyTrack("alignment.paf"))
layout.add_query_track(cp.GeneTrack("query_genes.gff3"))
layout.add_query_track(cp.IdeogramTrack())
layout.save("synteny.pdf")

Command Line

# Single region plot
chromoplot plot -r genome.fa.fai --region chr1:1-10000000 \
    --gff genes.gff3 --haplotypes haplotypes.bed -o figure.pdf

# Whole genome plot
chromoplot genome -r genome.fa.fai --haplotypes haplotypes.bed -o genome.pdf

# Comparative synteny plot
chromoplot comparative --ref-fai ref.fa.fai --query-fai query.fa.fai \
    --synteny alignment.paf --ref-region chr1 --query-region chr1 -o synteny.pdf

# From YAML config
chromoplot from-config config.yaml -o figure.pdf

Available Tracks

Track Description Input Formats
IdeogramTrack Chromosome backbone (none)
GeneTrack Gene models with exons GFF3, GTF
FeatureTrack Generic features BED
HaplotypeTrack Haplotype blocks BED (phaser output)
AlignmentTrack Sequence alignments PAF
DepthTrack Read coverage BAM, bedGraph, bigWig
SignalTrack Continuous signal bedGraph, bigWig
VariantTrack Variant positions VCF
SyntenyTrack Synteny ribbons PAF, SyRI, MCScanX
ScaleBarTrack Scale reference (none)
AnnotationTrack Text labels TSV

Themes

# Built-in themes
fig = cp.GenomeFigure(..., theme='publication')  # Default
fig = cp.GenomeFigure(..., theme='presentation')
fig = cp.GenomeFigure(..., theme='minimal')
fig = cp.GenomeFigure(..., theme='dark')

# Custom theme
my_theme = cp.Theme(
    figure_facecolor='white',
    title_fontsize=14,
    label_fontsize=10,
)
cp.register_theme('my_theme', my_theme)

Color Palettes

# Get palette
colors = cp.get_palette('categorical', n=5)
colors = cp.get_palette('founder_default')
colors = cp.get_palette('maize_heterotic')

# Founder colors for haplotype tracks
color_map = cp.founder_colors(['B73', 'Mo17', 'W22'])

# Maize NAM colors (by heterotic group)
color_map = cp.maize_nam_colors(['B73', 'Mo17', 'CML247'])

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chromoplot-0.1.0.tar.gz (49.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chromoplot-0.1.0-py3-none-any.whl (60.2 kB view details)

Uploaded Python 3

File details

Details for the file chromoplot-0.1.0.tar.gz.

File metadata

  • Download URL: chromoplot-0.1.0.tar.gz
  • Upload date:
  • Size: 49.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for chromoplot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe2225ec4c3ee80db2f4a6af5cd9acc259dc9217c4dc1cdd4e9fcd4cb68b9d8c
MD5 a218802f0ea52a3d24f4b3cef18cf84c
BLAKE2b-256 33b5098509700a988184d4828eceab12a8679715650b7683e8d41366f67b0d7c

See more details on using hashes here.

File details

Details for the file chromoplot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chromoplot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 60.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for chromoplot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d24004a88d4cd26b497415de2cc489dabe2d067edd59c920fdb7365ca835961
MD5 4c524efa149f9f1378b6f0ab8a4ba97b
BLAKE2b-256 1909d27b7d7938f966c72ba87501ede57b6545f08e791b4cedec194b86bc0e70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page