getGRegionsStat2 {MethylIT.utils}R Documentation

Statistic of Genomic Regions

Description

A function to estimate the summarized measures of a specified variable given in a GRanges object (a column from the metacolums of the GRanges object) after split the GRanges object into intervals.

Usage

getGRegionsStat2(GR, win.size = 350, step.size = 350,
  grfeatures = NULL, stat = c("sum", "mean", "gmean", "median",
  "density", "count"), columns = NULL, absolute = FALSE,
  select.strand = NULL, maxgap = -1L, minoverlap = 0L,
  select = "all", ignore.strand = FALSE, type = c("any", "start",
  "end", "within", "equal"), scaling = 1000L, logbase = 2,
  missings = 0, naming = FALSE, na.rm = TRUE, verbose = TRUE, ...)

Arguments

GR

A GRange object carying the variables of interest in the GRanges metacolumn.

win.size

An integer for the size of the windows/regions size of the intervals of genomics regions.

step.size

Interval at which the regions/windows must be defined

grfeatures

A GRanges object corresponding to an annotated genomic feature. For example, gene region, transposable elements, exons, intergenic region, etc. If provided, then parameters 'win.size' and step.size are ignored and the statistics are estimated for 'grfeatures'.

stat

Statistic used to estimate the summarized value of the variable of interest in each interval/window. Posible options are: "mean", geometric mean ("gmean"), "median", "density", "count" and "sum" (default). Here, we define "density" as the sum of values from the variable of interest in the given region devided by the length/width of the region. The option 'count' compute the number/count of positions in the specified regions with values greater than zero in the selected 'column'.

absolute

Optional. Logic (default: FALSE). Whether to use the absolute values of the variable provided. For example, the difference of methylation levels could take negative values (TV) and we would be interested on the sum of abs(TV), which is sum of the total variation distance.

select.strand

Optional. If provided,"+" or "-", then the summarized statistic is computed only for the specified DNA chain.

maxgap, minoverlap, type

See ?findOverlaps in the IRanges package for a description of these arguments.

ignore.strand

When set to TRUE, the strand information is ignored in the overlap calculations.

scaling

integer (default 1). Scaling factor to be used when stat = "density". For example, if scaling = 1000, then density * scaling denotes the sum of values in 1000 bp.

logbase

A positive number: the base with respect to which logarithms are computed when parameter 'entropy = TRUE' (default: logbase = 2).

missings

Whether to write '0' or 'NA' on regions where there is not data to compute the statistic.

naming

Logical value. If TRUE, the rows GRanges object will be given the names(grfeatures). Default is FALSE.

na.rm

Logical value. If TRUE, the NA values will be removed.

verbose

Logical. Default is TRUE. If TRUE, then the progress of the computational tasks is given.

Details

This function split a Grange object into intervals genomic regions (GRs) of fixed size A summarized statistic (mean, median, geometric mean or sum) is calculated for the specified variable values from each region. Notice that if win.size == step.size, then non-overlapping windows are obtained.

Value

A GRanges object with the new genomic regions and their corresponding summarized statistic.

Author(s)

Robersy Sanchez

See Also

getGRegionsStat

Examples

library(GenomicRanges)
set.seed(1)
gr <- GRanges(seqnames = Rle( c("chr1", "chr2", "chr3", "chr4"),
            c(5, 5, 5, 5)),
            ranges = IRanges(start = 1:20, end = 1:20),
            strand = rep(c("+", "-"), 10),
            A = seq(1, 0, length = 20))
gr$B <- runif(20)
grs <- getGRegionsStat2(gr, win.size = 4, step.size = 4)
grs

## Selecting the positive strand
grs <- getGRegionsStat2(gr, win.size = 4, step.size = 4, select.strand = "+")
grs

## Selecting the negative strand
grs <- getGRegionsStat2(gr, win.size = 4, step.size = 4, select.strand = "-")
grs


[Package MethylIT.utils version 0.3.1 ]