jianhong / ChIPpeakAnno

11 stars 4 forks source link

use 'entrez_id' instead of 'EntrezID' for getEnrichedPATH() output #19

Closed hukai916 closed 1 year ago

hukai916 commented 1 year ago

Hi Jianhong,

One user reached out because the following commands generated unexpected output when trying to add 'symbol' to enriched pathways:

library(EnsDb.Hsapiens.v75) ##(hg19)
library(org.Hs.eg.db)
data(annotatedPeak)

enriched.PATH <- getEnrichedPATH(annotatedPeak[1:500], orgAnn="org.Hs.eg.db", 
                                    feature_id_type="ensembl_gene_id",
                                    pathAnn="reactome.db", maxP=0.01,
                                    minPATHterm=10, multiAdjMethod="NULL")

ann <- addGeneIDs(enriched.PATH[,2], feature_id_type = "entrez_id", orgAnn = org.Hs.eg.db, IDs2Add = "symbol")
enriched.PATH <- merge(ann, enriched.PATH)

It was caused because getEnrichedPATH() uses 'EntrezID' as output column name whereas addGeneIDs() uses 'entrez_id' as output column name. So that users need to run the following to obtain the correct output.

enriched.PATH <- merge(ann, enriched.PATH, by.x = "entrez_id", by.y = "EntrezID")

I think it better to patch getEnrichedPATH() to also use 'entrez_id' so that it is consistent with addGeneIDs().

Also, the vignette has been updated by adding this example.