Last data update: 2014.03.03

R: Annotate peaks
annoPeaksR Documentation

Annotate peaks

Description

Annotate peaks by annoGR object in the given range.

Usage

annoPeaks (peaks, annoData, 
          bindingType=c("nearestBiDirectionalPromoters",
                        "startSite", "endSite", "fullRange"), 
          bindingRegion=c(-5000, 5000), 
          ignore.peak.strand=TRUE,
          ...)

Arguments

peaks

peak list, GRanges object

annoData

annotation data, GRanges object

bindingType

Specifying the criteria to associate peaks with annotation. Here is how to use it together with the parameter bindingRegion

  • To obtain peaks within 5kb upstream and up to 3kb downstream of TSS within the gene body, set bindingType = "startSite" and bindingRegion = c(-5000, 3000)

  • To obtain peaks up to 5kb upstream within the gene body and 3kb downstream of gene/Exon End, set bindingType = "endSite" and bindingRegion = c(-5000, 3000)

  • To obtain peaks from 5kb upstream to 3kb downstream of genes/Exons , set bindingType = "fullRange" and bindingRegion = c(-5000, 3000)

  • To obtain peaks with nearest bi-directional promoters within 5kb upstream and 3kb downstream of TSS, set bindingType = "nearestBiDirectionalPromoters" and bindingRegion = c(-5000, 3000)

startSite

start position of the feature (strand is considered)

endSite

end position of the feature (strand is considered)

fullRange

whole range of the feature

nearestBiDirectionalPromoters

nearest promoters from both direction of the peaks (strand is considered). It will report bidirectional promoters if there are promoters in both directions in the given region (defined by bindingRegion). Otherwise, it will report the closest promoter in one direction.

bindingRegion

Annotation range used together with bindingType, which is a vector with two integer values, default to c (-5000, 5000). The first one must be no bigger than 0. And the sec ond one must be no less than 1. For details, see bindingType.

ignore.peak.strand

ignore the peaks strand or not.

...

Not used.

Value

Output is a GRanges object of the annotated peaks.

Author(s)

Jianhong Ou

See Also

See Also as annotatePeakInBatch

Examples

    library(EnsDb.Hsapiens.v75)
    data("myPeakList")
    annoGR <- toGRanges(EnsDb.Hsapiens.v75)
    seqlevelsStyle(myPeakList) <- seqlevelsStyle(annoGR)
    annoPeaks(myPeakList, annoGR)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ChIPpeakAnno)
Loading required package: grid
Loading required package: IRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: Biostrings
Loading required package: XVector
Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: VennDiagram
Loading required package: futile.logger

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ChIPpeakAnno/annoPeaks.Rd_%03d_medium.png", width=480, height=480)
> ### Name: annoPeaks
> ### Title: Annotate peaks
> ### Aliases: annoPeaks
> ### Keywords: misc
> 
> ### ** Examples
> 
>     library(EnsDb.Hsapiens.v75)
Loading required package: ensembldb
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

