pqplot 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pqplot/__init__.py +20 -0
- pqplot/colors.py +86 -0
- pqplot/columns.py +69 -0
- pqplot/cytobands.py +103 -0
- pqplot/data/hg19/cytoBand.txt.gz +0 -0
- pqplot/data/hg38/cytoBand.txt.gz +0 -0
- pqplot/data/hs1/chm13v2.0_cytobands_allchrs.bed +862 -0
- pqplot/data/mm10/cytoBand.txt.gz +0 -0
- pqplot/data/mm39/cytoBand.txt.gz +0 -0
- pqplot/genome.py +486 -0
- pqplot/ideograms.py +638 -0
- pqplot/karyogram.py +595 -0
- pqplot/labels.py +71 -0
- pqplot/layout.py +255 -0
- pqplot/outline.py +96 -0
- pqplot/panels.py +80 -0
- pqplot/spans.py +89 -0
- pqplot/tracks.py +787 -0
- pqplot-0.1.0.dist-info/METADATA +167 -0
- pqplot-0.1.0.dist-info/RECORD +22 -0
- pqplot-0.1.0.dist-info/WHEEL +4 -0
- pqplot-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pqplot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Chromosome ideograms and karyograms for matplotlib.
|
|
5
|
+
Keywords: ideogram,karyogram,karyotype,chromosome,genomics,matplotlib
|
|
6
|
+
Author: Christian Ramirez
|
|
7
|
+
Author-email: Christian Ramirez <christian.ramirez1@umassmed.edu>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Framework :: Matplotlib
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
19
|
+
Requires-Dist: matplotlib>=3.10
|
|
20
|
+
Requires-Dist: numpy>=2.2
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Project-URL: Repository, https://github.com/ramirc0/pqplot
|
|
23
|
+
Project-URL: Issues, https://github.com/ramirc0/pqplot/issues
|
|
24
|
+
Project-URL: Changelog, https://github.com/ramirc0/pqplot/blob/main/CHANGELOG.md
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# pqplot
|
|
28
|
+
|
|
29
|
+
Chromosome ideograms and karyograms for matplotlib.
|
|
30
|
+
|
|
31
|
+
## Description
|
|
32
|
+
|
|
33
|
+
pqplot draws banded chromosomes and puts your data on them. It covers a single
|
|
34
|
+
ideogram over a locus plot and whole karyotypes, vertical or horizontal. Data
|
|
35
|
+
can go on the bodies as painted categories or values, or in tracks beside them
|
|
36
|
+
as marks, labels, scatter, lines, areas, heatmaps and intervals. It also has
|
|
37
|
+
helpers for genome-wide plots such as Manhattan plots.
|
|
38
|
+
|
|
39
|
+
Every chromosome and track is a plain matplotlib Axes with positions in bp. You
|
|
40
|
+
can call any matplotlib method on it. Every entry point takes `ax=None`. Without
|
|
41
|
+
an Axes, it makes a figure sized to the content. With one, it fills that slot of
|
|
42
|
+
your figure. Input is any table with columns (polars, pandas, pyarrow, a dict)
|
|
43
|
+
or plain arrays. Chromosome names match across `chr1` and `1`.
|
|
44
|
+
|
|
45
|
+
Bundled assemblies are hg19, hg38, hs1 (T2T-CHM13), mm10 and mm39. Any other
|
|
46
|
+
genome works from a `.chrom.sizes` or `.fai` file, with an optional centromere
|
|
47
|
+
BED.
|
|
48
|
+
|
|
49
|
+
## Getting Started
|
|
50
|
+
|
|
51
|
+
### Dependencies
|
|
52
|
+
|
|
53
|
+
* Python 3.12 or later
|
|
54
|
+
* matplotlib 3.10 or later
|
|
55
|
+
* NumPy 2.2 or later
|
|
56
|
+
|
|
57
|
+
### Installing
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
uv add pqplot
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Executing program
|
|
64
|
+
|
|
65
|
+
A karyotype with GWAS hits as marks and gene names as labels:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import pqplot as pqp
|
|
69
|
+
|
|
70
|
+
hg38 = pqp.Genome.bundled("hg38")
|
|
71
|
+
kary = pqp.Karyogram(
|
|
72
|
+
hg38, groups=2, align="centromere", tracks=[pqp.Track("hits", side="after", size=5)]
|
|
73
|
+
)
|
|
74
|
+
kary.track("hits").mark(hits, pos="pos", color="trait")
|
|
75
|
+
kary.track("hits").label(genes, pos="pos", text="gene")
|
|
76
|
+
kary.legend(title="Trait")
|
|
77
|
+
kary.figure.savefig("karyotype.svg")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
<p align="center">
|
|
81
|
+
<img src="https://raw.githubusercontent.com/ramirc0/pqplot/main/tests/baseline/test_gallery_karyotype.png" alt="Karyotype with marks and labels" width="927">
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
An ideogram over your own locus plot, with x in bp:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import matplotlib.pyplot as plt
|
|
88
|
+
|
|
89
|
+
locus = pqp.Region.parse("chr17:43,044,295-43,125,483")
|
|
90
|
+
fig, (head, body) = plt.subplots(2, 1, height_ratios=[1, 3])
|
|
91
|
+
ideo = pqp.ideogram(hg38[locus.chrom], ax=head)
|
|
92
|
+
body.plot(pos, signal)
|
|
93
|
+
body.set_xlim(locus.start, locus.end)
|
|
94
|
+
ideo.zoom(locus, into=body)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
<p align="center">
|
|
98
|
+
<img src="https://raw.githubusercontent.com/ramirc0/pqplot/main/tests/baseline/test_gallery_locus.png" alt="Locus with an ideogram header" width="650">
|
|
99
|
+
</p>
|
|
100
|
+
|
|
101
|
+
Painting chromosome bodies by category or by value:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
kary = pqp.Karyogram(hg38, groups=2)
|
|
105
|
+
kary.paint(
|
|
106
|
+
segments,
|
|
107
|
+
start="start",
|
|
108
|
+
end="end",
|
|
109
|
+
color="state",
|
|
110
|
+
palette={"gain": "tab:red", "loss": "tab:blue"},
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
kary = pqp.Karyogram(hg38, bands=False)
|
|
114
|
+
heat = kary.paint(bins, start="start", end="end", value="per_mb", cmap="magma")
|
|
115
|
+
kary.colorbar(heat, label="cCREs per Mb")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
<p align="center">
|
|
119
|
+
<img src="https://raw.githubusercontent.com/ramirc0/pqplot/main/tests/baseline/test_gallery_paint_categories.png" alt="Painted copy number" width="347">
|
|
120
|
+
<img src="https://raw.githubusercontent.com/ramirc0/pqplot/main/tests/baseline/test_gallery_paint_values.png" alt="Painted density" width="536">
|
|
121
|
+
</p>
|
|
122
|
+
|
|
123
|
+
The [`gallery/`](https://github.com/ramirc0/pqplot/tree/main/gallery) scripts
|
|
124
|
+
hold the full code for these figures and for data tracks, homolog pairs,
|
|
125
|
+
genome-wide plots and unbanded assemblies. Each script ends with a figure named
|
|
126
|
+
`fig`. The tests render them against the images in `tests/baseline/`.
|
|
127
|
+
|
|
128
|
+
## Help
|
|
129
|
+
|
|
130
|
+
* Chromosome and track panels are child Axes of a hidden host Axes. They are
|
|
131
|
+
not in `fig.axes`, and `plt.gca()` does not return them. Get them with
|
|
132
|
+
`kary.panel(chrom, track=None)` or `kary.panels(track=None)`.
|
|
133
|
+
* Labels do not count in the layout. Size their track to fit the longest
|
|
134
|
+
label, or labels run into the next chromosome.
|
|
135
|
+
* A legend and a colorbar both sit at the top right of the karyogram. Draw one
|
|
136
|
+
or the other.
|
|
137
|
+
* Docstrings document every public name. Read them with `help()`:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
python -c "import pqplot; help(pqplot.Karyogram)"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Authors
|
|
144
|
+
|
|
145
|
+
Christian Ramirez (christian.ramirez1@umassmed.edu)
|
|
146
|
+
|
|
147
|
+
## Version History
|
|
148
|
+
|
|
149
|
+
See [CHANGELOG.md](https://github.com/ramirc0/pqplot/blob/main/CHANGELOG.md).
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
This project is licensed under the MIT License. See the
|
|
154
|
+
[LICENSE](https://github.com/ramirc0/pqplot/blob/main/LICENSE) file for
|
|
155
|
+
details.
|
|
156
|
+
|
|
157
|
+
## Acknowledgments
|
|
158
|
+
|
|
159
|
+
* Cytobands for hg19, hg38, mm10 and mm39 come from the
|
|
160
|
+
[UCSC Genome Browser](https://genome.ucsc.edu) database, built on NCBI
|
|
161
|
+
assemblies.
|
|
162
|
+
* hs1 cytobands come from the
|
|
163
|
+
[T2T Consortium](https://github.com/marbl/CHM13) and are released under CC0.
|
|
164
|
+
* [pyideogram](https://github.com/Balthasar-eu/pyideogram),
|
|
165
|
+
[tagore](https://github.com/jordanlab/tagore) and
|
|
166
|
+
[karyoploteR](https://bioconductor.org/packages/karyoploteR) shaped the
|
|
167
|
+
design. pqplot shares no code with them.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
pqplot/__init__.py,sha256=k4fRd4F7otbkiULrMqmHkgz9l-J_BLe1mbmhoCD8lG0,475
|
|
2
|
+
pqplot/colors.py,sha256=K-PoxxKu5bE548gX7wzST3sD_s9_z3StzzaMeOPQOEM,2854
|
|
3
|
+
pqplot/columns.py,sha256=-cy_QzvfBnt2Jhi_iOyPQ-sDqka-vLx76k0D3Kl2SrI,1949
|
|
4
|
+
pqplot/cytobands.py,sha256=Idom3oanHC3OfG3HvPECqXo0owc0CrGKKYxpxB_0lMc,3138
|
|
5
|
+
pqplot/data/hg19/cytoBand.txt.gz,sha256=-bgjCbK8oeudkaXLLGqgUoNRFY5uILUdgsyjbQFzXLo,6609
|
|
6
|
+
pqplot/data/hg38/cytoBand.txt.gz,sha256=5RTkiwoSpRb9UjG0QkGiCigvKQvdYTHK3N3GJ27iYII,12118
|
|
7
|
+
pqplot/data/hs1/chm13v2.0_cytobands_allchrs.bed,sha256=Ccf6PKPiIuuqu-ztwwhqolQ5mYJMCWb5aww_McESbqI,30753
|
|
8
|
+
pqplot/data/mm10/cytoBand.txt.gz,sha256=MFE3KK0q_FD8deC6HUjlYCxJHVtzE1BbtcXiqcZ70uU,4155
|
|
9
|
+
pqplot/data/mm39/cytoBand.txt.gz,sha256=WQAviH3aH0KV7yrKvMdjTQ8GtFE3EiZE8QBLJ3OYxI0,4242
|
|
10
|
+
pqplot/genome.py,sha256=rxrfEg8zCv0SMvz9Cj8_RdSYZ_lHKy0XtpPcsLQVQHU,14077
|
|
11
|
+
pqplot/ideograms.py,sha256=d59Fmx82oj1iHDRUKQdcVeW8c7q4SYRVA0SLthki504,22755
|
|
12
|
+
pqplot/karyogram.py,sha256=Ym01f67Tw6bCK6Dox2v-x5UN0EThRhv_ioUw2lw5cYw,22302
|
|
13
|
+
pqplot/labels.py,sha256=2mxQ3EA3uIKx19LjsvnkWPvP8sY1MY5XKcW1GS8_c84,2265
|
|
14
|
+
pqplot/layout.py,sha256=HJGSQSmiBHn-V4AongRm1adMWOgcA3KZR2Z-soCyD9g,7748
|
|
15
|
+
pqplot/outline.py,sha256=DmzKLAuO5a1vKHb6XT-KtZg0qAk4ttDHfMk07d1ZKXI,3436
|
|
16
|
+
pqplot/panels.py,sha256=_x5u3KX_HrIhjoF68dVqpn9fXJSd8Mljfqsww1yQw1Y,2846
|
|
17
|
+
pqplot/spans.py,sha256=-ijfr2nVTISMa5C_gfAJwyBpvRUj0aXs_-N9txqleOg,3237
|
|
18
|
+
pqplot/tracks.py,sha256=xxMtZzSKDiVQ7EK3Al6h70wfrNqUoixlVse4zTknkhA,28966
|
|
19
|
+
pqplot-0.1.0.dist-info/licenses/LICENSE,sha256=LV_ebJ5sCWToygT2CfGniiAyxyEYDaZRZ1Ybn5OLaNk,1074
|
|
20
|
+
pqplot-0.1.0.dist-info/WHEEL,sha256=3OmCxFA0ffBIsX4x0o8CdfSvZAOvO3mzEG8U_z5TvV4,80
|
|
21
|
+
pqplot-0.1.0.dist-info/METADATA,sha256=CTEVKAuA0qKrU-EhWCQlrdhVzKgIF4mE5SzgtpG6oRM,5819
|
|
22
|
+
pqplot-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christian Ramirez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|