Learn R Programming

hiAnnotator (version 1.6.2)

doAnnotation: Annotate a GRanges object using one of annotation functions.

Description

This is a wrapper function which calls one of following functions depending on annotType parameter: getFeatureCounts, getFeatureCountsBig, getNearestFeature, get2NearestFeature, getSitesInFeature

Usage

doAnnotation(annotType = NULL, ..., postProcessFun = NULL,
  postProcessFunArgs = list())

Arguments

annotType
one of following: within, nearest, twoNearest, counts, countsBig.
...
Additional parameters to be passed to the respective annotation function.
postProcessFun
function to call on the resulting object for any post processing steps.
postProcessFunArgs
additional arguments for postProcessFun as a list.

Value

  • a GRanges object with new annotation columns appended at the end of sites.rd.

See Also

makeGRanges, getFeatureCounts, getFeatureCountsBig, getNearestFeature, get2NearestFeature, getSitesInFeature.

Examples

Run this code
# Convert a dataframe to GRanges object
data(sites)
alldata.rd <- makeGRanges(sites,soloStart=TRUE)

data(genes)
genes.rd <- makeGRanges(genes)

doAnnotation(annotType="within",alldata.rd,genes.rd,"InGene",asBool=TRUE)
doAnnotation(annotType="counts",alldata.rd,genes.rd,"NumOfGene")
doAnnotation(annotType="nearest",alldata.rd,genes.rd,"NearestGene")
doAnnotation(annotType="countsBig",alldata.rd,genes.rd,"ChipSeqCounts")
geneCheck <- function(x,wanted) { x$isWantedGene <- x$InGene %in% wanted;
return(x) }
doAnnotation(annotType="within",alldata.rd,genes.rd,"InGene",
postProcessFun=geneCheck,
postProcessFunArgs=list("wanted"=c("FOXJ3","SEPT9","RPTOR")) )

Run the code above in your browser using DataLab