>     data("myPeakList")
>     annoGR <- toGRanges(EnsDb.Hsapiens.v75)
>     seqlevelsStyle(myPeakList) <- seqlevelsStyle(annoGR)
>     annoPeaks(myPeakList, annoGR)
GRanges object with 802 ranges and 8 metadata columns:
                  seqnames               ranges strand |         feature
                     <Rle>            <IRanges>  <Rle> |     <character>
     X1_41_559455     chr1   [ 559774,  559874]      * | ENSG00000225972
     X1_12_703729     chr1   [ 703885,  703985]      * | ENSG00000240618
    X1_14_1300250     chr1   [1300503, 1300603]      * | ENSG00000162576
    X1_11_1499907     chr1   [1500164, 1500264]      * | ENSG00000215791
    X1_11_6617055     chr1   [6617363, 6617463]      * | ENSG00000162408
              ...      ...                  ...    ... .             ...
  X17_12_72793359     chr9 [72794436, 72794536]      * | ENSG00000204706
  X17_11_72795094     chr9 [72795475, 72795575]      * | ENSG00000204706
  X17_12_75763698     chr9 [75764011, 75764111]      * | ENSG00000135046
  X17_17_76981376     chr9 [76982484, 76982584]      * | ENSG00000227809
  X17_12_77410131     chr9 [77411629, 77411729]      * | ENSG00000202217
                             peak       feature.ranges feature.strand  distance
                      <character>            <IRanges>          <Rle> <integer>
     X1_41_559455    X1_41_559455   [ 564442,  564813]              +      4567
     X1_12_703729    X1_12_703729   [ 694412,  700305]              -      3579
    X1_14_1300250   X1_14_1300250   [1288069, 1297157]              -      3345
    X1_11_1499907   X1_11_1499907   [1497726, 1499904]              -       259
    X1_11_6617055   X1_11_6617055   [6581407, 6614595]              -      2767
              ...             ...                  ...            ...       ...
  X17_12_72793359 X17_12_72793359 [72700732, 72790804]              -      3631
  X17_11_72795094 X17_11_72795094 [72700732, 72790804]              -      4670
  X17_12_75763698 X17_12_75763698 [75766673, 75785309]              +      2561
  X17_17_76981376 X17_17_76981376 [76986447, 76998446]              +      3862
  X17_12_77410131 X17_12_77410131 [77414811, 77415138]              +      3081
                  insideFeature distanceToStart     gene_name
                       <factor>       <numeric>   <character>
     X1_41_559455      upstream            4568      MTND1P23
     X1_12_703729      upstream            3580 RP11-206L10.5
    X1_14_1300250      upstream            3346         MXRA8
    X1_11_1499907      upstream             260    AL645728.2
    X1_11_6617055      upstream            2768          NOL9
              ...           ...             ...           ...
  X17_12_72793359      upstream            3632    MAMDC2-AS1
  X17_11_72795094      upstream            4671    MAMDC2-AS1
  X17_12_75763698      upstream            2562         ANXA1
  X17_17_76981376      upstream            3863 RP11-171A24.2
  X17_12_77410131      upstream            3082      RN7SKP47
  -------
  seqinfo: 24 sequences from an unspecified genome; no seqlengths
Warning messages:
1: In valid.GenomicRanges.seqinfo(x, suggest.trim = TRUE) :
  GRanges object contains 14 out-of-bound ranges located on sequences
  chrM, GL000199.1, GL000201.1, GL000243.1, and LRG_93. Note that only
  ranges located on a non-circular sequence whose length is not NA can be
  considered out-of-bound (use seqlengths() and isCircular() to get the
  lengths and circularity flags of the underlying sequences). You can use
  trim() to trim these ranges. See ?`trim,GenomicRanges-method` for more
  information.
2: In valid.GenomicRanges.seqinfo(x, suggest.trim = TRUE) :
  GRanges object contains 22 out-of-bound ranges located on sequences
  chrM, GL000199.1, GL000201.1, GL000243.1, LRG_93, GL000229.1, and
  GL000220.1. Note that only ranges located on a non-circular sequence
  whose length is not NA can be considered out-of-bound (use seqlengths()
  and isCircular() to get the lengths and circularity flags of the
  underlying sequences). You can use trim() to trim these ranges. See
  ?`trim,GenomicRanges-method` for more information.
3: In valid.GenomicRanges.seqinfo(x, suggest.trim = TRUE) :
  GRanges object contains 27 out-of-bound ranges located on sequences
  chrM, GL000199.1, GL000201.1, GL000243.1, LRG_93, GL000229.1,
  GL000230.1, GL000220.1, and GL000192.1. Note that only ranges located
  on a non-circular sequence whose length is not NA can be considered
  out-of-bound (use seqlengths() and isCircular() to get the lengths and
  circularity flags of the underlying sequences). You can use trim() to
  trim these ranges. See ?`trim,GenomicRanges-method` for more
  information.
4: In valid.GenomicRanges.seqinfo(x, suggest.trim = TRUE) :
  GRanges object contains 34 out-of-bound ranges located on sequences
  chrM, HG417_PATCH, GL000237.1, GL000199.1, GL000240.1, GL000201.1,
  GL000243.1, LRG_93, GL000229.1, GL000230.1, GL000220.1, and GL000192.1.
  Note that only ranges located on a non-circular sequence whose length
  is not NA can be considered out-of-bound (use seqlengths() and
  isCircular() to get the lengths and circularity flags of the underlying
  sequences). You can use trim() to trim these ranges. See
  ?`trim,GenomicRanges-method` for more information.
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>