Skip to main content

PyPI - Version

ChromosomeIdeogram

The magical companion of the chromosome map.

Install

pip install chromosome-ideogram --upgrade

Usage example

Draw the vertical chromosome ideograms

import matplotlib.pyplot as plt
from chromosome_ideogram import ChromosomeIdeogram

plt.rcParams['font.size'] = 12
plt.rcParams['pdf.fonttype'] = 42

fig = plt.figure(figsize=(10, 8))
axes = fig.add_subplot(111)

ci = ChromosomeIdeogram(
    karyotype='example/karyotype.xls',
    radius=0.4,  # Radius of chromosome
    space=4  # Chromosome center coordinate interval (radius x space)
)
ci.draw_chrom(axes=axes, centromere_angle=60, facecolor='white', edgecolor='black', linewidth=1.0)
ci.annotations(axes=axes, annotations='example/satellite_DNA.bed', height=None)

# show rDNA array
ci.mark_loci(axes=axes, markers='example/hapA_rDNA_left.bed', pos='left', size=0.4)  # Show rDNA on the left side of the haplotype A chromosome
ci.mark_loci(axes=axes, markers='example/hapB_rDNA_right.bed', pos='right', size=0.4)  # Show rDNA on the right side of the haplotype A chromosome

# show chromosome 14 synteny
ci.draw_synteny(axes=axes, synteny_file='example/Chr14_SV.bed')

axes.legend(handles=ci.handles, loc=(0.5, 0.8), ncol=2)

plt.savefig('example/vertical_chromosome.pdf', bbox_inches='tight')
plt.savefig('example/vertical_chromosome.png', bbox_inches='tight')

image

show reads tracks

import matplotlib.pyplot as plt
from chromosome_ideogram import ChromosomeIdeogram

plt.rcParams['font.size'] = 12
plt.rcParams['pdf.fonttype'] = 42

fig = plt.figure(figsize=(12, 8))
axes = fig.add_subplot(111)

ci = ChromosomeIdeogram(
    karyotype='example/karyotype.xls',
    radius=0.4,  # Radius of chromosome
    space=5  # Chromosome center coordinate interval (radius x space)
)
ci.draw_chrom(axes=axes, centromere_angle=60, facecolor='white', edgecolor='black', linewidth=1.0)
ci.annotations(axes=axes, annotations='example/satellite_DNA.bed', height=None)

# show HiFi reads pile up
ci.show_tracks(axes=axes, bigwig='example/hapA_HiFi.bw', sample_name='Pla', pos='left', bin_size=10000, max=110, color='steelblue', label='HiFi reads mapped hapA')
ci.show_tracks(axes=axes, bigwig='example/hapB_HiFi.bw', sample_name='Pla', pos='right', bin_size=10000, max=110, color='steelblue', label='HiFi reads mapped hapB')

# show chromosome 14 synteny
ci.draw_synteny(axes=axes, synteny_file='example/Chr14_SV.bed')

axes.legend(handles=ci.handles, loc=(0.5, 0.8), ncol=2)

plt.savefig('example/vertical_chromosome_with_tracks.pdf', bbox_inches='tight')
plt.savefig('example/vertical_chromosome_with_tracks.png', bbox_inches='tight')

image

Draw the horizontal chromosome ideograms

import matplotlib.pyplot as plt
from matplotlib import gridspec
from chromosome_ideogram import ChromosomeIdeogram

plt.rcParams['font.size'] = 12
plt.rcParams['pdf.fonttype'] = 42

fig = plt.figure(figsize=(18, 15))
gs = gridspec.GridSpec(nrows=12, ncols=4)
axes1 = fig.add_subplot(gs[:10, :])
axes2 = fig.add_subplot(gs[10:, :3])  # Used to display the detailed karyotype of a certain chromosome (such as chromosome 14)

ci1 = ChromosomeIdeogram(
    karyotype='example/karyotype.xls',
    radius=0.4,  # Radius of chromosome
    space=4  # Chromosome center coordinate interval (radius x space)
)
ci1.draw_chromh(axes=axes1, centromere_angle=60, facecolor='lightgrey', edgecolor=None, linewidth=0)
ci1.annotations(axes=axes1, annotations='example/satellite_DNA.bed', height=None)

# show rDNA
ci1.mark_loci(axes=axes1, markers='example/hapA_rDNA_bottom.bed', pos='bottom', size=None)  # Draw the rDNA beneath haplotype A chromosomes
ci1.mark_loci(axes=axes1, markers='example/hapB_rDNA_top.bed', pos='top', size=None)  # Draw the rDNA above haplotype B chromosomes

# Create a second karyotype ideogram object (containing only chromosome 14)
ci2 = ChromosomeIdeogram(
    karyotype='example/Chr14_karyotype.xls',
    radius=0.4,
    space=3
)
ci2.draw_chromh(axes=axes2, centromere_angle=60, facecolor='white', edgecolor='#4d4d4d', linewidth=1)
ci2.annotations(axes=axes2, annotations='example/satellite_DNA.bed', height=None)
ci2.mark_loci(axes=axes2, markers='example/hapA_rDNA_bottom.bed', pos='bottom', size=None)
ci2.mark_loci(axes=axes2, markers='example/hapB_rDNA._topbed', pos='top', size=None)
ci2.draw_synteny(axes=axes2, synteny_file='example/Chr14_SV.bed') # show synteny

axes1.legend(handles=ci1.handles, loc=(0.85, 0.85))  # Set axes1 legend
axes2.legend(handles=ci2.handles, loc=(1.05, 0.1), ncol=2)  # You can also set axes2 legend

plt.subplots_adjust(hspace=9)  # Adjust the vertical distance between the two subgraphs

plt.savefig('example/horizontal_chromosome.pdf', bbox_inches='tight')
plt.savefig('example/horizontal_chromosome.png', bbox_inches='tight')

image

Metadata

Release files for chromosome-ideogram 0.0.8

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

Source distribution (sdist)

Source distribution for chromosome-ideogram 0.0.8
File Size Uploaded Provenance Actions
chromosome_ideogram-0.0.8.tar.gz 10.4 kB Without provenance Details for chromosome_ideogram-0.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chromosome-ideogram 0.0.8
File Interpreter ABI Platform Actions
chromosome_ideogram-0.0.8-py3-none-any.whl Python 3 none any Details for chromosome_ideogram-0.0.8-py3-none-any.whl

Total release size: 21.6 kB

Release files / chromosome_ideogram-0.0.8.tar.gz

Download URL chromosome_ideogram-0.0.8.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cad062b65239bcd51140134ad09083c626d6da2e2011e88b8c8e5cc643f6caea
BLAKE2b-256 checksum
How to use checksums
03c11cfc6fe5e46c2d36c190d5e6433da84b006705452a2aaf9e6ca425c6f076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / chromosome_ideogram-0.0.8-py3-none-any.whl

Download URL chromosome_ideogram-0.0.8-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f8b74f168dd408411b97b6ca11885e9e69fbcff0db2909daab20af4407a63e2
BLAKE2b-256 checksum
How to use checksums
be3e961c428afcb251eba99c1660bb4fe95710663ef03ee71a936549e1c4492d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Security for chromosome-ideogram 0.0.8

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.

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