S4ExpandRange: Range expansion

Description Usage Arguments Details Value Examples

Description

Expand a range with multiplicative and additive constants

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
S4ExpandRange(limits, expand = expansion())

## S4 method for signature ''NULL''
S4ExpandRange(limits, expand = expansion())

## S4 method for signature 'numeric'
S4ExpandRange(limits, expand = expansion())

## S4 method for signature 'Ranges'
S4ExpandRange(limits, expand = expansion())

Arguments

limits

An object indicating a range

expand

A numeric vector of length 4, typically the result of a call to expansion.

Details

The expand argument consist of 4 constants that code for the following:

  1. A multiplicative constant relative to the width of the limits argument to subtract from the start of the limits.

  2. An additive constant to subtract from the start of the limits.

  3. A multiplicative constant relative to the width of the limits argument to add to the end of the limits.

  4. An additive constant to add to the end of the limits.

Integer-based classes such as IRanges and GRanges are rounded to the nearest integer.

Value

An object indicating a range

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Regular numeric limits
S4ExpandRange(c(10, 20), expansion(0.5, 1))

# IntegerRanges
require(IRanges)
S4ExpandRange(IRanges::IRanges(10, 20), expansion(0.5, 1))

# GenomicRanges
require(GenomicRanges)
S4ExpandRange(GenomicRanges::GRanges(c("chr1", "chr2"), c("10-20", "20-30")),
              expansion(0.5, 1))

teunbrand/ggnomics documentation built on Aug. 2, 2020, 7:34 p.m.