├── .Rbuildignore ├── .github └── issue_template.md ├── .gitignore ├── .svnignore ├── .travis.yml ├── DESCRIPTION ├── Makefile ├── NAMESPACE ├── NEWS ├── NEWS.md ├── R ├── DOSE.R ├── ReactomePA-package.R ├── enrichPathway.R ├── enrichplot.R ├── gseAnalyzer.R ├── gson.R ├── utilities.R ├── viewPathway.R └── zzz.R ├── README.Rmd ├── README.md ├── appveyor.yml ├── docs └── index.html ├── inst └── CITATION ├── man ├── DataSet.Rd ├── ReactomePA-package.Rd ├── enrichPathway.Rd ├── getALLEG.Rd ├── getDb.Rd ├── gsePathway.Rd ├── gson_Reactome.Rd ├── reexports.Rd └── viewPathway.Rd ├── tests ├── testthat.R └── testthat │ └── test-getDb.R └── vignettes └── ReactomePA.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | .svnignore 2 | ^.*\.DS_Store 3 | Makefile 4 | .travis.yml 5 | appveyor.yml 6 | README.Rmd 7 | mkdocs 8 | docs 9 | .github 10 | site_src 11 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | ### Prerequisites 2 | 3 | + [ ] Have you read [Feedback](https://guangchuangyu.github.io/reactomepa/#feedback) and follow the [guide](https://guangchuangyu.github.io/2016/07/how-to-bug-author/)? 4 | * [ ] make sure your are using the latest release version 5 | * [ ] read the [documents](https://guangchuangyu.github.io/reactomepa/documentation/) 6 | * [ ] google your quesion/issue 7 | 8 | ### Describe you issue 9 | 10 | * [ ] Make a reproducible example (*e.g.* [1](https://gist.github.com/talonsensei/e1fad082657054207f249ec98f0920eb)) 11 | * [ ] your code should contain comments to describe the problem (*e.g.* what expected and actually happened?) 12 | 13 | 14 | ### Ask in right place 15 | 16 | * [ ] for bugs or feature requests, post here (github issue) 17 | * [ ] for questions, please post to [Bioconductor](https://support.bioconductor.org/) or [Biostars](https://www.biostars.org/) with tag `ReactomePA` 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | .svn 3 | .svnignore 4 | *~ 5 | __init__.py 6 | __pycache__ 7 | __init__.pyc 8 | -------------------------------------------------------------------------------- /.svnignore: -------------------------------------------------------------------------------- 1 | .git 2 | appveyor.yml 3 | .travis.yml 4 | mkdocs 5 | docs 6 | .github 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | ## reference: http://docs.travis-ci.com/user/languages/r/ 2 | 3 | language: r 4 | r: 5 | - bioc-devel 6 | 7 | cache: packages 8 | bioc_required: true 9 | bioc_use_devel: true 10 | 11 | os: 12 | - linux 13 | - osx 14 | 15 | 16 | env: 17 | global: 18 | - _R_CHECK_FORCE_SUGGESTS_=False 19 | - R_LIBS="http://cran.rstudio.com" 20 | 21 | r_packages: 22 | - knitr 23 | - rmarkdown 24 | 25 | bioc_packages: 26 | - DO.db 27 | - org.Hs.eg.db 28 | - DOSE 29 | - reactome.db 30 | - graphite 31 | 32 | after_failure: 33 | - ./travis-tool.sh dump_logs 34 | 35 | r_github_packages: 36 | - jimhester/covr 37 | 38 | after_success: 39 | - Rscript -e 'library(covr); codecov()' 40 | 41 | notifications: 42 | email: 43 | recipients: gcyu@connect.hku.hk 44 | on_success: never 45 | on_failure: always 46 | 47 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: ReactomePA 2 | Type: Package 3 | Title: Reactome Pathway Analysis 4 | Version: 1.53.0 5 | Authors@R: c(person(given = "Guangchuang", family = "Yu", 6 | email = "guangchuangyu@gmail.com", 7 | role = c("aut", "cre")), 8 | person(given = "Vladislav", family = "Petyuk", 9 | email = "petyuk@gmail.com", 10 | role = "ctb")) 11 | Maintainer: Guangchuang Yu 12 | Description: This package provides functions for pathway analysis based on 13 | REACTOME pathway database. It implements enrichment analysis, gene set 14 | enrichment analysis and several functions for visualization. 15 | This package is not affiliated with the Reactome team. 16 | Depends: 17 | R (>= 3.4.0) 18 | Imports: 19 | AnnotationDbi, 20 | DOSE (>= 3.5.1), 21 | enrichplot, 22 | ggplot2 (>= 3.3.5), 23 | ggraph, 24 | reactome.db, 25 | igraph, 26 | graphite, 27 | gson, 28 | yulab.utils (>= 0.1.5) 29 | Suggests: 30 | BiocStyle, 31 | clusterProfiler, 32 | knitr, 33 | rmarkdown, 34 | org.Hs.eg.db, 35 | prettydoc, 36 | testthat 37 | VignetteBuilder: knitr 38 | ByteCompile: true 39 | License: GPL-2 40 | URL: https://yulab-smu.top/contribution-knowledge-mining/ 41 | BugReports: https://github.com/GuangchuangYu/ReactomePA/issues 42 | Packaged: 2012-03-05 18:26:53 UTC; mcarlson 43 | biocViews: Pathways, Visualization, Annotation, MultipleComparison, 44 | GeneSetEnrichment, Reactome 45 | RoxygenNote: 7.3.2 46 | Encoding: UTF-8 47 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION) 2 | PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION) 3 | PKGSRC := $(shell basename `pwd`) 4 | BIOCVER := RELEASE_3_21 5 | 6 | all: rd readme check clean 7 | 8 | alldocs: rd readme 9 | 10 | rd: 11 | Rscript -e 'roxygen2::roxygenise(".")' 12 | 13 | readme: 14 | Rscript -e 'rmarkdown::render("README.Rmd", encoding="UTF-8")' 15 | 16 | build: 17 | #cd ..;\ 18 | #R CMD build $(PKGSRC) 19 | Rscript -e 'devtools::build()' 20 | 21 | build2: 22 | cd ..;\ 23 | R CMD build --no-build-vignettes $(PKGSRC) 24 | 25 | 26 | install: 27 | cd ..;\ 28 | R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz 29 | 30 | check: #build 31 | # cd ..;\ 32 | # Rscript -e 'rcmdcheck::rcmdcheck("$(PKGNAME)_$(PKGVERS).tar.gz")' 33 | Rscript -e 'devtools::check()' 34 | 35 | check2: build 36 | cd ..;\ 37 | R CMD check $(PKGNAME)_$(PKGVERS).tar.gz 38 | 39 | bioccheck: 40 | cd ..;\ 41 | Rscript -e 'BiocCheck::BiocCheck("$(PKGNAME)_$(PKGVERS).tar.gz")' 42 | 43 | clean: 44 | cd ..;\ 45 | $(RM) -r $(PKGNAME).Rcheck/ 46 | 47 | 48 | gitmaintain: 49 | git gc --auto;\ 50 | git prune -v;\ 51 | git fsck --full 52 | 53 | biocinit: 54 | git remote add upstream git@git.bioconductor.org:packages/$(PKGNAME).git;\ 55 | git fetch --all 56 | 57 | 58 | rmrelease: 59 | git branch -D $(BIOCVER) 60 | 61 | release: 62 | git checkout $(BIOCVER);\ 63 | git fetch --all 64 | 65 | update: 66 | git fetch --all;\ 67 | git checkout devel;\ 68 | git merge upstream/devel;\ 69 | git merge origin/devel 70 | 71 | push: 72 | git push upstream devel;\ 73 | git push origin devel 74 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(cnetplot) 4 | export(dotplot) 5 | export(emapplot) 6 | export(enrichPathway) 7 | export(geneID) 8 | export(geneInCategory) 9 | export(gsePathway) 10 | export(gseaplot) 11 | export(gson_Reactome) 12 | export(heatplot) 13 | export(ridgeplot) 14 | export(viewPathway) 15 | importClassesFrom(DOSE,enrichResult) 16 | importClassesFrom(DOSE,gseaResult) 17 | importFrom(DOSE,EXTID2NAME) 18 | importFrom(DOSE,geneID) 19 | importFrom(DOSE,geneInCategory) 20 | importFrom(DOSE,setReadable) 21 | importFrom(enrichplot,cnetplot) 22 | importFrom(enrichplot,dotplot) 23 | importFrom(enrichplot,emapplot) 24 | importFrom(enrichplot,gseaplot) 25 | importFrom(enrichplot,heatplot) 26 | importFrom(enrichplot,ridgeplot) 27 | importFrom(ggplot2,aes_) 28 | importFrom(ggplot2,scale_color_continuous) 29 | importFrom(ggplot2,scale_size) 30 | importFrom(ggplot2,theme_void) 31 | importFrom(ggraph,geom_edge_link) 32 | importFrom(ggraph,geom_node_point) 33 | importFrom(ggraph,geom_node_text) 34 | importFrom(ggraph,ggraph) 35 | importFrom(graphite,convertIdentifiers) 36 | importFrom(graphite,pathwayGraph) 37 | importFrom(gson,gson) 38 | importFrom(igraph,"E<-") 39 | importFrom(igraph,"V<-") 40 | importFrom(igraph,E) 41 | importFrom(igraph,V) 42 | importFrom(igraph,as.undirected) 43 | importFrom(igraph,igraph.from.graphNEL) 44 | importFrom(reactome.db,reactomeEXTID2PATHID) 45 | importFrom(reactome.db,reactomePATHID2EXTID) 46 | importFrom(reactome.db,reactomePATHID2NAME) 47 | importFrom(utils,stack) 48 | importFrom(yulab.utils,yulab_msg) 49 | importMethodsFrom(AnnotationDbi,as.list) 50 | importMethodsFrom(AnnotationDbi,keys) 51 | importMethodsFrom(DOSE,show) 52 | importMethodsFrom(DOSE,summary) 53 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | CHANGES IN VERSION 1.25.1 2 | ------------------------ 3 | o add keyType parameter in viewPathway (2018-09-04, Tue) 4 | 5 | CHANGES IN VERSION 1.23.2 6 | ------------------------ 7 | o re-implement viewPathway <2018-03-15, Thu> 8 | o mv site to https://guangchuangyu.github.io/software/ReactomePA 9 | 10 | CHANGES IN VERSION 1.23.1 11 | ------------------------ 12 | o import enrichplot 13 | 14 | CHANGES IN VERSION 1.21.3 15 | ------------------------ 16 | o new project site using blogdown <2017-09-30, Fri> 17 | 18 | CHANGES IN VERSION 1.21.2 19 | ------------------------ 20 | o correct typo in vignette <2017-05-18, Thu> 21 | 22 | CHANGES IN VERSION 1.21.1 23 | ------------------------ 24 | o update vignette according to the change of reactome.db (pathway ID was changed) <2017-04-28, Fri> 25 | 26 | CHANGES IN VERSION 1.20.0 27 | ------------------------ 28 | o BioC 3.5 release <2017-04-26, Wed> 29 | 30 | CHANGES IN VERSION 1.19.1 31 | ------------------------ 32 | o update startup message <2016-11-09, Wed> 33 | 34 | CHANGES IN VERSION 1.18.0 35 | ------------------------ 36 | o BioC 3.4 released <2016-10-18, Tue> 37 | 38 | CHANGES IN VERSION 1.17.4 39 | ------------------------ 40 | o unit test <2016-08-15, Mon> 41 | 42 | CHANGES IN VERSION 1.17.3 43 | ------------------------ 44 | o move getDb from GOSemSim (no longer need this function) to ReactomePA and remove dependency of GOSemSim <2016-07-06, Wed> 45 | o 'by' parameter for GSEA analysis <2016-07-04, Mon> 46 | 47 | CHANGES IN VERSION 1.17.2 48 | ------------------------ 49 | o use byte compiler <2016-05-18, Wed> 50 | o https://github.com/Bioconductor-mirror/ReactomePA/commit/6ce32c8e03e1b252662a07901cce022fab038086 51 | 52 | CHANGES IN VERSION 1.17.1 53 | ------------------------ 54 | o https://github.com/Bioconductor-mirror/ReactomePA/commit/5d150f5fe545cfa3983872bf5485af1b9ba3129d 55 | 56 | CHANGES IN VERSION 1.16.0 57 | ------------------------ 58 | o BioC 3.3 released <2016-05-05, Thu> 59 | 60 | CHANGES IN VERSION 1.15.6 61 | ------------------------ 62 | o fixed issue of duplicated name in PATHID2NAME <2016-04-21, Thu> 63 | 64 | CHANGES IN VERSION 1.15.5 65 | ------------------------ 66 | o add maxGSSize parameter <2016-03-10, Thu> 67 | o update ReactomePA citation info <2016-02-17, Wed> 68 | 69 | CHANGES IN VERSION 1.15.4 70 | ------------------------ 71 | o according to the update of DOSE <2015-12-20, Sun> 72 | 73 | CHANGES IN VERSION 1.15.3 74 | ------------------------ 75 | o update citation info <2015-11-24, Tue> 76 | 77 | CHANGES IN VERSION 1.15.2 78 | ------------------------ 79 | o update vignette <2015-11-16, Mon> 80 | 81 | CHANGES IN VERSION 1.15.1 82 | ------------------------ 83 | o update vignette <2015-10-28, Wed> 84 | 85 | CHANGES IN VERSION 1.14.0 86 | ------------------------ 87 | o BioC 3.2 Branch 88 | 89 | CHANGES IN VERSION 1.13.5 90 | ------------------------ 91 | o add support of fly (Drosophila melanogaster) <2015-09-22, Tue> 92 | 93 | CHANGES IN VERSION 1.13.4 94 | ------------------------ 95 | o update vignette <2015-08-19, Wed> 96 | 97 | CHANGES IN VERSION 1.13.3 98 | ------------------------ 99 | o add citation of ChIPseeker <2015-07-09, Thu> 100 | o add 'Pathway analysis of NGS data' section in vignette <2015-06-29, Mon> 101 | o convert vignette from Rnw to Rmd <2015-06-29, Mon> 102 | 103 | CHANGES IN VERSION 1.13.2 104 | ------------------------ 105 | o enable other organisms for viewPathway by Vladislav Petyuk <2015-05-28, Thu> 106 | see https://github.com/GuangchuangYu/ReactomePA/pull/1 107 | 108 | CHANGES IN VERSION 1.13.1 109 | ------------------------ 110 | o update enrichMap and viewPathway <2015-05-13, Wed> 111 | 112 | CHANGES IN VERSION 1.11.9 113 | ------------------------ 114 | o use mapIds instead of mget in TERM2NAME. mapIds will not throw error when pathID is old/deprecated. <2015-04-10, Fri> 115 | 116 | CHANGES IN VERSION 1.11.8 117 | ------------------------ 118 | o according to https://support.bioconductor.org/p/63024/#66438, modify gsePathway to only test pathways. <2015-04-09, Thu> 119 | 120 | CHANGES IN VERSION 1.11.7 121 | ------------------------ 122 | o update use_internal_data parameter to ... according to the change of DOSE <2015-04-01, Wed> 123 | 124 | CHANGES IN VERSION 1.11.6 125 | ------------------------ 126 | o update according to DOSE <2015-03-31, Tue> 127 | add use_internal_data parameter in internal functional of enrichPathway. 128 | 129 | CHANGES IN VERSION 1.11.5 130 | ------------------------ 131 | o update according to DOSE <2015-03-01, Sun> 132 | add use_internal_data parameter in getGeneSet. 133 | 134 | CHANGES IN VERSION 1.11.2 135 | ------------------------ 136 | o remove import org.Hs.eg.db <2015-01-22, Thu> 137 | 138 | CHANGES IN VERSION 1.11.1 139 | ------------------------ 140 | o fix some pathways don't have a name <2014-11-17, Mon> 141 | ## > get("5493857", reactomePATHID2EXTID) 142 | ## [1] "510850" "523328" "282187" "282188" ... 143 | ## > get("5493857", reactomePATHID2NAME) 144 | ## Error in .checkKeys(value, Lkeys(x), x@ifnotfound) : 145 | ## value for "5493857" not found 146 | 147 | --> This is not a bug in ReactomePA, but an issue of reactome.db, refer to: 148 | --> https://support.bioconductor.org/p/63024/ 149 | 150 | 151 | CHANGES IN VERSION 1.9.4 152 | ------------------------ 153 | o add gseaplot function <2014-07-31, Thu> 154 | 155 | CHANGES IN VERSION 1.9.3 156 | ------------------------ 157 | o import enrichMap from DOSE <2014-07-31, Thu> 158 | 159 | CHANGES IN VERSION 1.9.2 160 | ------------------------ 161 | o update roxygen to version 4 <2014-06-09, Mon> 162 | 163 | CHANGES IN VERSION 1.9.1 164 | ------------------------ 165 | o bug fixed of TERM2NAME.Reactome <2014-04-21, Mon> 166 | 167 | CHANGES IN VERSION 1.7.2 168 | ------------------------ 169 | o bug fixed for multi-organisms support <2013-12-09, Mon> 170 | 171 | CHANGES IN VERSION 1.5.3 172 | ------------------------ 173 | o bug fixed in TERMID2EXTID <2013-09-18, Wed> 174 | 175 | CHANGES IN VERSION 1.5.2 176 | ------------------------ 177 | o implement gseAnalyzer for GSEA analysis <2013-07-10, Wed> 178 | o implement viewPathway for visualizing pathway <2013-07-10, Wed> 179 | 180 | CHANGES IN VERSION 1.5.1 181 | ------------------------ 182 | o extend enrichPathway to support rat, mouse, celegans, zebrafish, and fly. <2013-03-27, Wed> 183 | o modify enrichPathway according to the change of enrich.internal, remove qvalueCutoff parameter, 184 | add pAdjustMethod, add universe paramter for user to specify background. <2013-05-29, Wed> 185 | 186 | CHANGES IN VERSION 1.3.1 187 | ------------------------ 188 | o bug fixed of ALLEXTID. <2013-03-1, Fri> 189 | 190 | CHANGES IN VERSION 1.1.1 191 | ------------------------ 192 | o remove geneID2Name, instead import EXTID2NAME from DOSE. <2012-03-12, Mon> 193 | o remove most of the codes in enrichPathway, instead import enrich.internal in DOSE. 194 | implement some S3 method for mapping. 195 | pathID2Name was rename to TERM2NAME, which will called by enrich.internal. <2012-03-12, Tue> 196 | 197 | CHANGES IN VERSION 0.99.0 198 | ------------------------ 199 | o change package name to ReactomePA, for there is already an RPA package. <2012-03-02, Fri> 200 | o Vignette issues: <2012-03-02, Fri> 201 | change image format from .eps to .pdf, make it easier to build. 202 | remove the tolatex tag of sessionInfo(), make the output more readble. 203 | o re-implement geneID2Name using select method. <2012-03-02, Fri> 204 | o add examples in man pages. <2012-03-02, Fri> 205 | o remove man pages of internal functions. <2012-03-02, Fri> 206 | o import plot summary from stats4, for BiocGenerics (version 0.1.10) removed them <2012-03-03, Sat> 207 | o add Methods section in enrichPathwayResult-class man page. <2012-03-05, Mon> 208 | 209 | CHANGES IN VERSION 0.2.3 210 | ------------------------ 211 | o @exportMethod plot <2012-02-15 Wed> 212 | o fix bug when calling summary method from plot, 213 | for summary defined in base is S3 method, 214 | instead import summary generic from stats4 <2012-02-15 Wed> 215 | 216 | CHANGES IN VERSION 0.2.2 217 | ------------------------ 218 | o remove generic definition of show, summary and plot, add NAMESPACE import show 219 | from methods and plot from graphics. summary need not to import, for is defined 220 | in the base package <2012-02-10 Fri> 221 | 222 | CHANGES IN VERSION 0.2.1 223 | ------------------------ 224 | o update vignette <2012-02-09 Thu> 225 | o add sample data (an example list of genes from ProfCom: 226 | http://webclu.bio.wzw.tum.de/profcom/gene_Lists/example1.txt 227 | the gene symbols were converted to entrezgene) <2012-02-09 Thu> 228 | 229 | CHANGES IN VERSION 0.2.0 230 | ------------------------ 231 | o separate codes of mapping pathway ID to pathway Name to a new function pathID2Name <2012-02-09 Thu> 232 | o implement geneID2Name function for mapping gene ID to gene Symbol <2012-02-09 Thu> 233 | o add parameter readable in function enrichPathway <2012-02-09 Thu> 234 | o implement cnetplot for plotting category net <2012-02-09 Thu> 235 | o modify plot function for class enrichPathwayResult to use cnetplot <2012-02-09 Thu> 236 | 237 | CHANGES IN VERSION 0.1.1 238 | ------------------------ 239 | o add vignette <2012-02-08 Wed> 240 | o bug fixed for multiple mapping of pathway ID to pathway Name 241 | such as pathway 162906 can mapping to 1629061 242 | and 1629062 when getting pathway name, remain the first one. <2012-02-08 Wed> 243 | 244 | CHANGES IN VERSION 0.1.0 245 | ------------------------ 246 | o implement show, summary and plot method for enrichPathwayResult class <2012-02-08 Wed> 247 | o define class enrichPathwayResult to store result of enrichPathway <2012-02-08 Wed> 248 | o implement enrichPathway function for enrichment analysis. 249 | using hypergeometric model <2012-02-08 Wed> 250 | o initial package skeleton <2012-02-08 Wed> 251 | 252 | 253 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # ReactomePA 1.52.0 2 | 3 | + Bioconductor RELEASE_3_21 (2025-04-17, Thu) 4 | 5 | # ReactomePA 1.50.0 6 | 7 | + Bioconductor (2024-10-30, Wed) 8 | 9 | # ReactomePA 1.49.1 10 | 11 | + use `yulab.utils::yulab_msg()` for startup message (2024-07-26, Fri) 12 | 13 | # ReactomePA 1.48.0 14 | 15 | + Bioconductor RELEASE_3_19 (2024-05-15, Wed) 16 | 17 | # ReactomePA 1.47.1 18 | 19 | + Add a disclaimer in package Description to claim that this package is not affiliated with the Reactome team (2023-11-17, Fri) 20 | 21 | # ReactomePA 1.46.0 22 | 23 | + Bioconductor RELEASE_3_18 (2023-10-25, Wed) 24 | 25 | # ReactomePA 1.44.0 26 | 27 | + Bioconductor RELEASE_3_16 (2022-11-02, Wed) 28 | 29 | # ReactomePA 1.41.1 30 | 31 | + add function `gson_Reactome` (2022-7-13, Wed) 32 | 33 | # ReactomePA 1.34.0 34 | 35 | + Bioconductor 3.12 release (2020-10-28, Wed) 36 | 37 | -------------------------------------------------------------------------------- /R/DOSE.R: -------------------------------------------------------------------------------- 1 | 2 | ##' @importFrom DOSE geneID 3 | ##' @export 4 | DOSE::geneID 5 | 6 | ##' @importFrom DOSE geneInCategory 7 | ##' @export 8 | DOSE::geneInCategory 9 | -------------------------------------------------------------------------------- /R/ReactomePA-package.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | "_PACKAGE" 3 | 4 | 5 | #' Datasets 6 | #' sample contains a sample of gene IDs. 7 | #' 8 | #' 9 | #' @name DataSet 10 | #' @docType data 11 | #' @keywords datasets 12 | NULL 13 | -------------------------------------------------------------------------------- /R/enrichPathway.R: -------------------------------------------------------------------------------- 1 | ##' Pathway Enrichment Analysis of a gene set. 2 | ##' Given a vector of genes, this function will return the enriched pathways 3 | ##' with FDR control. 4 | ##' 5 | ##' 6 | ##' @param gene a vector of entrez gene id. 7 | ##' @param organism one of "human", "rat", "mouse", "celegans", "yeast", "zebrafish", "fly". 8 | ##' @param pvalueCutoff Cutoff value of pvalue. 9 | ##' @param pAdjustMethod one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" 10 | ##' @param qvalueCutoff Cutoff value of qvalue 11 | ##' @param universe background genes 12 | ##' @param minGSSize minimal size of genes annotated by Ontology term for testing. 13 | ##' @param maxGSSize maximal size of each geneSet for analyzing 14 | ##' @param readable whether mapping gene ID to gene Name 15 | ##' @return A \code{enrichResult} instance. 16 | ##' @importFrom DOSE setReadable 17 | ##' @importClassesFrom DOSE enrichResult 18 | ##' @importMethodsFrom DOSE show 19 | ##' @importMethodsFrom DOSE summary 20 | ##' @importFrom DOSE EXTID2NAME 21 | ##' @export 22 | ##' @author Guangchuang Yu \url{http://ygc.name} 23 | ##' @seealso \code{\link{enrichResult-class}} 24 | ##' @keywords manip 25 | ##' @examples 26 | ##' 27 | ##' gene <- c("11171", "8243", "112464", "2194", 28 | ##' "9318", "79026", "1654", "65003", 29 | ##' "6240", "3476", "6238", "3836", 30 | ##' "4176", "1017", "249") 31 | ##' yy = enrichPathway(gene, pvalueCutoff=0.05) 32 | ##' head(summary(yy)) 33 | ##' #plot(yy) 34 | ##' 35 | enrichPathway <- function(gene, 36 | organism="human", 37 | pvalueCutoff = 0.05, 38 | pAdjustMethod="BH", 39 | qvalueCutoff = 0.2, 40 | universe, 41 | minGSSize=10, 42 | maxGSSize=500, 43 | readable=FALSE) { 44 | 45 | Reactome_DATA <- get_Reactome_DATA(organism) 46 | 47 | res <- enricher_internal(gene, 48 | pvalueCutoff=pvalueCutoff, 49 | pAdjustMethod=pAdjustMethod, 50 | qvalueCutoff=qvalueCutoff, 51 | universe = universe, 52 | minGSSize = minGSSize, 53 | maxGSSize = maxGSSize, 54 | USER_DATA = Reactome_DATA) 55 | 56 | if (is.null(res)) 57 | return(res) 58 | 59 | res@keytype <- "ENTREZID" 60 | res@organism <- organism 61 | OrgDb <- getDb(organism) 62 | if (readable) { 63 | res <- setReadable(res, OrgDb) 64 | } 65 | res@ontology <- "Reactome" 66 | return(res) 67 | } 68 | 69 | 70 | 71 | ## ' @importFrom DOSE TERM2NAME 72 | ## ' @importFrom reactome.db reactomePATHID2NAME 73 | ## ' @importFrom reactome.db reactome.db 74 | ## ' @importMethodsFrom AnnotationDbi mget 75 | ## ' @importMethodsFrom AnnotationDbi mapIds 76 | ## ' @method TERM2NAME Reactome 77 | ## ' @export 78 | ## TERM2NAME.Reactome <- function(term, organism, ...) { 79 | ## pathID <- as.character(term) 80 | ## ## pathName <- mget(pathID, reactomePATHID2NAME) 81 | ## pathName <- mapIds(reactome.db, pathID, 'PATHNAME', 'PATHID') 82 | ## pathName <- pathName[!is.na(pathName)] 83 | 84 | ## ## 85 | ## ## this issue had been solve since reactome 52 86 | ## ## 87 | ## ## multiple mapping exists. 88 | ## ## 89 | ## ## 90 | 91 | ## ## > term 92 | ## ## Homo sapiens: NS1 Mediated Effects on Host Pathways 93 | ## ## "168276" 94 | ## ## Homo sapiens: 2-LTR circle formation 95 | ## ## "164843" 96 | ## ## > pathName <- unlist(mget(pathID, reactomePATHID2NAME)) 97 | ## ## > pathName 98 | ## ## 1682761 99 | ## ## "Homo sapiens: NS1 Mediated Effects on Host Pathways" 100 | ## ## 1682762 101 | ## ## "Influenza A virus: NS1 Mediated Effects on Host Pathways" 102 | ## ## 1648431 103 | ## ## "Homo sapiens: 2-LTR circle formation" 104 | ## ## 1648432 105 | ## ## "Human immunodeficiency virus 1: 2-LTR circle formation" 106 | ## ## 1629061 107 | ## ## "Human immunodeficiency virus 1: HIV Infection" 108 | ## ## 1629062 109 | ## ## "Homo sapiens: HIV Infection" 110 | ## ## 1629063 111 | ## ## "Human immunodeficiency virus 2: HIV Infection" 112 | 113 | ## ## The following description contain "Homo sapiens", and report a bug. 114 | ## ## "Mycobacterium tuberculosis: Latent infection of Homo sapiens with Mycobacterium tuberculosis" 115 | ## ## To fix it, the ":" should presented in grep. 116 | ## org <- switch(organism, 117 | ## human = "Homo sapiens:", 118 | ## rat = "Rattus norvegicus:", 119 | ## mouse = "Mus musculus:", 120 | ## yeast = "Saccharomyces cerevisiae:", 121 | ## zebrafish = "Danio rerio:", 122 | ## celegans = "Caenorhabditis elegans:", 123 | ## fly = "Drosophila melanogaster:" 124 | ## ) 125 | 126 | ## pathName <- sapply(pathName, function(p) p[grep(org, p)]) 127 | ## pathName <- unlist(pathName) 128 | ## pathName <- sapply(pathName, function(i) unlist(strsplit(i, split=org))[2]) # splitting by ":" is risky 129 | ## pathName <- sub("^\\s+", "", pathName) # remove leading spaces 130 | 131 | ## ## 132 | ## ## BUG was reported by Jean-Christophe Aude (Jean-Christophe.AUDE@cea.fr) 133 | ## ## 134 | ## ## > get("174495", reactomePATHID2NAME) 135 | ## ## [1] "Human immunodeficiency virus 1: Synthesis And Processing Of GAG, GAGPOL Polyproteins" 136 | ## ## human genes involves, but pathway name was not labelled by "Homo sapiens". 137 | 138 | ## ## get first term of missing ID 139 | ## missID <- pathID[ ! pathID %in% names(pathName) ] 140 | ## if (length(missID) > 0 ) { 141 | ## missPathName <- unlist(sapply(mget(missID, reactomePATHID2NAME), "[[", 1)) 142 | ## names(missPathName) <- missID 143 | ## } else { 144 | ## missPathName <- NA 145 | ## } 146 | ## if (is.na(missPathName)) { 147 | ## res <- pathName 148 | ## } else { 149 | ## ## merge and keep input order 150 | ## res <- c(pathName, missPathName) 151 | ## res <- res[pathID] 152 | ## } 153 | ## return(res) 154 | ## } 155 | 156 | -------------------------------------------------------------------------------- /R/enrichplot.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom enrichplot cnetplot 2 | ##' @export 3 | enrichplot::cnetplot 4 | 5 | ##' @importFrom enrichplot dotplot 6 | ##' @export 7 | enrichplot::dotplot 8 | 9 | ##' @importFrom enrichplot emapplot 10 | ##' @export 11 | enrichplot::emapplot 12 | 13 | 14 | ##' @importFrom enrichplot gseaplot 15 | ##' @export 16 | enrichplot::gseaplot 17 | 18 | ##' @importFrom enrichplot heatplot 19 | ##' @export 20 | enrichplot::heatplot 21 | 22 | ##' @importFrom enrichplot ridgeplot 23 | ##' @export 24 | enrichplot::ridgeplot 25 | -------------------------------------------------------------------------------- /R/gseAnalyzer.R: -------------------------------------------------------------------------------- 1 | ##' Gene Set Enrichment Analysis of Reactome Pathway 2 | ##' 3 | ##' 4 | ##' @title gsePathway 5 | ##' @param geneList order ranked geneList 6 | ##' @param organism organism 7 | ##' @param exponent weight of each step 8 | ##' @param minGSSize minimal size of each geneSet for analyzing 9 | ##' @param maxGSSize maximal size of each geneSet for analyzing 10 | ##' @param eps This parameter sets the boundary for calculating the p value. 11 | ##' @param pvalueCutoff pvalue Cutoff 12 | ##' @param pAdjustMethod pvalue adjustment method 13 | ##' @param verbose print message or not 14 | ##' @param seed logical 15 | ##' @param by one of 'fgsea' or 'DOSE' 16 | ##' @param ... other parameter 17 | ##' @importClassesFrom DOSE gseaResult 18 | ##' @importMethodsFrom DOSE show 19 | ##' @importMethodsFrom DOSE summary 20 | ##' @export 21 | ##' @return gseaResult object 22 | ##' @author Yu Guangchuang 23 | gsePathway <- function(geneList, 24 | organism = "human", 25 | exponent = 1, 26 | minGSSize = 10, 27 | maxGSSize = 500, 28 | eps = 1e-10, 29 | pvalueCutoff = 0.05, 30 | pAdjustMethod = "BH", 31 | verbose = TRUE, 32 | seed = FALSE, 33 | by = 'fgsea', 34 | ...) { 35 | 36 | Reactome_DATA <- get_Reactome_DATA(organism) 37 | 38 | res <- GSEA_internal(geneList = geneList, 39 | exponent = exponent, 40 | minGSSize = minGSSize, 41 | maxGSSize = maxGSSize, 42 | eps = eps, 43 | pvalueCutoff = pvalueCutoff, 44 | pAdjustMethod = pAdjustMethod, 45 | verbose = verbose, 46 | USER_DATA = Reactome_DATA, 47 | seed = seed, 48 | by = by, 49 | ...) 50 | 51 | if (is.null(res)) 52 | return(res) 53 | 54 | res@organism <- organism 55 | res@setType <- "Reactome" 56 | res@keytype <- "ENTREZID" 57 | 58 | return(res) 59 | } 60 | 61 | # Create a new environment to avoid assignments to 62 | # a user's global environment 63 | reactome_env <- new.env(parent = emptyenv()) 64 | get_Reactome_Env <- function() { 65 | 66 | if (!exists(".ReactomePA_Env", envir = reactome_env)) { 67 | assign(".ReactomePA_Env", new.env(), reactome_env) 68 | } 69 | get(".ReactomePA_Env", envir= reactome_env) 70 | } 71 | 72 | ##' @importMethodsFrom AnnotationDbi as.list 73 | ##' @importFrom reactome.db reactomeEXTID2PATHID 74 | ##' @importFrom reactome.db reactomePATHID2EXTID 75 | ##' @importFrom reactome.db reactomePATHID2NAME 76 | get_Reactome_DATA <- function(organism = "human") { 77 | ReactomePA_Env <- get_Reactome_Env() 78 | 79 | if (exists("organism", envir=ReactomePA_Env, inherits = FALSE)) { 80 | org <- get("organism", envir=ReactomePA_Env) 81 | if (org == organism && 82 | exists("PATHID2EXTID", envir = ReactomePA_Env) && 83 | exists("EXTID2PATHID", envir = ReactomePA_Env) && 84 | exists("PATHID2NAME", envir = ReactomePA_Env)) { 85 | 86 | ## use_cached 87 | return(ReactomePA_Env) 88 | } 89 | } 90 | 91 | ALLEG <- getALLEG(organism) 92 | 93 | EXTID2PATHID <- as.list(reactomeEXTID2PATHID) 94 | EXTID2PATHID <- EXTID2PATHID[names(EXTID2PATHID) %in% ALLEG] 95 | 96 | PATHID2EXTID <- as.list(reactomePATHID2EXTID) ## also contains reactions 97 | 98 | PATHID2NAME <- as.list(reactomePATHID2NAME) 99 | PI <- names(PATHID2NAME) 100 | ## > PATHID2NAME[['68877']] 101 | ## [1] "Homo sapiens: Mitotic Prometaphase" "Homo sapiens: Mitotic Prometaphase" 102 | PATHID2NAME <- lapply(PATHID2NAME, function(x) x[1]) 103 | names(PATHID2NAME) <- PI 104 | 105 | PATHID2EXTID <- PATHID2EXTID[names(PATHID2EXTID) %in% names(PATHID2NAME)] 106 | PATHID2EXTID <- PATHID2EXTID[names(PATHID2EXTID) %in% unique(unlist(EXTID2PATHID))] 107 | PATHID2EXTID <- lapply(PATHID2EXTID, function(x) intersect(x, ALLEG)) 108 | 109 | PATHID2NAME <- PATHID2NAME[names(PATHID2NAME) %in% names(PATHID2EXTID)] 110 | 111 | PATHID2NAME <- unlist(PATHID2NAME) 112 | PATHID2NAME <- gsub("^\\w+\\s\\w+:\\s+", "", PATHID2NAME) # remove leading spaces 113 | 114 | assign("PATHID2EXTID", PATHID2EXTID, envir=ReactomePA_Env) 115 | assign("EXTID2PATHID", EXTID2PATHID, envir=ReactomePA_Env) 116 | assign("PATHID2NAME", PATHID2NAME, envir=ReactomePA_Env) 117 | return(ReactomePA_Env) 118 | } 119 | 120 | 121 | ##' get all entrezgene ID of a specific organism 122 | ##' 123 | ##' 124 | ##' @title getALLEG 125 | ##' @param organism species 126 | ##' @return entrez gene ID vector 127 | ##' @importMethodsFrom AnnotationDbi keys 128 | ##' @author Yu Guangchuang 129 | getALLEG <- function(organism) { 130 | annoDb <- getDb(organism) 131 | require(annoDb, character.only = TRUE) 132 | annoDb <- eval(parse(text=annoDb)) 133 | eg=keys(annoDb, keytype="ENTREZID") 134 | return(eg) 135 | } 136 | 137 | -------------------------------------------------------------------------------- /R/gson.R: -------------------------------------------------------------------------------- 1 | ##' download the latest version of Reactome and stored in a 'GSON' object 2 | ##' 3 | ##' 4 | ##' @title gson_Reactome 5 | ##' @param organism one of "human", "rat", "mouse", "celegans", "yeast", "zebrafish", "fly". 6 | ##' @return a 'GSON' object 7 | ##' @importFrom gson gson 8 | ##' @importFrom utils stack 9 | ##' @export 10 | ##' @examples 11 | ##' \dontrun{ 12 | ##' rec_gson <- gson_Reactome("human") 13 | ##' } 14 | ##' 15 | gson_Reactome <- function(organism = "human") { 16 | 17 | Reactome_DATA <- get_Reactome_DATA(organism) 18 | EXTID2PATHID = get("EXTID2PATHID", envir=Reactome_DATA) 19 | PATHID2EXTID = get("PATHID2EXTID", envir = Reactome_DATA) 20 | PATHID2NAME = get("PATHID2NAME", envir = Reactome_DATA) 21 | 22 | 23 | ############### 24 | reactomeAnno <- stack(PATHID2EXTID) 25 | gsid2gene <- reactomeAnno[, c(2,1)] 26 | colnames(gsid2gene) <- c("gsid", "gene") 27 | gsid2gene <- unique(gsid2gene[!is.na(gsid2gene[,2]), ]) 28 | 29 | termname <- PATHID2NAME 30 | gsid2name <- data.frame(gsid = names(termname), 31 | name = termname) 32 | species <- organism 33 | m <- AnnotationDbi::metadata(reactome.db::reactome.db) 34 | version <- paste("Version: ", 35 | m$value[m$name == "DBSCHEMAVERSION"], 36 | "; Source date: ", 37 | m$value[m$name == "SOURCEDATE"], 38 | sep = "") 39 | info = paste("Source url: ", m$value[m$name == "SOURCEURL"], sep = "") 40 | gson(gsid2gene = gsid2gene, 41 | gsid2name = gsid2name, 42 | species = species, 43 | gsname = "reactome pathway", 44 | version = version, 45 | accessed_date = as.character(Sys.Date()), 46 | keytype = "ENTREZID", 47 | info = info 48 | ) 49 | } -------------------------------------------------------------------------------- /R/utilities.R: -------------------------------------------------------------------------------- 1 | ##' mapping organism name to annotationDb package name 2 | ##' 3 | ##' 4 | ##' @title getDb 5 | ##' @param organism one of supported organism 6 | ##' @return annotationDb name 7 | ##' @author Yu Guangchuang 8 | getDb <- function(organism) { 9 | if (organism == "worm") { 10 | organism = "celegans" 11 | warning("'worm' is deprecated, please use 'celegans' instead...") 12 | } 13 | 14 | annoDb <- switch(organism, 15 | anopheles = "org.Ag.eg.db", 16 | arabidopsis = "org.At.tair.db", 17 | bovine = "org.Bt.eg.db", 18 | canine = "org.Cf.eg.db", 19 | celegans = "org.Ce.eg.db", 20 | chicken = "org.Gg.eg.db", 21 | chimp = "org.Pt.eg.db", 22 | coelicolor = "org.Sco.eg.db", 23 | ecolik12 = "org.EcK12.eg.db", 24 | ecsakai = "org.EcSakai.eg.db", 25 | fly = "org.Dm.eg.db", 26 | gondii = "org.Tgondii.eg.db", 27 | human = "org.Hs.eg.db", 28 | malaria = "org.Pf.plasmo.db", 29 | mouse = "org.Mm.eg.db", 30 | pig = "org.Ss.eg.db", 31 | rat = "org.Rn.eg.db", 32 | rhesus = "org.Mmu.eg.db", 33 | xenopus = "org.Xl.eg.db", 34 | yeast = "org.Sc.sgd.db", 35 | zebrafish = "org.Dr.eg.db", 36 | ) 37 | return(annoDb) 38 | } 39 | 40 | enricher_internal <- DOSE:::enricher_internal 41 | GSEA_internal <- DOSE:::GSEA_internal 42 | -------------------------------------------------------------------------------- /R/viewPathway.R: -------------------------------------------------------------------------------- 1 | ##' view reactome pathway 2 | ##' 3 | ##' plotting reactome pathway 4 | ##' @title viewPathway 5 | ##' @param pathName pathway Name 6 | ##' @param organism supported organism 7 | ##' @param readable logical 8 | ##' @param foldChange fold change 9 | ##' @param keyType keyType of gene ID (i.e. names of foldChange, if available) 10 | ##' @param layout graph layout 11 | ## @importFrom graphite pathways 12 | ##' @importFrom graphite convertIdentifiers 13 | ##' @importFrom graphite pathwayGraph 14 | ##' @importFrom igraph igraph.from.graphNEL 15 | ##' @importFrom igraph as.undirected 16 | ##' @importFrom igraph V<- 17 | ##' @importFrom DOSE EXTID2NAME 18 | ##' @importFrom ggraph ggraph 19 | ##' @importFrom ggraph geom_edge_link 20 | ##' @importFrom ggraph geom_node_point 21 | ##' @importFrom ggraph geom_node_text 22 | ##' @importFrom ggplot2 aes_ 23 | ##' @importFrom ggplot2 scale_color_continuous 24 | ##' @importFrom ggplot2 scale_size 25 | ##' @importFrom ggplot2 theme_void 26 | ##' @return plot 27 | ##' @export 28 | ##' @author Yu Guangchuang 29 | viewPathway <- function(pathName, 30 | organism="human", 31 | readable=TRUE, 32 | foldChange=NULL, 33 | keyType = "ENTREZID", 34 | layout = "kk"){ 35 | 36 | ## call pathways via imported from graphite has the following issue: 37 | ## 38 | ## Error: processing vignette 'ReactomePA.Rnw' failed with diagnostics: 39 | ## no item called "package:graphite" on the search list 40 | ## Execution halted 41 | ## 42 | 43 | pkg <- "graphite" 44 | require(pkg, character.only=TRUE) 45 | 46 | # convertion to the names that graphite::pathways understands 47 | org2org <- list(arabidopsis="athaliana", 48 | bovine="btaurus", 49 | canine="cfamiliaris", 50 | chicken="ggallus", 51 | ecolik12="ecoli", 52 | fly="dmelanogaster", 53 | human="hsapiens", 54 | mouse="mmusculus", 55 | pig="sscrofa", 56 | rat="rnorvegicus", 57 | celegans="celegans", 58 | xenopus="xlaevis", 59 | yeast="scerevisiae", 60 | zebrafish="drerio") 61 | 62 | if(!(organism %in% names(org2org))){ 63 | cat(paste(c("the list of supported organisms:",names(org2org)), collapse='\n')) 64 | stop(sprintf("organism %s is not supported", organism)) 65 | } 66 | pathways <- eval(parse(text="pathways")) 67 | p <- pathways(org2org[[organism]], 'reactome')[[pathName]] 68 | 69 | if (readable) { 70 | p <- convertIdentifiers(p, "symbol") 71 | if (!is.null(foldChange)) { 72 | stopifnot(!any(duplicated(names(foldChange)))) # can't have two value for one gene 73 | OrgDb <- getDb(organism) 74 | names(foldChange) <- EXTID2NAME(OrgDb, names(foldChange), keyType) 75 | 76 | } 77 | } else { 78 | if (!is.null(foldChange)) { 79 | p <- convertIdentifiers(p, "entrez") 80 | } 81 | } 82 | 83 | g <- pathwayGraph(p) 84 | gg <- igraph.from.graphNEL(g) 85 | gg <- as.undirected(gg) 86 | gg <- setting.graph.attributes(gg) 87 | V(gg)$name <- sub("[^:]+:", "", V(gg)$name) 88 | 89 | if (!is.null(foldChange)) { 90 | ## gg <- scaleNodeColor(gg, foldChange) 91 | fc <- foldChange[V(gg)$name] 92 | V(gg)$color <- fc 93 | ## palette <- enrichplot:::fc_palette(fc) 94 | 95 | } 96 | ## netplot(gg, foldChange=foldChange, ...) 97 | ggraph(gg, layout=layout) + 98 | geom_edge_link(alpha=.8, colour='darkgrey') + 99 | geom_node_point(aes_(color=~as.numeric(as.character(color)), size=~size)) + 100 | scale_color_continuous(low="red", high="blue", name = "fold change", na.value = "#E5C494") + 101 | geom_node_text(aes_(label=~name), repel=TRUE) + 102 | ## scale_color_gradientn(name = "fold change", colors=palette, na.value = "#E5C494") + 103 | scale_size(guide = "none") + theme_void() 104 | } 105 | 106 | 107 | ##' @importFrom igraph V 108 | ##' @importFrom igraph V<- 109 | ##' @importFrom igraph E 110 | ##' @importFrom igraph E<- 111 | setting.graph.attributes <- function(g, node.size=8, 112 | node.color="#B3B3B3", 113 | edege.width=2, 114 | edege.color="#8DA0CB") { 115 | V(g)$size <- node.size 116 | V(g)$color <- node.color 117 | V(g)$label <- V(g)$name 118 | 119 | E(g)$width <- edege.width 120 | E(g)$color <- edege.color 121 | 122 | return(g) 123 | } 124 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom yulab.utils yulab_msg 2 | .onAttach <- function(libname, pkgname) { 3 | packageStartupMessage(yulab_msg(pkgname)) 4 | } 5 | 6 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: 3 | md_document: 4 | variant: gfm 5 | html_preview: false 6 | --- 7 | 8 | 9 | ```{r echo=FALSE, results="hide", message=FALSE} 10 | library("badger") 11 | library("ypages") 12 | ``` 13 | 14 | # ReactomePA: Reactome Pathway Analysis 15 | 16 | [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 17 | [![codecov](https://codecov.io/gh/GuangchuangYu/ReactomePA/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ReactomePA/) 18 | `r badge_bioc_release("ReactomePA", "green")` 19 | `r badge_devel("guangchuangyu/ReactomePA", "green")` 20 | [![Bioc](http://www.bioconductor.org/shields/years-in-bioc/clusterProfiler.svg)](https://www.bioconductor.org/packages/devel/bioc/html/clusterProfiler.html#since) 21 | 22 | 23 | [![platform](http://www.bioconductor.org/shields/availability/devel/ReactomePA.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ReactomePA.html#archives) 24 | [![Last-changedate](https://img.shields.io/badge/last%20change-`r gsub('-', '--', Sys.Date())`-green.svg)](https://github.com/GuangchuangYu/ReactomePA/commits/master) 25 | [![Build Status](http://www.bioconductor.org/shields/build/devel/bioc/ReactomePA.svg)](https://bioconductor.org/checkResults/devel/bioc-LATEST/ReactomePA/) 26 | [![Linux/Mac Travis Build Status](https://img.shields.io/travis/GuangchuangYu/ReactomePA/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/GuangchuangYu/ReactomePA) 27 | [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/Guangchuangyu/ReactomePA/master.svg?label=Windows)](https://ci.appveyor.com/project/GuangchuangYu/ReactomePA) 28 | 29 | 30 | 31 | 32 | ```{r comment="", echo=FALSE, results='asis'} 33 | cat(packageDescription('ReactomePA')$Description) 34 | ``` 35 | 36 | 37 | For details, please visit . 38 | 39 | 40 | ## :writing_hand: Authors 41 | 42 | Guangchuang YU 43 | 44 | School of Basic Medical Sciences, Southern Medical University 45 | 46 | 47 | 48 | 49 | [![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&logo=twitter)](https://twitter.com/intent/tweet?hashtags=ReactomePA&url=http://pubs.rsc.org/en/Content/ArticleLanding/2016/MB/C5MB00663E#!divAbstract) 50 | [![saythanks](https://img.shields.io/badge/say-thanks-ff69b4.svg)](https://saythanks.io/to/GuangchuangYu) 51 | `r badger::badge_custom('follow me on', 'WeChat', 'green', 'https://guangchuangyu.github.io/blog_images/biobabble.jpg')` 52 | 53 | 54 | 55 | ------------------------------------------------------------------------ 56 | 57 | Please cite the following article when using `ReactomePA`: 58 | 59 | __*G Yu*__, QY He^\*^. ReactomePA: an R/Bioconductor package for reactome pathway analysis and visualization. __*Molecular BioSystems*__ 2016, 12(2):477-479. 60 | 61 | 62 | `r badge_doi("10.1039/c5mb00663e", "green")` 63 | 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReactomePA: Reactome Pathway Analysis 2 | 3 | [![Project Status: Active - The project has reached a stable, usable 4 | state and is being actively 5 | developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 6 | [![codecov](https://codecov.io/gh/GuangchuangYu/ReactomePA/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ReactomePA/) 7 | [![](https://img.shields.io/badge/release%20version-1.40.0-green.svg)](https://www.bioconductor.org/packages/ReactomePA) 8 | [![](https://img.shields.io/badge/devel%20version-1.41.1-green.svg)](https://github.com/guangchuangyu/ReactomePA) 9 | [![Bioc](http://www.bioconductor.org/shields/years-in-bioc/clusterProfiler.svg)](https://www.bioconductor.org/packages/devel/bioc/html/clusterProfiler.html#since) 10 | 11 | [![platform](http://www.bioconductor.org/shields/availability/devel/ReactomePA.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ReactomePA.html#archives) 12 | [![Last-changedate](https://img.shields.io/badge/last%20change-2022--10--30-green.svg)](https://github.com/GuangchuangYu/ReactomePA/commits/master) 13 | [![Build 14 | Status](http://www.bioconductor.org/shields/build/devel/bioc/ReactomePA.svg)](https://bioconductor.org/checkResults/devel/bioc-LATEST/ReactomePA/) 15 | [![Linux/Mac Travis Build 16 | Status](https://img.shields.io/travis/GuangchuangYu/ReactomePA/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/GuangchuangYu/ReactomePA) 17 | [![AppVeyor Build 18 | Status](https://img.shields.io/appveyor/ci/Guangchuangyu/ReactomePA/master.svg?label=Windows)](https://ci.appveyor.com/project/GuangchuangYu/ReactomePA) 19 | 20 | This package provides functions for pathway analysis based on REACTOME 21 | pathway database. It implements enrichment analysis, gene set enrichment 22 | analysis and several functions for visualization. 23 | 24 | For details, please visit 25 | . 26 | 27 | ## :writing_hand: Authors 28 | 29 | Guangchuang YU 30 | 31 | School of Basic Medical Sciences, Southern Medical University 32 | 33 | 34 | 35 | [![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&logo=twitter)](https://twitter.com/intent/tweet?hashtags=ReactomePA&url=http://pubs.rsc.org/en/Content/ArticleLanding/2016/MB/C5MB00663E#!divAbstract) 36 | [![saythanks](https://img.shields.io/badge/say-thanks-ff69b4.svg)](https://saythanks.io/to/GuangchuangYu) 37 | [![](https://img.shields.io/badge/follow%20me%20on-WeChat-green.svg)](https://guangchuangyu.github.io/blog_images/biobabble.jpg) 38 | 39 | ------------------------------------------------------------------------ 40 | 41 | Please cite the following article when using `ReactomePA`: 42 | 43 | ***G Yu***, QY He\*. ReactomePA: an R/Bioconductor package 44 | for reactome pathway analysis and visualization. ***Molecular 45 | BioSystems*** 2016, 12(2):477-479. 46 | 47 | [![](https://img.shields.io/badge/doi-10.1039/c5mb00663e-green.svg)](https://doi.org/10.1039/c5mb00663e) 48 | 49 | 71 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - R_VERSION: devel 4 | R_ARCH: x64 5 | USE_RTOOLS: true 6 | R_CHECK_ARGS: --no-manual --no-build-vignettes 7 | R_BUILD_ARGS: --no-manual --no-build-vignettes 8 | _R_CHECK_FORCE_SUGGESTS_: false 9 | 10 | # DO NOT CHANGE the "init" and "install" sections below 11 | 12 | # Download script file from GitHub 13 | init: 14 | ps: | 15 | $ErrorActionPreference = "Stop" 16 | Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" 17 | Import-Module '..\appveyor-tool.ps1' 18 | 19 | install: 20 | ps: Bootstrap 21 | 22 | # Adapt as necessary starting from here 23 | 24 | build_script: 25 | - travis-tool.sh install_bioc BiocStyle AnnotationDbi DO.db igraph knitr org.Hs.eg.db reactome.db graphite clusterProfiler 26 | - travis-tool.sh install_deps 27 | 28 | test_script: 29 | - travis-tool.sh run_tests 30 | 31 | on_failure: 32 | - 7z a failure.zip *.Rcheck\* 33 | - appveyor PushArtifact failure.zip 34 | 35 | artifacts: 36 | - path: '*.Rcheck\**\*.log' 37 | name: Logs 38 | 39 | - path: '*.Rcheck\**\*.out' 40 | name: Logs 41 | 42 | - path: '*.Rcheck\**\*.fail' 43 | name: Logs 44 | 45 | - path: '*.Rcheck\**\*.Rout' 46 | name: Logs 47 | 48 | - path: '\*_*.tar.gz' 49 | name: Linux Package 50 | 51 | - path: '\*_*.zip' 52 | name: Windows Package 53 | 54 | notifications: 55 | - provider: Email 56 | to: 57 | - gcyu@connect.hku.hk 58 | on_build_success: false 59 | 60 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | ggtree 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("Please cite G. Yu (2015) for using ReactomePA. In addition, please cite G. Yu (2012) when using compareCluster in clusterProfiler package, G. Yu (2015) when applying enrichment analysis to NGS data by using ChIPseeker") 2 | 3 | citEntry(entry = "ARTICLE", 4 | title = "ReactomePA: an R/Bioconductor package for reactome pathway analysis and visualization", 5 | author = c( 6 | person("Guangchuang", "Yu"), 7 | person("Qing-Yu", "He") 8 | ), 9 | journal = "Molecular BioSystems", 10 | year = "2016", 11 | volume = "12", 12 | number = "12", 13 | pages = "477-479", 14 | PMID = "26661513", 15 | url = "http://pubs.rsc.org/en/Content/ArticleLanding/2015/MB/C5MB00663E", 16 | doi = "10.1039/C5MB00663E", 17 | textVersion = paste("Guangchuang Yu, Qing-Yu He.", 18 | "ReactomePA: an R/Bioconductor package for reactome pathway analysis and visualization.", 19 | "Molecular BioSystems 2016, 12(2):477-479") 20 | ) 21 | -------------------------------------------------------------------------------- /man/DataSet.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ReactomePA-package.R 3 | \docType{data} 4 | \name{DataSet} 5 | \alias{DataSet} 6 | \title{Datasets 7 | sample contains a sample of gene IDs.} 8 | \description{ 9 | Datasets 10 | sample contains a sample of gene IDs. 11 | } 12 | \keyword{datasets} 13 | -------------------------------------------------------------------------------- /man/ReactomePA-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ReactomePA-package.R 3 | \docType{package} 4 | \name{ReactomePA-package} 5 | \alias{ReactomePA} 6 | \alias{ReactomePA-package} 7 | \title{ReactomePA: Reactome Pathway Analysis} 8 | \description{ 9 | This package provides functions for pathway analysis based on REACTOME pathway database. It implements enrichment analysis, gene set enrichment analysis and several functions for visualization. This package is not affiliated with the Reactome team. 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://yulab-smu.top/biomedical-knowledge-mining-book/} 15 | \item Report bugs at \url{https://github.com/GuangchuangYu/ReactomePA/issues} 16 | } 17 | 18 | } 19 | \author{ 20 | \strong{Maintainer}: Guangchuang Yu \email{guangchuangyu@gmail.com} 21 | 22 | Other contributors: 23 | \itemize{ 24 | \item Vladislav Petyuk \email{petyuk@gmail.com} [contributor] 25 | } 26 | 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/enrichPathway.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/enrichPathway.R 3 | \name{enrichPathway} 4 | \alias{enrichPathway} 5 | \title{Pathway Enrichment Analysis of a gene set. 6 | Given a vector of genes, this function will return the enriched pathways 7 | with FDR control.} 8 | \usage{ 9 | enrichPathway( 10 | gene, 11 | organism = "human", 12 | pvalueCutoff = 0.05, 13 | pAdjustMethod = "BH", 14 | qvalueCutoff = 0.2, 15 | universe, 16 | minGSSize = 10, 17 | maxGSSize = 500, 18 | readable = FALSE 19 | ) 20 | } 21 | \arguments{ 22 | \item{gene}{a vector of entrez gene id.} 23 | 24 | \item{organism}{one of "human", "rat", "mouse", "celegans", "yeast", "zebrafish", "fly".} 25 | 26 | \item{pvalueCutoff}{Cutoff value of pvalue.} 27 | 28 | \item{pAdjustMethod}{one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"} 29 | 30 | \item{qvalueCutoff}{Cutoff value of qvalue} 31 | 32 | \item{universe}{background genes} 33 | 34 | \item{minGSSize}{minimal size of genes annotated by Ontology term for testing.} 35 | 36 | \item{maxGSSize}{maximal size of each geneSet for analyzing} 37 | 38 | \item{readable}{whether mapping gene ID to gene Name} 39 | } 40 | \value{ 41 | A \code{enrichResult} instance. 42 | } 43 | \description{ 44 | Pathway Enrichment Analysis of a gene set. 45 | Given a vector of genes, this function will return the enriched pathways 46 | with FDR control. 47 | } 48 | \examples{ 49 | 50 | gene <- c("11171", "8243", "112464", "2194", 51 | "9318", "79026", "1654", "65003", 52 | "6240", "3476", "6238", "3836", 53 | "4176", "1017", "249") 54 | yy = enrichPathway(gene, pvalueCutoff=0.05) 55 | head(summary(yy)) 56 | #plot(yy) 57 | 58 | } 59 | \seealso{ 60 | \code{\link{enrichResult-class}} 61 | } 62 | \author{ 63 | Guangchuang Yu \url{http://ygc.name} 64 | } 65 | \keyword{manip} 66 | -------------------------------------------------------------------------------- /man/getALLEG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gseAnalyzer.R 3 | \name{getALLEG} 4 | \alias{getALLEG} 5 | \title{getALLEG} 6 | \usage{ 7 | getALLEG(organism) 8 | } 9 | \arguments{ 10 | \item{organism}{species} 11 | } 12 | \value{ 13 | entrez gene ID vector 14 | } 15 | \description{ 16 | get all entrezgene ID of a specific organism 17 | } 18 | \author{ 19 | Yu Guangchuang 20 | } 21 | -------------------------------------------------------------------------------- /man/getDb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{getDb} 4 | \alias{getDb} 5 | \title{getDb} 6 | \usage{ 7 | getDb(organism) 8 | } 9 | \arguments{ 10 | \item{organism}{one of supported organism} 11 | } 12 | \value{ 13 | annotationDb name 14 | } 15 | \description{ 16 | mapping organism name to annotationDb package name 17 | } 18 | \author{ 19 | Yu Guangchuang 20 | } 21 | -------------------------------------------------------------------------------- /man/gsePathway.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gseAnalyzer.R 3 | \name{gsePathway} 4 | \alias{gsePathway} 5 | \title{gsePathway} 6 | \usage{ 7 | gsePathway( 8 | geneList, 9 | organism = "human", 10 | exponent = 1, 11 | minGSSize = 10, 12 | maxGSSize = 500, 13 | eps = 1e-10, 14 | pvalueCutoff = 0.05, 15 | pAdjustMethod = "BH", 16 | verbose = TRUE, 17 | seed = FALSE, 18 | by = "fgsea", 19 | ... 20 | ) 21 | } 22 | \arguments{ 23 | \item{geneList}{order ranked geneList} 24 | 25 | \item{organism}{organism} 26 | 27 | \item{exponent}{weight of each step} 28 | 29 | \item{minGSSize}{minimal size of each geneSet for analyzing} 30 | 31 | \item{maxGSSize}{maximal size of each geneSet for analyzing} 32 | 33 | \item{eps}{This parameter sets the boundary for calculating the p value.} 34 | 35 | \item{pvalueCutoff}{pvalue Cutoff} 36 | 37 | \item{pAdjustMethod}{pvalue adjustment method} 38 | 39 | \item{verbose}{print message or not} 40 | 41 | \item{seed}{logical} 42 | 43 | \item{by}{one of 'fgsea' or 'DOSE'} 44 | 45 | \item{...}{other parameter} 46 | } 47 | \value{ 48 | gseaResult object 49 | } 50 | \description{ 51 | Gene Set Enrichment Analysis of Reactome Pathway 52 | } 53 | \author{ 54 | Yu Guangchuang 55 | } 56 | -------------------------------------------------------------------------------- /man/gson_Reactome.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gson.R 3 | \name{gson_Reactome} 4 | \alias{gson_Reactome} 5 | \title{gson_Reactome} 6 | \usage{ 7 | gson_Reactome(organism = "human") 8 | } 9 | \arguments{ 10 | \item{organism}{one of "human", "rat", "mouse", "celegans", "yeast", "zebrafish", "fly".} 11 | } 12 | \value{ 13 | a 'GSON' object 14 | } 15 | \description{ 16 | download the latest version of Reactome and stored in a 'GSON' object 17 | } 18 | \examples{ 19 | \dontrun{ 20 | rec_gson <- gson_Reactome("human") 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /man/reexports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DOSE.R, R/enrichplot.R 3 | \docType{import} 4 | \name{reexports} 5 | \alias{reexports} 6 | \alias{geneID} 7 | \alias{geneInCategory} 8 | \alias{cnetplot} 9 | \alias{dotplot} 10 | \alias{emapplot} 11 | \alias{gseaplot} 12 | \alias{heatplot} 13 | \alias{ridgeplot} 14 | \title{Objects exported from other packages} 15 | \keyword{internal} 16 | \description{ 17 | These objects are imported from other packages. Follow the links 18 | below to see their documentation. 19 | 20 | \describe{ 21 | \item{DOSE}{\code{\link[DOSE]{geneID}}, \code{\link[DOSE]{geneInCategory}}} 22 | 23 | \item{enrichplot}{\code{\link[enrichplot]{cnetplot}}, \code{\link[enrichplot]{dotplot}}, \code{\link[enrichplot]{emapplot}}, \code{\link[enrichplot]{gseaplot}}, \code{\link[enrichplot]{heatplot}}, \code{\link[enrichplot]{ridgeplot}}} 24 | }} 25 | 26 | -------------------------------------------------------------------------------- /man/viewPathway.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/viewPathway.R 3 | \name{viewPathway} 4 | \alias{viewPathway} 5 | \title{viewPathway} 6 | \usage{ 7 | viewPathway( 8 | pathName, 9 | organism = "human", 10 | readable = TRUE, 11 | foldChange = NULL, 12 | keyType = "ENTREZID", 13 | layout = "kk" 14 | ) 15 | } 16 | \arguments{ 17 | \item{pathName}{pathway Name} 18 | 19 | \item{organism}{supported organism} 20 | 21 | \item{readable}{logical} 22 | 23 | \item{foldChange}{fold change} 24 | 25 | \item{keyType}{keyType of gene ID (i.e. names of foldChange, if available)} 26 | 27 | \item{layout}{graph layout} 28 | } 29 | \value{ 30 | plot 31 | } 32 | \description{ 33 | view reactome pathway 34 | } 35 | \details{ 36 | plotting reactome pathway 37 | } 38 | \author{ 39 | Yu Guangchuang 40 | } 41 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(ReactomePA) 3 | 4 | test_check("ReactomePA") 5 | 6 | -------------------------------------------------------------------------------- /tests/testthat/test-getDb.R: -------------------------------------------------------------------------------- 1 | library(ReactomePA) 2 | 3 | context("getDb") 4 | 5 | test_that("getDb", { 6 | expect_equal(getDb("human"), "org.Hs.eg.db") 7 | expect_equal(getDb("mouse"), "org.Mm.eg.db") 8 | }) 9 | 10 | -------------------------------------------------------------------------------- /vignettes/ReactomePA.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "An R package for Reactome Pathway Analysis" 3 | author: 4 | - name: Guangchuang Yu 5 | email: guangchuangyu@gmail.com 6 | affiliation: Department of Bioinformatics, School of Basic Medical Sciences, Southern Medical University 7 | date: "`r Sys.Date()`" 8 | biblio-style: apalike 9 | output: 10 | prettydoc::html_pretty: 11 | toc: true 12 | theme: cayman 13 | highlight: github 14 | pdf_document: 15 | toc: true 16 | vignette: > 17 | %\VignetteIndexEntry{An R package for Reactome Pathway Analysis} 18 | %\VignetteEngine{knitr::rmarkdown} 19 | %\VignetteDepends{org.Hs.eg.db} 20 | %\usepackage[utf8]{inputenc} 21 | %\VignetteEncoding{UTF-8} 22 | --- 23 | 24 | ```{r style, echo=FALSE, results="asis", message=FALSE} 25 | knitr::opts_chunk$set(tidy = FALSE, 26 | warning = FALSE, 27 | message = FALSE) 28 | ``` 29 | 30 | ```{r echo=FALSE, results='hide', message=FALSE} 31 | CRANpkg <- function (pkg) { 32 | cran <- "https://CRAN.R-project.org/package" 33 | fmt <- "[%s](%s=%s)" 34 | sprintf(fmt, pkg, cran, pkg) 35 | } 36 | 37 | Biocpkg <- function (pkg) { 38 | sprintf("[%s](http://bioconductor.org/packages/%s)", pkg, pkg) 39 | } 40 | 41 | library(org.Hs.eg.db) 42 | library(DOSE) 43 | library(ReactomePA) 44 | ``` 45 | 46 | 47 | 48 | 49 | # Vignette 50 | 51 | Please go to for the full vignette. 52 | 53 | 54 | # Citation 55 | 56 | If you use `r Biocpkg("ReactomePA")` [@yu_reactomepa_2016] in published research, please cite: 57 | 58 | __*G Yu*__, QY He^\*^. ReactomePA: an R/Bioconductor package for reactome pathway analysis and visualization. __*Molecular BioSystems*__ 2016, 12(2):477-479. doi: [10.1039/C5MB00663E](http://dx.doi.org/10.1039/C5MB00663E) 59 | 60 | 61 | 62 | # Need help? 63 | 64 | 65 | If you have questions/issues, please post to [Bioconductor support site](https://support.bioconductor.org/) and tag your post with *ReactomePA*. 66 | 67 | --------------------------------------------------------------------------------