annotateWithFeatures {genomation} | R Documentation

## Annotate given ranges with genomic features

### Description

The function annotates a target GRangesList or GRanges object as overlapping or not with the elements of a named GRangesList. This is useful to annotate your regions of interest with genomic features with arbitrary categories such as repeat classes or families, or output from genome segmentation alogorithms such as chromHMM.

### Usage

    annotateWithFeatures(target, features, strand.aware = FALSE,
      intersect.chr = FALSE)

    ## S4 method for signature 'GRanges,GRangesList'
    annotateWithFeatures(target, features,
      strand.aware = FALSE, intersect.chr = FALSE)

    ## S4 method for signature 'GRangesList,GRangesList'
    annotateWithFeatures(target, features,
      strand.aware = FALSE, intersect.chr = FALSE)

### Arguments

`target` | GRanges or GRangesList object storing chromosome locations to be annotated (e.g. chipseq peaks)
`features` | a named GRangesList object containing GRanges objects different set of features. The function calculates percent overlaps with and without precendence at the same time. The order of objects in GRangesList defines their precedence. If a range in `target` overlaps with a more precedent range in an element of `features`, the other overlaps from other less precedent elments will be discarded. This is useful for getting piecharts where percentages should add up to 100.
`strand.aware` | if set to TRUE, annotation features and target features will be overlapped based on strand (def:FALSE)
`intersect.chr` | logical value, whether to select only chromosomes that are common to feature and target. FALSE by default

### Value

returns an `AnnotationByFeature` object or if target is a GRangesList, a list of `AnnotationByFeature` objects.

### See Also

see `getMembers`, `heatTargetAnnotation`, `plotTargetAnnotation`

### Examples

    library(GenomicRanges)
    data(cage)
    data(cpgi)
    cage$tpm=NULL
    gl = GRangesList(cage=cage, cpgi=cpgi)

    bed.file = system.file("extdata/chr21.refseq.hg19.bed", package = "genomation")
    gene.parts = readTranscriptFeatures(bed.file)
    annot = annotateWithFeatures(gl, gene.parts, intersect.chr=TRUE)

[Package genomation version 1.18.0 Index]