Metadata-Version: 2.1
Name: chromosome-ideogram
Version: 0.0.5
Summary: A python package for drawing genome-wide data on idiograms.
Home-page: https://github.com/wenlinXu-njfu/ChromosomeIdeogram
License: MIT
Author: Wenlin Xu
Author-email: wenlinxu.njfu@outlook.com
Requires-Python: >=3.8
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: click (>=8.1.8)
Requires-Dist: matplotlib (>=3.7.5)
Requires-Dist: numpy (>=1.24.4)
Description-Content-Type: text/markdown

[![PyPI - Version](https://img.shields.io/pypi/v/chromosome-ideogram)](https://pypi.org/project/chromosome-ideogram)

# ChromosomeIdeogram
A python package for drawing genome-wide data on ideograms.

## Install
```shell
pip install chromosome-ideogram --upgrade
```

## Usage example
```python
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=10, ncols=4)
axes1 = fig.add_subplot(gs[:8, :])
axes2 = fig.add_subplot(gs[8:, :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)

# Create a second karyotype diagram object (containing only chromosome 14)
ci2 = ChromosomeIdeogram(
    karyotype='example/Chr14_karyotype.xls',
    radius=0.4,
    space=4
)
ci2.draw_chromh(axes=axes2, centromere_angle=60, facecolor='white', edgecolor='#4d4d4d', linewidth=1)
ci2.annotations(axes=axes2, annotations='example/Chr14_satellite_DNA.bed', height=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.3), ncol=2)  # You can also set axes2 legend

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

plt.savefig('example/satellite_DNA.pdf', bbox_inches='tight')
plt.savefig('example/satellite_DNA.png', bbox_inches='tight')
```
![image](https://github.com/wenlinXu-njfu/ChromosomeIdeogram/blob/main/example/satellite_DNA.png?raw=true)

