| gdReduce {BSgenome} | R Documentation |
WARNING: Starting with BioC 3.1, GenomeData and GenomeDataList objects are defunct. Note that the GenomeData/GenomeDataList containers predate the GRanges/GRangesList containers and, most of the times, the latters can be used instead of the formers. Please let us know on the bioc-devel mailing list (http://bioconductor.org/help/mailing-list/) if you have a use case where you think there are significant benefits in using GenomeData/GenomeDataList over GRanges/GRangesList, or if you have questions or concerns about this.
This function accepts one or more objects that are reduced, with a
user-specified function, to a single GenomeData
instance.
gdReduce(f, ..., init, right = FALSE, accumulate = FALSE, gdArgs = list())
f |
An object of class |
... |
Objects to be reduced. All objects should be of the same class, as
dictated by methods defined on |
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 |
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.
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).
Martin Morgan
Reduce,
GenomeData-class,
GenomeDataList-class
## Not run:
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"]]
## End(Not run)