plot-io 0.12.1__tar.gz → 0.13.0__tar.gz
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.
- {plot_io-0.12.1 → plot_io-0.13.0}/PKG-INFO +1 -1
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/api.md +9 -9
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/bigwig.md +2 -1
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/hic.md +2 -2
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/links.md +1 -1
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/__init__.py +1 -1
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_methods.py +39 -34
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/adapters.py +4 -28
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/contacts.py +2 -2
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/links.py +3 -5
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/readers.py +7 -7
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/signal.py +2 -1
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/sites.py +4 -5
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/sources.py +54 -32
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/types.py +13 -11
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_genome.py +155 -7
- {plot_io-0.12.1 → plot_io-0.13.0}/LICENSE +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/README.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/annotated.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/bars.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/box_plots.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/colorbars.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/density.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/distributions.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/dots.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/error_bars.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/facets.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/genome_matrices.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/genome_regions.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/genome_tracks.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/grids2d.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/groups.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/heatmap.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/helpers.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/large_data.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/layouts.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/levels.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/line_band.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/scales.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/scatter_groups.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/shared_colorbar.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/shared_legend.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/shared_sizes.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/styles.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/time_twin.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/titles.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/units.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples/variable_fonts.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/examples.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/from_matplotlib.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/area.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/bar.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/bed.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/box.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/clustermap.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/contour.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/dendrogram.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/dots.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/ecdf.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/errorbar.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/facet.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/fill.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/genes.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/gtf.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/heatmap.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/hexbin.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/hist.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/hist2d.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/joint.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/kde.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/kde2d.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/line.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/linkage.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/ma.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/manhattan.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/pairs.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/pie.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/qq.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/raincloud.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/regression.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/scatter.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/site_heatmap.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/site_profile.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/stem.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/strip.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/swarm.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/violin.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/plots/volcano.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/axis.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/canvas.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/color_axes.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/colorbars.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/decorations.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/figure.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/figure_rows.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/legends.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/plot.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/sets.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/titles.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/reference/tracks.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/docs/tutorial.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/hatch_build.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/README.md +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/__init__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/__main__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/_api.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/kernels.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/manifest.json +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/alloc.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/cluster.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/colormap.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/math.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/plio.h +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/plio_api.h +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/plot.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/rt.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/signatures.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/sort.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/_native/src/stats.c +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/axis.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/boxes.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/canvas.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/color/__init__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/color/data.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/color/maps.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/color/values.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/color/variants.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/colorbar.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/columns.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/decorations.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/defaults.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/density.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/ext.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/facets.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/figure.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/formatters.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/__init__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/combine.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/intervals.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/lanes.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/layout.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/pack.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/regions.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/scale.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/series.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/genome/testing.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/geometry.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/groups.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/guides.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/__init__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/clustermap.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/dendrogram.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/grids.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/qq.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/raincloud.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/tree.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/helpers/volcano.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/hints.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/kernels.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/labels.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/__init__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/base.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/context.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/core.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/geoms.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/grammar.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/paint.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/pipeline.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/positions.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layers/stats.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/layout.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/legend.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/levels.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/limits.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/lines.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/mapped.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/markers.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/markup.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/numbers.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/occupancy.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/plot.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/__init__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/_util.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/area.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/bar.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/box.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/catpoints.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/contour.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/curves.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/dots.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/ecdf.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/errorbar.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/errors.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/fill.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/heatmap.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/hexbin.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/hist.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/hist2d.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/kde.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/kde2d.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/line.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/pie.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/regression.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/scatter.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/stem.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/presets/violin.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/py.typed +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/registry.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/render.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/rows.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/scales.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/seams.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/settings.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/shapes.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/sharing.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/sizemaps.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/spec.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/states.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/styles/__init__.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/styles/library.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/tables.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/text.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/ticks.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/times.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/titles.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/transform.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/units.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/validators.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/plot_io/values.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/pyproject.toml +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/fonts/VarTest.ttf +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/fonts/VioTest-Bold.ttf +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/fonts/VioTest-Regular.ttf +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/fuzz_native.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/golden.json +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/helpers.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/preset_ref.json +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/recording.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/stats_reference.json +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_api.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_bars.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_boundary.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_box.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_colorbars.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_decorations.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_defaults.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_density.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_distributions.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_docs.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_dots.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_edge_cases.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_entry.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_figure_title.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_fonts.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_geometry.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_golden.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_grids.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_heatmap.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_invariants.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_jxl_output.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_layers.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_layout.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_limits.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_maps.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_markers.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_markup.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_native.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_numbers.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_occupancy.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_output.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_pie.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_reflines.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_registry.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_rows.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_series.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_settings.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_settings_fuzz.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_shared_legends.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_sharing.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_simplify.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_size_keys.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_stats.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_style_settings.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_style_types.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_styles.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_tables.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_ticks.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_time_twin.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_titles.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_transform.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_typing.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_units.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_values.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/test_vocabulary.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tests/typing/user_code.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tools/build_native.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tools/gen_api.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tools/gen_docs.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tools/settings_doc.py +0 -0
- {plot_io-0.12.1 → plot_io-0.13.0}/tools/zig.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: plot_io
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.0
|
|
4
4
|
Summary: Plots for PDF, EPS, SVG, PNG, JPEG, JPEG XL and AVIF, drawn with vec_io
|
|
5
5
|
Project-URL: Repository, https://github.com/ajgouhier/plot_io
|
|
6
6
|
Author-email: Arthur Gouhier <ajgouhier@gmail.com>
|
|
@@ -1086,8 +1086,8 @@ A series' data argument is a reader, a path, or plain data
|
|
|
1086
1086
|
* **Paths** are opened with gwseq_io (imported on first use) when the figure is first
|
|
1087
1087
|
drawn, once per figure (series reading one path share its reader), and closed with the
|
|
1088
1088
|
figure: `.bed`, `.narrowPeak`, `.broadPeak` with `open_bed`; `.tsv`, `.csv`, `.xlsx`
|
|
1089
|
-
with `open_peaks`; anything else
|
|
1090
|
-
|
|
1089
|
+
with `open_peaks`; anything else (bigWig, bedGraph, WIG, BAM, CRAM, BEDPE, `.hic`,
|
|
1090
|
+
`.cool`, …) with `gwseq_io.open`. A missing or unreadable file raises at draw.
|
|
1091
1091
|
* **Plain data** become in-memory readers: BED columns (`bed`, `genes`, `gtf`), BEDPE
|
|
1092
1092
|
columns (`links`), `chr`, `start`, `end`, `value` records (`bigwig`, binned with
|
|
1093
1093
|
`bin_mode`), a square matrix (`hic`).
|
|
@@ -1098,15 +1098,15 @@ A series' data argument is a reader, a path, or plain data
|
|
|
1098
1098
|
|
|
1099
1099
|
| Data | Methods called |
|
|
1100
1100
|
|---|---|
|
|
1101
|
-
| signal (bigWig; the coverage of bigBed, BED and peaks) | `read_values([(chr, start, end)], bin_count=n, bin_mode=…, def_value=…, zoom="auto")`, or with `bin_size=b, snap_to_grid="expand"` and the bounds from `resolve_regions(…)`: one row of values |
|
|
1102
|
-
| intervals (bigBed, BED, peaks) | `read_entries([(chr, start, end)], columns=…)`: a dict of columns |
|
|
1101
|
+
| signal (bigWig, bedGraph, WIG; the coverage of BAM, CRAM, bigBed, BED and peaks) | `read_values([(chr, start, end)], bin_count=n, bin_mode=…, def_value=…, zoom="auto")`, or with `bin_size=b, snap_to_grid="expand"` and the bounds from `resolve_regions(…)`: one row of values |
|
|
1102
|
+
| intervals (bigBed, BED, peaks) | `read_entries([(chr, start, end)], columns=…)`: a table (gwseq_io's `Table`, or a dict) of columns |
|
|
1103
1103
|
| annotation (GTF, GFF3) | `read_entries([(chr, start, end)], model="transcript", gene_type=…, transcript_type=…)`: transcripts (`start`, `end`, `strand`, `transcript_id`, `transcript_name`, `gene_id`, `gene_name`, `cds_start`, `cds_end`) with `nested["exons"]` and `groups`; told by its `tss` method |
|
|
1104
|
-
| pairs (BEDPE, for `links`) | `read_entries([(chr, start, end)])`: `chr1`, `start1`, `end1`, `chr2`, `start2`, `end2`, optionally `name`, `score` |
|
|
1105
|
-
| contacts (Hi-C) | `bin_sizes`, `normalizations`, `read_values((chr, start, end), bin_size=b, snap_to_grid="expand", normalization=…, matrix_type=…, max_distance=…)`: a square matrix (`shape="square"`: `read_values(region, region2, …)`), bounds from `resolve_regions(…)` |
|
|
1104
|
+
| pairs (BEDPE, for `links`) | `read_entries([(chr, start, end), …])`: `chr1`, `start1`, `end1`, `chr2`, `start2`, `end2`, optionally `name`, `score` |
|
|
1105
|
+
| contacts (Hi-C: `.hic`, `.cool`, `.mcool`) | `bin_sizes`, `normalizations`, `read_values((chr, start, end), bin_size=b, snap_to_grid="expand", normalization=…, matrix_type=…, max_distance=…)`: a square matrix (`shape="square"`: `read_values(region, region2, …)`), bounds from `resolve_regions(…)` (one row: `start1`, `end1`; `start2` of a square) |
|
|
1106
1106
|
|
|
1107
|
-
Results are read as buffers without importing numpy. BAM
|
|
1108
|
-
|
|
1109
|
-
track's label in the message.
|
|
1107
|
+
Results are read as buffers without importing numpy. A BAM or CRAM reader is a signal
|
|
1108
|
+
source: its coverage, binned by gwseq_io. A pair with a `.` anchor (no place) is left
|
|
1109
|
+
out. A reader's error is raised with the track's label in the message.
|
|
1110
1110
|
|
|
1111
1111
|
### Genome plot types
|
|
1112
1112
|
|
|
@@ -10,7 +10,8 @@ p.bigwig(reader=None, *, x=None, y=None, **settings) -> BigWig
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
A binned signal over the region: a step line along the bins, filled to a baseline.
|
|
13
|
-
`reader` is a signal reader (bigWig; bigBed, BED and
|
|
13
|
+
`reader` is a signal reader (bigWig, bedGraph, WIG; BAM, CRAM, bigBed, BED and
|
|
14
|
+
peaks give their coverage;
|
|
14
15
|
`combine` of two), a path (opened with gwseq_io),
|
|
15
16
|
`chr`, `start`, `end`, `value` records (columns, a DataFrame or rows; binned
|
|
16
17
|
by plot_io), a function `f(chr, start, end, bins)` giving values, or `None` with
|
|
@@ -11,8 +11,8 @@ p.hic(reader, **settings) -> HiC
|
|
|
11
11
|
|
|
12
12
|
The upper triangle of a contact matrix, the diagonal along the x axis (each cell a
|
|
13
13
|
diamond), or with `shape="square"` the whole matrix of `region` (x) against
|
|
14
|
-
`region2` (y, its start at the top). `reader` is a Hi-C reader
|
|
15
|
-
with gwseq_io), or a square matrix over the region (bins of `span / n`).
|
|
14
|
+
`region2` (y, its start at the top). `reader` is a Hi-C reader (`.hic`,
|
|
15
|
+
`.cool`, `.mcool`), a path (opened with gwseq_io), or a square matrix over the region (bins of `span / n`).
|
|
16
16
|
|
|
17
17
|
On the triangle, the matrix is drawn as an image under a 45° transform and clipped to
|
|
18
18
|
the track. Readers and paths: see [readers](../api.md#readers). `bins="0.5px"` takes the finest of the
|
|
@@ -12,7 +12,7 @@ p.links(pairs, **settings) -> Links
|
|
|
12
12
|
Links between pairs of places (BEDPE): an arc from anchor centre to anchor centre
|
|
13
13
|
in a lane of its own, or, `lane="over"` a Hi-C triangle or square, a mark at each
|
|
14
14
|
pair's contact cell (on a square, and at its mirror). `pairs` is a reader whose `read_entries` gives the BEDPE columns, a
|
|
15
|
-
path gwseq_io reads them from, or plain data (the pairs with an anchor in view are
|
|
15
|
+
path gwseq_io reads them from (a BEDPE file, or a table of pairs), or plain data (the pairs with an anchor in view are
|
|
16
16
|
read): a dict of columns, a DataFrame, or rows in BEDPE order (`chr1`,
|
|
17
17
|
`start1`, `end1`, `chr2`, `start2`, `end2`, then optionally `name`,
|
|
18
18
|
`score`).
|
|
@@ -450,12 +450,13 @@ class FigureMixin(Settings):
|
|
|
450
450
|
def bigwig(self, reader: Any = None, *, x: Any = None, y: Any = None,
|
|
451
451
|
**settings: Unpack[t.BigWigFigureSettings]) -> BigWig:
|
|
452
452
|
"""A new plot holding: A binned signal over the region: a step line along the bins,
|
|
453
|
-
filled to a baseline. ``reader`` is a signal reader (bigWig
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
or n + 1 edges, in
|
|
453
|
+
filled to a baseline. ``reader`` is a signal reader (bigWig, bedGraph, WIG; BAM,
|
|
454
|
+
CRAM, bigBed, BED and peaks give their coverage;
|
|
455
|
+
:func:`~plot_io.genome.combine.combine` of two), a path (opened with gwseq_io),
|
|
456
|
+
``chr``, ``start``, ``end``, ``value`` records (columns, a DataFrame or rows; binned
|
|
457
|
+
by plot_io), a function ``f(chr, start, end, bins)`` giving values, or ``None`` with
|
|
458
|
+
``y`` (values over the region) and optionally ``x`` (bin centres, or n + 1 edges, in
|
|
459
|
+
bp).
|
|
459
460
|
"""
|
|
460
461
|
return _figure_layer(self, "bigwig", (reader,), 0, {"x": x, "y": y}, settings)
|
|
461
462
|
|
|
@@ -485,8 +486,8 @@ class FigureMixin(Settings):
|
|
|
485
486
|
"""A new plot holding: The upper triangle of a contact matrix, the diagonal along the x
|
|
486
487
|
axis (each cell a diamond), or with ``shape="square"`` the whole matrix of
|
|
487
488
|
``region`` (x) against ``region2`` (y, its start at the top). ``reader`` is a Hi-C
|
|
488
|
-
reader, a path (opened with gwseq_io), or a square
|
|
489
|
-
``span / n``).
|
|
489
|
+
reader (``.hic``, ``.cool``, ``.mcool``), a path (opened with gwseq_io), or a square
|
|
490
|
+
matrix over the region (bins of ``span / n``).
|
|
490
491
|
"""
|
|
491
492
|
return _figure_layer(self, "hic", (reader,), 1, {}, settings)
|
|
492
493
|
|
|
@@ -495,9 +496,10 @@ class FigureMixin(Settings):
|
|
|
495
496
|
to anchor centre in a lane of its own, or, ``lane="over"`` a Hi-C triangle or
|
|
496
497
|
square, a mark at each pair's contact cell (on a square, and at its mirror).
|
|
497
498
|
``pairs`` is a reader whose ``read_entries`` gives the BEDPE columns, a path
|
|
498
|
-
gwseq_io reads them from, or
|
|
499
|
-
a dict of columns, a DataFrame, or rows in
|
|
500
|
-
``end1``, ``chr2``, ``start2``, ``end2``, then
|
|
499
|
+
gwseq_io reads them from (a BEDPE file, or a table of pairs), or plain data (the
|
|
500
|
+
pairs with an anchor in view are read): a dict of columns, a DataFrame, or rows in
|
|
501
|
+
BEDPE order (``chr1``, ``start1``, ``end1``, ``chr2``, ``start2``, ``end2``, then
|
|
502
|
+
optionally ``name``, ``score``).
|
|
501
503
|
"""
|
|
502
504
|
return _figure_layer(self, "links", (pairs,), 1, {}, settings)
|
|
503
505
|
|
|
@@ -975,12 +977,12 @@ class PlotMixin(Settings):
|
|
|
975
977
|
def bigwig(self, reader: Any = None, *, x: Any = None, y: Any = None,
|
|
976
978
|
**settings: Unpack[t.BigWigSettings]) -> BigWig:
|
|
977
979
|
"""A binned signal over the region: a step line along the bins, filled to a baseline.
|
|
978
|
-
``reader`` is a signal reader (bigWig; bigBed, BED and
|
|
979
|
-
:func:`~plot_io.genome.combine.combine` of two), a path
|
|
980
|
-
``chr``, ``start``, ``end``, ``value`` records (columns, a
|
|
981
|
-
by plot_io), a function ``f(chr, start, end, bins)``
|
|
982
|
-
``y`` (values over the region) and optionally ``x``
|
|
983
|
-
bp).
|
|
980
|
+
``reader`` is a signal reader (bigWig, bedGraph, WIG; BAM, CRAM, bigBed, BED and
|
|
981
|
+
peaks give their coverage; :func:`~plot_io.genome.combine.combine` of two), a path
|
|
982
|
+
(opened with gwseq_io), ``chr``, ``start``, ``end``, ``value`` records (columns, a
|
|
983
|
+
DataFrame or rows; binned by plot_io), a function ``f(chr, start, end, bins)``
|
|
984
|
+
giving values, or ``None`` with ``y`` (values over the region) and optionally ``x``
|
|
985
|
+
(bin centres, or n + 1 edges, in bp).
|
|
984
986
|
"""
|
|
985
987
|
return _plot_layer(self, "bigwig", (reader,), 0, {"x": x, "y": y}, settings)
|
|
986
988
|
|
|
@@ -1007,8 +1009,9 @@ class PlotMixin(Settings):
|
|
|
1007
1009
|
def hic(self, reader: Any, **settings: Unpack[t.HiCSettings]) -> HiC:
|
|
1008
1010
|
"""The upper triangle of a contact matrix, the diagonal along the x axis (each cell a
|
|
1009
1011
|
diamond), or with ``shape="square"`` the whole matrix of ``region`` (x) against
|
|
1010
|
-
``region2`` (y, its start at the top). ``reader`` is a Hi-C reader
|
|
1011
|
-
with gwseq_io), or a square matrix over the
|
|
1012
|
+
``region2`` (y, its start at the top). ``reader`` is a Hi-C reader (``.hic``,
|
|
1013
|
+
``.cool``, ``.mcool``), a path (opened with gwseq_io), or a square matrix over the
|
|
1014
|
+
region (bins of ``span / n``).
|
|
1012
1015
|
"""
|
|
1013
1016
|
return _plot_layer(self, "hic", (reader,), 1, {}, settings)
|
|
1014
1017
|
|
|
@@ -1016,10 +1019,10 @@ class PlotMixin(Settings):
|
|
|
1016
1019
|
"""Links between pairs of places (BEDPE): an arc from anchor centre to anchor centre in
|
|
1017
1020
|
a lane of its own, or, ``lane="over"`` a Hi-C triangle or square, a mark at each
|
|
1018
1021
|
pair's contact cell (on a square, and at its mirror). ``pairs`` is a reader whose
|
|
1019
|
-
``read_entries`` gives the BEDPE columns, a path gwseq_io reads them from
|
|
1020
|
-
data (the pairs with an anchor in view are
|
|
1021
|
-
rows in BEDPE order (``chr1``, ``start1``,
|
|
1022
|
-
then optionally ``name``, ``score``).
|
|
1022
|
+
``read_entries`` gives the BEDPE columns, a path gwseq_io reads them from (a BEDPE
|
|
1023
|
+
file, or a table of pairs), or plain data (the pairs with an anchor in view are
|
|
1024
|
+
read): a dict of columns, a DataFrame, or rows in BEDPE order (``chr1``, ``start1``,
|
|
1025
|
+
``end1``, ``chr2``, ``start2``, ``end2``, then optionally ``name``, ``score``).
|
|
1023
1026
|
"""
|
|
1024
1027
|
return _plot_layer(self, "links", (pairs,), 1, {}, settings)
|
|
1025
1028
|
|
|
@@ -1551,12 +1554,12 @@ class PanelSetMixin(object):
|
|
|
1551
1554
|
def bigwig(self, reader: Any = None, *, x: Any = None, y: Any = None,
|
|
1552
1555
|
**settings: Unpack[t.BigWigSettings]) -> LayerSet:
|
|
1553
1556
|
"""One per panel: A binned signal over the region: a step line along the bins, filled
|
|
1554
|
-
to a baseline. ``reader`` is a signal reader (bigWig
|
|
1555
|
-
their coverage; :func:`~plot_io.genome.combine.combine`
|
|
1556
|
-
gwseq_io), ``chr``, ``start``, ``end``, ``value``
|
|
1557
|
-
rows; binned by plot_io), a function ``f(chr,
|
|
1558
|
-
``None`` with ``y`` (values over the region)
|
|
1559
|
-
+ 1 edges, in bp).
|
|
1557
|
+
to a baseline. ``reader`` is a signal reader (bigWig, bedGraph, WIG; BAM, CRAM,
|
|
1558
|
+
bigBed, BED and peaks give their coverage; :func:`~plot_io.genome.combine.combine`
|
|
1559
|
+
of two), a path (opened with gwseq_io), ``chr``, ``start``, ``end``, ``value``
|
|
1560
|
+
records (columns, a DataFrame or rows; binned by plot_io), a function ``f(chr,
|
|
1561
|
+
start, end, bins)`` giving values, or ``None`` with ``y`` (values over the region)
|
|
1562
|
+
and optionally ``x`` (bin centres, or n + 1 edges, in bp).
|
|
1560
1563
|
"""
|
|
1561
1564
|
return _panelset_layer(self, "bigwig", (reader,), 0, {"x": x, "y": y}, settings)
|
|
1562
1565
|
|
|
@@ -1585,8 +1588,9 @@ class PanelSetMixin(object):
|
|
|
1585
1588
|
def hic(self, reader: Any, **settings: Unpack[t.HiCSettings]) -> LayerSet:
|
|
1586
1589
|
"""One per panel: The upper triangle of a contact matrix, the diagonal along the x axis
|
|
1587
1590
|
(each cell a diamond), or with ``shape="square"`` the whole matrix of ``region`` (x)
|
|
1588
|
-
against ``region2`` (y, its start at the top). ``reader`` is a Hi-C reader
|
|
1589
|
-
(opened with gwseq_io), or a square matrix
|
|
1591
|
+
against ``region2`` (y, its start at the top). ``reader`` is a Hi-C reader
|
|
1592
|
+
(``.hic``, ``.cool``, ``.mcool``), a path (opened with gwseq_io), or a square matrix
|
|
1593
|
+
over the region (bins of ``span / n``).
|
|
1590
1594
|
"""
|
|
1591
1595
|
return _panelset_layer(self, "hic", (reader,), 1, {}, settings)
|
|
1592
1596
|
|
|
@@ -1595,9 +1599,10 @@ class PanelSetMixin(object):
|
|
|
1595
1599
|
anchor centre in a lane of its own, or, ``lane="over"`` a Hi-C triangle or square, a
|
|
1596
1600
|
mark at each pair's contact cell (on a square, and at its mirror). ``pairs`` is a
|
|
1597
1601
|
reader whose ``read_entries`` gives the BEDPE columns, a path gwseq_io reads them
|
|
1598
|
-
from, or plain data (the pairs with an anchor in
|
|
1599
|
-
a DataFrame, or rows in BEDPE order (``chr1``,
|
|
1600
|
-
``start2``, ``end2``, then optionally ``name``,
|
|
1602
|
+
from (a BEDPE file, or a table of pairs), or plain data (the pairs with an anchor in
|
|
1603
|
+
view are read): a dict of columns, a DataFrame, or rows in BEDPE order (``chr1``,
|
|
1604
|
+
``start1``, ``end1``, ``chr2``, ``start2``, ``end2``, then optionally ``name``,
|
|
1605
|
+
``score``).
|
|
1601
1606
|
"""
|
|
1602
1607
|
return _panelset_layer(self, "links", (pairs,), 1, {}, settings)
|
|
1603
1608
|
|
|
@@ -3,8 +3,8 @@ memory. Each meets its protocol (:mod:`plot_io.genome.readers`).
|
|
|
3
3
|
|
|
4
4
|
* paths: ``.bed`` (``.bed12``, …), ``.narrowPeak``, ``.broadPeak`` (gzipped too) through
|
|
5
5
|
``gwseq_io.open_bed``; ``.tsv``, ``.csv``, ``.xlsx`` through ``gwseq_io.open_peaks``;
|
|
6
|
-
anything else
|
|
7
|
-
|
|
6
|
+
anything else (bigWig, bedGraph, WIG, BAM, CRAM, bigBed, BEDPE, GTF, GFF3, ``.hic``,
|
|
7
|
+
``.cool``, ``.mcool``) through ``gwseq_io.open``, which tells the format by its bytes;
|
|
8
8
|
* :class:`Intervals`: BED columns (a gene table: BED12);
|
|
9
9
|
* :class:`Pairs`: BEDPE columns, the pairs with an anchor in the region;
|
|
10
10
|
* :class:`Signal`: ``chr``, ``start``, ``end``, ``value`` records, binned here;
|
|
@@ -23,19 +23,11 @@ from typing import Any
|
|
|
23
23
|
|
|
24
24
|
from . import sources
|
|
25
25
|
|
|
26
|
-
__all__ = ["
|
|
26
|
+
__all__ = ["open_path", "close", "Deferred", "from_data", "Intervals", "Pairs",
|
|
27
27
|
"Signal", "Matrix", "REDUCTIONS"]
|
|
28
28
|
|
|
29
29
|
_BED = re.compile(r"\.(bed\d*|narrowpeak|broadpeak)(\.b?gz)?$", re.IGNORECASE)
|
|
30
30
|
_PEAKS = re.compile(r"\.(tsv|csv|xlsx)$", re.IGNORECASE)
|
|
31
|
-
#: Formats gwseq_io has no reader for, by suffix: their name and what to do instead.
|
|
32
|
-
_UNREAD = {
|
|
33
|
-
"bedgraph": ("bedGraph", "convert it to a bigWig (gwseq_io.convert_to_bigwig) or pass "
|
|
34
|
-
"its chr, start, end, value columns"),
|
|
35
|
-
"bdg": ("bedGraph", "convert it to a bigWig (gwseq_io.convert_to_bigwig) or pass its "
|
|
36
|
-
"chr, start, end, value columns"),
|
|
37
|
-
"bedpe": ("BEDPE", "pass its columns (chr1, start1, end1, chr2, start2, end2) as data"),
|
|
38
|
-
}
|
|
39
31
|
|
|
40
32
|
|
|
41
33
|
def _gwseq_io(path: str, what: str) -> Any:
|
|
@@ -46,23 +38,8 @@ def _gwseq_io(path: str, what: str) -> Any:
|
|
|
46
38
|
f"installed; or pass an open reader or plain data") from None
|
|
47
39
|
|
|
48
40
|
|
|
49
|
-
def check_path(path: Any, what: str) -> None:
|
|
50
|
-
"""Refuse a path of a format gwseq_io has no reader for (by its suffix)."""
|
|
51
|
-
p = os.fsdecode(path)
|
|
52
|
-
name = p.lower()
|
|
53
|
-
for ext in (".gz", ".bgz"):
|
|
54
|
-
if name.endswith(ext):
|
|
55
|
-
name = name[:-len(ext)]
|
|
56
|
-
suffix = name.rsplit(".", 1)[-1] if "." in os.path.basename(name) else ""
|
|
57
|
-
if suffix in _UNREAD:
|
|
58
|
-
fmt, instead = _UNREAD[suffix]
|
|
59
|
-
raise TypeError(f"{what}: gwseq_io, which plot_io reads files with, has no {fmt} "
|
|
60
|
-
f"reader ({p!r}): {instead}")
|
|
61
|
-
|
|
62
|
-
|
|
63
41
|
def open_path(path: Any, what: str) -> Any:
|
|
64
42
|
"""The gwseq_io reader of the file at ``path`` (see the module)."""
|
|
65
|
-
check_path(path, what)
|
|
66
43
|
p = os.fsdecode(path)
|
|
67
44
|
g = _gwseq_io(p, what)
|
|
68
45
|
if _BED.search(p):
|
|
@@ -204,8 +181,7 @@ _SIGNAL_KEYS = {"chr": ("chr", "chrom", "chromosome", "seqname"),
|
|
|
204
181
|
|
|
205
182
|
|
|
206
183
|
def _signal_columns(data: Any, what: str) -> dict[str, list]:
|
|
207
|
-
|
|
208
|
-
data = {str(c): list(data[c]) for c in data.columns}
|
|
184
|
+
data = sources.table_columns(data) # a gwseq_io table, a DataFrame
|
|
209
185
|
if isinstance(data, Mapping):
|
|
210
186
|
low = {str(k).lower(): v for k, v in data.items()}
|
|
211
187
|
cols = {}
|
|
@@ -74,8 +74,8 @@ def _oe_limits(s: "HiC") -> Any:
|
|
|
74
74
|
class HiC(GenomeSeries):
|
|
75
75
|
"""The upper triangle of a contact matrix, the diagonal along the x axis (each cell a
|
|
76
76
|
diamond), or with ``shape="square"`` the whole matrix of ``region`` (x) against
|
|
77
|
-
``region2`` (y, its start at the top). ``reader`` is a Hi-C reader
|
|
78
|
-
with gwseq_io), or a square matrix over the region (bins of ``span / n``).
|
|
77
|
+
``region2`` (y, its start at the top). ``reader`` is a Hi-C reader (``.hic``,
|
|
78
|
+
``.cool``, ``.mcool``), a path (opened with gwseq_io), or a square matrix over the region (bins of ``span / n``).
|
|
79
79
|
|
|
80
80
|
On the triangle, the matrix is drawn as an image under a 45° transform and clipped to
|
|
81
81
|
the track. Readers and paths: see `readers <docs/api.md#readers>`_. ``bins="0.5px"`` takes the finest of the
|
|
@@ -41,7 +41,7 @@ class Links(LinksMixin, GenomeSeries):
|
|
|
41
41
|
"""Links between pairs of places (BEDPE): an arc from anchor centre to anchor centre
|
|
42
42
|
in a lane of its own, or, ``lane="over"`` a Hi-C triangle or square, a mark at each
|
|
43
43
|
pair's contact cell (on a square, and at its mirror). ``pairs`` is a reader whose ``read_entries`` gives the BEDPE columns, a
|
|
44
|
-
path gwseq_io reads them from, or plain data (the pairs with an anchor in view are
|
|
44
|
+
path gwseq_io reads them from (a BEDPE file, or a table of pairs), or plain data (the pairs with an anchor in view are
|
|
45
45
|
read): a dict of columns, a DataFrame, or rows in BEDPE order (``chr1``,
|
|
46
46
|
``start1``, ``end1``, ``chr2``, ``start2``, ``end2``, then optionally ``name``,
|
|
47
47
|
``score``).
|
|
@@ -105,8 +105,8 @@ class Links(LinksMixin, GenomeSeries):
|
|
|
105
105
|
return segments_of(self.plot)
|
|
106
106
|
|
|
107
107
|
def pairs(self) -> dict[str, list[Any]]:
|
|
108
|
-
"""The BEDPE columns of the pairs read for the region (
|
|
109
|
-
|
|
108
|
+
"""The BEDPE columns of the pairs read for the region (over several regions, an
|
|
109
|
+
axis' or a square's two, each pair once)."""
|
|
110
110
|
segs = self._segments()
|
|
111
111
|
regions = tuple(g.region for g in segs) if segs is not None else (self.region(),)
|
|
112
112
|
if segs is None:
|
|
@@ -114,8 +114,6 @@ class Links(LinksMixin, GenomeSeries):
|
|
|
114
114
|
hic = under_hic(self)
|
|
115
115
|
if hic is not None and hic.square() and hic.region2() != regions[0]:
|
|
116
116
|
regions += (hic.region2(),) # the pairs with an anchor on y
|
|
117
|
-
return self.cached(regions, lambda: self._guard(
|
|
118
|
-
lambda: sources.read_pairs(self.reader, regions)), kind="pairs")
|
|
119
117
|
if len(regions) == 1:
|
|
120
118
|
return self.cached(regions, lambda: self._guard(
|
|
121
119
|
lambda: sources.read_pairs(self.reader, regions)), kind="pairs")
|
|
@@ -28,7 +28,8 @@ Region3 = tuple[str, int, int]
|
|
|
28
28
|
|
|
29
29
|
@runtime_checkable
|
|
30
30
|
class SignalReader(Protocol):
|
|
31
|
-
"""Values binned over regions (bigWig; the coverage of
|
|
31
|
+
"""Values binned over regions (bigWig, bedGraph, WIG; the coverage of BAM, CRAM,
|
|
32
|
+
bigBed, BED and peaks)."""
|
|
32
33
|
|
|
33
34
|
def read_values(self, regions: Sequence[Region3], *, bin_count: int | None = ...,
|
|
34
35
|
bin_size: int | None = ..., bin_mode: str = ..., def_value: float = ...,
|
|
@@ -72,7 +73,7 @@ class AnnotationReader(Protocol):
|
|
|
72
73
|
|
|
73
74
|
@runtime_checkable
|
|
74
75
|
class PairReader(Protocol):
|
|
75
|
-
"""Pairs of places (BEDPE), for links."""
|
|
76
|
+
"""Pairs of places (BEDPE; a peaks table of pairs), for links."""
|
|
76
77
|
|
|
77
78
|
def read_entries(self, regions: Sequence[Region3]) -> Any:
|
|
78
79
|
"""A mapping of the BEDPE columns (``chr1``, ``start1``, ``end1``, ``chr2``,
|
|
@@ -84,7 +85,7 @@ class PairReader(Protocol):
|
|
|
84
85
|
|
|
85
86
|
@runtime_checkable
|
|
86
87
|
class ContactReader(Protocol):
|
|
87
|
-
"""A contact matrix (
|
|
88
|
+
"""A contact matrix (``.hic``, ``.cool``, ``.mcool``)."""
|
|
88
89
|
|
|
89
90
|
bin_sizes: Sequence[int]
|
|
90
91
|
normalizations: Sequence[str]
|
|
@@ -111,8 +112,8 @@ class Resolving(Protocol):
|
|
|
111
112
|
|
|
112
113
|
def resolve_regions(self, regions: Any, *more: Any, **kw: Any) -> Any:
|
|
113
114
|
"""With the arguments of the read: the ``start`` and ``end`` columns of the rows it
|
|
114
|
-
gives (a contact reader:
|
|
115
|
-
``
|
|
115
|
+
gives (a contact reader: one BEDPE row, ``start1`` and ``end1`` of the matrix's
|
|
116
|
+
rows, ``start2`` and ``end2`` of its columns)."""
|
|
116
117
|
...
|
|
117
118
|
|
|
118
119
|
|
|
@@ -125,7 +126,7 @@ class Sized(Protocol):
|
|
|
125
126
|
|
|
126
127
|
#: The reader kinds each data role takes (:func:`~plot_io.genome.sources.kind_of`).
|
|
127
128
|
WANTS = {"signal": ("signal", "intervals"), "intervals": ("intervals",),
|
|
128
|
-
"annotation": ("annotation",), "pairs": ("intervals"
|
|
129
|
+
"annotation": ("annotation",), "pairs": ("pairs", "intervals"), "contacts": ("contacts",)}
|
|
129
130
|
|
|
130
131
|
|
|
131
132
|
def adapt(value: Any, want: str, what: str, owner: Any = None) -> Any:
|
|
@@ -137,7 +138,6 @@ def adapt(value: Any, want: str, what: str, owner: Any = None) -> Any:
|
|
|
137
138
|
(an interval table for ``annotation``: BED12 models)."""
|
|
138
139
|
from . import adapters
|
|
139
140
|
if isinstance(value, (str, bytes)) or hasattr(value, "__fspath__"):
|
|
140
|
-
adapters.check_path(value, what)
|
|
141
141
|
return adapters.Deferred(value, WANTS[want], what, owner)
|
|
142
142
|
if sources.kind_of(value) is not None:
|
|
143
143
|
sources.check_reader(value, WANTS[want], what)
|
|
@@ -83,7 +83,8 @@ def _fill_to(v: Any) -> Any:
|
|
|
83
83
|
|
|
84
84
|
class BigWig(GenomeSeries):
|
|
85
85
|
"""A binned signal over the region: a step line along the bins, filled to a baseline.
|
|
86
|
-
``reader`` is a signal reader (bigWig; bigBed, BED and
|
|
86
|
+
``reader`` is a signal reader (bigWig, bedGraph, WIG; BAM, CRAM, bigBed, BED and
|
|
87
|
+
peaks give their coverage;
|
|
87
88
|
:func:`~plot_io.genome.combine.combine` of two), a path (opened with gwseq_io),
|
|
88
89
|
``chr``, ``start``, ``end``, ``value`` records (columns, a DataFrame or rows; binned
|
|
89
90
|
by plot_io), a function ``f(chr, start, end, bins)`` giving values, or ``None`` with
|
|
@@ -100,10 +100,9 @@ def _window_settings() -> dict[str, Setting]:
|
|
|
100
100
|
# ---------------------------------------------------------------------------
|
|
101
101
|
|
|
102
102
|
def _columns(value: Any, what: str, owner: Any) -> dict[str, list[Any]]:
|
|
103
|
-
"""The columns of a sites table: a mapping of columns, a
|
|
104
|
-
or tuples in BED order), an interval reader or a path (every entry)."""
|
|
105
|
-
|
|
106
|
-
return {str(c): list(value[c]) for c in value.columns}
|
|
103
|
+
"""The columns of a sites table: a mapping of columns, a gwseq_io table, a DataFrame,
|
|
104
|
+
rows (mappings, or tuples in BED order), an interval reader or a path (every entry)."""
|
|
105
|
+
value = sources.table_columns(value)
|
|
107
106
|
if isinstance(value, Mapping):
|
|
108
107
|
return {str(k): list(v.tolist() if hasattr(v, "tolist") else v)
|
|
109
108
|
for k, v in value.items()}
|
|
@@ -115,7 +114,7 @@ def _columns(value: Any, what: str, owner: Any) -> dict[str, list[Any]]:
|
|
|
115
114
|
raise ValueError(f"{what}: an interval reader as sites needs its chr_sizes "
|
|
116
115
|
f"(to read every entry); pass a table")
|
|
117
116
|
got = reader.read_entries([(str(c), 0, int(n)) for c, n in sizes.items()])
|
|
118
|
-
return _columns(
|
|
117
|
+
return _columns(got, what, owner)
|
|
119
118
|
rows = list(value)
|
|
120
119
|
if rows and isinstance(rows[0], Mapping):
|
|
121
120
|
return {str(k): [r[k] for r in rows] for k in rows[0]}
|
|
@@ -18,8 +18,8 @@ from .. import kernels
|
|
|
18
18
|
from .regions import Region
|
|
19
19
|
|
|
20
20
|
__all__ = ["kind_of", "check_reader", "read_signal", "read_entries", "read_models",
|
|
21
|
-
"read_contacts", "bin_size_for", "entry_columns", "
|
|
22
|
-
"BED_COLUMNS", "BEDPE_COLUMNS"]
|
|
21
|
+
"read_contacts", "bin_size_for", "entry_columns", "table_columns", "pair_columns",
|
|
22
|
+
"read_pairs", "even_edges", "matrix", "ints", "BED_COLUMNS", "BEDPE_COLUMNS"]
|
|
23
23
|
|
|
24
24
|
#: The BED columns the interval tracks use, by their names in autoSql and in BED files.
|
|
25
25
|
BED_COLUMNS = ("chr", "start", "end", "name", "score", "strand", "thickStart", "thickEnd",
|
|
@@ -29,9 +29,10 @@ BEDPE_COLUMNS = ("chr1", "start1", "end1", "chr2", "start2", "end2", "name", "sc
|
|
|
29
29
|
_PAIR_ALIASES = {"chrom1": "chr1", "chromosome1": "chr1", "chr": "chr1", "chrom": "chr1",
|
|
30
30
|
"chromosome": "chr1", "start": "start1", "end": "end1", "chrom2": "chr2",
|
|
31
31
|
"chromosome2": "chr2"}
|
|
32
|
-
_TYPES = {"bigwig": "signal", "
|
|
33
|
-
"
|
|
34
|
-
"
|
|
32
|
+
_TYPES = {"bigwig": "signal", "bedgraph": "signal", "wig": "signal", "bam": "signal",
|
|
33
|
+
"cram": "signal", "bigbed": "intervals", "bed": "intervals", "peaks": "intervals",
|
|
34
|
+
"bedpe": "pairs", "hic": "contacts", "cool": "contacts", "mcool": "contacts",
|
|
35
|
+
"gtf": "annotation", "gff3": "annotation"}
|
|
35
36
|
_ALIASES = {"chrom": "chr", "chromosome": "chr", "chromStart": "start", "chromEnd": "end",
|
|
36
37
|
"chrom_start": "start", "chrom_end": "end", "reserved": "itemRgb",
|
|
37
38
|
"item_rgb": "itemRgb",
|
|
@@ -43,8 +44,9 @@ _ALIASES = {"chrom": "chr", "chromosome": "chr", "chromStart": "start", "chromEn
|
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
def kind_of(reader: Any) -> str | None:
|
|
46
|
-
"""``"signal"``, ``"intervals"``, ``"annotation"``, ``"
|
|
47
|
-
``None`` (not a reader).
|
|
47
|
+
"""``"signal"``, ``"intervals"``, ``"annotation"``, ``"pairs"``, ``"contacts"`` or
|
|
48
|
+
``None`` (not a reader). A reader without a known ``type`` is told by its members, and
|
|
49
|
+
never as ``"pairs"`` (an interval reader serves pairs too)."""
|
|
48
50
|
t = getattr(reader, "type", None)
|
|
49
51
|
if isinstance(t, str) and t.lower() in _TYPES:
|
|
50
52
|
return _TYPES[t.lower()]
|
|
@@ -56,26 +58,23 @@ def kind_of(reader: Any) -> str | None:
|
|
|
56
58
|
return "intervals"
|
|
57
59
|
if hasattr(reader, "read_values"):
|
|
58
60
|
return "signal"
|
|
59
|
-
if hasattr(reader, "read_alignments"):
|
|
60
|
-
return "alignments"
|
|
61
61
|
return None
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
def check_reader(reader: Any, want: tuple[str, ...], what: str) -> str:
|
|
65
65
|
"""The kind of ``reader``, which must be one of ``want``."""
|
|
66
66
|
kind = kind_of(reader)
|
|
67
|
-
if kind == "alignments":
|
|
68
|
-
raise TypeError(f"{what} does not read alignments: pile the reads up into a bigWig "
|
|
69
|
-
f"first (gwseq_io.pileup_reads)")
|
|
70
67
|
if kind == "annotation" and kind not in want:
|
|
71
68
|
raise TypeError(f"{what} does not read gene annotations: draw a GTF or GFF3 reader "
|
|
72
69
|
f"with gtf()")
|
|
73
70
|
if kind not in want:
|
|
74
71
|
raise TypeError(f"{what} needs a reader with "
|
|
75
|
-
+ {"signal": "read_values (a bigWig)",
|
|
72
|
+
+ {"signal": "read_values (a bigWig, bedGraph, WIG, BAM or CRAM)",
|
|
76
73
|
"intervals": "read_entries (a bigBed, BED or peaks file)",
|
|
77
74
|
"annotation": "read_entries(model=) and tss (a GTF or GFF3 file)",
|
|
78
|
-
"
|
|
75
|
+
"pairs": "read_entries giving BEDPE columns (a BEDPE file)",
|
|
76
|
+
"contacts": "bin_sizes and read_values (a Hi-C file: "
|
|
77
|
+
".hic, .cool or .mcool)"}[want[0]]
|
|
79
78
|
+ f", got {type(reader).__name__}")
|
|
80
79
|
return kind
|
|
81
80
|
|
|
@@ -96,11 +95,13 @@ def _first(v: Any) -> Any:
|
|
|
96
95
|
|
|
97
96
|
|
|
98
97
|
def _bounds(reader: Any, region: Region, kw: dict[str, Any], hic: bool) -> tuple[int, int]:
|
|
99
|
-
"""The start and end of the row a binned read gives, from ``resolve_regions
|
|
98
|
+
"""The start and end of the row a binned read gives, from ``resolve_regions`` (a
|
|
99
|
+
contact reader's: its rows, ``start1`` and ``end1``)."""
|
|
100
100
|
target = (region.chr, region.start, region.end)
|
|
101
|
-
r = reader.resolve_regions(target if hic else [target], **kw)
|
|
102
101
|
if hic:
|
|
103
|
-
r =
|
|
102
|
+
r = reader.resolve_regions(target, **kw)
|
|
103
|
+
return int(r["start1"][0]), int(r["end1"][0])
|
|
104
|
+
r = reader.resolve_regions([target], **kw)
|
|
104
105
|
return int(r["start"][0]), int(r["end"][0])
|
|
105
106
|
|
|
106
107
|
|
|
@@ -196,15 +197,31 @@ def _score(v: Any) -> float | None:
|
|
|
196
197
|
return f if math.isfinite(f) else None
|
|
197
198
|
|
|
198
199
|
|
|
200
|
+
def _list(v: Any) -> list[Any]:
|
|
201
|
+
"""A column as a list (``tolist`` when it has one: masked values become ``None``)."""
|
|
202
|
+
return list(v.tolist() if hasattr(v, "tolist") else v)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def table_columns(cols: Any) -> Any:
|
|
206
|
+
"""A dict of lists of a gwseq_io ``Table`` (``columns``, ``nested``) or a DataFrame;
|
|
207
|
+
anything else as given."""
|
|
208
|
+
if isinstance(cols, Mapping):
|
|
209
|
+
return cols
|
|
210
|
+
if hasattr(cols, "columns") and hasattr(cols, "nested"): # a gwseq_io Table
|
|
211
|
+
return {str(c): _list(cols[c]) for c in cols.columns}
|
|
212
|
+
if hasattr(cols, "to_dict") and hasattr(cols, "columns"): # a DataFrame
|
|
213
|
+
return {str(c): list(cols[c]) for c in cols.columns}
|
|
214
|
+
return cols
|
|
215
|
+
|
|
216
|
+
|
|
199
217
|
def entry_columns(cols: Any) -> dict[str, list[Any]]:
|
|
200
|
-
"""The BED columns of a dict of columns, a DataFrame, or rows (dicts, or tuples in BED
|
|
218
|
+
"""The BED columns of a dict of columns, a gwseq_io table, a DataFrame, or rows (dicts, or tuples in BED
|
|
201
219
|
order, ``chr`` first): ``chr`` as strings, ``start`` and ``end`` as ints, ``score`` as
|
|
202
220
|
numbers (``None`` where missing or not a number), ``blockSizes`` and ``blockStarts`` as
|
|
203
221
|
lists of ints, the others as given (missing ones left out). Reversed intervals and
|
|
204
222
|
blocks not matching ``blockCount`` (or several blocks without ``blockStarts``) are refused."""
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
elif not isinstance(cols, Mapping):
|
|
223
|
+
cols = table_columns(cols)
|
|
224
|
+
if not isinstance(cols, Mapping):
|
|
208
225
|
rows = list(cols)
|
|
209
226
|
if not rows:
|
|
210
227
|
return {"start": [], "end": []}
|
|
@@ -221,7 +238,7 @@ def entry_columns(cols: Any) -> dict[str, list[Any]]:
|
|
|
221
238
|
v = _column(cols, name)
|
|
222
239
|
if v is None:
|
|
223
240
|
continue
|
|
224
|
-
out[name] =
|
|
241
|
+
out[name] = _list(v)
|
|
225
242
|
if "start" not in out or "end" not in out:
|
|
226
243
|
raise ValueError("intervals need start and end columns")
|
|
227
244
|
if len(out["start"]) != len(out["end"]):
|
|
@@ -266,13 +283,13 @@ def read_entries(reader: Any, region: Region) -> dict[str, list[Any]]:
|
|
|
266
283
|
|
|
267
284
|
|
|
268
285
|
def pair_columns(cols: Any) -> dict[str, list[Any]]:
|
|
269
|
-
"""The BEDPE columns of a dict of columns, a DataFrame, or rows (dicts, or tuples in
|
|
286
|
+
"""The BEDPE columns of a dict of columns, a gwseq_io table, a DataFrame, or rows (dicts, or tuples in
|
|
270
287
|
BEDPE order): chromosomes as strings, positions as ints, ``score`` as numbers
|
|
271
288
|
(``None`` where missing); ``name`` and ``score`` optional. Strand columns are left
|
|
272
|
-
out
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
289
|
+
out, and so are the pairs with an anchor without a place (a BEDPE ``.`` anchor: no
|
|
290
|
+
chromosome or position). Reversed anchors are refused."""
|
|
291
|
+
cols = table_columns(cols)
|
|
292
|
+
if not isinstance(cols, Mapping):
|
|
276
293
|
rows = list(cols)
|
|
277
294
|
if not rows:
|
|
278
295
|
return {k: [] for k in BEDPE_COLUMNS[:6]}
|
|
@@ -295,10 +312,14 @@ def pair_columns(cols: Any) -> dict[str, list[Any]]:
|
|
|
295
312
|
missing = [k for k in BEDPE_COLUMNS[:6] if k not in named]
|
|
296
313
|
if missing:
|
|
297
314
|
raise ValueError(f"links need the BEDPE columns {', '.join(missing)}")
|
|
298
|
-
out = {k:
|
|
315
|
+
out = {k: _list(v) for k, v in named.items()}
|
|
299
316
|
n = len(out["start1"])
|
|
300
317
|
if any(len(v) != n for v in out.values()):
|
|
301
318
|
raise ValueError("the BEDPE columns have different lengths")
|
|
319
|
+
keep = [i for i in range(n) if all(out[k][i] is not None for k in BEDPE_COLUMNS[:6])]
|
|
320
|
+
if len(keep) < n:
|
|
321
|
+
out = {k: [v[i] for i in keep] for k, v in out.items()}
|
|
322
|
+
n = len(keep)
|
|
302
323
|
for k in ("chr1", "chr2"):
|
|
303
324
|
out[k] = [str(c) for c in out[k]]
|
|
304
325
|
for k in ("start1", "end1", "start2", "end2"):
|
|
@@ -333,10 +354,11 @@ def read_models(reader: Any, region: Region, model: str, gene_type: Any,
|
|
|
333
354
|
exons = cols.nested["exons"]
|
|
334
355
|
ex0, ex1 = ints(exons["start"]), ints(exons["end"])
|
|
335
356
|
offs = ints(exons.groups)
|
|
336
|
-
strands =
|
|
357
|
+
strands = _list(cols["strand"])
|
|
337
358
|
level = "transcript" if model == "transcript" else "gene"
|
|
338
|
-
ids =
|
|
339
|
-
|
|
359
|
+
ids = _list(cols[f"{level}_id"])
|
|
360
|
+
got = cols.get(f"{level}_name")
|
|
361
|
+
names = [None] * len(ids) if got is None else _list(got)
|
|
340
362
|
models: dict[Any, dict[str, Any]] = {}
|
|
341
363
|
for i, key in enumerate(ids):
|
|
342
364
|
m = models.setdefault(key, {"start": starts[i], "end": ends[i], "strand": strands[i],
|
|
@@ -437,7 +459,7 @@ def read_square(reader: Any, region: Region, region2: Region, bin_size: int | No
|
|
|
437
459
|
elif hasattr(reader, "resolve_regions"):
|
|
438
460
|
kw = {"bin_size": _bin_size(reader, bin_size), "snap_to_grid": "expand"}
|
|
439
461
|
r = reader.resolve_regions(t1, t2, **kw)
|
|
440
|
-
start, start2 = float(r["
|
|
462
|
+
start, start2 = float(r["start1"][0]), float(r["start2"][0])
|
|
441
463
|
else:
|
|
442
464
|
kw = {"bin_size": _bin_size(reader, bin_size), "snap_to_grid": False,
|
|
443
465
|
"full_bin": True}
|