I am trying to perfom Chip-Seq Analysis which is greatly described in that conversation: introduction to Chip Seq . The same as autor of mentioned question I am a student of Applied Mathematics and I am doing my best to enter bioinformatics fields.

I am basically at the moment where I would like to annotate peaks with genes' IDs. To do this I am using ChIPpeakAnno R package from Bioconductor. I used below code to annotate my reads (outputs from MACS) with genes' ID's

> library(ChIPpeakAnno)
> # data(package = "ChIPpeakAnno")$results[,3]
> macsOutput <- toGRanges(data="example_peaks.bed",
+                                               format = "MACS")

> data(TSS.human.GRCh37)
> macs.anno <- annotatePeakInBatch(macsOutput,
+                                                                AnnotationData=TSS.human.GRCh37,
+                                                                output="overlapping", maxgap=5000L)
> library(org.Hs.eg.db)
> macs.anno <- addGeneIDs(annotatedPeak=macs.anno,
+                                               orgAnn="org.Hs.eg.db",
+                                               IDs2Add="symbol")
> # no annotations for some genes
> as.character(head(as.data.frame(macs.anno)$symbol))
[1] "PTCHD2" "PTCHD2" "PTGER3" NA       "HFM1"   NA  

but there occures that there are no genes' annotations for some peaks. Can anyone tell me why this might happen? And how to avoid this? Does this refer to the maxgap=5000L parameter? When creating output from MACS I set a parameter for length to be 10 000.


1 Answer 1


I had the same problem. This how I solved it, I found the solution somewhere here, I don't remember where, and it worked for me.

macs.anno <- annotatePeakInBatch(gr_broadPeak, AnnotationData=TSS.human.GRCh38, 
                                     output="both", maxgap=5000L)
 macs.annoL=addGeneIDs(macs.anno,"org.Hs.eg.db",c("symbol", "genename","entrez_id"))
  • 1
    $\begingroup$ I'm on vacations. $\endgroup$
    – Marcin
    Jun 29, 2016 at 4:34
  • 1
    $\begingroup$ I'll check your solution soon and then, if it will work, I accept it :) $\endgroup$
    – Marcin
    Jun 29, 2016 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .