gdReduce: Reduces arguments to a single GenomeData instance

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function accepts one or more objects that are reduced, with a user-specified function, to a single GenomeData instance.

Usage

1
gdReduce(f, ..., init, right = FALSE, accumulate = FALSE, gdArgs = list()) 

Arguments

f

An object of class "function", accepting two instances of classes appropriate for the ... arguments, and returning an object suitable for subsequent use in f and incorporation into GenomeData.

...

Objects to be reduced. All objects should be of the same class, as dictated by methods defined on gdReduce A function to be applied to each chromosome-level sub-element of X.

init

An R object of the same kind as the elements of ....

right

A logical indicating whether to proceed from left to right (default) or right to left.

accumulate

A logical indicating whether the successive reduce combinations should be accumulated. By default, only the final combination is used.

gdArgs

Additional arguments passed to the GenomeData constructor used to assemble the final object.

Details

The gdReduce method for GenomeData objects successively combines GenomeData elements of ... using f; all arguments assigned to ... must be of class GenomeData. f is a function accepting two objects returned by "[[" applied to the successive elements of ..., returning a single GenomeData object to be used in subsequent calls to f. init, right, and accumulate are as described for Reduce. gdArgs can be used to provide metadata information to the constructor used to create the final GenomeData object.

Currently the gdReduce method for GenomeDataList objects works when a single GenomeDataList object x is provided as ... and it does gdReduce(f, x[[1]], x[[2]] ... x[[N]], init, right, accumulate, gdArgs) where N is the length of x i.e. the number of GenomeData objects in it.

Value

An object of class GenomeData, containing elements corresponding to the intersection of all named elements of ... (in the case of the method for GenomeData objects) or all elements in the single GenomeDataList object passed to it (in the case of the method for GenomeDataList objects).

Author(s)

Martin Morgan

See Also

Reduce, GenomeData-class, GenomeDataList-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
gdReduce
showMethods("gdReduce")

gd <- GenomeData(list(chr1 = IRanges(1, 10), chrX = IRanges(2, 5)),
                 organism = "Mmusculus", provider = "UCSC",
                 providerVersion = "mm9")

gdr <- gdReduce(function(x, y) {
    ## "[[" returns IRanges instances, construct a synthetic version
    IRanges(c(start(x), start(y)), c(end(x), end(y)))
}, GenomeDataList(list(gd, gd[2])))
gdr[["chr1"]]
gdr[["chrX"]]

Przemol/mirrors-bioc-BSgenome documentation built on May 8, 2019, 3:46 a.m.