hc_rect-HilbertCurve-method: Add rectangles on Hilbert curve

Description Usage Arguments Details Value Author(s) Examples

Description

Add rectangles on Hilbert curve

Usage

1
2
3
4
## S4 method for signature 'HilbertCurve'
hc_rect(object, ir = NULL, x1 = NULL, x2 = NULL,
    gp = gpar(fill = "red"),
    mean_mode = c("w0", "absolute", "weighted"))

Arguments

object

A HilbertCurve-class object.

ir

an IRanges object which specifies the input intervals.

x1

if start positions are not integers, they can be set by x1.

x2

if end positions are not integers, they can be set by x2.

gp

graphic parameters for rectangles. It should be specified by gpar. Note you cannot set linejoin and lineend.

mean_mode

when a segment in the curve can not be overlapped with intervals in ir, how to calculate the mean values for this segment. See explanation in hc_points,HilbertCurve-method.

Details

Rectangles are put if a segment in the Hilbert curve overlaps with the input intervals. You cannot set the width or height of the rectangles. It is always fixed (actually it is a square).

It can be thought as the low-resolution version of hc_layer,HilbertCurve-method.

Value

A data frame which contains coordinates (in the 2D space) of rectangles.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

1
2
3
4
5
6
7
8
hc = HilbertCurve(1, 100, level = 4, reference = TRUE)

x = sort(sample(100, 20))
s = x[1:10*2 - 1]
e = x[1:10*2]
require(IRanges)
ir = IRanges(s, e)
hc_rect(hc, ir)

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

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