GenomicHilbertCurve: Initialize a Hilbert curve specifically for genomic data

Description Usage Arguments Details Value Author(s) Examples

View source: R/GenomicHilbertCurve.R

Description

Initialize a Hilbert curve specifically for genomic data

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

Example output

Loading required package: grid
Loading required package: IRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: circlize
Warning message:
In file.remove(chromInfo) :
  cannot remove file '/work/tmp/tmp/RtmpgQuE0T/hg19_chromInfo.txt.gz', reason 'No such file or directory'
Warning message:
In file.remove(chromInfo) :
  cannot remove file '/work/tmp/tmp/RtmpgQuE0T/hg19_chromInfo.txt.gz', reason 'No such file or directory'

HilbertCurve documentation built on Nov. 8, 2020, 8:05 p.m.