This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Custom Annotation With Chippeakanno

I am trying to figure out how to make a custom annotation that I can feed into the annotatePeakInBatch function which is part of the ChIPpeakAnno package for Bioconductor.

The usage is something like this,

annotatePeakInBatch(myPeakList, AnnotationData) where myPeakList is a list of peaks derived from a ChIP-seq exeperiment.

I want to be able to create a set of custom annotations for C. elegans.

I would like to be able to make use of data like the human gene ortholog, the wormbase gene name.

I assume the getBM function for BiomaRt might be of help. However, I haven't been able to figure out how to get this to produce the annotations for all genes of a particular species, nor how to convert the output to something that is suitable for annotatePeakInBatch.

bioconductor r

1 answer

If you can make a data frame of your custom annotations (i.e. a table), then you can simply convert the relevant fields to a RangedData object for ChIPpeakAnno. For instance, if you want to get all c elegans genes, you can grab them using the biomaRt library in R with just a few lines of code:

library(biomaRt)
library(ChIPpeakAnno)

# create a biomart object and select a mart to use
ensembl <- useDataset("celegans_gene_ensembl", mart=useMart("ensembl"))

# what kind of attributes can we retrieve?
listAttributes(ensembl)

# set the properties to extract
props <- c("ensembl_gene_id", "external_gene_id", "transcript_biotype", "chromosome_name", "start_position", "end_position", "strand")

# get the information
genes <- getBM(attributes=props, mart=ensembl)

# create a RangedData object with my custom annotations
myCustomAnno <- RangedData(IRanges(start=genes[,"start_position"], end=genes[,"end_position"], names=genes[,"external_gene_id"]), space=genes[,"chromosome_name"], strand=genes[,"strand"])

# annotate my peaks with my custom annotations
annotatedPeaks <- annotatePeakInBatch(myPeakList, AnnotationData=myCustomAnno)

There are quite a few things you can look up in biomart, or you can curate your own table. The trick is simply getting the information into the form of a RangedData object, which may seem a little scary, but as you can see in the example above, is actually pretty straightforward.

This looks good. Thanks!

Log in to answer this question.