GenomicHilbertCurve: Initialize a Hilbert curve specifically for genomic data

View source: R/GenomicHilbertCurve.R

GenomicHilbertCurveR Documentation

Initialize a Hilbert curve specifically for genomic data

Description

Initialize a Hilbert curve specifically for genomic data

Usage

GenomicHilbertCurve(chr = paste0("chr", c(1:22, "X", "Y")), species = "hg19",
    background = NULL, ...)

Arguments

chr

a vector of chromosome names. Note it should have 'chr' prefix. This argument will be ignored when background is set.

species

abbreviation of species, e.g. 'hg19' or 'mm10'. read.chromInfo is used to retrieve the chromosome information.

background

the background can be provided as a GRanges object. Chromosomes should be unique across rows. Or more generally, the 'seqnames' should be different.

...

common arguments in HilbertCurve can be used here.

Details

Multiple chromosomes can be visualized in a same Hilbert curve. All chromosomes are concatenated on after the other based on the order which is specified.

Since chromosomes will have irregular shapes on the curve, under 'pixel' mode, users can set border option in hc_map,GenomicHilbertCurve-method to highlight borders of chromosomes to identify their locations on the curve.

Value

A GenomicHilbertCurve-class object

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

require(circlize)
require(GenomicRanges)
bed = generateRandomBed()
gr = GRanges(seqnames = bed[[1]], ranges = IRanges(bed[[2]], bed[[3]]))
hc = GenomicHilbertCurve()
hc_points(hc, gr)

hc = GenomicHilbertCurve(chr = c("chr1", "chr2"))
hc_points(hc, gr)

bg = GRanges(seqnames = c("chr1", "chr2"), 
    ranges = IRanges(c(1,10000000), c(10000000,20000000)))
hc = GenomicHilbertCurve(background = bg, level = 6)
hc_points(hc, gr, gp = gpar(fill = rand_color(length(gr))))
hc_map(hc, fill = NA, border = "grey", add = TRUE)

jokergoo/HilbertCurve documentation built on Oct. 11, 2024, 11:18 a.m.