applyMapped {Genominator} | R Documentation |
Apply a function over each element of a list containing data subsets, organized by annotation, with an additional argument for the annotation element associated with the list item.
applyMapped(mapped, annoData, FUN, bindAnno = FALSE)
mapped |
A list of data subsets, typically the return value of a call to |
annoData |
A data frame which must contain the columns |
FUN |
A function of two arguments, the first being an element of |
bindAnno |
Logical indicating whether annotation information should be included in the output. If |
If bindAnno
is FALSE
, returns a list containing the output of FUN
for each element of the original
mapped
argument. If bindAnno
is TRUE
, returns a data frame, containing annotation information and
output of FUN
.
James Bullard bullard@berkeley.edu, Kasper Daniel Hansen khansen@jhsph.edu
See Genominator
vignette for more information.
ed <- ExpData(system.file(package = "Genominator", "sample.db"), tablename = "raw") data("yeastAnno") s <- splitByAnnotation(ed, yeastAnno[1:100,], what = getColnames(ed, all = FALSE), ignoreStrand = TRUE, addOverStrand = TRUE) ## compute the per-base rate for this dataset. applyMapped(s, yeastAnno, function(dta, anno) { colSums(dta, na.rm = TRUE)/(anno$end - anno$start + 1) }, bindAnno = TRUE)[1:4,]