How to fix ChIPPeakAnno error in adding gene names to annotated peaks?
2
0
Entering edit mode
jmKeith • 0
@jmkeith-11960
Last seen 5.6 years ago

Hello,

I should preface this with the general, "I'm new and don't know what I'm doing, but I'm trying to learn" message.  I've just started to learn R (using 3.4) and am trying to use ChIPPeakAnno to 1) annotate my peaks 2) compare 3 datasets for TSS, TSS+200bp, etc.  

Using the following script: 

library(biomaRt)
library(org.Mm.eg.db)
mart <- useMart("ensembl", "mmusculus_gene_ensembl")
AnnotationData <- getAnnotation(mart, featureType="TSS")
data("TSS.mouse.NCBIM37")

d3.k4m1 <- import.bed("d3_TCR_k4m1_summits.bed")
d3.k4m1.RD <- RangedData(d3.k4m1)
d3.k4m1.TGR <- toGRanges(d3.k4m1.RD)

I get this error and am unable to procede with anything:

> d3.k4m1.anno <- annotatePeakInBatch(d3.k4m1.TGR, mart, featureType="TSS", AnnotationData = TSS.mouse.NCBIM37, output = "both", mutliple=FALSE, maxgap = 0L, PeakLocForDistance = "middle", FeatureLocForDistance = "TSS", select="all", ignore.strand = FALSE, bindingRegion = NULL)
There were 37 warnings (use warnings() to see them)
> d3.k4m1.fullanno <- addGeneIDs(d3.k4m1.TGR, mart=mart, feature_id_type="ensembl_gene_id", IDs2Add= c("ensembl_gene_id","description", "chromosome_name", "start_position", "end_position", "external_gene_name", "go_id", "name_1006"), silence=TRUE)
Error: There is no feature column in annotatedPeak or 
             annotatedPeak has size 0!
In addition: Warning message:
In is.na(feature_ids) :
  is.na() applied to non-(list or vector) of type 'NULL'

 

This error is on a dataset with 57,000 peaks but when I use a dataset with only 5000 peaks or so, I have no problems so I get that the file size is maybe an issue but I'm unsure how to fix it.  I would appreciate any assistance.  

Many thanks.

software error annotation • 1.7k views
ADD COMMENT
3
Entering edit mode
Ou, Jianhong ★ 1.3k
@ou-jianhong-4539
Last seen 1 day ago
United States

Hi,

Please have a try of following code, and let me know if there is any question.

 
library(ChIPpeakAnno)
library(biomaRt) 
library(org.Mm.eg.db) 
mart <- useMart("ensembl", "mmusculus_gene_ensembl")
# you can get annotationData from TxDb
#library(TxDb.Mmusculus.UCSC.mm10.knownGene) 
#AnnotationData <- toGRanges(TxDb.Mmusculus.UCSC.mm10.knownGene) ## if you use TxDb, parameters feature_id_type of addGeneIDs should be changed.
# or EnsDb
#library(EnsDb.Mmusculus.v79)
#AnnotationData <- toGRanges(EnsDb.Mmusculus.v79) 
data("TSS.mouse.NCBIM37")
AnnotationData <- TSS.mouse.NCBIM37
d3.k4m1 <- toGRanges("d3_TCR_k4m1_summits.bed", format="BED") #import to GRanges
d3.k4m1.anno <- annotatePeakInBatch(d3.k4m1, featureType="TSS", AnnotationData = AnnotationData, output = "both", mutliple=FALSE, maxgap = 0L, PeakLocForDistance = "middle", FeatureLocForDistance = "TSS", select="all", ignore.strand = FALSE, bindingRegion = NULL)

head(d3.k4m1.anno) # take a look about the annotations

d3.k4m1.fullanno <- addGeneIDs(d3.k4m1.anno, mart=mart, feature_id_type="ensembl_gene_id", IDs2Add= c("ensembl_gene_id","description", "external_gene_name", "go_id", "name_1006"), silence=TRUE)

 

addGeneIDs is used to add annotations for the output of annotatePeakInBatch.

ADD COMMENT
0
Entering edit mode
jmKeith • 0
@jmkeith-11960
Last seen 5.6 years ago

Thanks!  I saw that I had an error in that I was trying to use both mart and data arguments at the same time.  An accident of playing around with various parameters.  Many thanks for your help!

ADD COMMENT

Login before adding your answer.

Traffic: 545 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6