jianhong / ChIPpeakAnno

11 stars 4 forks source link

Annotation for dm6 does not contain gene_name #8

Closed ashleymaeconard closed 3 years ago

ashleymaeconard commented 3 years ago

Hello Jianhong,

I have enjoyed using ChIPpeakAnno however working with dm6, the annoData does not contain a gene name. This is prohibiting me from extracting useful information directly with the more interpretable gene symbol. I can certainly find another way to convert the Flybase IDs if needed, but your examples in the user guide suggest that you can get the gene_name directly. Please let me know what I need to do to get this information!

Thank you. Ashley

> library("TxDb.Dmelanogaster.UCSC.dm6.ensGene")
> txdb <- TxDb.Dmelanogaster.UCSC.dm6.ensGene
> annoData <- toGRanges(txdb, feature="gene")
> annoData
GRanges object with 17699 ranges and 0 metadata columns:
              seqnames            ranges strand
                 <Rle>         <IRanges>  <Rle>
  FBgn0000003    chr3R   6822498-6822796      +
  FBgn0000008    chr2R 22136968-22172834      +
  FBgn0000014    chr3R 16807214-16830049      -
  FBgn0000015    chr3R 16927212-16972236      -
  FBgn0000017    chr3L 16615866-16647882      -
          ...      ...               ...    ...
  FBgn0285994    chr3L 21576460-21576661      -
  FBgn0286004     chrX 19558607-19558693      +
  FBgn0286005    chr2R 18180151-18180205      -
  FBgn0286006    chr2R 12170373-12170462      -
  FBgn0286007    chr2R 12170153-12170244      -
  -------
  seqinfo: 1870 sequences (1 circular) from dm6 genome
jianhong commented 3 years ago

Hi Ashley, Thank you trying ChIPpeakAnno. You may want to try following code to add gene symbols:

library(org.Dm.eg.db)

annoData$entrizID <- xget(names(annoData), org.Dm.egFLYBASE2EG, output = "first")

annoData$gene_name[!is.na(annoData$entrizID)] <- xget(annoData$entrizID[!is.na(annoData$entrizID)], org.Dm.egSYMBOL)

Let me know if you still have question.

Jianhong.

ashleymaeconard commented 3 years ago

Thank you! This solves my problem, and thank you for your patience as I reply later than desired! I will close the issue.