├── .travis.yml ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── R ├── 00-AllClasses.R ├── AllGenerics.R ├── RcppExports.R ├── compareResult.R ├── dplyr-arrange.R ├── dplyr-filter.R ├── dplyr-group_by.R ├── dplyr-mutate.R ├── dplyr-rename.R ├── dplyr-select.R ├── dplyr-slice.R ├── dplyr-summarise.R ├── dplyr_exportR.R ├── enrich.R ├── ggbar.R ├── ggdot.R ├── ggdot_cluster.R ├── ggdot_cluster_gsea.R ├── ggheatmap.R ├── ggnetmap.R ├── ggnetwork.R ├── ggrich.R ├── kappa.R ├── makeAnnot.R ├── makeown.R ├── misc.R ├── richGO.R ├── richGSEA.R ├── richKEGG.R ├── richLevel.R └── zzz.R ├── README.md ├── _config.yml ├── data ├── godata.rdata ├── kegg.rdata ├── module.rda ├── path.rda └── pathway.rda ├── man ├── Annot-class.Rd ├── GO_child.Rd ├── GSEAResult-class.Rd ├── buildAnnot-methods.Rd ├── buildMSIGDB.Rd ├── buildOwn.Rd ├── compareGSEA.Rd ├── compareResult.Rd ├── comparedot.Rd ├── detail.Rd ├── dollar-methods.Rd ├── dot-calculate_Enrichment_Score.Rd ├── dot-clean.char.Rd ├── dot-getmsig.Rd ├── dot-ggcluster_enrich.Rd ├── dot-ggcluster_gsea.Rd ├── dot-kappa.Rd ├── dot-kappa_cluster_internal.Rd ├── dot-makeGOdata.Rd ├── dot-makeKOMdata.Rd ├── dot-makeKOdata.Rd ├── dot-makeROdata.Rd ├── dot-merge_term.Rd ├── dot-paste.char.Rd ├── enrich-ANY-Annot-method.Rd ├── enrich-ANY-data.frame-method.Rd ├── enrich.Rd ├── enrich_internal.Rd ├── getann.Rd ├── getdetail.Rd ├── ggGSEA.Rd ├── ggbar-methods.Rd ├── ggbar.Rd ├── ggcluster.Rd ├── ggdot-methods.Rd ├── ggdot.Rd ├── ggdot_internal.Rd ├── ggheatmap.Rd ├── ggnetmap.Rd ├── ggnetplot-method.Rd ├── ggnetplot-richResult-method.Rd ├── ggnetplot.Rd ├── ggnetwork-methods.Rd ├── ggnetwork.Rd ├── ggrich_internal.Rd ├── idconvert.Rd ├── msigdbinfo.Rd ├── overlap.Rd ├── parGSEA.Rd ├── plotGSEA.Rd ├── rbind.GSEAResult.Rd ├── rbind.richResult.Rd ├── reexports.Rd ├── result.Rd ├── result_detail_methods.Rd ├── reverseList_bk.Rd ├── richCluster-data.frame-method.Rd ├── richCluster-richResult-method.Rd ├── richCluster.Rd ├── richDAVID.Rd ├── richGO-ANY-Annot-method.Rd ├── richGO-ANY-data.frame-method.Rd ├── richGO.Rd ├── richGO_internal.Rd ├── richGSEA-ANY-Annot-method.Rd ├── richGSEA-ANY-data.frame-method.Rd ├── richGSEA-methods.Rd ├── richGSEA_internal.Rd ├── richKEGG-ANY-Annot-method.Rd ├── richKEGG-ANY-data.frame-method.Rd ├── richKEGG.Rd ├── richKEGG_internal.Rd ├── richLevel-ANY-Annot-method.Rd ├── richLevel-ANY-data.frame-method.Rd ├── richLevel-methods.Rd ├── richLevel_internal.Rd ├── richResult-class.Rd ├── s4-accessors.Rd ├── showData.Rd ├── subset-methods.Rd ├── summary-GSEAResult-method.Rd ├── summary-richResult-method.Rd ├── utilities-methods.Rd └── vec_to_df.Rd ├── richR.Rproj ├── src ├── RcppExports.cpp ├── hyper.cpp ├── name_table.cpp ├── reverse_list.cpp ├── sf.cpp └── unique.cpp └── vignettes └── richR.Rmd /.travis.yml: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------- 2 | # Travis-CI configuration for R packages 3 | # 4 | # REFERENCES: 5 | # * Travis CI: https://docs.travis-ci.com/user/languages/r# 6 | # YAML validated using http://www.yamllint.com/ 7 | #---------------------------------------------------------------- 8 | language: r 9 | sudo: false 10 | cache: packages 11 | warnings_are_errors: false 12 | r_check_args: --as-cran 13 | r: 14 | - bioc-devel 15 | 16 | cache: packages 17 | bioc_required: true 18 | bioc_use_devel: true 19 | latex: false 20 | 21 | matrix: 22 | include: 23 | - os: osx 24 | r_check_args: '--ignore-vignettes' 25 | r_build_args: '--no-build-vignettes' 26 | - dist: linux 27 | r_check_args: '--ignore-vignettes' 28 | r_build_args: '--no-build-vignettes' 29 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: richR 2 | Type: Package 3 | Title: Function Enrichment analysis and Network construction 4 | Version: 0.0.37 5 | Author: Kai Guo 6 | Maintainer: Kai Guo 7 | Description: This package is used for for enrichment analysis and network construction. 8 | License: GPL-3 9 | LazyData: TRUE 10 | Depends: R (>= 3.5.0) 11 | Imports: 12 | Rcpp, 13 | ggplot2, 14 | GO.db, 15 | dplyr, 16 | magrittr, 17 | msigdbr, 18 | KEGGREST, 19 | igraph, 20 | visNetwork, 21 | AnnotationDbi, 22 | reshape2, 23 | intergraph, 24 | fgsea, 25 | ggrepel, 26 | cowplot, 27 | GGally, 28 | rlang, 29 | S4Vectors, 30 | sna 31 | LinkingTo: Rcpp 32 | Suggests: 33 | knitr, 34 | testthat, 35 | rmarkdown 36 | VignetteBuilder: knitr 37 | RoxygenNote: 7.3.2 38 | biocViews: 39 | Encoding: UTF-8 40 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | exportPattern("^[[:alpha:]]+") 3 | importFrom(Rcpp, evalCpp) 4 | useDynLib(richR) 5 | S3method(arrange,Annot) 6 | S3method(arrange,GSEAResult) 7 | S3method(arrange,richResult) 8 | S3method(as.data.frame,Annot) 9 | S3method(as.data.frame,GSEAResult) 10 | S3method(as.data.frame,richResult) 11 | S3method(filter,Annot) 12 | S3method(filter,GSEAResult) 13 | S3method(filter,richResult) 14 | S3method(group_by,GSEAResult) 15 | S3method(group_by,richResult) 16 | S3method(mutate,GSEAResult) 17 | S3method(mutate,richResult) 18 | S3method(rbind,GSEAResult) 19 | S3method(rbind,richResult) 20 | S3method(rename,Annot) 21 | S3method(rename,GSEAResult) 22 | S3method(rename,richResult) 23 | S3method(select,GSEAResult) 24 | S3method(select,richResult) 25 | S3method(slice,GSEAResult) 26 | S3method(slice,richResult) 27 | S3method(summarise,GSEAResult) 28 | S3method(summarise,richResult) 29 | export("%<>%") 30 | export("%>%") 31 | export(arrange) 32 | export(buildAnnot) 33 | export(buildMSIGDB) 34 | export(buildOwn) 35 | export(compareGSEA) 36 | export(compareResult) 37 | export(comparedot) 38 | export(detail) 39 | export(enrich) 40 | export(enrich_internal) 41 | export(filter) 42 | export(getdetail) 43 | export(ggGSEA) 44 | export(ggbar) 45 | export(ggcluster) 46 | export(ggdot) 47 | export(ggnetmap) 48 | export(ggnetplot) 49 | export(ggnetwork) 50 | export(group_by) 51 | export(idconvert) 52 | export(msigdbinfo) 53 | export(mutate) 54 | export(mutate.Annot) 55 | export(n) 56 | export(parGSEA) 57 | export(plotGSEA) 58 | export(rename) 59 | export(result) 60 | export(reverseList_bk) 61 | export(richCluster) 62 | export(richDAVID) 63 | export(richGO) 64 | export(richGSEA) 65 | export(richGSEA_internal) 66 | export(richKEGG) 67 | export(richLevel) 68 | export(select) 69 | export(showData) 70 | export(slice) 71 | export(summarise) 72 | exportClasses(Annot) 73 | exportClasses(GSEAResult) 74 | exportClasses(richResult) 75 | exportMethods(detail) 76 | exportMethods(enrich) 77 | exportMethods(ggbar) 78 | exportMethods(ggdot) 79 | exportMethods(ggnetplot) 80 | exportMethods(ggnetwork) 81 | exportMethods(result) 82 | exportMethods(richCluster) 83 | exportMethods(richGO) 84 | exportMethods(richGSEA) 85 | exportMethods(richKEGG) 86 | exportMethods(richLevel) 87 | exportMethods(summary) 88 | import(cowplot) 89 | import(dplyr) 90 | import(ggplot2) 91 | import(tidyr) 92 | importFrom(AnnotationDbi,as.list) 93 | importFrom(AnnotationDbi,keys) 94 | importFrom(GGally,ggnet2) 95 | importFrom(KEGGREST,keggLink) 96 | importFrom(KEGGREST,keggList) 97 | importFrom(S4Vectors,bindROWS) 98 | importFrom(cowplot,plot_grid) 99 | importFrom(dplyr,arrange) 100 | importFrom(dplyr,distinct) 101 | importFrom(dplyr,filter) 102 | importFrom(dplyr,full_join) 103 | importFrom(dplyr,group_by) 104 | importFrom(dplyr,left_join) 105 | importFrom(dplyr,mutate) 106 | importFrom(dplyr,n) 107 | importFrom(dplyr,rename) 108 | importFrom(dplyr,select) 109 | importFrom(dplyr,slice) 110 | importFrom(dplyr,summarise) 111 | importFrom(fgsea,fgseaMultilevel) 112 | importFrom(fgsea,plotEnrichment) 113 | importFrom(fgsea,plotGseaTable) 114 | importFrom(ggplot2,aes) 115 | importFrom(ggplot2,coord_equal) 116 | importFrom(ggplot2,coord_flip) 117 | importFrom(ggplot2,element_blank) 118 | importFrom(ggplot2,element_text) 119 | importFrom(ggplot2,facet_wrap) 120 | importFrom(ggplot2,geom_bar) 121 | importFrom(ggplot2,geom_hline) 122 | importFrom(ggplot2,geom_line) 123 | importFrom(ggplot2,geom_point) 124 | importFrom(ggplot2,geom_segment) 125 | importFrom(ggplot2,geom_text) 126 | importFrom(ggplot2,geom_tile) 127 | importFrom(ggplot2,ggplot) 128 | importFrom(ggplot2,ggsave) 129 | importFrom(ggplot2,ggtitle) 130 | importFrom(ggplot2,guide_colourbar) 131 | importFrom(ggplot2,guide_legend) 132 | importFrom(ggplot2,guides) 133 | importFrom(ggplot2,labs) 134 | importFrom(ggplot2,scale_color_gradient) 135 | importFrom(ggplot2,scale_color_manual) 136 | importFrom(ggplot2,scale_fill_gradient) 137 | importFrom(ggplot2,scale_fill_gradient2) 138 | importFrom(ggplot2,theme) 139 | importFrom(ggplot2,theme_bw) 140 | importFrom(ggplot2,theme_light) 141 | importFrom(ggplot2,theme_minimal) 142 | importFrom(ggplot2,xlab) 143 | importFrom(ggplot2,ylab) 144 | importFrom(ggplot2,ylim) 145 | importFrom(ggrepel,geom_text_repel) 146 | importFrom(igraph,"E<-") 147 | importFrom(igraph,"V<-") 148 | importFrom(igraph,E) 149 | importFrom(igraph,V) 150 | importFrom(igraph,degree) 151 | importFrom(igraph,delete.edges) 152 | importFrom(igraph,graph.data.frame) 153 | importFrom(igraph,graph_from_data_frame) 154 | importFrom(igraph,simplify) 155 | importFrom(igraph,write_graph) 156 | importFrom(intergraph,asNetwork) 157 | importFrom(magrittr,"%<>%") 158 | importFrom(magrittr,"%>%") 159 | importFrom(msigdbr,msigdbr) 160 | importFrom(reshape2,melt) 161 | importFrom(rlang,quos) 162 | importFrom(rlang,sym) 163 | importFrom(visNetwork,visIgraph) 164 | importFrom(visNetwork,visInteraction) 165 | importFrom(visNetwork,visOptions) 166 | importFrom(visNetwork,visSave) 167 | -------------------------------------------------------------------------------- /R/00-AllClasses.R: -------------------------------------------------------------------------------- 1 | ##' Class "richResult" 2 | ##' This class represents the result of enrichment analysis. 3 | ##' 4 | ##' 5 | ##' @name richResult-class 6 | ##' @aliases richResult-class 7 | ##' show,richResult-method plot,richResult-method 8 | ##' summary,richResult-method 9 | ##' 10 | ##' @docType class 11 | ##' @slot result enrichment analysis results 12 | ##' @slot detail genes included in significant terms and original information 13 | ##' @slot pvalueCutoff cutoff pvalue 14 | ##' @slot pAdjustMethod pvalue adjust method 15 | ##' @slot padjCutoff pvalue adjust cutoff value 16 | ##' @slot genenumber number of input genes 17 | ##' @slot organism organism used 18 | ##' @slot ontology biological ontology 19 | ##' @slot gene Gene IDs 20 | ##' @slot keytype Gene ID type 21 | ##' @slot sep character string used to separate the genes when concatenating 22 | ##' @exportClass richResult 23 | ##' @author Kai Guo 24 | ##' @keywords classes 25 | setClass("richResult", 26 | representation=representation( 27 | result = "data.frame", 28 | detail = "data.frame", 29 | pvalueCutoff = "numeric", 30 | pAdjustMethod = "character", 31 | padjCutoff = "numeric", 32 | genenumber = "numeric", 33 | organism = "character", 34 | ontology = "character", 35 | gene = "character", 36 | keytype = "character", 37 | sep = "character" 38 | ) 39 | ) 40 | ##' Class "GSEAResult" 41 | ##' This class represents the result from GSEA analysis 42 | ##' @name GSEAResult-class 43 | ##' @aliases GSEAResult-class 44 | ##' show,GSEAResult-method summary,GSEAResult-method 45 | ##' plot,GSEAResult-method 46 | ##' 47 | ##' @docType class 48 | ##' @slot result enrichment analysis results 49 | ##' @slot pvalueCutoff cutoff pvalue 50 | ##' @slot pAdjustMethod pvalue adjust method 51 | ##' @slot padjCutoff pvalue adjust cutoff value 52 | ##' @slot genenumber number of input genes 53 | ##' @slot organism organism used 54 | ##' @slot ontology biological ontology 55 | ##' @slot gene Gene IDs 56 | ##' @slot keytype Gene ID type 57 | ##' @slot sep character string used to separate the genes when concatenating 58 | ##' @exportClass GSEAResult 59 | ##' @author Kai Guo 60 | ##' @keywords classes 61 | setClass("GSEAResult", 62 | representation = representation( 63 | result = "data.frame", 64 | pvalueCutoff = "numeric", 65 | pAdjustMethod = "character", 66 | padjCutoff = "numeric", 67 | genenumber = "numeric", 68 | organism = "character", 69 | gene = "character", 70 | input = 'numeric', 71 | ontology = "character", 72 | keytype = "character", 73 | sep = "character" 74 | ) 75 | ) 76 | ##' Class "Annot" 77 | ##' This class represents the Annotation information 78 | ##' @name Annot-class 79 | ##' @aliases Annot-class 80 | ##' summary, Annot-method 81 | ##' @docType class 82 | ##' @slot species the species of the annotation file 83 | ##' @slot anntype the type of the annotation file 84 | ##' @slot keytype Gene ID type 85 | ##' @slot annot Annotation information data.frame 86 | ##' @exportClass Annot 87 | ##' @author Kai Guo 88 | ##' @keywords classes 89 | setClass("Annot", 90 | representation = representation( 91 | species="character", 92 | anntype="character", 93 | keytype="character", 94 | annot="data.frame" 95 | )) 96 | 97 | -------------------------------------------------------------------------------- /R/RcppExports.R: -------------------------------------------------------------------------------- 1 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand 2 | # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 3 | 4 | hyper_bench_vector <- function(xin, yin, N, n) { 5 | .Call('_richR_hyper_bench_vector', PACKAGE = 'richR', xin, yin, N, n) 6 | } 7 | 8 | name_table <- function(lh) { 9 | .Call('_richR_name_table', PACKAGE = 'richR', lh) 10 | } 11 | 12 | reverseList <- function(lhs) { 13 | .Call('_richR_reverseList', PACKAGE = 'richR', lhs) 14 | } 15 | 16 | fast_factor <- function(x) { 17 | .Call('_richR_fast_factor', PACKAGE = 'richR', x) 18 | } 19 | 20 | sf <- function(x) { 21 | .Call('_richR_sf', PACKAGE = 'richR', x) 22 | } 23 | 24 | uniq <- function(xa) { 25 | .Call('_richR_uniq', PACKAGE = 'richR', xa) 26 | } 27 | 28 | -------------------------------------------------------------------------------- /R/dplyr-arrange.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom dplyr arrange 2 | ##' @importFrom magrittr %<>% 3 | ##' @method arrange richResult 4 | ##' @export 5 | arrange.richResult<- function(.data, ...) { 6 | dots <- quos(...) 7 | .data@result%<>%arrange(!!!dots,) 8 | return(.data) 9 | } 10 | 11 | ##' @method arrange GSEAResult 12 | ##' @export 13 | arrange.GSEAResult <- arrange.richResult 14 | ##' @importFrom dplyr arrange 15 | ##' @importFrom magrittr %<>% 16 | ##' @method arrange Annot 17 | ##' @export 18 | arrange.Annot<- function(.data, ...) { 19 | dots <- quos(...) 20 | .data@annot%<>%arrange(!!!dots,) 21 | return(.data) 22 | } 23 | -------------------------------------------------------------------------------- /R/dplyr-filter.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom dplyr filter 2 | ##' @importFrom magrittr %<>% 3 | ##' @method filter richResult 4 | ##' @export 5 | filter.richResult <- function(.data, ..., .preserve = FALSE) { 6 | dots <- quos(...) 7 | .data@result %<>% filter(!!!dots, .preserve = .preserve) 8 | return(.data) 9 | } 10 | 11 | 12 | ##' @method filter GSEAResult 13 | ##' @export 14 | filter.GSEAResult <- filter.richResult 15 | 16 | ##' @importFrom dplyr filter 17 | ##' @importFrom magrittr %<>% 18 | ##' @method filter Annot 19 | ##' @export 20 | filter.Annot<- function(.data, ..., .preserve = FALSE) { 21 | dots <- quos(...) 22 | .data@annot %<>% filter(!!!dots, .preserve = .preserve) 23 | return(.data) 24 | } 25 | -------------------------------------------------------------------------------- /R/dplyr-group_by.R: -------------------------------------------------------------------------------- 1 | #' @importFrom dplyr group_by 2 | ##' @importFrom magrittr %<>% 3 | ##' @method group_by richResult 4 | ##' @export 5 | group_by.richResult<- function(.data, ..., add = FALSE, .drop = FALSE) { 6 | dots <- quos(...) 7 | .data@result %<>% group_by(!!!dots, add = add, .drop = .drop) 8 | return(.data) 9 | } 10 | 11 | 12 | ##' @method group_by GSEAResult 13 | ##' @export 14 | group_by.GSEAResult<- group_by.richResult 15 | 16 | #' @importFrom dplyr group_by 17 | ##' @importFrom magrittr %<>% 18 | ##' @method group_by Annot 19 | group_by.Annot<- function(.data, ..., add = FALSE, .drop = FALSE) { 20 | dots <- quos(...) 21 | .data@annot %<>% group_by(!!!dots, add = add, .drop = .drop) 22 | return(.data) 23 | } 24 | -------------------------------------------------------------------------------- /R/dplyr-mutate.R: -------------------------------------------------------------------------------- 1 | ##' @method mutate richResult 2 | ##' @importFrom magrittr %<>% 3 | ##' @importFrom dplyr mutate 4 | ##' @importFrom rlang quos 5 | ##' @export 6 | ##' @author Kai Guo 7 | mutate.richResult <- function(.data, ...) { 8 | dots <- quos(...) 9 | .data@result %<>% mutate(!!!dots) 10 | return(.data) 11 | } 12 | 13 | ##' @method mutate GSEAResult 14 | ##' @export 15 | mutate.GSEAResult <- mutate.richResult 16 | 17 | ##' @importFrom magrittr %<>% 18 | ##' @importFrom dplyr mutate 19 | ##' @importFrom rlang quos 20 | ##' @export 21 | mutate.Annot<- function(.data, ...) { 22 | dots <- quos(...) 23 | .data@annot %<>% mutate(!!!dots) 24 | return(.data) 25 | } 26 | -------------------------------------------------------------------------------- /R/dplyr-rename.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom dplyr rename 2 | ##' @importFrom magrittr %<>% 3 | ##' @method rename richResult 4 | ##' @export 5 | rename.richResult <- function(.data, ...) { 6 | dots <- quos(...) 7 | .data@result %<>% rename(!!!dots,) 8 | return(.data) 9 | } 10 | 11 | ##' @method rename GSEAResult 12 | ##' @export 13 | rename.GSEAResult <- rename.richResult 14 | ##' @importFrom dplyr rename 15 | ##' @importFrom magrittr %<>% 16 | ##' @method rename Annot 17 | ##' @export 18 | rename.Annot<- function(.data, ...) { 19 | dots <- quos(...) 20 | .data@annot %<>% rename(!!!dots,) 21 | return(.data) 22 | } 23 | -------------------------------------------------------------------------------- /R/dplyr-select.R: -------------------------------------------------------------------------------- 1 | ##' @method select richResult 2 | ##' @importFrom magrittr %<>% 3 | ##' @importFrom dplyr select 4 | ##' @export 5 | select.richResult<- function(.data, ...) { 6 | dots <- quos(...) 7 | .data@result %<>% select(!!!dots,) 8 | return(.data) 9 | } 10 | 11 | ##' @method select GSEAResult 12 | ##' @export 13 | select.GSEAResult <- select.richResult 14 | 15 | 16 | ##' @method select richResult 17 | ##' @importFrom magrittr %<>% 18 | ##' @importFrom dplyr select 19 | ##' @export 20 | select.Annot<- function(.data, ...) { 21 | dots <- quos(...) 22 | .data@annot %<>% select(!!!dots,) 23 | return(.data) 24 | } 25 | -------------------------------------------------------------------------------- /R/dplyr-slice.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom dplyr slice 2 | ##' @importFrom magrittr %<>% 3 | ##' @method slice richResult 4 | ##' @export 5 | slice.richResult <- function(.data, ..., .preserve = FALSE) { 6 | dots <- quos(...) 7 | .data@result %<>% slice(!!!dots, .preserve = .preserve) 8 | return(.data) 9 | } 10 | 11 | ##' @method slice GSEAResult 12 | ##' @export 13 | slice.GSEAResult <- slice.richResult 14 | 15 | ##' @importFrom dplyr slice 16 | ##' @importFrom magrittr %<>% 17 | ##' @method slice richResult 18 | ##' @export 19 | slice.Annot <- function(.data, ..., .preserve = FALSE) { 20 | dots <- quos(...) 21 | .data@annot %<>% slice(!!!dots, .preserve = .preserve) 22 | return(.data) 23 | } 24 | -------------------------------------------------------------------------------- /R/dplyr-summarise.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom dplyr summarise 2 | ##' @importFrom magrittr %<>% 3 | ##' @method summarise richResult 4 | ##' @export 5 | summarise.richResult <- function(.data, ...) { 6 | dots <- quos(...) 7 | .data@result %>% summarise(!!!dots) 8 | } 9 | 10 | 11 | ##' @method summarise GSEAResult 12 | ##' @export 13 | summarise.GSEAResult <- summarise.richResult 14 | 15 | ##' @importFrom dplyr summarise 16 | ##' @importFrom magrittr %<>% 17 | ##' @method summarise richResult 18 | ##' @export 19 | summarise.Annot <- function(.data, ...) { 20 | dots <- quos(...) 21 | .data@annot %>% summarise(!!!dots) 22 | } 23 | -------------------------------------------------------------------------------- /R/dplyr_exportR.R: -------------------------------------------------------------------------------- 1 | 2 | ##' @importFrom magrittr %>% 3 | ##' @export 4 | magrittr::`%>%` 5 | 6 | ##' @importFrom magrittr %<>% 7 | ##' @export 8 | magrittr::`%<>%` 9 | 10 | ##' @importFrom dplyr arrange 11 | ##' @export 12 | dplyr::arrange 13 | 14 | ##' @importFrom dplyr filter 15 | ##' @export 16 | dplyr::filter 17 | 18 | ##' @importFrom dplyr group_by 19 | ##' @export 20 | dplyr::group_by 21 | 22 | ##' @importFrom dplyr mutate 23 | ##' @export 24 | dplyr::mutate 25 | 26 | ##' @importFrom dplyr n 27 | ##' @export 28 | dplyr::n 29 | 30 | ##' @importFrom dplyr rename 31 | ##' @export 32 | dplyr::rename 33 | 34 | ##' @importFrom dplyr select 35 | ##' @export 36 | dplyr::select 37 | 38 | ##' @importFrom dplyr slice 39 | ##' @export 40 | dplyr::slice 41 | 42 | ##' @importFrom dplyr summarise 43 | ##' @export 44 | dplyr::summarise 45 | -------------------------------------------------------------------------------- /R/ggbar.R: -------------------------------------------------------------------------------- 1 | ##' @importFrom ggplot2 ggplot 2 | ##' @importFrom ggplot2 aes 3 | ##' @importFrom ggplot2 geom_bar 4 | ##' @importFrom ggplot2 element_text 5 | ##' @importFrom ggplot2 geom_text 6 | ##' @importFrom ggplot2 theme 7 | ##' @importFrom ggplot2 scale_fill_gradient 8 | ##' @importFrom ggplot2 xlab 9 | ##' @importFrom ggplot2 ylab 10 | ##' @importFrom ggplot2 ylim 11 | ##' @importFrom ggplot2 ggsave 12 | ##' @importFrom ggplot2 theme_light 13 | ##' @importFrom ggplot2 labs 14 | ##' @rdname ggbar 15 | ##' @param object richResult object 16 | ##' @param top number of terms you want to display, 17 | ##' @param pvalue cutoff value of pvalue (if padj set as NULL) 18 | ##' @param low low color 19 | ##' @param high high color 20 | ##' @param alpha transparency alpha 21 | ##' @param font.x font of x axis 22 | ##' @param font y font of y axis 23 | ##' @param fontsize.x fontsize of x axis 24 | ##' @param fontsize.y fontsize of y axis 25 | ##' @param short automatic short name or not 26 | ##' @param padj cutoff value of p adjust value 27 | ##' @param order order by Term or richFactor 28 | ##' @param usePadj use p adjust value as color or not (should use with padj) 29 | ##' @param font.size font size for xlim or ylim 30 | ##' @param orderp order by p value(adjusted p value) 31 | ##' @param filename figure output name 32 | ##' @param width figure width 33 | ##' @param height figure height 34 | ##' @param horiz horiz or not 35 | ggbar_internal<-function(resultFis,top=50,pvalue=0.05,order=FALSE,horiz=TRUE, 36 | low="lightpink",high="red", 37 | font.x="bold",font.y="bold",fontsize.x=10,fontsize.y=10, 38 | short=FALSE, 39 | fontsize.text=3,angle=75,padj=NULL,usePadj=TRUE,orderp=FALSE, 40 | filename=NULL,width=10,height=8){ 41 | if(!is.null(padj)){ 42 | resultFis<-resultFis[resultFis$Padj=top){ 47 | resultFis<-resultFis[1:top,] 48 | } 49 | if(max(resultFis$Significant/(resultFis$Annotated+0.1))<=1){ 50 | yheight=max(resultFis$Significant/resultFis$Annotated)+0.1 51 | }else{ 52 | yheight=1 53 | } 54 | if(isTRUE(short)){ 55 | resultFis$Term<-unlist(lapply(resultFis$Term,function(x).paste.char(x,n=6))) 56 | } 57 | if(isTRUE(order)){ 58 | resultFis$rich<-as.numeric(resultFis$Significant)/as.numeric(resultFis$Annotated) 59 | if(isTRUE(orderp)){ 60 | resultFis$Term<-factor(resultFis$Term,levels=resultFis$Term[order(resultFis$Pvalue)]) 61 | }else{ 62 | resultFis$Term<-factor(resultFis$Term,levels=resultFis$Term[order(resultFis$rich)]) 63 | } 64 | } 65 | if(usePadj==FALSE){ 66 | p<-ggplot(resultFis,aes(x=Term,y=round(as.numeric(Significant/Annotated),2)))+geom_bar(stat="identity",aes(fill=-log10(as.numeric(Pvalue)))) 67 | p<-p+scale_fill_gradient(low=low,high=high)+theme_light() 68 | if(horiz==TRUE){ 69 | angle<-0 70 | p<-p+theme(axis.text.y=element_text(face=font.y,size=fontsize.y),axis.text.x=element_text(face=font.x,color="black",size=fontsize.x,angle=angle))+labs(fill="-log10(Pvalue)") 71 | p<-p+coord_flip() 72 | p<-p+geom_text(aes(label=Significant),hjust=-0.3,size=fontsize.text)+xlab("Annotation")+ylab("Rich Factor")+ylim(0,yheight) 73 | }else{ 74 | p<-p+theme(axis.text.y=element_text(face=font.y,size=fontsize.y),axis.text.x=element_text(face=font.x,color="black",size=fontsize.x,angle=angle,vjust=1,hjust=1))+labs(fill="-log10(Pvalue)") 75 | p<-p+geom_text(aes(label=Significant),vjust=-0.3,size=fontsize.text)+xlab("Annotation")+ylab("Rich Factor")+ylim(0,yheight) 76 | } 77 | # print(p) 78 | }else{ 79 | p<-ggplot(resultFis,aes(x=Term,y=round(as.numeric(Significant/Annotated),2)))+geom_bar(stat="identity",aes(fill=-log10(as.numeric(Padj)))) 80 | p<-p+scale_fill_gradient(low=low,high=high)+theme_light() 81 | if(horiz==TRUE){ 82 | angle<-0 83 | p<-p+theme(axis.text.y=element_text(face=font.y,size=fontsize.y),axis.text.x=element_text(face=font.x,color="black",size=fontsize.x,angle=angle))+labs(fill="-log10(Padj)") 84 | p<-p+coord_flip() 85 | p<-p+geom_text(aes(label=Significant),hjust=-0.3,size=fontsize.text)+xlab("Annotation")+ylab("Rich Factor")+ylim(0,yheight) 86 | 87 | }else{ 88 | p<-p+theme(axis.text.y=element_text(face=font.y,size=fontsize.y),axis.text.x=element_text(face=font.x,color="black",size=fontsize.x,angle=angle,vjust=1,hjust=1))+labs(fill="-log10(Padj)") 89 | p<-p+geom_text(aes(label=Significant),vjust=-0.3,size=fontsize.text)+xlab("Annotation")+ylab("Rich Factor")+ylim(0,yheight) 90 | } 91 | } 92 | if(!is.null(filename)){ 93 | ggsave(p,file=paste(filename,"enrich.pdf",sep="_"),width=width,height=height) 94 | } 95 | p 96 | } 97 | ##' barplot for Enrichment results 98 | ##' @rdname ggbar 99 | ##' @param object richResult object 100 | ##' @param top number of terms you want to display, 101 | ##' @param pvalue cutoff value of pvalue (if padj set as NULL) 102 | ##' @param low low color 103 | ##' @param high high color 104 | ##' @param alpha transparency alpha 105 | ##' @param font.x font of x axis 106 | ##' @param font y font of y axis 107 | ##' @param fontsize.x fontsize of x axis 108 | ##' @param fontsize.y fontsize of y axis 109 | ##' @param short automatic short name or not 110 | ##' @param padj cutoff value of p adjust value 111 | ##' @param order order by Term or richFactor 112 | ##' @param usePadj use p adjust value as color or not (should use with padj) 113 | ##' @param font.size font size for xlim or ylim 114 | ##' @param orderp order by p value(adjusted p value) 115 | ##' @param filename figure output name 116 | ##' @param width figure width 117 | ##' @param height figure height 118 | ##' @param horiz horiz or not 119 | ##' @examples 120 | ##' \dontrun{ 121 | ##' hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 122 | ##' gene=sample(unique(hsako$GeneID),1000) 123 | ##' res<-richKEGG(gene,kodata = hsako) 124 | ##' ggbar(res) 125 | ##' } 126 | ##' @export 127 | ##' @author Kai Guo 128 | setMethod("ggbar", signature(object = "richResult"),definition = function(object,top=50,pvalue=0.05,padj=NULL,order=FALSE, 129 | usePadj=TRUE,fontsize.x=10,fontsize.y=10,short=FALSE,fontsize.text=3,angle=75,orderp=orderp,filename=NULL, 130 | width=10,height=8,horiz=TRUE,...) { 131 | ggbar_internal(object@result,top=top,pvalue=pvalue,padj=padj,order=order, 132 | usePadj=usePadj,fontsize.x=fontsize.x,fontsize.y=fontsize.y,short=short,fontsize.text = fontsize.text,angle=angle, 133 | orderp=orderp,filename=filename,horiz=horiz, ...) 134 | }) 135 | ##' barplot for Enrichment result 136 | ##' @rdname ggbar 137 | ##' @param object dataframe of enrichment results 138 | ##' @param top number of terms you want to display, 139 | ##' @param pvalue cutoff value of pvalue (if padj set as NULL) 140 | ##' @param low low color 141 | ##' @param high high color 142 | ##' @param alpha transparency alpha 143 | ##' @param font.x font of x axis 144 | ##' @param font y font of y axis 145 | ##' @param fontsize.x fontsize of x axis 146 | ##' @param fontsize.y fontsize of y axis 147 | ##' @param short automatic short name or not 148 | ##' @param padj cutoff value of p adjust value 149 | ##' @param order order by Term or richFactor 150 | ##' @param usePadj use p adjust value as color or not (should use with padj) 151 | ##' @param font.size font size for xlim or ylim 152 | ##' @param orderp order by p value(adjusted p value) 153 | ##' @param filename figure output name 154 | ##' @param width figure width 155 | ##' @param height figure height 156 | ##' @param horiz horiz or not 157 | ##' @examples 158 | ##' \dontrun{ 159 | ##' hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 160 | ##' gene=sample(unique(hsako$GeneID),1000) 161 | ##' res<-richKEGG(gene,kodata = hsako) 162 | ##' ggbar(result(res)) 163 | ##' } 164 | ##' @export 165 | ##' @author Kai Guo 166 | setMethod("ggbar", signature(object = "data.frame"),definition = function(object,top=50,pvalue=0.05,padj=NULL,order=FALSE, 167 | usePadj=TRUE,fontsize.x=10,fontsize.y=10,short=FALSE,fontsize.text=3,angle=75,orderp=FALSE,filename=NULL, 168 | width=10,height=8,horiz=TRUE,...) { 169 | ggbar_internal(object,top=top,pvalue=pvalue,padj=padj,order=order, 170 | usePadj=usePadj,fontsize.x=fontsize.x,fontsize.y=fontsize.y,short=short,fontsize.text = fontsize.text,angle=angle, 171 | orderp=orderp,filename=filename,width=width,height=height,horiz=horiz,...) 172 | }) 173 | -------------------------------------------------------------------------------- /R/ggdot.R: -------------------------------------------------------------------------------- 1 | ##' Dotplot for enrichment results 2 | ##' @importFrom ggplot2 ggplot 3 | ##' @importFrom ggplot2 aes 4 | ##' @importFrom ggplot2 geom_point 5 | ##' @importFrom ggplot2 element_text 6 | ##' @importFrom ggplot2 geom_text 7 | ##' @importFrom ggplot2 theme 8 | ##' @importFrom ggplot2 scale_color_gradient 9 | ##' @importFrom ggplot2 xlab 10 | ##' @importFrom ggplot2 ylab 11 | ##' @importFrom ggplot2 ggsave 12 | ##' @importFrom ggplot2 theme_minimal 13 | ##' @importFrom ggplot2 labs 14 | ##' @importFrom ggplot2 guides 15 | ##' @importFrom ggplot2 guide_colourbar 16 | ##' @importFrom ggplot2 guide_legend 17 | ##' @param object richResult object 18 | ##' @param top number of terms you want to display, 19 | ##' @param pvalue cutoff value of pvalue (if padj set as NULL) 20 | ##' @param low low color 21 | ##' @param high high color 22 | ##' @param alpha transparency alpha 23 | ##' @param font.x font of x axis 24 | ##' @param font y font of y axis 25 | ##' @param fontsize.x fontsize of x axis 26 | ##' @param fontsize.y fontsize of y axis 27 | ##' @param short automatic short name or not 28 | ##' @param order order by Term or richFactor 29 | ##' @param usePadj use p adjust value as color or not (should use with padj) 30 | ##' @param font.size font size for xlim or ylim 31 | ##' @param orderp order by p value(adjusted p value) 32 | ##' @param filename figure output name 33 | ##' @param width figure width 34 | ##' @param height figure height 35 | ggdot_internal<-function(object,top=50,pvalue=0.05,order=FALSE, 36 | low="lightpink",high="red",alpha=0.7, 37 | font.x="bold",font.y="bold",fontsize.x=10,fontsize.y=10, 38 | short=FALSE, 39 | padj=NULL,usePadj=TRUE,orderp=FALSE,filename=NULL,width=10,height=8){ 40 | if(!is.null(padj)){ 41 | object<-object[object$Padj=top){ 46 | dd<-object[1:top,] 47 | }else{ 48 | dd<-object 49 | } 50 | if(nrow(dd)>=1){ 51 | dd$rich<-dd$Significant/dd$Annotated 52 | #colnames(dd)[3]<-"rich"; 53 | if(isTRUE(short)){ 54 | dd$Term<-unlist(lapply(dd$Term,function(x).paste.char(x,n=6))) 55 | } 56 | if(isTRUE(order)){ 57 | if(isTRUE(orderp)){ 58 | dd$Term<-factor(dd$Term,levels=dd$Term[order(dd$Pvalue,decreasing=TRUE)]) 59 | }else{ 60 | dd$Term<-factor(dd$Term,levels=dd$Term[order(dd$rich)]) 61 | } 62 | } 63 | if(usePadj==FALSE){ 64 | p<-ggplot(dd,aes(x=rich,y=Term))+geom_point(aes(size=Significant,color=-log10(Pvalue)),alpha=alpha)+theme_minimal()+ 65 | theme(axis.text.y=element_text(face=font.y,size=fontsize.y),axis.text.x=element_text(face=font.x,color="black",size=fontsize.x))+ 66 | scale_color_gradient(low=low,high=high)+ylab("Pathway name")+ 67 | xlab("Rich factor")+labs(size="Gene number")+guides(color=guide_colourbar(order = 1),size=guide_legend(order = 2)) 68 | }else{ 69 | p<-ggplot(dd,aes(x=rich,y=Term))+geom_point(aes(size=Significant,color=-log10(Padj)),alpha=alpha)+theme_minimal()+ 70 | theme(axis.text.y=element_text(face=font.y,size=fontsize.y),axis.text.x=element_text(face=font.x,color="black",size=fontsize.x))+ 71 | scale_color_gradient(low=low,high=high)+ylab("Pathway name")+ 72 | xlab("Rich factor")+labs(size="Gene number")+guides(color=guide_colourbar(order = 1),size=guide_legend(order = 2)) 73 | }}else{ 74 | cat("No Pathway enrichment results were found!\n") 75 | } 76 | if(!is.null(filename)){ 77 | ggsave(p,file=paste(filename,"dot.pdf",sep="_"),width=width,height=height) 78 | } 79 | p 80 | } 81 | ##' dotplot for Enrichment results 82 | ##' @rdname ggdot 83 | ##' @param object richResult object 84 | ##' @param top number of terms you want to display, 85 | ##' @param pvalue cutoff value of pvalue (if padj set as NULL) 86 | ##' @param low low color 87 | ##' @param high high color 88 | ##' @param alpha transparency alpha 89 | ##' @param font.x font of x axis 90 | ##' @param font y font of y axis 91 | ##' @param fontsize.x fontsize of x axis 92 | ##' @param fontsize.y fontsize of y axis 93 | ##' @param short automatic short name or not 94 | ##' @param order order by Term or richFactor 95 | ##' @param usePadj use p adjust value as color or not (should use with padj) 96 | ##' @param font.size font size for xlim or ylim 97 | ##' @param orderp order by p value(adjusted p value) 98 | ##' @param filename figure output name 99 | ##' @param width figure width 100 | ##' @param height figure height 101 | ##' @examples 102 | #' \dontrun{ 103 | #' hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 104 | #' gene=sample(unique(hsako$GeneID),1000) 105 | #' res<-richKEGG(gene,kodata = hsako) 106 | #' ggdot(res) 107 | #' } 108 | ##' @exportMethod ggdot 109 | ##' @author Kai Guo 110 | setMethod("ggdot", signature(object = "richResult"),definition = function(object,top=50,pvalue=0.05,order=FALSE, 111 | low="lightpink",high="red",alpha=0.7, 112 | font.x="bold",font.y="bold",fontsize.x=10,fontsize.y=10, 113 | short=FALSE, 114 | padj=NULL,usePadj=TRUE,orderp=FALSE,filename=NULL,width=10,height=8) { 115 | ggdot_internal(object@result,top=top,pvalue=pvalue,order=order, 116 | low=low,high=high,alpha=alpha, 117 | font.x=font.x,font.y=font.y,fontsize.x=fontsize.x,fontsize.y=fontsize.y, 118 | padj=padj,usePadj=usePadj,orderp=orderp,filename=filename,width=width,height=height) 119 | }) 120 | ##' dotplot for Enrichment results 121 | ##' @rdname ggdot 122 | ##' @param object richResult object 123 | ##' @param top number of terms you want to display, 124 | ##' @param pvalue cutoff value of pvalue (if padj set as NULL) 125 | ##' @param low low color 126 | ##' @param high high color 127 | ##' @param alpha transparency alpha 128 | ##' @param font.x font of x axis 129 | ##' @param font y font of y axis 130 | ##' @param fontsize.x fontsize of x axis 131 | ##' @param fontsize.y fontsize of y axis 132 | ##' @param short automatic short name or not 133 | ##' @param padj cutoff value of p adjust value 134 | ##' @param order order by Term or richFactor 135 | ##' @param usePadj use p adjust value as color or not (should use with padj) 136 | ##' @param font.size font size for xlim or ylim 137 | ##' @param orderp order by p value(adjusted p value) 138 | ##' @param filename figure output name 139 | ##' @param width figure width 140 | ##' @param height figure height 141 | ##' @examples 142 | ##' \dontrun{ 143 | ##' hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 144 | ##' gene=sample(unique(hsago$GeneID),1000) 145 | ##' res<-richKEGG(gene,kodata = hsako) 146 | ##' ggdot(result(res)) 147 | ##' } 148 | ##' @exportMethod ggdot 149 | ##' @author Kai Guo 150 | setMethod("ggdot", signature(object = "data.frame"),definition = function(object,top=50,pvalue=0.05,order=FALSE, 151 | low="lightpink",high="red",alpha=0.7, 152 | font.x="bold",font.y="bold",fontsize.x=10,fontsize.y=10, 153 | short=FALSE, 154 | padj=NULL,usePadj=TRUE,orderp=FALSE,filename=NULL,width=10,height=8) { 155 | ggdot_internal(object,top=top,pvalue=pvalue,order=order, 156 | low=low,high=high,alpha=alpha, 157 | font.x=font.x,font.y=font.y,fontsize.x=fontsize.x,fontsize.y=fontsize.y, 158 | padj=padj,usePadj=usePadj,orderp=orderp,filename=filename,width=width,height=height) 159 | }) 160 | -------------------------------------------------------------------------------- /R/ggdot_cluster_gsea.R: -------------------------------------------------------------------------------- 1 | #' Plot KEGG Cluster Visualization 2 | #' 3 | #' This function generates a KEGG GESA cluster plot, showing pathways and their relationships 4 | #' across different clusters with customizable aesthetics. 5 | #' 6 | #' @param data A data frame containing KEGG cluster data. Must include columns: `pathway`, `Level2`, `group`, `Padj`, `Significant`, and `Annotated`. 7 | #' @param color_low Color for the lowest value in the gradient (default: "cyan4"). 8 | #' @param color_high Color for the highest value in the gradient (default: "white"). 9 | #' @param color_mid Color for the middle value in the gradient (default: "red"). 10 | #' @param size_range A numeric vector of length 2 to control the size range of points (default: c(0.8, 4)). 11 | #' @param curve_color Color for the connecting curves between Level2 and pathways (default: "grey70"). 12 | #' @param curve_size Line width for the connecting curves (default: 0.5). 13 | #' @param vertical_line_color Color for the vertical lines between Level2 labels and pathways (default: "darkcyan"). 14 | #' @param vertical_line_size Width of vertical lines between Level2 and pathways (default: 1.5). 15 | #' @param dot_line_color Color for dotted lines connecting clusters to pathways (default: "grey70"). 16 | #' @param dot_line_size Line width for the dotted lines (default: 0.3). 17 | #' @param dot_line_type Line type for the dotted lines (default: "dotted"). 18 | #' @param vline_color Color for vertical lines separating clusters (default: "grey80"). 19 | #' @param vline_type Line type for vertical lines separating clusters (default: "dashed"). 20 | #' @param label_font_size Font size for the Level2 labels (default: 3). 21 | #' @param label_font_face Font face for the Level2 labels (default: "bold"). 22 | #' @param pathway_font_size Font size for pathway labels (default: 2.5). 23 | #' @param pathway_font_face Font face for pathway labels (default: "italic"). 24 | #' @param legend_position Position of the legend (default: "right"). 25 | #' @param x_pathway_offset Offset to control the x-axis positioning of pathways (default: 0.3). 26 | #' @param plot_margins Numeric vector of length 4 to control plot margins (default: c(5, 200, 10, 250)). 27 | #' 28 | #' @import ggplot2 29 | #' @import dplyr 30 | #' @import tidyr 31 | #' @import cowplot 32 | #' 33 | .ggcluster_gsea <- function( 34 | data, 35 | color_low = "cyan4", 36 | color_high = "red", 37 | color_mid = "white", 38 | size_range = c(0.8, 4), 39 | curve_color = "grey70", 40 | curve_size = 0.5, 41 | vertical_line_color = "darkcyan", 42 | vertical_line_size = 1.5, 43 | dot_line_color = "grey70", 44 | dot_line_size = 0.3, 45 | dot_line_type = "dotted", 46 | vline_color = "grey80", 47 | vline_type = "dashed", 48 | label_font_size = 3, 49 | label_font_face = "bold", 50 | pathway_font_size = 2.5, 51 | pathway_font_face = "italic", 52 | legend_position = "right", 53 | x_pathway_offset = 0.3, 54 | plot_margins = c(5, 200, 10, 250) 55 | ) { 56 | # Check that required columns are present 57 | required_cols <- c("pathway", "Level2", "group", "padj","NES") 58 | if (!all(required_cols %in% colnames(data))) { 59 | stop("Input data must contain columns: ", paste(required_cols, collapse = ", ")) 60 | } 61 | 62 | # Preprocess data 63 | data <- data %>% 64 | mutate( 65 | Padj = as.numeric(padj), 66 | neg_log10_Padj = -log10(padj) 67 | ) 68 | 69 | # Define pathways and positions for y-axis 70 | pathways <- data %>% 71 | select(pathway, Level2) %>% 72 | distinct() %>% 73 | arrange(Level2, pathway) %>% 74 | mutate(y = row_number()) 75 | 76 | level2_labels <- pathways %>% 77 | group_by(Level2) %>% 78 | summarise(y_level2 = mean(y)) %>% 79 | ungroup() 80 | 81 | data <- data %>% 82 | left_join(pathways %>% select(pathway, y), by = "pathway") %>% 83 | left_join(level2_labels, by = "Level2") 84 | 85 | groups <- sort(unique(data$group)) 86 | n_groups <- length(groups) 87 | group_x_positions <- 2:(1 + n_groups) 88 | 89 | group_mapping <- data.frame( 90 | group = groups, 91 | x_group = group_x_positions 92 | ) 93 | 94 | data <- data %>% 95 | left_join(group_mapping, by = "group") 96 | 97 | x_pathway <- 1 + n_groups + x_pathway_offset 98 | 99 | pathway_labels <- pathways %>% 100 | mutate(x_pathway = x_pathway) %>% 101 | mutate(x = x_pathway, label = pathway) 102 | 103 | # Prepare data for curves and segments 104 | lines_data <- data %>% 105 | select(Level2, pathway, y) %>% 106 | distinct() %>% 107 | left_join(level2_labels, by = "Level2") %>% 108 | group_by(Level2) %>% 109 | arrange(y) %>% 110 | mutate( 111 | n_pathways = n(), 112 | index = row_number(), 113 | curvature = case_when( 114 | n_pathways == 1 ~ 0, 115 | index <= n_pathways / 2 ~ +0.1, 116 | TRUE ~ -0.1 117 | ) 118 | ) %>% 119 | ungroup() %>% 120 | mutate( 121 | x_start = 1, 122 | x_end = 1.5, 123 | y_start = y_level2, 124 | y_end = y 125 | ) 126 | 127 | curve_lines_data <- lines_data %>% filter(n_pathways > 1) 128 | segment_lines_data <- lines_data %>% filter(n_pathways == 1) 129 | 130 | pathways_lines <- pathways %>% 131 | group_by(Level2) %>% 132 | summarise( 133 | y_min = min(y), 134 | y_max = max(y), 135 | n_pathways = n() 136 | ) %>% 137 | ungroup() %>% 138 | mutate( 139 | delta = ifelse(n_pathways == 1, 0.1, 0), 140 | y_start = y_min - delta, 141 | y_end = y_max + delta, 142 | x = 1.5 143 | ) 144 | 145 | lines_horizontal <- data %>% 146 | select(group, x_group, y, pathway) %>% 147 | distinct() %>% 148 | mutate( 149 | x_start = x_group, 150 | x_end = x_pathway, 151 | y_end = y 152 | ) 153 | 154 | vlines_data <- data.frame( 155 | x = group_x_positions, 156 | y_start = min(data$y) - 0.5, 157 | y_end = max(data$y) + 0.5 158 | ) 159 | 160 | p_main <- ggplot() + 161 | lapply(1:nrow(curve_lines_data), function(i) { 162 | geom_curve( 163 | data = curve_lines_data[i, ], 164 | aes(x = x_start, y = y_start, xend = x_end, yend = y_end), 165 | curvature = curve_lines_data$curvature[i], 166 | color = curve_color, 167 | size = curve_size 168 | ) 169 | }) + 170 | geom_segment(data = segment_lines_data, 171 | aes(x = x_start, y = y_start, xend = x_end, yend = y_end), 172 | color = curve_color, size = curve_size) + 173 | geom_segment(data = pathways_lines, 174 | aes(x = x, y = y_start, xend = x, yend = y_end), 175 | color = vertical_line_color, size = vertical_line_size) + 176 | geom_segment(data = lines_horizontal, 177 | aes(x = x_start, y = y, xend = x_end, yend = y_end), 178 | color = dot_line_color, size = dot_line_size, linetype = dot_line_type) + 179 | geom_segment(data = vlines_data, 180 | aes(x = x, y = y_start, xend = x, yend = y_end), 181 | color = vline_color, linetype = vline_type) + 182 | geom_text(data = level2_labels, 183 | aes(x = 1, y = y_level2, label = Level2), 184 | hjust = 1, size = label_font_size, fontface = label_font_face) + 185 | geom_point(data = data, 186 | aes(x = x_group, y = y, color = NES, size = -log10(padj))) + 187 | geom_text(data = pathway_labels, 188 | aes(x = x, y = y, label = label), 189 | hjust = 0, size = pathway_font_size, fontface = pathway_font_face) + 190 | scale_x_continuous( 191 | limits = c(0.5, x_pathway + 1.2), 192 | breaks = c(1, 1.5, group_x_positions, x_pathway), 193 | labels = c("", "", groups, ""), 194 | expand = c(0, 0) 195 | ) + 196 | scale_y_continuous( 197 | limits = c(min(data$y) - 0.5, max(data$y) + 0.5), 198 | expand = c(0, 0) 199 | ) + 200 | scale_color_gradient2(low = color_low, high = color_high, mid=color_mid,midpoint = 0,name = "NES") + 201 | scale_size_continuous(name = "-log10(Padj)", range = size_range) + 202 | theme_minimal() + 203 | theme( 204 | axis.title = element_blank(), 205 | axis.text.y = element_blank(), 206 | axis.text.x = element_text(angle=90,hjust=1,vjust = 0.5), 207 | axis.ticks = element_blank(), 208 | panel.grid.major.y = element_blank(), 209 | panel.grid.minor.y = element_blank(), 210 | panel.grid.major.x = element_blank(), 211 | panel.grid.minor.x = element_blank(), 212 | legend.position = "none", 213 | plot.margin = margin(t = plot_margins[1], r = plot_margins[2], b = plot_margins[3], l = plot_margins[4], unit = "pt") 214 | ) + 215 | coord_cartesian(clip = "off") 216 | 217 | p_legend <- ggplot(data, aes(x = x_group, y = y, color = NES, size = neg_log10_Padj)) + 218 | geom_point() + 219 | scale_color_gradient2(low = color_low, high = color_high, mid=color_mid,midpoint = 0,name = "NES") + 220 | scale_size_continuous(name = "-log10(Padj)", range = size_range) + 221 | theme_minimal() + 222 | theme( 223 | legend.position = legend_position, 224 | legend.box.margin = margin(0, 0, 0, 0) 225 | ) 226 | 227 | legend <- get_legend(p_legend) 228 | 229 | final_plot <- plot_grid( 230 | p_main, 231 | legend, 232 | ncol = 2, 233 | rel_widths = c(1, 0.2) 234 | ) 235 | 236 | return(final_plot) 237 | } 238 | -------------------------------------------------------------------------------- /R/ggheatmap.R: -------------------------------------------------------------------------------- 1 | #' Plot compare heatmap of Enrichment result among DEG groups 2 | #' @importFrom dplyr full_join 3 | #' @importFrom dplyr arrange 4 | #' @importFrom ggplot2 ggplot 5 | #' @importFrom ggplot2 geom_tile 6 | #' @importFrom ggplot2 scale_fill_gradient2 7 | #' @importFrom ggplot2 theme 8 | #' @importFrom ggplot2 theme_minimal 9 | #' @importFrom ggplot2 coord_equal 10 | #' @importFrom ggplot2 coord_flip 11 | #' @importFrom reshape2 melt 12 | #' @importFrom magrittr %>% 13 | #' @param richRes list of enrichment object 14 | #' @param top the number of Terms you want to display 15 | #' @param colnames the compare DEG group names 16 | #' @param xsize size of group name 17 | #' @param ysize size of Terms name 18 | #' @author Kai Guo 19 | ggheatmap<-function(richRes, top = 50, colnames = NULL, xsize = 6, ysize = 6,usePadj=FALSE, 20 | horizontal=FALSE,returnData=FALSE,...) 21 | { 22 | object<-Reduce(function(x, y) rbind(x, y), lapply(richRes, function(x)x@result[1:top,])) 23 | object<-as.data.frame(na.omit(object)) 24 | sel<-as.vector(unique(object$Term)) 25 | if(isTRUE(usePadj)){ 26 | res <- Reduce(function(x, y) full_join(x, y, by = "Term"),lapply(richRes,function(x)x@result[,c("Term","Padj")])) 27 | }else{ 28 | res <- Reduce(function(x, y) full_join(x, y, by = "Term"),lapply(richRes,function(x)x@result[,c("Term","Pvalue")])) 29 | } 30 | if (!is.null(colnames)) { 31 | colnames(res)[2:ncol(res)] <- colnames 32 | } 33 | else { 34 | colnames(res)[2:ncol(res)] <- paste("Group", 1:(ncol(res)-1), sep = "_") 35 | } 36 | res[is.na(res)] <- 1 37 | res<-subset(res,Term%in%sel) 38 | res<-as.data.frame(res) 39 | rownames(res)<-res$Term 40 | cor_mat<-cor(t(res[,2:ncol(res)])) 41 | dd <- as.dist((1-cor_mat)/2); 42 | hc <- hclust(dd); 43 | melted <- melt(res[hc$order,]) 44 | melted$Term<-factor(melted$Term,levels=res$Term[hc$order]) 45 | maxp = max(-log10(melted[, 3])) + 0.5 46 | if(!isTRUE(usePadj)){ 47 | colnames(melted)[3] <- "Padj" 48 | p<-ggplot(melted, aes(x = variable, y = Term, fill = -log10(Padj))) +coord_equal(ratio = 0.8)+ 49 | geom_tile(color = "white") + scale_fill_gradient2(low = "white",high = "red", midpoint = 0, limit = c(0, maxp)) + 50 | theme_minimal()+theme(axis.text.y = element_text(size = ysize), axis.text.x = element_text(angle = 70, 51 | vjust = 1, size = xsize, hjust = 1,face = "bold")) + 52 | theme(axis.title.x = element_blank(),axis.title.y = element_blank(), panel.grid.major = element_blank(), 53 | panel.grid.minor = element_blank()) 54 | }else{ 55 | colnames(melted)[3] <- "Pvalue" 56 | p<-ggplot(melted, aes(x = variable, y = Term, fill = -log10(Pvalue))) +coord_equal(ratio = 0.8)+ 57 | geom_tile(color = "white") + scale_fill_gradient2(low = "white",high = "red", midpoint = 0, limit = c(0, maxp)) + 58 | theme_minimal()+theme(axis.text.y = element_text(size = ysize), axis.text.x = element_text(angle = 70, 59 | vjust = 1, size = xsize, hjust = 1,face = "bold")) + 60 | theme(axis.title.x = element_blank(),axis.title.y = element_blank(), panel.grid.major = element_blank(), 61 | panel.grid.minor = element_blank()) 62 | } 63 | if(isTRUE(horizontal)){ 64 | p<-p+coord_flip() 65 | } 66 | if(isTRUE(returnData)){ 67 | return(res) 68 | }else{ 69 | p 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /R/ggnetmap.R: -------------------------------------------------------------------------------- 1 | ##' generate network based on Enrichment results 2 | ##' @rdname ggnetmap 3 | ##' @param richRes list of enrichment object 4 | ##' @param gene vector contains gene names or dataframe with DEGs information 5 | ##' @param top number of terms to display 6 | ##' @param top.display top number to display 7 | ##' @param pvalue cutoff value of pvalue (if padj set as NULL) 8 | ##' @param padj cutoff value of p adjust value 9 | ##' @param weightcut cutoff valule for edge 10 | ##' @param usePadj use adjust p value as color or not (should use with padj) 11 | ##' @param layout layout method ('fruchtermanreingold','kamadakawai','target','circle') 12 | ##' @param low color used for small value 13 | ##' @param high color used for large value 14 | ##' @param writeCyt write out the cytoscape file 15 | ##' @param cytoscapeFile output cytoscape File 16 | ##' @param cytoscapeFormat Character string giving the output file format 17 | ##' @param segment.size size for label segment 18 | ##' @param node.alpha alpha-transparency scales 19 | ##' @param label.font label font 20 | ##' @param label.color label color 21 | ##' @param label.size label size 22 | ##' @param filename figure output name 23 | ##' @param savefig save the figure or not 24 | ##' @param width figure width 25 | ##' @param height figure height 26 | ##' @examples 27 | #' \dontrun{ 28 | #' hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 29 | #' hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 30 | #' gene <- sample(unique(hsako$GeneID),1000) 31 | #' resko <-richKEGG(gene,kodata = hsako) 32 | #' resgo <- richGO(gene,hsago) 33 | #' ggnetmap(list(resgo,resko)) 34 | #' } 35 | ##' @export 36 | ##' @author Kai Guo 37 | ggnetmap<-function(richRes,gene=NULL,top=50,top.display=NULL,pvalue = 0.05, padj = NULL,usePadj=TRUE,low = "orange",high = "red", 38 | weightcut = 0.2, useTerm = TRUE, writeCyt = FALSE,cytoscapeFile = "cytoscape.txt",cytoscapeFormat="graphml", 39 | label.color = "black", label.size = 2,node.shape=NULL, layout = "fruchtermanreingold",savefig=FALSE, 40 | visNet=FALSE,smooth=TRUE,nodeselect=FALSE,edit=FALSE,savehtml=FALSE,filename="network", 41 | width=7,height=7,segment.size=0.2,node.alpha=0.7,...){ 42 | if(!is.null(top)){ 43 | object<-Reduce(function(x, y) rbind(x, y), lapply(richRes, function(x)x@result[1:top,])) 44 | }else{ 45 | object<-Reduce(function(x, y) rbind(x, y), lapply(richRes, function(x)x@result)) 46 | } 47 | object <- object[order(object$Pvalue),] 48 | if(is.null(gene)){ 49 | gene <- unique(unlist(lapply(richRes, function(x) x@gene))) 50 | } 51 | if(is.null(top.display)){ 52 | top.display=nrow(object) 53 | } 54 | ggnetwork(object,gene=gene,top=top,pvalue=pvalue,padj=padj,usePadj=usePadj,weightcut=weightcut,useTerm=useTerm,writeCyt=writeCyt, 55 | cytoscapeFile = cytoscapeFile,cytoscapeFormat=cytoscapeFormat, 56 | label.font=label.font,label.color=label.color,label.size=label.size,node.shape=node.shape, 57 | layout=layout,savefig=savefig,width=width,height=height, 58 | visNet=visNet,smooth=smooth,nodeselect=nodeselect,edit=edit, 59 | filename=filename,node.alpha=node.alpha,...) 60 | } 61 | -------------------------------------------------------------------------------- /R/kappa.R: -------------------------------------------------------------------------------- 1 | ##' calculate kappa cluster 2 | ##' @param x richResult object 3 | ##' @param gene (Optional).a vector of gene list 4 | ##' @param useTerm to use the term or not (TRUE/FALSE) 5 | ##' @param cutoff kappa score threshold for significant dispersion results 6 | ##' @param overlap overlap between clusters 7 | ##' @param minSize minimal number of terms in the cluster 8 | ##' @param escore kappa enrichment score cutoff value (default: 3) 9 | ##' @author Kai Guo 10 | .kappa_cluster_internal<-function(x,gene=NULL,useTerm=FALSE,cutoff=0.5,overlap=0.5,minSize=5,escore=3){ 11 | if(isTRUE(useTerm)){ 12 | rownames(x) <- x$Term 13 | }else{ 14 | rownames(x) <- x$Annot 15 | } 16 | mat<-expand.grid(rownames(x),rownames(x),stringsAsFactors=F) 17 | mat <- mat[mat$Var1>mat$Var2,] 18 | mat$kappa <- apply(mat,1,function(y).kappa(x[y[1],"GeneID"],x[y[2],"GeneID"],gene)) 19 | mat<-mat[mat$kappa > cutoff,] 20 | if(nrow(mat)==0){ 21 | stop("kappa cutoff too high\n") 22 | } 23 | ml1<-split(mat$Var1,mat$Var2) 24 | ml2<-split(mat$Var2,mat$Var1) 25 | ### 26 | ml<-sapply(union(names(ml1),names(ml2)),function(x)c(ml1[[x]],ml2[[x]])) 27 | ### 28 | res<-.merge_term(ml,overlap) 29 | #### remove the class with smaller number 30 | res<-res[unlist(lapply(res, function(x)length(x)>=minSize))] 31 | ###find the smallest p value 32 | idx<-lapply(res,function(y)which.min(x[y,"Pvalue"])) 33 | ###use the term with smallest p value as name 34 | names(res)<-unlist(lapply(names(idx),function(x)res[[x]][idx[[x]]])) 35 | res<-sapply(unique(names(res)),function(x)unique(unlist(res[names(res)==x]))) 36 | ##### 37 | es <- lapply(res, function(y).calculate_Enrichment_Score(y,x)) 38 | tl <- unlist(lapply(res,length)) 39 | es <- unlist(es)/tl 40 | es <- es[es>escore] 41 | if(length(es)==0){ 42 | stop("Enrichment score too high, No significant cluster\n") 43 | } 44 | dx <- x[names(es),] 45 | tl <- tl[names(es)] 46 | dy <-data.frame(AnnotationCluster=1:length(es),EnrichmentScore=es,filteredClusterSize=tl) 47 | rs<-cbind(dy,dx) 48 | rs<-rs[order(rs$EnrichmentScore,decreasing = T),] 49 | rs$Cluster<-unlist(lapply(res[rownames(rs)],function(x)paste(x,collapse=",",sep="")))[rownames(rs)] 50 | return(rs) 51 | } 52 | #' kappa cluster analysis 53 | ##' @param x richResult object or dataframe 54 | ##' @param gene (Optional).a vector of gene list 55 | ##' @param useTerm to use the term or not (TRUE/FALSE) 56 | ##' @param cutoff kappa score threshold for significant dispersion results 57 | ##' @param overlap cutoff value of the overlap between two Terms 58 | ##' @param minSize minimal number of terms in the cluster 59 | ##' @param escore kappa enrichment score cutoff value (default: 3) 60 | #' @examples 61 | #' \dontrun{ 62 | #' hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 63 | #' gene=sample(unique(hsago$GeneID),1000) 64 | #' res<-richGO(gene,godata = hsago,ontology ="BP") 65 | #' resc<-richCluster(res) 66 | #' } 67 | #' @export 68 | #' @author Kai Guo 69 | setMethod("richCluster", signature(x = "data.frame"),definition = function(x,gene=NULL,useTerm=FALSE,cutoff=0.5,overlap=0.5,minSize=5,escore=3) { 70 | if(is.null(gene)){ 71 | gene=unique(unlist(strsplit(x$GeneID,","))) 72 | } 73 | .kappa_cluster_internal(x,gene=gene,useTerm=useTerm,cutoff=cutoff,overlap=overlap,minSize=minSize,escore=escore) 74 | }) 75 | #' kappa cluster analysis 76 | ##' @param x richResult object or dataframe 77 | ##' @param gene (Optional).a vector of gene list 78 | ##' @param useTerm to use the term or not (TRUE/FALSE) 79 | ##' @param cutoff kappa score threshold for significant dispersion results 80 | ##' @param overlap cutoff value of the overlap between two Terms 81 | ##' @param minSize minimal number of terms in the cluster 82 | ##' @param escore kappa enrichment score cutoff value (default: 3) 83 | #' @examples 84 | #' \dontrun{ 85 | #' hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 86 | #' gene=sample(unique(hsago$GeneID),1000) 87 | #' res<-richGO(gene,godata = hsago,ontology ="BP") 88 | #' resc<-richCluster(res) 89 | #' } 90 | #' @export 91 | #' @author Kai Guo 92 | setMethod("richCluster", signature(x = "richResult"),definition = function(x,gene=NULL,useTerm=FALSE,cutoff=0.5,overlap=0.5,minSize=5,escore=3) { 93 | if(is.null(gene)){ 94 | gene=x@gene 95 | } 96 | .kappa_cluster_internal(x@result,gene=gene,useTerm=useTerm,cutoff=cutoff,overlap=overlap,minSize=minSize,escore=escore) 97 | }) 98 | -------------------------------------------------------------------------------- /R/makeown.R: -------------------------------------------------------------------------------- 1 | #' make annotation database using bioAnno results 2 | #' @importFrom AnnotationDbi keys 3 | #' @importFrom dplyr distinct 4 | #' @param dbname database name from bioAnno 5 | #' @param anntype GO or KEGG 6 | #' @param OP BP,CC,MF default use all 7 | #' @examples 8 | #' \dontrun{ 9 | #' fromKEGG(species="ath") 10 | #' athgo<-buildOwn(dbname="org.ath.eg.db",anntype="GO") 11 | #' } 12 | #' @author Kai Guo 13 | #' @export 14 | buildOwn<-function(dbname,anntype="GO",OP=NULL,species="",keytype=""){ 15 | if (!require(dbname,character.only=TRUE)){ 16 | stop("Please give the package name") 17 | }else{ 18 | suppressMessages(require(dbname,character.only = T,quietly = T)) 19 | } 20 | dbname<-eval(parse(text=dbname)) 21 | if(anntype=="GO"){ 22 | annof<-AnnotationDbi::select(dbname,keys=keys(dbname,keytype=keytype),keytype=keytype,columns=c("GOALL","ONTOLOGYALL")) 23 | colnames(annof)[1]<-"GeneID" 24 | # annof<-distinct_(annof,~GeneID, ~GOALL, ~ONTOLOGYALL) 25 | annof<-distinct(annof[,c("GeneID", "GOALL", "ONTOLOGYALL")]) 26 | annot <- getann("GO") 27 | annof$Annot <- annot[annof[,2],"annotation"] 28 | if(!is.null(OP)){ 29 | annof<-annof[annof$ONTOLOGYALL==OP,] 30 | } 31 | }else if(anntype=="KEGG"){ 32 | annof=AnnotationDbi::select(dbname,keys=keys(dbname,keytype=keytype),keytype=keytype,columns="PATH") 33 | annof<-na.omit(annof) 34 | annot<-getann("KEGG") 35 | annof[,1]<-as.vector(annof[,1]) 36 | annof[,2]<-as.vector(annof[,2]) 37 | annof$Annot<-annot[annof[,2],"annotation"] 38 | }else if(anntype=="KEGGM"){ 39 | annof=AnnotationDbi::select(dbname,keys=keys(dbname,keytype=keytype),keytype=keytype,columns="KEGGM") 40 | annof<-na.omit(annof) 41 | annot<-.get_kgm.data() 42 | annof[,1]<-as.vector(annof[,1]) 43 | annof[,2]<-as.vector(annof[,2]) 44 | annof$Annot<-annot[annof[,2],"annotation"] 45 | }else{ 46 | annof=AnnotationDbi::select(dbname,keys=keys(dbname,keytype=keytype),keytype=keytype,columns=anntype) 47 | annof<-na.omit(annof) 48 | annof[,1]<-as.vector(annof[,1]) 49 | annof[,2]<-as.vector(annof[,2]) 50 | annof$Annot<-annof[,2] 51 | } 52 | annof <- na.omit(annof) 53 | result<-new("Annot", 54 | species = species, 55 | anntype = anntype, 56 | keytype = keytype, 57 | annot = annof 58 | 59 | ) 60 | return(result) 61 | } 62 | 63 | 64 | -------------------------------------------------------------------------------- /R/richGO.R: -------------------------------------------------------------------------------- 1 | #' GO Enrichment analysis function 2 | #' @param x vector contains gene names or dataframe with DEGs information 3 | #' @param godata GO annotation data 4 | #' @param ontology BP,MF or CC 5 | #' @param pvalue cutoff pvalue 6 | #' @param padj cutoff p adjust value 7 | #' @param organism organism 8 | #' @param keytype keytype for input genes 9 | #' @param minSize minimal number of genes included in significant terms 10 | #' @param maxSize maximum number of genes included in significant terms 11 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 12 | #' @param maxGSSize maximal size of each geneset for analyzing 13 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: FALSE) 14 | #' @param filename output filename 15 | #' @param padj.method pvalue adjust method(default:"BH") 16 | #' @param sep character string used to separate the genes when concatenating 17 | #' @author Kai Guo 18 | richGO_internal<-function(x,godata,ontology="BP",pvalue=0.05,padj=NULL, 19 | organism=NULL,keytype="SYMBOL",minSize=2,maxSize=500, 20 | minGSSize = 10, maxGSSize = 500, 21 | keepRich=FALSE, filename=NULL,padj.method="BH",sep=","){ 22 | go2gene<-sf(godata) 23 | all_go<-.get_go_dat(ont=ontology) 24 | go2gene<-go2gene[names(go2gene)%in%rownames(all_go)]; 25 | gene2go<-reverseList(go2gene) 26 | if(is.data.frame(x)){ 27 | input=rownames(x) 28 | }else{ 29 | input=as.vector(x) 30 | } 31 | fgene2go<-gene2go[input]; 32 | fgo2gene<-reverseList(fgene2go) 33 | k=name_table(fgo2gene); 34 | n=sum(!is.na(names(fgene2go))) 35 | IGO<-names(fgo2gene); 36 | N <- length(unique(unlist(go2gene))); 37 | M <- name_table(go2gene[IGO]) 38 | rhs<-hyper_bench_vector(k,M,N,n) 39 | lhs<-p.adjust(rhs,method=padj.method) 40 | rhs_an<-all_go[names(rhs),] 41 | rhs_gene<-unlist(lapply(fgo2gene, function(x)paste(unique(x),sep="",collapse = sep))) 42 | Annotated=M[names(rhs)] 43 | Significant=k[names(rhs)] 44 | RichFactor <- Significant / Annotated 45 | FoldEnrichment <- RichFactor * N / n 46 | Pvalue=as.vector(rhs) 47 | GeneID=rhs_gene[names(rhs)] 48 | # mu and sigma are the mean and standard deviation of the hypergeometric distribution 49 | ## https://en.wikipedia.org/wiki/Hypergeometric_distribution 50 | mu <- M * n / N 51 | sigma <- mu * (N - n) * (N - M) / N / (N-1) 52 | zscore <- (k - mu)/sqrt(sigma) 53 | 54 | resultFis<-data.frame("Annot"=names(rhs),"Term"=rhs_an,"Annotated"=Annotated, 55 | "Significant"=Significant,"RichFactor" = RichFactor,"FoldEnrichment"= FoldEnrichment, 56 | "zscore"=zscore,"Pvalue"=Pvalue,"Padj"=lhs, 57 | "GeneID"=GeneID) 58 | resultFis<-resultFis[order(resultFis$Pvalue),] 59 | resultFis<-subset(resultFis, Significant<=maxSize) 60 | ## remove gene Set with too much gene annotated 61 | resultFis<-subset(resultFis, Annotated<=maxGSSize) 62 | if(keepRich==FALSE){ 63 | resultFis<-subset(resultFis, Significant>=minSize) 64 | resultFis<-subset(resultFis, Annotated>=minGSSize) 65 | }else{ 66 | resultFis<-subset(resultFis, Significant>=minSize|RichFactor==1|Annotated >=minGSSize) 67 | } 68 | if(is.null(padj)){ 69 | resultFis<-resultFis[resultFis$Pvalue=1)){ 82 | gene<-strsplit(as.vector(resultFis$GeneID),split=sep) 83 | names(gene)<-resultFis$Annot 84 | gened<-data.frame("TERM"=rep(names(gene),times=unlist(lapply(gene,length))), 85 | "Annot"=rep(resultFis$Term,times=unlist(lapply(gene,length))), 86 | "GeneID"=unlist(gene),row.names=NULL, 87 | "Pvalue"=rep(resultFis$Pvalue,times=unlist(lapply(gene,length))), 88 | "Padj"=rep(resultFis$Padj,times=unlist(lapply(gene,length))) 89 | ) 90 | }else{ 91 | gene = x 92 | names(gene)<-resultFis$Annot 93 | gened<-data.frame("TERM"="", 94 | "Annot"="", 95 | "GeneID"=x,row.names=NULL, 96 | "Pvalue"=1, 97 | "Padj"=1) 98 | } 99 | gened$GeneID<-as.character(gened$GeneID) 100 | detail<-gened 101 | } 102 | if(is.null(organism)){ 103 | organism=character() 104 | } 105 | if(is.null(keytype)){ 106 | keytype=character() 107 | } 108 | result<-new("richResult", 109 | result=resultFis, 110 | detail=detail, 111 | pvalueCutoff = pvalue, 112 | pAdjustMethod = padj.method, 113 | padjCutoff = padj, 114 | genenumber = length(input), 115 | organism = organism, 116 | ontology = ontology, 117 | gene = input, 118 | keytype = keytype, 119 | sep=sep 120 | ) 121 | return(result); 122 | } 123 | #' GO Enrichment analysis function 124 | #' @param x vector contains gene names or dataframe with DEGs information 125 | #' @param godata GO annotation data 126 | #' @param ontology BP,MF or CC 127 | #' @param pvalue cutoff pvalue 128 | #' @param padj cutoff p adjust value 129 | #' @param organism organism 130 | #' @param keytype keytype for input genes 131 | #' @param minSize minimal number of genes included in significant terms 132 | #' @param maxSize maximum number of genes included in significant terms 133 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 134 | #' @param maxGSSize maximal size of each geneset for analyzing 135 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 136 | #' @param filename output filename 137 | #' @param padj.method pvalue adjust method(default:"BH") 138 | #' @param sep character string used to separate the genes when concatenating 139 | #' @examples 140 | #' \dontrun{ 141 | #' hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 142 | #' hsago <- as.data.frame(hsago) 143 | #' gene <- sample(unique(hsago$GeneID),1000) 144 | #' res<-richGO(gene,godata = hsago,ontology ="BP") 145 | #' } 146 | #' @export 147 | #' @author Kai Guo 148 | setMethod("richGO", signature(godata = "data.frame"),definition = function(x,godata,ontology="BP",pvalue=0.05,padj=NULL, 149 | organism=NULL,keytype=NULL,minSize=2,maxSize=500, 150 | minGSSize = 10, maxGSSize = 500, 151 | keepRich=TRUE, filename=NULL,padj.method="BH",sep=",") { 152 | # godata<-as(godata,"Annot") 153 | richGO_internal(x,godata,ontology=ontology,pvalue=pvalue,padj=padj, 154 | organism=organism,keytype=keytype,minSize=minSize,maxSize=maxSize, 155 | minGSSize = minGSSize, maxGSSize = maxGSSize, 156 | keepRich=keepRich,filename=filename,padj.method=padj.method,sep=sep) 157 | }) 158 | 159 | #' GO Enrichment analysis function 160 | #' @param x vector contains gene names or dataframe with DEGs information 161 | #' @param godata GO annotation data 162 | #' @param ontology BP,MF or CC 163 | #' @param pvalue cutoff pvalue 164 | #' @param padj cutoff p adjust value 165 | #' @param organism organism 166 | #' @param keytype keytype for input genes 167 | #' @param minSize minimal number of genes included in significant terms 168 | #' @param maxSize maximum number of genes included in significant terms 169 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 170 | #' @param maxGSSize maximal size of each geneset for analyzing 171 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 172 | #' @param filename output filename 173 | #' @param padj.method pvalue adjust method(default:"BH") 174 | #' @param sep character string used to separate the genes when concatenating 175 | #' @examples 176 | #' \dontrun{ 177 | #' hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 178 | #' gene=sample(unique(hsago$GeneID),1000) 179 | #' res<-richGO(gene,godata = hsago,ontology ="BP") 180 | #' } 181 | #' @export 182 | #' @author Kai Guo 183 | setMethod("richGO", signature(godata = "Annot"),definition = function(x,godata,ontology="BP",pvalue=0.05,padj=NULL,minSize=2,maxSize=500, 184 | minGSSize = 10, maxGSSize = 500, 185 | keepRich=TRUE,filename=NULL,padj.method="BH",sep=",") { 186 | richGO_internal(x,godata@annot,ontology=ontology,pvalue=pvalue,padj=padj, 187 | organism=godata@species,keytype=godata@keytype,minSize=minSize,maxSize=maxSize,minGSSize = minGSSize, maxGSSize = maxGSSize, 188 | keepRich=keepRich,filename=filename,padj.method=padj.method,sep=sep) 189 | }) 190 | -------------------------------------------------------------------------------- /R/richKEGG.R: -------------------------------------------------------------------------------- 1 | #' KEGG Pathway Enrichment analysis function 2 | #' @importFrom dplyr filter 3 | #' @importFrom rlang sym 4 | #' @param x vector contains gene names or dataframe with DEGs information 5 | #' @param kodata GO annotation data 6 | #' @param ontology KEGG 7 | #' @param pvalue cutoff pvalue 8 | #' @param padj cutoff p adjust value 9 | #' @param organism organism 10 | #' @param keytype keytype for input genes 11 | #' @param minSize minimal number of genes included in significant terms 12 | #' @param maxSize maximum number of genes included in significant terms 13 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 14 | #' @param maxGSSize maximal size of each geneSet for analyzing 15 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 16 | #' @param bulitin use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data) 17 | #' @param filename output filename 18 | #' @param padj.method pvalue adjust method(default:"BH") 19 | #' @param sep character string used to separate the genes when concatenating 20 | #' @author Kai Guo 21 | richKEGG_internal<-function(x,kodata,pvalue=0.05,padj=NULL,ontology="KEGG", 22 | organism=NULL,keytype="SYMBOL",minSize=2,maxSize=500, 23 | minGSSize = 10, maxGSSize = 500, 24 | keepRich=TRUE, filename=NULL,padj.method="BH",builtin=TRUE,sep=","){ 25 | 26 | ko2gene<-sf(kodata) 27 | ko2gene_num<-name_table(ko2gene) 28 | gene2ko<-sf(kodata[,c(2,1)]) 29 | if(is.data.frame(x)){ 30 | input=rownames(x) 31 | }else{ 32 | input=as.vector(x) 33 | } 34 | fgene2ko=gene2ko[input] 35 | fko2gene=reverseList(fgene2ko) 36 | k=name_table(fko2gene) 37 | n=length(unique(unlist(fko2gene))) 38 | M=ko2gene_num[names(k)] 39 | N=length(unique(kodata[,1])) 40 | ###change to k-1 to keep result similar as other tools 41 | rhs<-hyper_bench_vector(k,M,N,n) 42 | lhs<-p.adjust(rhs,method=padj.method) 43 | if(ontology=="KEGGM"){ 44 | all_ko<-.get_kgm.data() 45 | }else{ 46 | all_ko<-.get_kg_dat(builtin=builtin) 47 | } 48 | rhs_an<-all_ko[names(rhs),] 49 | rhs_gene<-unlist(lapply(fko2gene, function(x)paste(unique(x),sep="",collapse = sep))) 50 | Annotated=M[names(rhs)] 51 | Significant=k[names(rhs)] 52 | RichFactor <- Significant / Annotated 53 | FoldEnrichment <- RichFactor * N / n 54 | Pvalue=as.vector(rhs) 55 | GeneID=rhs_gene[names(rhs)] 56 | # mu and sigma are the mean and standard deviation of the hypergeometric distribution 57 | ## https://en.wikipedia.org/wiki/Hypergeometric_distribution 58 | mu <- M * n / N 59 | sigma <- mu * (N - n) * (N - M) / N / (N-1) 60 | zscore <- (k - mu)/sqrt(sigma) 61 | 62 | resultFis<-data.frame("Annot"=names(rhs),"Term"=rhs_an,"Annotated"=Annotated, 63 | "Significant"=Significant,"RichFactor" = RichFactor,"FoldEnrichment"= FoldEnrichment, 64 | "zscore"=zscore,"Pvalue"=Pvalue,"Padj"=lhs, 65 | "GeneID"=GeneID) 66 | data("path") 67 | resultFis<-cbind(resultFis,path[resultFis$Annot,]) 68 | resultFis<-resultFis[order(resultFis$Pvalue),] 69 | resultFis<-subset(resultFis, Significant<=maxSize) 70 | resultFis<-subset(resultFis, Annotated<=maxGSSize) 71 | if(keepRich==FALSE){ 72 | resultFis<-subset(resultFis, Significant>=minSize) 73 | resultFis<-subset(resultFis, Annotated>=minGSSize) 74 | }else{ 75 | resultFis<-subset(resultFis, Significant>=minSize|RichFactor==1|Annotated >=minGSSize) 76 | } 77 | if(is.null(padj)){ 78 | resultFis<-resultFis[resultFis$Pvalue=1)){ 91 | gene<-strsplit(as.vector(resultFis$GeneID),split=sep) 92 | names(gene)<-resultFis$Annot 93 | gened<-data.frame("TERM"=rep(names(gene),times=unlist(lapply(gene,length))), 94 | "Annot"=rep(resultFis$Term,times=unlist(lapply(gene,length))), 95 | "GeneID"=unlist(gene),row.names=NULL, 96 | "Pvalue"=rep(resultFis$Pvalue,times=unlist(lapply(gene,length))), 97 | "Padj"=rep(resultFis$Padj,times=unlist(lapply(gene,length))) 98 | ) 99 | }else{ 100 | gene <- x 101 | names(gene)<-resultFis$Annot 102 | gened<-data.frame("TERM"="", 103 | "Annot"="", 104 | "GeneID"=x,row.names=NULL, 105 | "Pvalue"=1, 106 | "Padj"=1) 107 | } 108 | gened$GeneID<-as.character(gened$GeneID) 109 | detail<-gened 110 | } 111 | if(is.null(organism)){ 112 | organism=character() 113 | } 114 | if(is.null(keytype)){ 115 | keytype=character() 116 | } 117 | result<-new("richResult", 118 | result=resultFis, 119 | detail=detail, 120 | pvalueCutoff = pvalue, 121 | pAdjustMethod = padj.method, 122 | padjCutoff = padj, 123 | genenumber = length(input), 124 | organism = organism, 125 | ontology = ontology, 126 | gene = input, 127 | keytype = keytype, 128 | sep = sep 129 | ) 130 | return(result) 131 | } 132 | #' KEGG Pathway Enrichment analysis function 133 | #' @param x vector contains gene names or dataframe with DEGs information 134 | #' @param ontology KEGG 135 | #' @param pvalue cutoff pvalue 136 | #' @param padj cutoff p adjust value 137 | #' @param organism organism 138 | #' @param keytype keytype for input genes 139 | #' @param minSize minimal number of genes included in significant terms 140 | #' @param maxSize maximum number of genes included in significant terms 141 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 142 | #' @param maxGSSize maximal size of each geneset for analyzing 143 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 144 | #' @param bulitin use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data) 145 | #' @param filename output filename 146 | #' @param padj.method pvalue adjust method(default:"BH") 147 | #' @param sep character string used to separate the genes when concatenating 148 | #' @examples 149 | #' \dontrun{ 150 | #' hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 151 | #' hsako<-as.data.frame(hsako) 152 | #' gene=sample(unique(hsako$GeneID),1000) 153 | #' res<-richKEGG(gene,kodata = hsako) 154 | #' } 155 | #' @export 156 | #' @author Kai Guo 157 | setMethod("richKEGG", signature(kodata = "data.frame"),definition = function(x,kodata,pvalue=0.05,padj=NULL,organism=NULL,ontology="KEGG", 158 | keytype=NULL,minSize=2,maxSize=500,minGSSize = 10, maxGSSize = 500, 159 | keepRich=TRUE,filename=NULL,padj.method="BH",builtin=TRUE,sep=",") { 160 | richKEGG_internal(x,kodata=kodata,pvalue=pvalue,padj=padj, 161 | organism=organism,ontology=ontology,keytype=keytype,minSize=minSize, 162 | maxSize=maxSize,minGSSize = minGSSize, maxGSSize = maxGSSize,keepRich=keepRich,filename=filename, 163 | padj.method=padj.method,builtin=builtin,sep=sep) 164 | }) 165 | 166 | #' KEGG Enrichment analysis function 167 | #' @param x vector contains gene names or dataframe with DEGs information 168 | #' @param ontology KEGG 169 | #' @param pvalue cutoff pvalue 170 | #' @param padj cutoff p adjust value 171 | #' @param organism organism 172 | #' @param keytype keytype for input genes 173 | #' @param minSize minimal number of genes included in significant terms 174 | #' @param maxSize maximum number of genes included in significant terms 175 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 176 | #' @param maxGSSize maximal size of each geneset for analyzing 177 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 178 | #' @param bulitin use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data) 179 | #' @param filename output filename 180 | #' @param padj.method pvalue adjust method(default:"BH") 181 | #' @param sep character string used to separate the genes when concatenating 182 | #' @examples 183 | #' \dontrun{ 184 | #' hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 185 | #' gene=sample(unique(hsako$GeneID),1000) 186 | #' res<-richKEGG(gene,kodata = hsako) 187 | #' } 188 | #' @export 189 | #' @author Kai Guo 190 | setMethod("richKEGG", signature(kodata = "Annot"),definition = function(x,kodata,pvalue=0.05,padj=NULL,organism=NULL,ontology="KEGG", 191 | keytype=NULL,minSize=2,maxSize=500,minGSSize = 10, maxGSSize = 500, 192 | keepRich=TRUE,filename=NULL,padj.method="BH",builtin=TRUE,sep=",") { 193 | richKEGG_internal(x,kodata@annot,pvalue=pvalue,padj=padj, 194 | organism=kodata@species,ontology=kodata@anntype,keytype=kodata@keytype,minSize=minSize, 195 | maxSize=maxSize,minGSSize = minGSSize, maxGSSize = maxGSSize,keepRich=keepRich,filename=filename, 196 | padj.method=padj.method,builtin=builtin,sep=sep) 197 | }) 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /R/richLevel.R: -------------------------------------------------------------------------------- 1 | #' Pathway Enrichment analysis for different level function 2 | #' @importFrom dplyr filter left_join 3 | #' @importFrom rlang sym 4 | #' @param x vector contains gene names or dataframe with DEGs information 5 | #' @param kodata KEGG annotation data 6 | #' @param pvalue cutoff pvalue 7 | #' @param padj cutoff p adjust value 8 | #' @param organism organism 9 | #' @param keytype keytype for input genes 10 | #' @param ontology ontology type 11 | #' @param minSize minimal number of genes included in significant terms 12 | #' @param maxSize maximum number of genes included in significant terms 13 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 14 | #' @param maxGSSize maximal size of each geneset for analyzing 15 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 16 | #' @param filename output filename 17 | #' @param padj.method pvalue adjust method(default:"BH") 18 | #' @param sep character string used to separate the genes when concatenating 19 | #' @author Kai Guo 20 | richLevel_internal<-function(x,kodata,level="Level2",pvalue =0.05, padj=NULL, 21 | organism=NULL,keytype="SYMBOL",ontology="",minSize=2,maxSize=500, 22 | minGSSize = 10, maxGSSize = 500, 23 | keepRich=TRUE, filename=NULL,padj.method="BH",sep=","){ 24 | data(path) 25 | annot<-left_join(kodata,path,by=c('PATH'="ko")) 26 | annot<-annot[,c("GeneID",level)] 27 | annot<-annot[!is.na(annot[,2]),] 28 | result<-enrich(x = x,object = annot,pvalue=pvalue,padj=padj,organism=organism,minSize=minSize, 29 | maxSize=maxSize,minGSSize = minGSSize, maxGSSize = maxGSSize,keepRich=keepRich,keytype=keytype,ontology=ontology,filename=filename, 30 | padj.method=padj.method,sep = sep) 31 | return(result) 32 | } 33 | #' Pathway Enrichment analysis for different level function 34 | #' @importFrom dplyr filter left_join 35 | #' @importFrom rlang sym 36 | #' @param x vector contains gene names or dataframe with DEGs information 37 | #' @param kodata KEGG annotation data 38 | #' @param pvalue cutoff pvalue 39 | #' @param padj cutoff p adjust value 40 | #' @param organism organism 41 | #' @param keytype keytype for input genes 42 | #' @param ontology ontology type 43 | #' @param minSize minimal number of genes included in significant terms 44 | #' @param maxSize maximum number of genes included in significant terms 45 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 46 | #' @param maxGSSize maximal size of each geneset for analyzing 47 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 48 | #' @param filename output filename 49 | #' @param padj.method pvalue adjust method(default:"BH") 50 | #' @param sep character string used to separate the genes when concatenating 51 | #' @examples 52 | #' \dontrun{ 53 | #' hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 54 | #' hsako<-as.data.frame(hsako) 55 | #' gene=sample(unique(hsako$GeneID),1000) 56 | #' res<-richLevel(gene,kodata = hsako,level="Level2") 57 | #' } 58 | #' @export 59 | #' @author Kai Guo 60 | setMethod("richLevel", signature(kodata = "data.frame"),definition = function(x,kodata,level="Level2",pvalue =0.05, padj=NULL, 61 | organism=NULL,keytype="SYMBOL",ontology="KEGG",minSize=2,maxSize=500, 62 | minGSSize = 10, maxGSSize = 500, 63 | keepRich=TRUE, filename=NULL,padj.method="BH",sep=",") { 64 | richLevel_internal(x,kodata=kodata,level=level, pvalue=pvalue,padj=padj, 65 | organism=organism,keytype=keytype,ontology=ontology,minSize=minSize, 66 | maxSize=maxSize,minGSSize = minGSSize, maxGSSize = maxGSSize,keepRich=keepRich,filename=filename, 67 | padj.method=padj.method,sep=sep) 68 | }) 69 | 70 | #' Pathway Enrichment analysis for different level function 71 | #' @importFrom dplyr filter left_join 72 | #' @param x vector contains gene names or dataframe with DEGs information 73 | #' @param kodata KEGG annotation data 74 | #' @param pvalue cutoff pvalue 75 | #' @param padj cutoff p adjust value 76 | #' @param organism organism 77 | #' @param keytype keytype for input genes 78 | #' @param ontology ontology type 79 | #' @param minSize minimal number of genes included in significant terms 80 | #' @param maxSize maximum number of genes included in significant terms 81 | #' @param minGSSize minimal size of genes annotated by ontology term for testing. 82 | #' @param maxGSSize maximal size of each geneset for analyzing 83 | #' @param keepRich keep terms with rich factor value equal 1 or not (default: TRUE) 84 | #' @param filename output filename 85 | #' @param padj.method pvalue adjust method(default:"BH") 86 | #' @param sep character string used to separate the genes when concatenating 87 | #' @examples 88 | #' \dontrun{ 89 | #' hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 90 | #' gene=sample(unique(hsako$GeneID),1000) 91 | #' res<-richLevel(gene,kodata = hsako,level="Level2") 92 | #' } 93 | #' @export 94 | #' @author Kai Guo 95 | setMethod("richLevel", signature(kodata = "Annot"),definition = function(x,kodata,level="Level2",pvalue =0.05, padj=NULL, 96 | organism=NULL,keytype="SYMBOL",ontology="",minSize=2,maxSize=500, 97 | minGSSize = 10, maxGSSize = 500, 98 | keepRich=TRUE, filename=NULL,padj.method="BH",sep=",") { 99 | richLevel_internal(x,kodata@annot,level=level,pvalue=pvalue,padj=padj, 100 | organism=kodata@species,keytype=kodata@keytype,ontology=kodata@anntype,minSize=minSize, 101 | maxSize=maxSize,minGSSize = minGSSize, maxGSSize = maxGSSize,keepRich=keepRich,filename=filename, 102 | padj.method=padj.method,sep=sep) 103 | }) 104 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onLoad <- function(libname, pkgname) { 2 | options(stringsAsFactors = FALSE) 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # richR [![Project Status:](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![](https://img.shields.io/badge/devel%20version-0.0.37-green.svg)](https://github.com/guokai8/richR) ![](https://img.shields.io/github/languages/code-size/guokai8/richR)[![DOI](https://zenodo.org/badge/243827597.svg)](https://zenodo.org/badge/latestdoi/243827597) 2 | 3 | ## Description 4 | _richR_ provide functions _richGO_, _richKEGG_,and _enrich_ to do functional enrichment analysis. 5 | ## Installation 6 | ``` 7 | library(devtools) 8 | install_github("guokai8/richR") 9 | ``` 10 | ## Quick tour 11 | ```{r} 12 | set.seed(123) 13 | library(richR) 14 | # To check the available species !!! 15 | showData() 16 | # Make the GO and KEGG Pathway data for your analysis 17 | # find suitable species name by using showensemble() 18 | hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 19 | hsako <- buildAnnot(species = "human",keytype="SYMBOL", anntype = "KEGG") 20 | ``` 21 | ### Support KEGG Module and MSIGDB anntation 22 | ``` 23 | hsamgi <- buildMSIGDB(species="human",keytype="SYMBOL",anntype="GO") 24 | hsakom <- buildAnnot(species = "human",keytype="SYMBOL", anntype = "KEGGM") 25 | ``` 26 | ____ 27 | 28 | ### You can make annotation data for all species from _bioAnno_ package 29 | * If had _bioAnno_ installed, you can build annotation package with it 30 | ```{r} 31 | # library(bioAnno) 32 | # fromKEGG(species="ath") 33 | # athgo<-buildOwn(dbname="org.ath.eg.db",anntype="GO") 34 | # athko<-buildOwn(dbname="org.ath.eg.db",anntype="KEGG") 35 | # Please go over the bioAnno package webpage ("https://github.com/guokai8/bioAnno") to learn more 36 | ``` 37 | ---- 38 | 39 | ### Simple example for enrichment analysis 40 | 41 | ```{r,fig.height=6,fig.width=6,fig.align="center",dpi=100} 42 | gene <- sample(unique(hsago$GeneID),1000) 43 | resgo <- richGO(gene,godata = hsago,ontology ="BP") 44 | head(resgo) 45 | ggbar(resgo,top = 20,usePadj = F) 46 | ###extract gene and related term 47 | head(detail(resgo)) 48 | ``` 49 | ### cluster GO enrichment result 50 | ```{r} 51 | resc<-richCluster(resgo) 52 | ggdot(resc) 53 | ``` 54 | 55 | ```{r,fig.height=6,fig.width=6,fig.align="center"} 56 | resko<-richKEGG(gene,hsako,pvalue=0.05) 57 | head(resko) 58 | ggdot(resko,top=10,usePadj = F) 59 | ##GSEA 60 | set.seed(123) 61 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 62 | name <- sample(unique(hsako$GeneID),1000) 63 | gene<-rnorm(1000) 64 | names(gene) <- name 65 | res <- richGSEA(gene,object = hsako) 66 | ``` 67 | ### Support DAVID analysis (Online) 68 | ``` 69 | gene <- sample(unique(hsako$GeneID),1000) 70 | res <- richDAVID(gene,keytype="ENTREZID",species="human") 71 | ``` 72 | #### You can also get network graphic for any type of enrichment analysis result and also combine different enrichment result 73 | ```{r,fig.height=6,fig.width=6,fig.align="center",dpi=100} 74 | ggnetplot(resko,top=20) 75 | ggnetwork(resgo,top=20,weightcut = 0.01) 76 | 77 | ``` 78 | ### Directly support dplyr filter, select, mutate,group_by ... functions 79 | ``` 80 | library(dplyr) 81 | filter(resko,Padj<0.05)%>%head() 82 | select(resko,Term) 83 | ``` 84 | ### Generate figures with mutiple enrichment results for groups 85 | ``` 86 | gene1 <- sample(unique(hsako$GeneID),1000) 87 | gene2 <- sample(unique(hsako$GeneID),1000) 88 | resko1 <- richKEGG(gene1,kodata = hsako) 89 | resko2 <- richKEGG(gene2,kodata = hsako) 90 | res <- compareResult(list(S1=resko1,S2=resko2)) 91 | comparedot(res) 92 | ``` 93 | ### Generate figures with different enrichment results 94 | ``` 95 | ggnetmap(list(resgo,resko),top=50,visNet=TRUE,smooth=FALSE) 96 | ``` 97 | ### Contact information 98 | For any questions please contact guokai8@gmail.com 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /data/godata.rdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guokai8/richR/5b41268e60259edbe08b723f61a0dd06c5912da1/data/godata.rdata -------------------------------------------------------------------------------- /data/kegg.rdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guokai8/richR/5b41268e60259edbe08b723f61a0dd06c5912da1/data/kegg.rdata -------------------------------------------------------------------------------- /data/module.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guokai8/richR/5b41268e60259edbe08b723f61a0dd06c5912da1/data/module.rda -------------------------------------------------------------------------------- /data/path.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guokai8/richR/5b41268e60259edbe08b723f61a0dd06c5912da1/data/path.rda -------------------------------------------------------------------------------- /data/pathway.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guokai8/richR/5b41268e60259edbe08b723f61a0dd06c5912da1/data/pathway.rda -------------------------------------------------------------------------------- /man/Annot-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/00-AllClasses.R 3 | \docType{class} 4 | \name{Annot-class} 5 | \alias{Annot-class} 6 | \alias{summary,} 7 | \alias{Annot-method} 8 | \title{Class "Annot" 9 | This class represents the Annotation information} 10 | \description{ 11 | Class "Annot" 12 | This class represents the Annotation information 13 | } 14 | \section{Slots}{ 15 | 16 | \describe{ 17 | \item{\code{species}}{the species of the annotation file} 18 | 19 | \item{\code{anntype}}{the type of the annotation file} 20 | 21 | \item{\code{keytype}}{Gene ID type} 22 | 23 | \item{\code{annot}}{Annotation information data.frame} 24 | }} 25 | 26 | \author{ 27 | Kai Guo 28 | } 29 | \keyword{classes} 30 | -------------------------------------------------------------------------------- /man/GO_child.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{GO_child} 4 | \alias{GO_child} 5 | \title{Get all children terms of node} 6 | \usage{ 7 | GO_child(node = "GO:0008150", ontology = "BP") 8 | } 9 | \arguments{ 10 | \item{node}{input node of GO} 11 | 12 | \item{ontology}{ontology term of BP} 13 | } 14 | \description{ 15 | Get all children terms of node 16 | } 17 | \author{ 18 | Kai Guo 19 | } 20 | -------------------------------------------------------------------------------- /man/GSEAResult-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/00-AllClasses.R 3 | \docType{class} 4 | \name{GSEAResult-class} 5 | \alias{GSEAResult-class} 6 | \alias{show,GSEAResult-method} 7 | \alias{summary,GSEAResult-method} 8 | \alias{plot,GSEAResult-method} 9 | \title{Class "GSEAResult" 10 | This class represents the result from GSEA analysis} 11 | \description{ 12 | Class "GSEAResult" 13 | This class represents the result from GSEA analysis 14 | } 15 | \section{Slots}{ 16 | 17 | \describe{ 18 | \item{\code{result}}{enrichment analysis results} 19 | 20 | \item{\code{pvalueCutoff}}{cutoff pvalue} 21 | 22 | \item{\code{pAdjustMethod}}{pvalue adjust method} 23 | 24 | \item{\code{padjCutoff}}{pvalue adjust cutoff value} 25 | 26 | \item{\code{genenumber}}{number of input genes} 27 | 28 | \item{\code{organism}}{organism used} 29 | 30 | \item{\code{ontology}}{biological ontology} 31 | 32 | \item{\code{gene}}{Gene IDs} 33 | 34 | \item{\code{keytype}}{Gene ID type} 35 | 36 | \item{\code{sep}}{character string used to separate the genes when concatenating} 37 | }} 38 | 39 | \author{ 40 | Kai Guo 41 | } 42 | \keyword{classes} 43 | -------------------------------------------------------------------------------- /man/buildAnnot-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makeAnnot.R 3 | \name{buildAnnot} 4 | \alias{buildAnnot} 5 | \title{make annotation database} 6 | \usage{ 7 | buildAnnot( 8 | species = "human", 9 | keytype = "SYMBOL", 10 | anntype = "GO", 11 | builtin = TRUE, 12 | OP = NULL 13 | ) 14 | } 15 | \arguments{ 16 | \item{species}{species for the annotation} 17 | 18 | \item{keytype}{key type export} 19 | 20 | \item{anntype}{annotation type} 21 | 22 | \item{OP}{BP,CC,MF default use all} 23 | 24 | \item{bulitin}{use default database(TRUE or FALSE)} 25 | } 26 | \description{ 27 | build annotation database 28 | } 29 | \examples{ 30 | \dontrun{ 31 | annot<-buildAnnot(species="human",keytype="ENTREZID",anntype="GO",bulitin=TRUE) 32 | } 33 | } 34 | \author{ 35 | Kai Guo 36 | } 37 | -------------------------------------------------------------------------------- /man/buildMSIGDB.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makeAnnot.R 3 | \name{buildMSIGDB} 4 | \alias{buildMSIGDB} 5 | \title{Download database from Msigdb and prepare for enrichment analysis} 6 | \usage{ 7 | buildMSIGDB(species = "human", keytype = "SYMBOL", anntype = "GO") 8 | } 9 | \arguments{ 10 | \item{species}{the species for query} 11 | 12 | \item{keytype}{the gene ID type} 13 | 14 | \item{anntype}{anntotaion type of gene set (GO,BP,CC,MF,KEGG,REACTOME, 15 | BIOCARTA,HALLMARK)} 16 | } 17 | \description{ 18 | Download database from Msigdb and prepare for enrichment analysis 19 | } 20 | \examples{ 21 | \dontrun{ 22 | hsamsi<-buildMSIGDB(species = "human", keytype = "SYMBOL", anntype = "GO") 23 | } 24 | } 25 | \author{ 26 | Kai Guo 27 | } 28 | -------------------------------------------------------------------------------- /man/buildOwn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makeown.R 3 | \name{buildOwn} 4 | \alias{buildOwn} 5 | \title{make annotation database using bioAnno results} 6 | \usage{ 7 | buildOwn(dbname, anntype = "GO", OP = NULL, species = "", keytype = "") 8 | } 9 | \arguments{ 10 | \item{dbname}{database name from bioAnno} 11 | 12 | \item{anntype}{GO or KEGG} 13 | 14 | \item{OP}{BP,CC,MF default use all} 15 | } 16 | \description{ 17 | make annotation database using bioAnno results 18 | } 19 | \examples{ 20 | \dontrun{ 21 | fromKEGG(species="ath") 22 | athgo<-buildOwn(dbname="org.ath.eg.db",anntype="GO") 23 | } 24 | } 25 | \author{ 26 | Kai Guo 27 | } 28 | -------------------------------------------------------------------------------- /man/compareGSEA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/compareResult.R 3 | \name{compareGSEA} 4 | \alias{compareGSEA} 5 | \title{compare GSEA enrichment results across different samples and generate figure} 6 | \usage{ 7 | compareGSEA( 8 | x, 9 | object, 10 | gene = NULL, 11 | pathway = NULL, 12 | mycol = NULL, 13 | pvalue = 0.05, 14 | padj = NULL, 15 | label = FALSE, 16 | gseaParam = 1, 17 | ticksSize = 0.2, 18 | ncol = 2, 19 | scales = "fixed" 20 | ) 21 | } 22 | \arguments{ 23 | \item{x}{list of GSEAResult} 24 | 25 | \item{object}{Annot object} 26 | 27 | \item{gene}{list of a vector include all log2FC with gene name (optional)} 28 | 29 | \item{pathway}{pathways you want to display (optional)} 30 | 31 | \item{mycol}{a vector indicate the colors used for the figure} 32 | 33 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 34 | 35 | \item{padj}{cutoff value of p adjust value} 36 | 37 | \item{label}{display the NES values or not} 38 | 39 | \item{scales}{Should scales be fixed ("fixed", the default), free ("free"), or free in one dimension ("free_x", "free_y")?} 40 | 41 | \item{top}{number of terms you want to display,} 42 | } 43 | \description{ 44 | compare GSEA enrichment results across different samples and generate figure 45 | } 46 | \examples{ 47 | \dontrun{ 48 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 49 | gene1 <- sample(unique(hsako$GeneID),1000) 50 | gene2 <- sample(unique(hsako$GeneID),1000) 51 | fc1<-rnorm(1000,11,2) 52 | names(fc1)<-gene1 53 | fc2<-rnorm(1000,11,2) 54 | names(fc2)<-gene2 55 | resko1 <-richGSEA(fc1,kodata = hsako) 56 | resko2 <-richGSEA(fc2,kodata = hsako) 57 | res<-compareGSEA(list(S1=resko1,S2=resko2),hsako) 58 | } 59 | } 60 | \author{ 61 | Kai Guo 62 | } 63 | -------------------------------------------------------------------------------- /man/compareResult.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/compareResult.R 3 | \name{compareResult} 4 | \alias{compareResult} 5 | \title{compare enrichment results across different samples} 6 | \usage{ 7 | compareResult(x, pvalue = 0.05, padj = NULL, include.all = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{list of richResults} 11 | 12 | \item{pvalue}{cutoff pvalue} 13 | 14 | \item{padj}{cutoff p adjust value} 15 | 16 | \item{include.all}{include all richResults even empty} 17 | } 18 | \description{ 19 | compare enrichment results across different samples 20 | } 21 | \examples{ 22 | \dontrun{ 23 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 24 | hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 25 | gene1 <- sample(unique(hsako$GeneID),1000) 26 | gene2 <- sample(unique(hsako$GeneID),1000) 27 | resko1 <-richKEGG(gene1,kodata = hsako) 28 | resko2 <-richKEGG(gene2,kodata = hsako) 29 | res<-compareResult(list(S1=resko1,S2=resko2)) 30 | } 31 | } 32 | \author{ 33 | Kai Guo 34 | } 35 | -------------------------------------------------------------------------------- /man/comparedot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/compareResult.R 3 | \name{comparedot} 4 | \alias{comparedot} 5 | \title{draw dotplot for multiple enrichment results} 6 | \usage{ 7 | comparedot( 8 | x, 9 | pvalue = 0.05, 10 | low = "lightpink", 11 | high = "red", 12 | level = "Level3", 13 | pathway = NULL, 14 | alpha = 0.7, 15 | font.x = "bold", 16 | font.y = "bold", 17 | fontsize.x = 10, 18 | fontsize.y = 10, 19 | short = FALSE, 20 | padj = NULL, 21 | usePadj = TRUE, 22 | filename = NULL, 23 | width = 10, 24 | height = 8, 25 | include.all = FALSE 26 | ) 27 | } 28 | \arguments{ 29 | \item{x}{dataframe of enrichment result} 30 | 31 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 32 | 33 | \item{low}{low color} 34 | 35 | \item{high}{high color} 36 | 37 | \item{level}{the level for KEGG pathway} 38 | 39 | \item{pathway}{the KEGG pathway name for the level} 40 | 41 | \item{alpha}{transparency alpha} 42 | 43 | \item{font.x}{font of x axis} 44 | 45 | \item{font.y}{font of y axis} 46 | 47 | \item{fontsize.x}{fontsize of x axis} 48 | 49 | \item{fontsize.y}{fontsize of y axis} 50 | 51 | \item{short}{automatic short name or not} 52 | 53 | \item{padj}{cutoff value of p adjust value} 54 | 55 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 56 | 57 | \item{filename}{figure output name} 58 | 59 | \item{width}{figure width} 60 | 61 | \item{height}{figure height} 62 | 63 | \item{include.all}{include all richResults even empty} 64 | } 65 | \description{ 66 | draw dotplot for multiple enrichment results 67 | } 68 | \examples{ 69 | \dontrun{ 70 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 71 | hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 72 | gene1 <- sample(unique(hsako$GeneID),1000) 73 | gene2 <- sample(unique(hsako$GeneID),1000) 74 | resko1 <-richKEGG(gene1,kodata = hsako) 75 | resko2 <-richKEGG(gene2,kodata = hsako) 76 | res<-compareResult(list(S1=resko1,S2=resko2)) 77 | comparedot(res,pvalue=0.05) 78 | } 79 | } 80 | \author{ 81 | Kai Guo 82 | } 83 | -------------------------------------------------------------------------------- /man/detail.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{detail} 4 | \alias{detail} 5 | \title{detail generic} 6 | \usage{ 7 | detail(x) 8 | } 9 | \arguments{ 10 | \item{x}{richResult object} 11 | } 12 | \value{ 13 | detail return detial for these significant genes 14 | } 15 | \description{ 16 | detail generic 17 | } 18 | -------------------------------------------------------------------------------- /man/dollar-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{dollar-methods} 4 | \alias{dollar-methods} 5 | \alias{$,Annot-method} 6 | \alias{$-Annot} 7 | \alias{$,richResult-method} 8 | \alias{$-richResult} 9 | \alias{$,GSEAResult-method} 10 | \alias{$-GSEAResult} 11 | \title{S4 `$` accessors for Annot and richResult} 12 | \usage{ 13 | \S4method{$}{Annot}(x, name) 14 | 15 | \S4method{$}{richResult}(x, name) 16 | 17 | \S4method{$}{GSEAResult}(x, name) 18 | } 19 | \arguments{ 20 | \item{x}{An S4 object (Annot or richResult)} 21 | 22 | \item{name}{column name to extract} 23 | } 24 | \description{ 25 | Provide `obj$name` access that extracts from the relevant slot columns. 26 | } 27 | -------------------------------------------------------------------------------- /man/dot-calculate_Enrichment_Score.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{.calculate_Enrichment_Score} 4 | \alias{.calculate_Enrichment_Score} 5 | \title{calculate enrichment score} 6 | \usage{ 7 | .calculate_Enrichment_Score(x, df) 8 | } 9 | \description{ 10 | calculate enrichment score 11 | } 12 | -------------------------------------------------------------------------------- /man/dot-clean.char.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{.clean.char} 4 | \alias{.clean.char} 5 | \title{Remove newlines} 6 | \usage{ 7 | .clean.char(x) 8 | 9 | .clean.char(x) 10 | } 11 | \arguments{ 12 | \item{x}{Character vector.} 13 | } 14 | \value{ 15 | Character vector without newlines. 16 | } 17 | \description{ 18 | Replaces any newline characters with a space. 19 | } 20 | \examples{ 21 | .clean.char("First line\nSecond line\nThird line") 22 | } 23 | -------------------------------------------------------------------------------- /man/dot-getmsig.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{.getmsig} 4 | \alias{.getmsig} 5 | \title{msigdb support species} 6 | \usage{ 7 | .getmsig(species = "human") 8 | } 9 | \arguments{ 10 | \item{species}{with common name} 11 | } 12 | \description{ 13 | msigdb support species 14 | } 15 | -------------------------------------------------------------------------------- /man/dot-ggcluster_enrich.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggdot_cluster.R 3 | \name{.ggcluster_enrich} 4 | \alias{.ggcluster_enrich} 5 | \title{Plot KEGG Cluster Visualization} 6 | \usage{ 7 | .ggcluster_enrich( 8 | data, 9 | color_low = "pink", 10 | color_high = "red", 11 | size_range = c(0.8, 4), 12 | curve_color = "grey70", 13 | curve_size = 0.5, 14 | vertical_line_color = "darkcyan", 15 | vertical_line_size = 1.5, 16 | dot_line_color = "grey70", 17 | dot_line_size = 0.3, 18 | dot_line_type = "dotted", 19 | vline_color = "grey80", 20 | vline_type = "dashed", 21 | label_font_size = 3, 22 | label_font_face = "bold", 23 | pathway_font_size = 2.5, 24 | pathway_font_face = "italic", 25 | legend_position = "right", 26 | x_pathway_offset = 0.3, 27 | label_x_size = 6, 28 | plot_margins = c(5, 200, 10, 250) 29 | ) 30 | } 31 | \arguments{ 32 | \item{data}{A data frame containing KEGG cluster data. Must include columns: `Term`, `Level2`, `group`, `Padj`, `Significant`, and `Annotated`.} 33 | 34 | \item{color_low}{Color for the lowest value in the gradient (default: "pink").} 35 | 36 | \item{color_high}{Color for the highest value in the gradient (default: "red").} 37 | 38 | \item{size_range}{A numeric vector of length 2 to control the size range of points (default: c(0.8, 4)).} 39 | 40 | \item{curve_color}{Color for the connecting curves between Level2 and Terms (default: "grey70").} 41 | 42 | \item{curve_size}{Line width for the connecting curves (default: 0.5).} 43 | 44 | \item{vertical_line_color}{Color for the vertical lines between Level2 labels and Terms (default: "darkcyan").} 45 | 46 | \item{vertical_line_size}{Width of vertical lines between Level2 and Terms (default: 1.5).} 47 | 48 | \item{dot_line_color}{Color for dotted lines connecting clusters to pathways (default: "grey70").} 49 | 50 | \item{dot_line_size}{Line width for the dotted lines (default: 0.3).} 51 | 52 | \item{dot_line_type}{Line type for the dotted lines (default: "dotted").} 53 | 54 | \item{vline_color}{Color for vertical lines separating clusters (default: "grey80").} 55 | 56 | \item{vline_type}{Line type for vertical lines separating clusters (default: "dashed").} 57 | 58 | \item{label_font_size}{Font size for the Level2 labels (default: 3).} 59 | 60 | \item{label_font_face}{Font face for the Level2 labels (default: "bold").} 61 | 62 | \item{pathway_font_size}{Font size for pathway labels (default: 2.5).} 63 | 64 | \item{pathway_font_face}{Font face for pathway labels (default: "italic").} 65 | 66 | \item{legend_position}{Position of the legend (default: "right").} 67 | 68 | \item{x_pathway_offset}{Offset to control the x-axis positioning of pathways (default: 0.3).} 69 | 70 | \item{label_x_size}{Font size for the x labels (default: 6).} 71 | 72 | \item{plot_margins}{Numeric vector of length 4 to control plot margins (default: c(5, 200, 10, 250)).} 73 | } 74 | \description{ 75 | This function generates a KEGG cluster plot, showing pathways and their relationships 76 | across different clusters with customizable aesthetics. 77 | } 78 | \examples{ 79 | data <- data.frame( 80 | Term = c("Peroxisome", "PPAR signaling pathway", "Fatty acid elongation"), 81 | Level2 = c("Transport and catabolism", "Endocrine system", "Lipid metabolism"), 82 | group = c("Cluster1", "Cluster1", "Cluster1"), 83 | Padj = c(0.015, 0.24, 0.23), 84 | Significant = c(7, 5, 3), 85 | Annotated = c(87, 89, 29) 86 | ) 87 | .ggcluster_enrich(data) 88 | 89 | } 90 | -------------------------------------------------------------------------------- /man/dot-ggcluster_gsea.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggdot_cluster_gsea.R 3 | \name{.ggcluster_gsea} 4 | \alias{.ggcluster_gsea} 5 | \title{Plot KEGG Cluster Visualization} 6 | \usage{ 7 | .ggcluster_gsea( 8 | data, 9 | color_low = "cyan4", 10 | color_high = "red", 11 | color_mid = "white", 12 | size_range = c(0.8, 4), 13 | curve_color = "grey70", 14 | curve_size = 0.5, 15 | vertical_line_color = "darkcyan", 16 | vertical_line_size = 1.5, 17 | dot_line_color = "grey70", 18 | dot_line_size = 0.3, 19 | dot_line_type = "dotted", 20 | vline_color = "grey80", 21 | vline_type = "dashed", 22 | label_font_size = 3, 23 | label_font_face = "bold", 24 | pathway_font_size = 2.5, 25 | pathway_font_face = "italic", 26 | legend_position = "right", 27 | x_pathway_offset = 0.3, 28 | plot_margins = c(5, 200, 10, 250) 29 | ) 30 | } 31 | \arguments{ 32 | \item{data}{A data frame containing KEGG cluster data. Must include columns: `pathway`, `Level2`, `group`, `Padj`, `Significant`, and `Annotated`.} 33 | 34 | \item{color_low}{Color for the lowest value in the gradient (default: "cyan4").} 35 | 36 | \item{color_high}{Color for the highest value in the gradient (default: "white").} 37 | 38 | \item{color_mid}{Color for the middle value in the gradient (default: "red").} 39 | 40 | \item{size_range}{A numeric vector of length 2 to control the size range of points (default: c(0.8, 4)).} 41 | 42 | \item{curve_color}{Color for the connecting curves between Level2 and pathways (default: "grey70").} 43 | 44 | \item{curve_size}{Line width for the connecting curves (default: 0.5).} 45 | 46 | \item{vertical_line_color}{Color for the vertical lines between Level2 labels and pathways (default: "darkcyan").} 47 | 48 | \item{vertical_line_size}{Width of vertical lines between Level2 and pathways (default: 1.5).} 49 | 50 | \item{dot_line_color}{Color for dotted lines connecting clusters to pathways (default: "grey70").} 51 | 52 | \item{dot_line_size}{Line width for the dotted lines (default: 0.3).} 53 | 54 | \item{dot_line_type}{Line type for the dotted lines (default: "dotted").} 55 | 56 | \item{vline_color}{Color for vertical lines separating clusters (default: "grey80").} 57 | 58 | \item{vline_type}{Line type for vertical lines separating clusters (default: "dashed").} 59 | 60 | \item{label_font_size}{Font size for the Level2 labels (default: 3).} 61 | 62 | \item{label_font_face}{Font face for the Level2 labels (default: "bold").} 63 | 64 | \item{pathway_font_size}{Font size for pathway labels (default: 2.5).} 65 | 66 | \item{pathway_font_face}{Font face for pathway labels (default: "italic").} 67 | 68 | \item{legend_position}{Position of the legend (default: "right").} 69 | 70 | \item{x_pathway_offset}{Offset to control the x-axis positioning of pathways (default: 0.3).} 71 | 72 | \item{plot_margins}{Numeric vector of length 4 to control plot margins (default: c(5, 200, 10, 250)).} 73 | } 74 | \description{ 75 | This function generates a KEGG GESA cluster plot, showing pathways and their relationships 76 | across different clusters with customizable aesthetics. 77 | } 78 | -------------------------------------------------------------------------------- /man/dot-kappa.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{.kappa} 4 | \alias{.kappa} 5 | \title{kappa function} 6 | \usage{ 7 | .kappa(x, y, geneall) 8 | } 9 | \description{ 10 | kappa function 11 | } 12 | -------------------------------------------------------------------------------- /man/dot-kappa_cluster_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/kappa.R 3 | \name{.kappa_cluster_internal} 4 | \alias{.kappa_cluster_internal} 5 | \title{calculate kappa cluster} 6 | \usage{ 7 | .kappa_cluster_internal( 8 | x, 9 | gene = NULL, 10 | useTerm = FALSE, 11 | cutoff = 0.5, 12 | overlap = 0.5, 13 | minSize = 5, 14 | escore = 3 15 | ) 16 | } 17 | \arguments{ 18 | \item{x}{richResult object} 19 | 20 | \item{gene}{(Optional).a vector of gene list} 21 | 22 | \item{useTerm}{to use the term or not (TRUE/FALSE)} 23 | 24 | \item{cutoff}{kappa score threshold for significant dispersion results} 25 | 26 | \item{overlap}{overlap between clusters} 27 | 28 | \item{minSize}{minimal number of terms in the cluster} 29 | 30 | \item{escore}{kappa enrichment score cutoff value (default: 3)} 31 | } 32 | \description{ 33 | calculate kappa cluster 34 | } 35 | \author{ 36 | Kai Guo 37 | } 38 | -------------------------------------------------------------------------------- /man/dot-makeGOdata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makeAnnot.R 3 | \name{.makeGOdata} 4 | \alias{.makeGOdata} 5 | \title{make GO annotation data function} 6 | \usage{ 7 | .makeGOdata(species = "human", keytype = "ENTREZID", OP = NULL) 8 | } 9 | \arguments{ 10 | \item{species}{you can check the support species by using showData()} 11 | 12 | \item{keytype}{the gene ID type} 13 | 14 | \item{OP}{BP,CC,MF default use all} 15 | } 16 | \description{ 17 | make GO annotation data function 18 | } 19 | \author{ 20 | Kai Guo 21 | } 22 | -------------------------------------------------------------------------------- /man/dot-makeKOMdata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makeAnnot.R 3 | \name{.makeKOMdata} 4 | \alias{.makeKOMdata} 5 | \title{make KEGG module annotation data function} 6 | \usage{ 7 | .makeKOMdata(species = "human", keytype = "ENTREZID", builtin = TRUE) 8 | } 9 | \arguments{ 10 | \item{species}{you can check the support species by using showData()} 11 | 12 | \item{keytype}{the gene ID type} 13 | } 14 | \description{ 15 | make KEGG module annotation data function 16 | } 17 | \author{ 18 | Kai Guo 19 | } 20 | -------------------------------------------------------------------------------- /man/dot-makeKOdata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makeAnnot.R 3 | \name{.makeKOdata} 4 | \alias{.makeKOdata} 5 | \title{make KEGG annotation data function} 6 | \usage{ 7 | .makeKOdata(species = "human", keytype = "ENTREZID", builtin = TRUE) 8 | } 9 | \arguments{ 10 | \item{species}{you can check the support species by using showData()} 11 | 12 | \item{keytype}{the gene ID type} 13 | } 14 | \description{ 15 | make KEGG annotation data function 16 | } 17 | \author{ 18 | Kai Guo 19 | } 20 | -------------------------------------------------------------------------------- /man/dot-makeROdata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makeAnnot.R 3 | \name{.makeROdata} 4 | \alias{.makeROdata} 5 | \title{make Reactome annotation data function} 6 | \usage{ 7 | .makeROdata(species = "human", keytype = "SYMBOL") 8 | } 9 | \arguments{ 10 | \item{species}{you can check the supported species by using showAvailableRO} 11 | 12 | \item{keytype}{key type export} 13 | } 14 | \description{ 15 | make Reactome annotation data function 16 | } 17 | \author{ 18 | Kai Guo 19 | } 20 | -------------------------------------------------------------------------------- /man/dot-merge_term.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{.merge_term} 4 | \alias{.merge_term} 5 | \title{merge term} 6 | \usage{ 7 | .merge_term(x, overlap) 8 | } 9 | \description{ 10 | merge term 11 | } 12 | -------------------------------------------------------------------------------- /man/dot-paste.char.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{.paste.char} 4 | \alias{.paste.char} 5 | \title{Insert newlines after every n words (defaults to 4)} 6 | \usage{ 7 | .paste.char(x, n = 4) 8 | } 9 | \arguments{ 10 | \item{x}{Character vector to process.} 11 | 12 | \item{n}{Integer. Number of words per line (default 4).} 13 | } 14 | \value{ 15 | Character vector with inserted newlines. 16 | } 17 | \description{ 18 | Splits a string into words, groups them in chunks of \code{n} words, 19 | then rejoins with a newline. If a string has fewer than \code{n} words, 20 | it remains unaltered. 21 | } 22 | \examples{ 23 | .paste.char("This is a long string we want to split after four words") 24 | .paste.char(c("One phrase", "Another phrase with many words"), n=3) 25 | } 26 | -------------------------------------------------------------------------------- /man/enrich-ANY-Annot-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/enrich.R 3 | \name{enrich,ANY,Annot-method} 4 | \alias{enrich,ANY,Annot-method} 5 | \title{Enrichment analysis function} 6 | \usage{ 7 | \S4method{enrich}{ANY,Annot}( 8 | x, 9 | object, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | organism = NULL, 13 | keytype = "", 14 | filename = NULL, 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = TRUE, 20 | padj.method = "BH", 21 | builtin = TRUE, 22 | sep = "," 23 | ) 24 | } 25 | \arguments{ 26 | \item{x}{vector contains gene names or dataframe with DEGs information} 27 | 28 | \item{object}{annotation data} 29 | 30 | \item{pvalue}{cutoff pvalue} 31 | 32 | \item{padj}{cutoff p adjust value} 33 | 34 | \item{organism}{organism} 35 | 36 | \item{keytype}{keytype for input genes} 37 | 38 | \item{filename}{output filename} 39 | 40 | \item{minSize}{minimal number of genes included in significant terms} 41 | 42 | \item{maxSize}{maximum number of genes included in significant terms} 43 | 44 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 45 | 46 | \item{maxGSSize}{maximal size of each geneset for analyzing} 47 | 48 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 49 | 50 | \item{padj.method}{pvalue adjust method(default:"BH")} 51 | 52 | \item{sep}{character string used to separate the genes when concatenating} 53 | 54 | \item{ontology}{ontology type} 55 | 56 | \item{bulitin}{use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data)} 57 | } 58 | \description{ 59 | Enrichment analysis function 60 | } 61 | \author{ 62 | Kai Guo 63 | } 64 | -------------------------------------------------------------------------------- /man/enrich-ANY-data.frame-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/enrich.R 3 | \name{enrich,ANY,data.frame-method} 4 | \alias{enrich,ANY,data.frame-method} 5 | \title{Enrichment analysis function} 6 | \usage{ 7 | \S4method{enrich}{ANY,data.frame}( 8 | x, 9 | object, 10 | ontology = "", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = "", 15 | filename = NULL, 16 | minSize = 2, 17 | maxSize = 500, 18 | minGSSize = 10, 19 | maxGSSize = 500, 20 | keepRich = TRUE, 21 | padj.method = "BH", 22 | sep = "," 23 | ) 24 | } 25 | \arguments{ 26 | \item{x}{vector contains gene names or dataframe with DEGs information} 27 | 28 | \item{object}{annotation data} 29 | 30 | \item{ontology}{ontology type} 31 | 32 | \item{pvalue}{cutoff pvalue} 33 | 34 | \item{padj}{cutoff p adjust value} 35 | 36 | \item{organism}{organism} 37 | 38 | \item{keytype}{keytype for input genes} 39 | 40 | \item{filename}{output filename} 41 | 42 | \item{minSize}{minimal number of genes included in significant terms} 43 | 44 | \item{maxSize}{maximum number of genes included in significant terms} 45 | 46 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 47 | 48 | \item{maxGSSize}{maximal size of each geneset for analyzing} 49 | 50 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 51 | 52 | \item{padj.method}{pvalue adjust method(default:"BH")} 53 | 54 | \item{sep}{character string used to separate the genes when concatenating} 55 | } 56 | \description{ 57 | Enrichment analysis function 58 | } 59 | \examples{ 60 | \dontrun{ 61 | hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 62 | hsago <- as.data.frame(hsago) 63 | gene <- sample(unique(hsago$GeneID),1000) 64 | res<-enrich(gene,godata = hsago) 65 | } 66 | } 67 | \author{ 68 | Kai Guo 69 | } 70 | -------------------------------------------------------------------------------- /man/enrich.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{enrich} 4 | \alias{enrich} 5 | \title{enrich method} 6 | \usage{ 7 | enrich( 8 | x, 9 | object, 10 | ontology = "", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = "", 15 | filename = NULL, 16 | minSize = 2, 17 | maxSize = 500, 18 | minGSSize = 10, 19 | maxGSSize = 500, 20 | keepRich = TRUE, 21 | padj.method = "BH", 22 | sep = ",", 23 | ... 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{object}{annotation data} 30 | 31 | \item{ontology}{ontology type} 32 | 33 | \item{pvalue}{cutoff pvalue} 34 | 35 | \item{padj}{cutoff p adjust value} 36 | 37 | \item{organism}{organism} 38 | 39 | \item{keytype}{keytype for input genes} 40 | 41 | \item{filename}{output filename} 42 | 43 | \item{minSize}{minimal number of genes included in significant terms} 44 | 45 | \item{maxSize}{maximum number of genes included in significant terms} 46 | 47 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 48 | 49 | \item{maxGSSize}{maximal size of each geneset for analyzing} 50 | 51 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 52 | 53 | \item{padj.method}{pvalue adjust method(default:"BH")} 54 | 55 | \item{sep}{character string used to separate the genes when concatenating} 56 | } 57 | \value{ 58 | richResult 59 | } 60 | \description{ 61 | enrich 62 | } 63 | \examples{ 64 | \dontrun{ 65 | library(bioAnno) 66 | fromKEGG(species="ath") 67 | athgo <- buildOwn(dbname="org.ath.eg.db",anntype="GO") 68 | athgo <- as.data.frame(athgo) 69 | athgo <- na.omit(athgo) 70 | gene <- sample(unique(athgo$GeneID),1000) 71 | res <- enrich(gene,athgo) 72 | } 73 | } 74 | \author{ 75 | Kai Guo 76 | } 77 | -------------------------------------------------------------------------------- /man/enrich_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/enrich.R 3 | \name{enrich_internal} 4 | \alias{enrich_internal} 5 | \title{Enrichment analysis for any type of annotation data} 6 | \usage{ 7 | enrich_internal( 8 | x, 9 | object, 10 | ontology = "", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | minSize = 1, 15 | maxSize = 500, 16 | minGSSize = 10, 17 | maxGSSize = 500, 18 | keepRich = TRUE, 19 | keytype = "", 20 | filename = NULL, 21 | padj.method = "BH", 22 | sep = "," 23 | ) 24 | } 25 | \arguments{ 26 | \item{x}{vector contains gene names or dataframe with DEGs information} 27 | 28 | \item{object}{annotation data} 29 | 30 | \item{ontology}{ontology type} 31 | 32 | \item{pvalue}{cutoff pvalue} 33 | 34 | \item{padj}{cutoff p adjust value} 35 | 36 | \item{organism}{organism} 37 | 38 | \item{minSize}{minimal number of genes included in significant terms} 39 | 40 | \item{maxSize}{maximum number of genes included in significant terms} 41 | 42 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 43 | 44 | \item{maxGSSize}{maximal size of each geneset for analyzing} 45 | 46 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 47 | 48 | \item{keytype}{keytype for input genes} 49 | 50 | \item{filename}{output filename} 51 | 52 | \item{padj.method}{pvalue adjust method(default:"BH")} 53 | 54 | \item{sep}{character string used to separate the genes when concatenating} 55 | } 56 | \description{ 57 | Enrichment analysis for any type of annotation data 58 | } 59 | \author{ 60 | Kai Guo 61 | } 62 | -------------------------------------------------------------------------------- /man/getann.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{getann} 4 | \alias{getann} 5 | \title{build annotaion for kegg} 6 | \usage{ 7 | getann(ontype = "GO") 8 | } 9 | \arguments{ 10 | \item{ontype}{GO or KEGG} 11 | } 12 | \description{ 13 | build annotaion for kegg 14 | } 15 | \examples{ 16 | annot = getann("GO") 17 | } 18 | \author{ 19 | Kai Guo 20 | } 21 | -------------------------------------------------------------------------------- /man/getdetail.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{getdetail} 4 | \alias{getdetail} 5 | \title{get detail and integrate with the input gene information} 6 | \usage{ 7 | getdetail(rese, resd, sep) 8 | } 9 | \arguments{ 10 | \item{rese}{richResult or GSEAResult} 11 | 12 | \item{resd}{dataframe with input gene as rownames} 13 | 14 | \item{sep}{character string used to separate the genes when concatenating} 15 | } 16 | \description{ 17 | get detail and integrate with the input gene information 18 | } 19 | \examples{ 20 | \dontrun{ 21 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 22 | hsako<-as.data.frame(hsako) 23 | gene=sample(unique(hsako$GeneID),1000) 24 | res<-richKEGG(gene,kodata = hsako) 25 | gened<-data.frame(lfc=rnorm(length(gene))) 26 | rownames(gened)<-gene 27 | head(getdetail(res,gened,sep=",")) 28 | } 29 | } 30 | \author{ 31 | Kai Guo 32 | } 33 | -------------------------------------------------------------------------------- /man/ggGSEA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGSEA.R 3 | \name{ggGSEA} 4 | \alias{ggGSEA} 5 | \title{plot the gsea result} 6 | \usage{ 7 | ggGSEA(x, term, object, gseaRes = gseaRes, top = 10, default = TRUE) 8 | } 9 | \arguments{ 10 | \item{x}{a vector include all log2FC with gene name} 11 | 12 | \item{term}{the significant term} 13 | 14 | \item{object}{Annot object} 15 | 16 | \item{gseaRes}{GSEAResult object} 17 | 18 | \item{info}{Term with annotation details} 19 | } 20 | \description{ 21 | plot the gsea result 22 | } 23 | \examples{ 24 | \dontrun{ 25 | set.seed(123) 26 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 27 | name=sample(unique(hsako$GeneID),1000) 28 | gene<-rnorm(1000) 29 | names(gene)<-name 30 | res<-richGSEA(gene,object = hsako) 31 | ggGSEA(gene,term = res$pathway,object = hsako,gseaRes = res,default = F) 32 | } 33 | } 34 | \author{ 35 | Kai Guo 36 | } 37 | -------------------------------------------------------------------------------- /man/ggbar-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{ggbar} 4 | \alias{ggbar} 5 | \title{ggbar method} 6 | \usage{ 7 | ggbar( 8 | object, 9 | top = 50, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | order = FALSE, 13 | usePadj = TRUE, 14 | fontsize.x = 10, 15 | fontsize.y = 10, 16 | short = FALSE, 17 | fontsize.text = 3, 18 | angle = 0, 19 | orderp = FALSE, 20 | filename = NULL, 21 | width = 10, 22 | height = 8, 23 | horiz = TRUE, 24 | ... 25 | ) 26 | } 27 | \arguments{ 28 | \item{object}{enrichment result or data.frame} 29 | 30 | \item{top}{number of terms you want to display,} 31 | 32 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 33 | 34 | \item{order}{order by Term or richFactor} 35 | 36 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 37 | 38 | \item{fontsize.x}{fontsize of x axis} 39 | 40 | \item{fontsize.y}{fontsize of y axis} 41 | 42 | \item{short}{automatic short name or not} 43 | 44 | \item{orderp}{order by p value(adjusted p value)} 45 | 46 | \item{filename}{figure output name} 47 | 48 | \item{width}{figure width} 49 | 50 | \item{height}{figure height} 51 | 52 | \item{horiz}{horiz or not} 53 | 54 | \item{low}{low color} 55 | 56 | \item{high}{high color} 57 | 58 | \item{alpha}{transparency alpha} 59 | 60 | \item{font.x}{font of x axis} 61 | 62 | \item{font}{y font of y axis} 63 | 64 | \item{font.size}{font size for xlim or ylim} 65 | } 66 | \value{ 67 | ggplot2 object 68 | } 69 | \description{ 70 | ggbar 71 | } 72 | \examples{ 73 | \dontrun{ 74 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 75 | gene=sample(unique(hsako$GeneID),1000) 76 | res<-richKEGG(gene,kodata = hsako) 77 | ggbar(res) 78 | } 79 | } 80 | \author{ 81 | Kai Guo 82 | } 83 | -------------------------------------------------------------------------------- /man/ggbar.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggbar.R 3 | \name{ggbar_internal} 4 | \alias{ggbar_internal} 5 | \alias{ggbar,richResult-method} 6 | \alias{ggbar,data.frame-method} 7 | \title{barplot for Enrichment results} 8 | \usage{ 9 | ggbar_internal( 10 | resultFis, 11 | top = 50, 12 | pvalue = 0.05, 13 | order = FALSE, 14 | horiz = TRUE, 15 | low = "lightpink", 16 | high = "red", 17 | font.x = "bold", 18 | font.y = "bold", 19 | fontsize.x = 10, 20 | fontsize.y = 10, 21 | short = FALSE, 22 | fontsize.text = 3, 23 | angle = 75, 24 | padj = NULL, 25 | usePadj = TRUE, 26 | orderp = FALSE, 27 | filename = NULL, 28 | width = 10, 29 | height = 8 30 | ) 31 | 32 | \S4method{ggbar}{richResult}( 33 | object, 34 | top = 50, 35 | pvalue = 0.05, 36 | padj = NULL, 37 | order = FALSE, 38 | usePadj = TRUE, 39 | fontsize.x = 10, 40 | fontsize.y = 10, 41 | short = FALSE, 42 | fontsize.text = 3, 43 | angle = 75, 44 | orderp = orderp, 45 | filename = NULL, 46 | width = 10, 47 | height = 8, 48 | horiz = TRUE, 49 | ... 50 | ) 51 | 52 | \S4method{ggbar}{data.frame}( 53 | object, 54 | top = 50, 55 | pvalue = 0.05, 56 | padj = NULL, 57 | order = FALSE, 58 | usePadj = TRUE, 59 | fontsize.x = 10, 60 | fontsize.y = 10, 61 | short = FALSE, 62 | fontsize.text = 3, 63 | angle = 75, 64 | orderp = FALSE, 65 | filename = NULL, 66 | width = 10, 67 | height = 8, 68 | horiz = TRUE, 69 | ... 70 | ) 71 | } 72 | \arguments{ 73 | \item{top}{number of terms you want to display,} 74 | 75 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 76 | 77 | \item{order}{order by Term or richFactor} 78 | 79 | \item{horiz}{horiz or not} 80 | 81 | \item{low}{low color} 82 | 83 | \item{high}{high color} 84 | 85 | \item{font.x}{font of x axis} 86 | 87 | \item{fontsize.x}{fontsize of x axis} 88 | 89 | \item{fontsize.y}{fontsize of y axis} 90 | 91 | \item{short}{automatic short name or not} 92 | 93 | \item{padj}{cutoff value of p adjust value} 94 | 95 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 96 | 97 | \item{orderp}{order by p value(adjusted p value)} 98 | 99 | \item{filename}{figure output name} 100 | 101 | \item{width}{figure width} 102 | 103 | \item{height}{figure height} 104 | 105 | \item{object}{dataframe of enrichment results} 106 | 107 | \item{alpha}{transparency alpha} 108 | 109 | \item{font}{y font of y axis} 110 | 111 | \item{font.size}{font size for xlim or ylim} 112 | } 113 | \description{ 114 | barplot for Enrichment results 115 | 116 | barplot for Enrichment result 117 | } 118 | \examples{ 119 | \dontrun{ 120 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 121 | gene=sample(unique(hsako$GeneID),1000) 122 | res<-richKEGG(gene,kodata = hsako) 123 | ggbar(res) 124 | } 125 | \dontrun{ 126 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 127 | gene=sample(unique(hsako$GeneID),1000) 128 | res<-richKEGG(gene,kodata = hsako) 129 | ggbar(result(res)) 130 | } 131 | } 132 | \author{ 133 | Kai Guo 134 | } 135 | -------------------------------------------------------------------------------- /man/ggcluster.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggdot_cluster.R 3 | \name{ggcluster} 4 | \alias{ggcluster} 5 | \title{Plot KEGG Cluster Visualization} 6 | \usage{ 7 | ggcluster(data, method = c("auto", "enrich", "gsea"), ...) 8 | } 9 | \arguments{ 10 | \item{data}{A data frame containing KEGG cluster data. Must include columns: `Term`, `Level2`, `group`, `Padj`, `Significant`, and `Annotated`.} 11 | 12 | \item{method}{One of \code{"enrich"} or \code{"gsea"}. If \code{"auto"}, guessed from columns.} 13 | 14 | \item{color_low}{Color for the lowest value in the gradient (default: "pink").} 15 | 16 | \item{color_high}{Color for the highest value in the gradient (default: "red").} 17 | 18 | \item{size_range}{A numeric vector of length 2 to control the size range of points (default: c(0.8, 4)).} 19 | 20 | \item{curve_color}{Color for the connecting curves between Level2 and Terms (default: "grey70").} 21 | 22 | \item{curve_size}{Line width for the connecting curves (default: 0.5).} 23 | 24 | \item{vertical_line_color}{Color for the vertical lines between Level2 labels and Terms (default: "darkcyan").} 25 | 26 | \item{vertical_line_size}{Width of vertical lines between Level2 and Terms (default: 1.5).} 27 | 28 | \item{dot_line_color}{Color for dotted lines connecting clusters to pathways (default: "grey70").} 29 | 30 | \item{dot_line_size}{Line width for the dotted lines (default: 0.3).} 31 | 32 | \item{dot_line_type}{Line type for the dotted lines (default: "dotted").} 33 | 34 | \item{vline_color}{Color for vertical lines separating clusters (default: "grey80").} 35 | 36 | \item{vline_type}{Line type for vertical lines separating clusters (default: "dashed").} 37 | 38 | \item{label_font_size}{Font size for the Level2 labels (default: 3).} 39 | 40 | \item{label_font_face}{Font face for the Level2 labels (default: "bold").} 41 | 42 | \item{pathway_font_size}{Font size for pathway labels (default: 2.5).} 43 | 44 | \item{pathway_font_face}{Font face for pathway labels (default: "italic").} 45 | 46 | \item{legend_position}{Position of the legend (default: "right").} 47 | 48 | \item{x_pathway_offset}{Offset to control the x-axis positioning of pathways (default: 0.3).} 49 | 50 | \item{label_x_size}{Font size for the x labels (default: 6).} 51 | 52 | \item{plot_margins}{Numeric vector of length 4 to control plot margins (default: c(5, 200, 10, 250)).} 53 | } 54 | \value{ 55 | A ggplot2 object (or a \code{cowplot} combined object). 56 | } 57 | \description{ 58 | This function merges two cluster-plot approaches: 59 | \itemize{ 60 | \item \strong{Enrichment mode}: requires columns \code{Term}, \code{Padj}, \code{Significant}, \code{Annotated}, etc. 61 | \item \strong{GSEA mode}: requires columns \code{pathway}, \code{padj}, \code{NES}, etc. 62 | } 63 | } 64 | \details{ 65 | If \code{method = "auto"}, the function guesses which mode to use based on the columns found. 66 | } 67 | -------------------------------------------------------------------------------- /man/ggdot-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{ggdot} 4 | \alias{ggdot} 5 | \title{ggdot method} 6 | \usage{ 7 | ggdot( 8 | object, 9 | top = 50, 10 | pvalue = 0.05, 11 | order = FALSE, 12 | low = "lightpink", 13 | high = "red", 14 | alpha = 0.7, 15 | font.x = "bold", 16 | font.y = "bold", 17 | fontsize.x = 10, 18 | fontsize.y = 10, 19 | short = FALSE, 20 | padj = NULL, 21 | usePadj = TRUE, 22 | orderp = FALSE, 23 | filename = NULL, 24 | width = 10, 25 | height = 8, 26 | ... 27 | ) 28 | } 29 | \arguments{ 30 | \item{object}{enrichment result or data.frame} 31 | 32 | \item{top}{number of terms you want to display,} 33 | 34 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 35 | 36 | \item{order}{order by Term or richFactor} 37 | 38 | \item{low}{low color} 39 | 40 | \item{high}{high color} 41 | 42 | \item{alpha}{transparency alpha} 43 | 44 | \item{font.x}{font of x axis} 45 | 46 | \item{fontsize.x}{fontsize of x axis} 47 | 48 | \item{fontsize.y}{fontsize of y axis} 49 | 50 | \item{short}{automatic short name or not} 51 | 52 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 53 | 54 | \item{orderp}{order by p value(adjusted p value)} 55 | 56 | \item{width}{figure width} 57 | 58 | \item{height}{figure height} 59 | 60 | \item{font}{y font of y axis} 61 | 62 | \item{font.size}{font size for xlim or ylim} 63 | } 64 | \value{ 65 | ggplot2 object 66 | } 67 | \description{ 68 | ggdot 69 | } 70 | \examples{ 71 | \dontrun{ 72 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 73 | gene <- sample(unique(hsako$GeneID),1000) 74 | res <- richKEGG(gene,kodata = hsako) 75 | ggdot(res) 76 | } 77 | } 78 | \author{ 79 | Kai Guo 80 | } 81 | -------------------------------------------------------------------------------- /man/ggdot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggdot.R 3 | \name{ggdot,richResult-method} 4 | \alias{ggdot,richResult-method} 5 | \alias{ggdot,data.frame-method} 6 | \title{dotplot for Enrichment results} 7 | \usage{ 8 | \S4method{ggdot}{richResult}( 9 | object, 10 | top = 50, 11 | pvalue = 0.05, 12 | order = FALSE, 13 | low = "lightpink", 14 | high = "red", 15 | alpha = 0.7, 16 | font.x = "bold", 17 | font.y = "bold", 18 | fontsize.x = 10, 19 | fontsize.y = 10, 20 | short = FALSE, 21 | padj = NULL, 22 | usePadj = TRUE, 23 | orderp = FALSE, 24 | filename = NULL, 25 | width = 10, 26 | height = 8 27 | ) 28 | 29 | \S4method{ggdot}{data.frame}( 30 | object, 31 | top = 50, 32 | pvalue = 0.05, 33 | order = FALSE, 34 | low = "lightpink", 35 | high = "red", 36 | alpha = 0.7, 37 | font.x = "bold", 38 | font.y = "bold", 39 | fontsize.x = 10, 40 | fontsize.y = 10, 41 | short = FALSE, 42 | padj = NULL, 43 | usePadj = TRUE, 44 | orderp = FALSE, 45 | filename = NULL, 46 | width = 10, 47 | height = 8 48 | ) 49 | } 50 | \arguments{ 51 | \item{object}{richResult object} 52 | 53 | \item{top}{number of terms you want to display,} 54 | 55 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 56 | 57 | \item{order}{order by Term or richFactor} 58 | 59 | \item{low}{low color} 60 | 61 | \item{high}{high color} 62 | 63 | \item{alpha}{transparency alpha} 64 | 65 | \item{font.x}{font of x axis} 66 | 67 | \item{fontsize.x}{fontsize of x axis} 68 | 69 | \item{fontsize.y}{fontsize of y axis} 70 | 71 | \item{short}{automatic short name or not} 72 | 73 | \item{padj}{cutoff value of p adjust value} 74 | 75 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 76 | 77 | \item{orderp}{order by p value(adjusted p value)} 78 | 79 | \item{filename}{figure output name} 80 | 81 | \item{width}{figure width} 82 | 83 | \item{height}{figure height} 84 | 85 | \item{font}{y font of y axis} 86 | 87 | \item{font.size}{font size for xlim or ylim} 88 | } 89 | \description{ 90 | dotplot for Enrichment results 91 | 92 | dotplot for Enrichment results 93 | } 94 | \examples{ 95 | \dontrun{ 96 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 97 | gene=sample(unique(hsako$GeneID),1000) 98 | res<-richKEGG(gene,kodata = hsako) 99 | ggdot(res) 100 | } 101 | \dontrun{ 102 | hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 103 | gene=sample(unique(hsago$GeneID),1000) 104 | res<-richKEGG(gene,kodata = hsako) 105 | ggdot(result(res)) 106 | } 107 | } 108 | \author{ 109 | Kai Guo 110 | } 111 | -------------------------------------------------------------------------------- /man/ggdot_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggdot.R 3 | \name{ggdot_internal} 4 | \alias{ggdot_internal} 5 | \title{Dotplot for enrichment results} 6 | \usage{ 7 | ggdot_internal( 8 | object, 9 | top = 50, 10 | pvalue = 0.05, 11 | order = FALSE, 12 | low = "lightpink", 13 | high = "red", 14 | alpha = 0.7, 15 | font.x = "bold", 16 | font.y = "bold", 17 | fontsize.x = 10, 18 | fontsize.y = 10, 19 | short = FALSE, 20 | padj = NULL, 21 | usePadj = TRUE, 22 | orderp = FALSE, 23 | filename = NULL, 24 | width = 10, 25 | height = 8 26 | ) 27 | } 28 | \arguments{ 29 | \item{object}{richResult object} 30 | 31 | \item{top}{number of terms you want to display,} 32 | 33 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 34 | 35 | \item{order}{order by Term or richFactor} 36 | 37 | \item{low}{low color} 38 | 39 | \item{high}{high color} 40 | 41 | \item{alpha}{transparency alpha} 42 | 43 | \item{font.x}{font of x axis} 44 | 45 | \item{fontsize.x}{fontsize of x axis} 46 | 47 | \item{fontsize.y}{fontsize of y axis} 48 | 49 | \item{short}{automatic short name or not} 50 | 51 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 52 | 53 | \item{orderp}{order by p value(adjusted p value)} 54 | 55 | \item{filename}{figure output name} 56 | 57 | \item{width}{figure width} 58 | 59 | \item{height}{figure height} 60 | 61 | \item{font}{y font of y axis} 62 | 63 | \item{font.size}{font size for xlim or ylim} 64 | } 65 | \description{ 66 | Dotplot for enrichment results 67 | } 68 | -------------------------------------------------------------------------------- /man/ggheatmap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggheatmap.R 3 | \name{ggheatmap} 4 | \alias{ggheatmap} 5 | \title{Plot compare heatmap of Enrichment result among DEG groups} 6 | \usage{ 7 | ggheatmap( 8 | richRes, 9 | top = 50, 10 | colnames = NULL, 11 | xsize = 6, 12 | ysize = 6, 13 | usePadj = FALSE, 14 | horizontal = FALSE, 15 | returnData = FALSE, 16 | ... 17 | ) 18 | } 19 | \arguments{ 20 | \item{richRes}{list of enrichment object} 21 | 22 | \item{top}{the number of Terms you want to display} 23 | 24 | \item{colnames}{the compare DEG group names} 25 | 26 | \item{xsize}{size of group name} 27 | 28 | \item{ysize}{size of Terms name} 29 | } 30 | \description{ 31 | Plot compare heatmap of Enrichment result among DEG groups 32 | } 33 | \author{ 34 | Kai Guo 35 | } 36 | -------------------------------------------------------------------------------- /man/ggnetmap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnetmap.R 3 | \name{ggnetmap} 4 | \alias{ggnetmap} 5 | \title{generate network based on Enrichment results} 6 | \usage{ 7 | ggnetmap( 8 | richRes, 9 | gene = NULL, 10 | top = 50, 11 | top.display = NULL, 12 | pvalue = 0.05, 13 | padj = NULL, 14 | usePadj = TRUE, 15 | low = "orange", 16 | high = "red", 17 | weightcut = 0.2, 18 | useTerm = TRUE, 19 | writeCyt = FALSE, 20 | cytoscapeFile = "cytoscape.txt", 21 | cytoscapeFormat = "graphml", 22 | label.color = "black", 23 | label.size = 2, 24 | node.shape = NULL, 25 | layout = "fruchtermanreingold", 26 | savefig = FALSE, 27 | visNet = FALSE, 28 | smooth = TRUE, 29 | nodeselect = FALSE, 30 | edit = FALSE, 31 | savehtml = FALSE, 32 | filename = "network", 33 | width = 7, 34 | height = 7, 35 | segment.size = 0.2, 36 | node.alpha = 0.7, 37 | ... 38 | ) 39 | } 40 | \arguments{ 41 | \item{richRes}{list of enrichment object} 42 | 43 | \item{gene}{vector contains gene names or dataframe with DEGs information} 44 | 45 | \item{top}{number of terms to display} 46 | 47 | \item{top.display}{top number to display} 48 | 49 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 50 | 51 | \item{padj}{cutoff value of p adjust value} 52 | 53 | \item{usePadj}{use adjust p value as color or not (should use with padj)} 54 | 55 | \item{low}{color used for small value} 56 | 57 | \item{high}{color used for large value} 58 | 59 | \item{weightcut}{cutoff valule for edge} 60 | 61 | \item{writeCyt}{write out the cytoscape file} 62 | 63 | \item{cytoscapeFile}{output cytoscape File} 64 | 65 | \item{cytoscapeFormat}{Character string giving the output file format} 66 | 67 | \item{label.color}{label color} 68 | 69 | \item{label.size}{label size} 70 | 71 | \item{layout}{layout method ('fruchtermanreingold','kamadakawai','target','circle')} 72 | 73 | \item{savefig}{save the figure or not} 74 | 75 | \item{filename}{figure output name} 76 | 77 | \item{width}{figure width} 78 | 79 | \item{height}{figure height} 80 | 81 | \item{segment.size}{size for label segment} 82 | 83 | \item{node.alpha}{alpha-transparency scales} 84 | 85 | \item{label.font}{label font} 86 | } 87 | \description{ 88 | generate network based on Enrichment results 89 | } 90 | \examples{ 91 | \dontrun{ 92 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 93 | hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 94 | gene <- sample(unique(hsako$GeneID),1000) 95 | resko <-richKEGG(gene,kodata = hsako) 96 | resgo <- richGO(gene,hsago) 97 | ggnetmap(list(resgo,resko)) 98 | } 99 | } 100 | \author{ 101 | Kai Guo 102 | } 103 | -------------------------------------------------------------------------------- /man/ggnetplot-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{ggnetplot} 4 | \alias{ggnetplot} 5 | \title{ggnetplot method} 6 | \usage{ 7 | ggnetplot( 8 | object, 9 | top = 50, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | usePadj = TRUE, 13 | useTerm = TRUE, 14 | low = "orange", 15 | high = "red", 16 | writeCyt = FALSE, 17 | cytoscapeFile = NULL, 18 | label.color = "black", 19 | label.size = 2, 20 | node.shape = NULL, 21 | layout = "fruchtermanreingold", 22 | savefig = FALSE, 23 | filename = NULL, 24 | width = 7, 25 | height = 7, 26 | node.alpha = 0.7, 27 | repel = TRUE, 28 | segment.size = 0.2, 29 | sep = ",", 30 | ... 31 | ) 32 | } 33 | \arguments{ 34 | \item{object}{richResult or dataframe} 35 | 36 | \item{top}{number of terms to show (default: 50)} 37 | 38 | \item{pvalue}{cutoff p value for enrichment result} 39 | 40 | \item{padj}{cutoff p adjust value for enrichment result} 41 | 42 | \item{usePadj}{use adjust p value for the color or not} 43 | 44 | \item{useTerm}{use terms for nodes (default: TRUE)} 45 | 46 | \item{low}{color used for small value} 47 | 48 | \item{high}{color used for large value} 49 | 50 | \item{writeCyt}{write out the cytoscape file} 51 | 52 | \item{cytoscapeFile}{output cytoscape File} 53 | 54 | \item{label.color}{label color} 55 | 56 | \item{label.size}{label size} 57 | 58 | \item{node.shape}{shape of the node} 59 | 60 | \item{layout}{layout method} 61 | 62 | \item{savefig}{save figures or not} 63 | 64 | \item{filename}{output figure name} 65 | 66 | \item{width}{width for output figure} 67 | 68 | \item{height}{height for output figure} 69 | 70 | \item{node.alpha}{alpha-transparency scales} 71 | 72 | \item{repel}{use ggrepel text function or not} 73 | 74 | \item{segment.size}{segment size for ggrepel text} 75 | 76 | \item{sep}{character string used to separate the genes when concatenating} 77 | } 78 | \value{ 79 | ggplot2 object 80 | } 81 | \description{ 82 | ggnetplot 83 | } 84 | \examples{ 85 | \dontrun{ 86 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 87 | gene<-sample(unique(hsako$GeneID),1000) 88 | res<-richKEGG(gene,kodata = hsako) 89 | ggnetplot(res) 90 | } 91 | } 92 | \author{ 93 | Kai Guo 94 | } 95 | -------------------------------------------------------------------------------- /man/ggnetplot-richResult-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggrich.R 3 | \name{ggnetplot,richResult-method} 4 | \alias{ggnetplot,richResult-method} 5 | \title{richplot for Enrichment results} 6 | \usage{ 7 | \S4method{ggnetplot}{richResult}( 8 | object, 9 | top = 50, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | usePadj = TRUE, 13 | useTerm = TRUE, 14 | low = "orange", 15 | high = "red", 16 | writeCyt = FALSE, 17 | cytoscapeFile = "network-file-for-cytoscape.txt", 18 | label.color = "black", 19 | label.size = 2, 20 | node.shape = NULL, 21 | layout = "fruchtermanreingold", 22 | savefig = FALSE, 23 | filename = "network", 24 | width = 7, 25 | height = 7, 26 | node.alpha = 0.7, 27 | repel = TRUE, 28 | segment.size = 0.2, 29 | sep = "," 30 | ) 31 | } 32 | \arguments{ 33 | \item{object}{richResult or dataframe} 34 | 35 | \item{top}{number of terms to show (default: 50)} 36 | 37 | \item{pvalue}{cutoff p value for enrichment result} 38 | 39 | \item{padj}{cutoff p adjust value for enrichment result} 40 | 41 | \item{usePadj}{use adjust p value for the color or not} 42 | 43 | \item{useTerm}{use terms for nodes (default: TRUE)} 44 | 45 | \item{low}{color used for small value} 46 | 47 | \item{high}{color used for large value} 48 | 49 | \item{writeCyt}{write out the cytoscape file} 50 | 51 | \item{cytoscapeFile}{output cytoscape File} 52 | 53 | \item{label.color}{label color} 54 | 55 | \item{label.size}{label size} 56 | 57 | \item{node.shape}{shape of the node} 58 | 59 | \item{layout}{layout method ('fruchtermanreingold','kamadakawai','target','circle')} 60 | 61 | \item{savefig}{save figures or not} 62 | 63 | \item{filename}{output figure name} 64 | 65 | \item{width}{width for output figure} 66 | 67 | \item{height}{height for output figure} 68 | 69 | \item{node.alpha}{alpha-transparency scales} 70 | 71 | \item{repel}{use ggrepel text function or not} 72 | 73 | \item{segment.size}{segment size for ggrepel text} 74 | 75 | \item{sep}{character string used to separate the genes when concatenating} 76 | } 77 | \description{ 78 | richplot for Enrichment results 79 | } 80 | \examples{ 81 | \dontrun{ 82 | hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 83 | gene=sample(unique(hsago$GeneID),1000) 84 | res<-richKEGG(gene,kodata = hsako) 85 | ggnetplot(res) 86 | } 87 | } 88 | \author{ 89 | Kai Guo 90 | } 91 | -------------------------------------------------------------------------------- /man/ggnetplot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggrich.R 3 | \name{ggnetplot,data.frame-method} 4 | \alias{ggnetplot,data.frame-method} 5 | \alias{ggnetplot,GSEAResult-method} 6 | \title{richplot for Enrichment result} 7 | \usage{ 8 | \S4method{ggnetplot}{data.frame}( 9 | object, 10 | top = 50, 11 | pvalue = 0.05, 12 | padj = NULL, 13 | usePadj = TRUE, 14 | useTerm = TRUE, 15 | low = "orange", 16 | high = "red", 17 | writeCyt = FALSE, 18 | cytoscapeFile = "network-file-for-cytoscape.txt", 19 | label.color = "black", 20 | label.size = 2, 21 | node.shape = NULL, 22 | layout = "fruchtermanreingold", 23 | savefig = FALSE, 24 | filename = "network", 25 | width = 7, 26 | height = 7, 27 | node.alpha = 0.7, 28 | repel = TRUE, 29 | segment.size = 0.2, 30 | sep = "," 31 | ) 32 | 33 | \S4method{ggnetplot}{GSEAResult}( 34 | object, 35 | top = 50, 36 | pvalue = 0.05, 37 | padj = NULL, 38 | usePadj = TRUE, 39 | useTerm = TRUE, 40 | low = "orange", 41 | high = "red", 42 | writeCyt = FALSE, 43 | cytoscapeFile = "network-file-for-cytoscape.txt", 44 | label.color = "black", 45 | label.size = 2, 46 | node.shape = NULL, 47 | layout = "fruchtermanreingold", 48 | savefig = FALSE, 49 | filename = "network", 50 | width = 7, 51 | height = 7, 52 | node.alpha = 0.7, 53 | repel = TRUE, 54 | segment.size = 0.2, 55 | sep = "," 56 | ) 57 | } 58 | \arguments{ 59 | \item{object}{richResult or dataframe} 60 | 61 | \item{top}{number of terms to show (default: 50)} 62 | 63 | \item{pvalue}{cutoff p value for enrichment result} 64 | 65 | \item{padj}{cutoff p adjust value for enrichment result} 66 | 67 | \item{usePadj}{use adjust p value for the color or not} 68 | 69 | \item{useTerm}{use terms for nodes (default: TRUE)} 70 | 71 | \item{low}{color used for small value} 72 | 73 | \item{high}{color used for large value} 74 | 75 | \item{writeCyt}{write out the cytoscape file} 76 | 77 | \item{cytoscapeFile}{output cytoscape File} 78 | 79 | \item{label.color}{label color} 80 | 81 | \item{label.size}{label size} 82 | 83 | \item{node.shape}{shape of the node} 84 | 85 | \item{layout}{layout method ('fruchtermanreingold','kamadakawai','target','circle')} 86 | 87 | \item{savefig}{save figures or not} 88 | 89 | \item{filename}{output figure name} 90 | 91 | \item{width}{width for output figure} 92 | 93 | \item{height}{height for output figure} 94 | 95 | \item{node.alpha}{alpha-transparency scales} 96 | 97 | \item{repel}{use ggrepel text function or not} 98 | 99 | \item{segment.size}{segment size for ggrepel text} 100 | 101 | \item{sep}{character string used to separate the genes when concatenating} 102 | } 103 | \description{ 104 | richplot for Enrichment result 105 | 106 | richplot for Enrichment result 107 | } 108 | \examples{ 109 | \dontrun{ 110 | hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 111 | gene=sample(unique(hsago$GeneID),1000) 112 | res<-richKEGG(gene,kodata = hsako) 113 | ggnetplot(result(res)) 114 | } 115 | \dontrun{ 116 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 117 | hsako<-as.data.frame(hsako) 118 | name=sample(unique(hsako$GeneID),1000) 119 | gene<-rnorm(1000) 120 | names(gene)<-name 121 | res<-richKEGG(gene,object = hsako) 122 | ggnetplot(res) 123 | } 124 | } 125 | \author{ 126 | Kai Guo 127 | } 128 | -------------------------------------------------------------------------------- /man/ggnetwork-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{ggnetwork} 4 | \alias{ggnetwork} 5 | \title{ggnetwork method} 6 | \usage{ 7 | ggnetwork( 8 | object, 9 | gene, 10 | top = 50, 11 | pvalue = 0.05, 12 | padj = NULL, 13 | usePadj = TRUE, 14 | low = "orange", 15 | high = "red", 16 | weightcut = 0.2, 17 | useTerm = TRUE, 18 | writeCyt = FALSE, 19 | cytoscapeFile = NULL, 20 | cytoscapeFormat = "graphml", 21 | label.color = "black", 22 | label.size = 2, 23 | node.shape = NULL, 24 | layout = "fruchtermanreingold", 25 | savefig = FALSE, 26 | visNet = FALSE, 27 | smooth = TRUE, 28 | nodeselect = FALSE, 29 | edit = FALSE, 30 | savehtml = FALSE, 31 | filename = NULL, 32 | width = 7, 33 | height = 7, 34 | segment.size = 0.2, 35 | node.alpha = 0.7, 36 | sep = ",", 37 | ... 38 | ) 39 | } 40 | \arguments{ 41 | \item{object}{richResult,GSEAResult object or dataframe} 42 | 43 | \item{gene}{vector contains gene names or dataframe with DEGs information} 44 | 45 | \item{top}{number of terms to display} 46 | 47 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 48 | 49 | \item{padj}{cutoff value of p adjust value} 50 | 51 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 52 | 53 | \item{low}{color used for small value} 54 | 55 | \item{high}{color used for large value} 56 | 57 | \item{weightcut}{cutoff valule for edge} 58 | 59 | \item{writeCyt}{write out the cytoscape file} 60 | 61 | \item{cytoscapeFile}{output cytoscape File} 62 | 63 | \item{cytoscapeFormat}{output file format ("edgelist", "pajek", "ncol", "lgl", "graphml", "dimacs", "gml", "dot","leda")} 64 | 65 | \item{label.color}{label color} 66 | 67 | \item{label.size}{label size} 68 | 69 | \item{layout}{layout for the network (layout.fruchterman.reingold)} 70 | 71 | \item{savefig}{save the figure or not} 72 | 73 | \item{filename}{figure output name} 74 | 75 | \item{width}{figure width} 76 | 77 | \item{height}{figure height} 78 | 79 | \item{segment.size}{size for label segment} 80 | 81 | \item{node.alpha}{alpha-transparency scales} 82 | 83 | \item{label.font}{label font} 84 | } 85 | \value{ 86 | ggplot2 object 87 | } 88 | \description{ 89 | ggnetwork 90 | } 91 | \examples{ 92 | \dontrun{ 93 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 94 | gene<-sample(unique(hsako$GeneID),1000) 95 | res<-richKEGG(gene,kodata = hsako) 96 | ggnetwork(res) 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /man/ggnetwork.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggnetwork.R 3 | \name{ggnetwork_internal} 4 | \alias{ggnetwork_internal} 5 | \alias{ggnetwork,richResult-method} 6 | \alias{ggnetwork,data.frame-method} 7 | \alias{ggnetwork,GSEAResult-method} 8 | \title{generate network based on Enrichment results} 9 | \usage{ 10 | ggnetwork_internal( 11 | object = object, 12 | gene = gene, 13 | top = 50, 14 | pvalue = 0.05, 15 | padj = NULL, 16 | usePadj = TRUE, 17 | low = "orange", 18 | high = "red", 19 | weightcut = 0.2, 20 | useTerm = TRUE, 21 | writeCyt = FALSE, 22 | cytoscapeFile = NULL, 23 | cytoscapeFormat = "graphml", 24 | label.color = "black", 25 | label.size = 2, 26 | node.shape = NULL, 27 | layout = "fruchtermanreingold", 28 | savefig = FALSE, 29 | visNet = FALSE, 30 | smooth = TRUE, 31 | nodeselect = FALSE, 32 | edit = FALSE, 33 | savehtml = FALSE, 34 | filename = NULL, 35 | width = 7, 36 | height = 7, 37 | segment.size = 0.2, 38 | node.alpha = 0.7, 39 | sep = ",", 40 | ... 41 | ) 42 | 43 | \S4method{ggnetwork}{richResult}( 44 | object, 45 | gene, 46 | top = 50, 47 | pvalue = 0.05, 48 | padj = NULL, 49 | usePadj = TRUE, 50 | low = "orange", 51 | high = "red", 52 | weightcut = 0.2, 53 | useTerm = TRUE, 54 | writeCyt = FALSE, 55 | cytoscapeFile = NULL, 56 | cytoscapeFormat = "graphml", 57 | label.color = "black", 58 | label.size = 2, 59 | node.shape = NULL, 60 | layout = "fruchtermanreingold", 61 | savefig = FALSE, 62 | visNet = FALSE, 63 | smooth = TRUE, 64 | nodeselect = FALSE, 65 | edit = FALSE, 66 | savehtml = FALSE, 67 | filename = NULL, 68 | width = 7, 69 | height = 7, 70 | segment.size = 0.2, 71 | node.alpha = 0.7, 72 | sep = ",", 73 | ... 74 | ) 75 | 76 | \S4method{ggnetwork}{data.frame}( 77 | object, 78 | gene = NULL, 79 | top = 50, 80 | pvalue = 0.05, 81 | padj = NULL, 82 | usePadj = TRUE, 83 | low = "orange", 84 | high = "red", 85 | weightcut = 0.2, 86 | useTerm = TRUE, 87 | writeCyt = FALSE, 88 | cytoscapeFile = NULL, 89 | cytoscapeFormat = "graphml", 90 | label.color = "black", 91 | label.size = 2, 92 | node.shape = NULL, 93 | layout = "fruchtermanreingold", 94 | savefig = FALSE, 95 | visNet = FALSE, 96 | smooth = TRUE, 97 | nodeselect = FALSE, 98 | edit = FALSE, 99 | savehtml = FALSE, 100 | filename = NULL, 101 | width = 7, 102 | height = 7, 103 | segment.size = 0.2, 104 | node.alpha = 0.7, 105 | sep = ",", 106 | ... 107 | ) 108 | 109 | \S4method{ggnetwork}{GSEAResult}( 110 | object, 111 | gene, 112 | top = 50, 113 | pvalue = 0.05, 114 | padj = NULL, 115 | usePadj = TRUE, 116 | low = "orange", 117 | high = "red", 118 | weightcut = 0.2, 119 | useTerm = TRUE, 120 | writeCyt = FALSE, 121 | cytoscapeFile = NULL, 122 | cytoscapeFormat = "graphml", 123 | label.color = "black", 124 | label.size = 2, 125 | node.shape = NULL, 126 | layout = "fruchtermanreingold", 127 | savefig = FALSE, 128 | visNet = FALSE, 129 | smooth = TRUE, 130 | nodeselect = FALSE, 131 | edit = FALSE, 132 | savehtml = FALSE, 133 | filename = NULL, 134 | width = 7, 135 | height = 7, 136 | segment.size = 0.2, 137 | node.alpha = 0.7, 138 | sep = ",", 139 | ... 140 | ) 141 | } 142 | \arguments{ 143 | \item{object}{data.frame object} 144 | 145 | \item{gene}{vector contains gene names or dataframe with DEGs information} 146 | 147 | \item{top}{number of terms to display} 148 | 149 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 150 | 151 | \item{padj}{cutoff value of p adjust value} 152 | 153 | \item{usePadj}{use p adjust value as color or not (should use with padj)} 154 | 155 | \item{low}{color used for small value} 156 | 157 | \item{high}{color used for large value} 158 | 159 | \item{weightcut}{cutoff valule for edge} 160 | 161 | \item{writeCyt}{write out the cytoscape file} 162 | 163 | \item{cytoscapeFile}{output cytoscape File} 164 | 165 | \item{cytoscapeFormat}{Character string giving the output file format} 166 | 167 | \item{label.color}{label color} 168 | 169 | \item{label.size}{label size} 170 | 171 | \item{layout}{layout method ('fruchtermanreingold','kamadakawai','target','circle')} 172 | 173 | \item{savefig}{save the figure or not} 174 | 175 | \item{filename}{figure output name} 176 | 177 | \item{width}{figure width} 178 | 179 | \item{height}{figure height} 180 | 181 | \item{segment.size}{size for label segment} 182 | 183 | \item{node.alpha}{alpha-transparency scales} 184 | 185 | \item{sep}{character string used to separate the genes when concatenating} 186 | 187 | \item{label.font}{label font} 188 | } 189 | \description{ 190 | generate network based on Enrichment results 191 | 192 | network for Enrichment results 193 | 194 | network for Enrichment results 195 | 196 | network for Enrichment results 197 | } 198 | \author{ 199 | Kai Guo 200 | } 201 | -------------------------------------------------------------------------------- /man/ggrich_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ggrich.R 3 | \name{ggrich_internal} 4 | \alias{ggrich_internal} 5 | \title{richplot} 6 | \usage{ 7 | ggrich_internal( 8 | object, 9 | top = 50, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | usePadj = TRUE, 13 | useTerm = TRUE, 14 | low = "orange", 15 | high = "red", 16 | writeCyt = FALSE, 17 | cytoscapeFile = "network-file-for-cytoscape.txt", 18 | label.color = "black", 19 | label.size = 2, 20 | node.shape = NULL, 21 | layout = "fruchtermanreingold", 22 | savefig = FALSE, 23 | filename = "network", 24 | width = 7, 25 | height = 7, 26 | node.alpha = 0.7, 27 | repel = TRUE, 28 | segment.size = 0.2, 29 | sep = "," 30 | ) 31 | } 32 | \arguments{ 33 | \item{object}{richResult or dataframe} 34 | 35 | \item{top}{number of terms to show (default: 50)} 36 | 37 | \item{pvalue}{cutoff p value for enrichment result} 38 | 39 | \item{padj}{cutoff p adjust value for enrichment result} 40 | 41 | \item{usePadj}{use adjust p value for the color or not} 42 | 43 | \item{useTerm}{use terms for nodes (default: TRUE)} 44 | 45 | \item{low}{color used for small value} 46 | 47 | \item{high}{color used for large value} 48 | 49 | \item{writeCyt}{write out the cytoscape file} 50 | 51 | \item{cytoscapeFile}{output cytoscape File} 52 | 53 | \item{label.color}{label color} 54 | 55 | \item{label.size}{label size} 56 | 57 | \item{node.shape}{shape of the node} 58 | 59 | \item{layout}{layout method ('fruchtermanreingold','kamadakawai','target','circle')} 60 | 61 | \item{savefig}{save figures or not} 62 | 63 | \item{filename}{output figure name} 64 | 65 | \item{width}{width for output figure} 66 | 67 | \item{height}{height for output figure} 68 | 69 | \item{node.alpha}{alpha-transparency scales} 70 | 71 | \item{repel}{use ggrepel text function or not} 72 | 73 | \item{segment.size}{segment size for ggrepel text} 74 | 75 | \item{sep}{character string used to separate the genes when concatenating} 76 | } 77 | \description{ 78 | plot the sigificant terms and shared genes with network format 79 | } 80 | -------------------------------------------------------------------------------- /man/idconvert.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{idconvert} 4 | \alias{idconvert} 5 | \title{Convert ID between ENTREZID to SYMBOL or other type ID based on bioconductor annotation package} 6 | \usage{ 7 | idconvert(species, keys, fkeytype, tkeytype) 8 | } 9 | \arguments{ 10 | \item{species:}{you can check the support species by using showData()} 11 | 12 | \item{fkeytype:}{the gene type you want to convert} 13 | 14 | \item{tkeytype:}{the gene type you want to get} 15 | } 16 | \description{ 17 | Convert ID between ENTREZID to SYMBOL or other type ID based on bioconductor annotation package 18 | } 19 | \examples{ 20 | \dontrun{ 21 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 22 | hsako<-as.data.frame(hsako) 23 | gene=sample(unique(hsako$GeneID),1000) 24 | id<-idconvert(species="human",fkeytype="SYMBOL",tkeytype="ENTREZID") 25 | } 26 | } 27 | \author{ 28 | Kai Guo 29 | } 30 | -------------------------------------------------------------------------------- /man/msigdbinfo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{msigdbinfo} 4 | \alias{msigdbinfo} 5 | \title{Print MSIGDB infomation} 6 | \usage{ 7 | msigdbinfo() 8 | } 9 | \description{ 10 | Print MSIGDB infomation 11 | } 12 | -------------------------------------------------------------------------------- /man/overlap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{overlap} 4 | \alias{overlap} 5 | \title{ovelap} 6 | \usage{ 7 | overlap(x, y) 8 | } 9 | \description{ 10 | ovelap 11 | } 12 | -------------------------------------------------------------------------------- /man/parGSEA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGSEA.R 3 | \name{parGSEA} 4 | \alias{parGSEA} 5 | \title{GSEA Enrichment analysis function for data frame with log2FC and name specifc} 6 | \usage{ 7 | parGSEA( 8 | x, 9 | object, 10 | log2FC = "log2FoldChange", 11 | gene.col = NULL, 12 | simplify = FALSE, 13 | keytype = "", 14 | pvalue = 0.05, 15 | padj = NULL, 16 | KEGG = FALSE, 17 | minSize = 15, 18 | ontology = "", 19 | maxSize = 500, 20 | padj.method = "BH", 21 | organism = NULL, 22 | table = TRUE, 23 | sep = "," 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{data.frame include the gene name and log2FC} 28 | 29 | \item{object}{annotation file for all genes} 30 | 31 | \item{log2FC}{the column name for log2FoldChange} 32 | 33 | \item{gene.col}{the gene name column if rownames won't be used as gene name} 34 | 35 | \item{simplify}{boolean value to indicate if the simple table shoule be returned} 36 | 37 | \item{pvalue}{pvalue cutoff value} 38 | 39 | \item{padj}{adjust p value cut off method} 40 | 41 | \item{minSize}{Minimal size of a gene set to test. All pathways below the threshold are excluded.} 42 | 43 | \item{maxSize}{Maximal size of a gene set to test. All pathways above the threshold are excluded.} 44 | 45 | \item{padj.method}{p value adjust method} 46 | 47 | \item{table}{leadingEdge as vector} 48 | 49 | \item{sep}{character string used to separate the genes when concatenating} 50 | } 51 | \description{ 52 | GSEA Enrichment analysis function for data frame with log2FC and name specifc 53 | } 54 | \examples{ 55 | \dontrun{ 56 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 57 | hsako<-as.data.frame(hsako) 58 | name=sample(unique(hsako$GeneID),1000) 59 | gene<-rnorm(1000) 60 | names(gene)<-name 61 | d<-data.frame(Gene=name,log2FoldChange=gene) 62 | rownames(d)<-d$Gene 63 | res<-parGSEA(d,object = hsako) 64 | } 65 | } 66 | \author{ 67 | Kai Guo 68 | } 69 | -------------------------------------------------------------------------------- /man/plotGSEA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGSEA.R 3 | \name{plotGSEA} 4 | \alias{plotGSEA} 5 | \title{plot multiple significant pathways} 6 | \usage{ 7 | plotGSEA( 8 | x, 9 | object, 10 | gseaRes, 11 | mycol = NULL, 12 | top = 10, 13 | pvalue = 0.05, 14 | padj = NULL, 15 | gseaParam = 1, 16 | ticksSize = 0.2 17 | ) 18 | } 19 | \arguments{ 20 | \item{x}{a vector include all log2FC with gene name} 21 | 22 | \item{object}{Annot object} 23 | 24 | \item{gseaRes}{GSEAResult object} 25 | 26 | \item{mycol}{a vector indicate the colors used for the figure} 27 | 28 | \item{top}{number of terms you want to display,} 29 | 30 | \item{pvalue}{cutoff value of pvalue (if padj set as NULL)} 31 | 32 | \item{padj}{cutoff value of p adjust value} 33 | } 34 | \description{ 35 | plot multiple significant pathways 36 | } 37 | \examples{ 38 | \dontrun{ 39 | set.seed(123) 40 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 41 | name=sample(unique(hsako$GeneID),1000) 42 | gene<-rnorm(1000) 43 | names(gene)<-name 44 | res<-richGSEA(gene,object = hsako) 45 | plotGSEA(gene,hsako,res,object = hsako) 46 | } 47 | } 48 | \author{ 49 | Kai Guo 50 | } 51 | -------------------------------------------------------------------------------- /man/rbind.GSEAResult.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{rbind.GSEAResult} 4 | \alias{rbind.GSEAResult} 5 | \title{rbind generic function for GSEAResult object} 6 | \usage{ 7 | \method{rbind}{GSEAResult}(...) 8 | } 9 | \description{ 10 | rbind generic function for GSEAResult object 11 | } 12 | \author{ 13 | Kai Guo 14 | } 15 | -------------------------------------------------------------------------------- /man/rbind.richResult.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{rbind.richResult} 4 | \alias{rbind.richResult} 5 | \title{rbind generic function for richResult object} 6 | \usage{ 7 | \method{rbind}{richResult}(...) 8 | } 9 | \description{ 10 | rbind generic function for richResult object 11 | } 12 | \author{ 13 | Kai Guo 14 | } 15 | -------------------------------------------------------------------------------- /man/reexports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dplyr_exportR.R 3 | \docType{import} 4 | \name{reexports} 5 | \alias{reexports} 6 | \alias{\%>\%} 7 | \alias{\%<>\%} 8 | \alias{arrange} 9 | \alias{filter} 10 | \alias{group_by} 11 | \alias{mutate} 12 | \alias{n} 13 | \alias{rename} 14 | \alias{select} 15 | \alias{slice} 16 | \alias{summarise} 17 | \title{Objects exported from other packages} 18 | \keyword{internal} 19 | \description{ 20 | These objects are imported from other packages. Follow the links 21 | below to see their documentation. 22 | 23 | \describe{ 24 | \item{dplyr}{\code{\link[dplyr]{arrange}}, \code{\link[dplyr]{filter}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr:context]{n}}, \code{\link[dplyr]{rename}}, \code{\link[dplyr]{select}}, \code{\link[dplyr]{slice}}, \code{\link[dplyr]{summarise}}} 25 | 26 | \item{magrittr}{\code{\link[magrittr:compound]{\%<>\%}}, \code{\link[magrittr:pipe]{\%>\%}}} 27 | }} 28 | 29 | -------------------------------------------------------------------------------- /man/result.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \docType{methods} 4 | \name{result} 5 | \alias{result} 6 | \title{result generic} 7 | \usage{ 8 | result(x) 9 | } 10 | \arguments{ 11 | \item{x}{An S4 object (e.g., \code{richResult} or \code{GSEAResult})} 12 | } 13 | \value{ 14 | result return dataframe and print summary 15 | 16 | Typically a data frame (implementation-specific) 17 | } 18 | \description{ 19 | result generic 20 | 21 | S4 generic for extracting the result slot 22 | } 23 | \examples{ 24 | \dontrun{ 25 | # usage: result(x) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /man/result_detail_methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{result_detail_methods} 4 | \alias{result_detail_methods} 5 | \alias{result,richResult-method} 6 | \alias{result,GSEAResult-method} 7 | \alias{detail,richResult-method} 8 | \alias{detail,GSEAResult-method} 9 | \title{S4 methods for result() and detail() on richResult and GSEAResult} 10 | \usage{ 11 | \S4method{result}{richResult}(x) 12 | 13 | \S4method{result}{GSEAResult}(x) 14 | 15 | \S4method{detail}{richResult}(x) 16 | 17 | \S4method{detail}{GSEAResult}(x) 18 | } 19 | \arguments{ 20 | \item{x}{A \code{richResult} or \code{GSEAResult} object} 21 | } 22 | \value{ 23 | A data frame 24 | } 25 | \description{ 26 | These methods return \code{as.data.frame(x@result)} or \code{x@detail}, 27 | depending on the class, effectively exposing object contents. 28 | } 29 | -------------------------------------------------------------------------------- /man/reverseList_bk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{reverseList_bk} 4 | \alias{reverseList_bk} 5 | \title{reverse List} 6 | \usage{ 7 | reverseList_bk(lhs) 8 | } 9 | \arguments{ 10 | \item{lhs:}{list with names} 11 | } 12 | \description{ 13 | reverse List 14 | } 15 | \author{ 16 | Kai Guo 17 | } 18 | -------------------------------------------------------------------------------- /man/richCluster-data.frame-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/kappa.R 3 | \name{richCluster,data.frame-method} 4 | \alias{richCluster,data.frame-method} 5 | \title{kappa cluster analysis} 6 | \usage{ 7 | \S4method{richCluster}{data.frame}( 8 | x, 9 | gene = NULL, 10 | useTerm = FALSE, 11 | cutoff = 0.5, 12 | overlap = 0.5, 13 | minSize = 5, 14 | escore = 3 15 | ) 16 | } 17 | \arguments{ 18 | \item{x}{richResult object or dataframe} 19 | 20 | \item{gene}{(Optional).a vector of gene list} 21 | 22 | \item{useTerm}{to use the term or not (TRUE/FALSE)} 23 | 24 | \item{cutoff}{kappa score threshold for significant dispersion results} 25 | 26 | \item{overlap}{cutoff value of the overlap between two Terms} 27 | 28 | \item{minSize}{minimal number of terms in the cluster} 29 | 30 | \item{escore}{kappa enrichment score cutoff value (default: 3)} 31 | } 32 | \description{ 33 | kappa cluster analysis 34 | } 35 | \examples{ 36 | \dontrun{ 37 | hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 38 | gene=sample(unique(hsago$GeneID),1000) 39 | res<-richGO(gene,godata = hsago,ontology ="BP") 40 | resc<-richCluster(res) 41 | } 42 | } 43 | \author{ 44 | Kai Guo 45 | } 46 | -------------------------------------------------------------------------------- /man/richCluster-richResult-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/kappa.R 3 | \name{richCluster,richResult-method} 4 | \alias{richCluster,richResult-method} 5 | \title{kappa cluster analysis} 6 | \usage{ 7 | \S4method{richCluster}{richResult}( 8 | x, 9 | gene = NULL, 10 | useTerm = FALSE, 11 | cutoff = 0.5, 12 | overlap = 0.5, 13 | minSize = 5, 14 | escore = 3 15 | ) 16 | } 17 | \arguments{ 18 | \item{x}{richResult object or dataframe} 19 | 20 | \item{gene}{(Optional).a vector of gene list} 21 | 22 | \item{useTerm}{to use the term or not (TRUE/FALSE)} 23 | 24 | \item{cutoff}{kappa score threshold for significant dispersion results} 25 | 26 | \item{overlap}{cutoff value of the overlap between two Terms} 27 | 28 | \item{minSize}{minimal number of terms in the cluster} 29 | 30 | \item{escore}{kappa enrichment score cutoff value (default: 3)} 31 | } 32 | \description{ 33 | kappa cluster analysis 34 | } 35 | \examples{ 36 | \dontrun{ 37 | hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 38 | gene=sample(unique(hsago$GeneID),1000) 39 | res<-richGO(gene,godata = hsago,ontology ="BP") 40 | resc<-richCluster(res) 41 | } 42 | } 43 | \author{ 44 | Kai Guo 45 | } 46 | -------------------------------------------------------------------------------- /man/richCluster.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{richCluster} 4 | \alias{richCluster} 5 | \title{kappa cluster analysis} 6 | \usage{ 7 | richCluster( 8 | x, 9 | gene = NULL, 10 | useTerm = FALSE, 11 | cutoff = 0.5, 12 | overlap = 0.5, 13 | minSize = 5, 14 | escore = 3 15 | ) 16 | } 17 | \arguments{ 18 | \item{x}{richResult object or dataframe} 19 | 20 | \item{gene}{(Optional).a vector of gene list} 21 | 22 | \item{useTerm}{to use the term or not (TRUE/FALSE)} 23 | 24 | \item{cutoff}{kappa score threshold for significant dispersion results} 25 | 26 | \item{overlap}{cutoff value of the overlap between two Terms} 27 | 28 | \item{minSize}{minimal number of terms in the cluster} 29 | 30 | \item{escore}{kappa enrichment score cutoff value (default: 3)} 31 | } 32 | \description{ 33 | kappa cluster analysis 34 | } 35 | \examples{ 36 | \dontrun{ 37 | hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 38 | gene<-ample(unique(hsago$GeneID),1000) 39 | res<-richGO(gene,godata = hsago,ontology ="BP") 40 | resc<-richCluster(res) 41 | } 42 | } 43 | \author{ 44 | Kai Guo 45 | } 46 | -------------------------------------------------------------------------------- /man/richDAVID.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/enrich.R 3 | \name{richDAVID} 4 | \alias{richDAVID} 5 | \title{Functional enrichment analysis with DAVID} 6 | \usage{ 7 | richDAVID( 8 | gene, 9 | keytype = "ENTREZ_GENE_ID", 10 | species = "human", 11 | anntype = "GOTERM_BP_FAT", 12 | universe, 13 | pvalue = 0.05, 14 | padj = NULL, 15 | minSize = 2, 16 | maxSize = 500, 17 | keepRich = TRUE, 18 | filename = NULL, 19 | padj.method = "BH", 20 | sep = ",", 21 | david.user = "richR@und.edu" 22 | ) 23 | } 24 | \arguments{ 25 | \item{gene}{vector contains gene names} 26 | 27 | \item{keytype}{key type export} 28 | 29 | \item{anntype}{GOTERM_BP_FAT, KEGG_PATHWAY,GOTERM_CC_FAT} 30 | 31 | \item{pvalue}{cutoff pvalue} 32 | 33 | \item{padj}{cutoff p adjust value} 34 | 35 | \item{david.user}{richR@und.edu} 36 | } 37 | \value{ 38 | Annot object 39 | } 40 | \description{ 41 | Functional enrichment analysis with DAVID 42 | } 43 | \examples{ 44 | \dontrun{ 45 | hsako <- buildAnnot(species="human",keytype="ENTREZID",anntype = "KEGG") 46 | hsako <- as.data.frame(hsako) 47 | gene <- sample(unique(hsako$GeneID),1000) 48 | res <- richDAVID(gene,keytype="ENTREZID",species="human") 49 | } 50 | } 51 | \author{ 52 | Kai Guo 53 | } 54 | -------------------------------------------------------------------------------- /man/richGO-ANY-Annot-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGO.R 3 | \name{richGO,ANY,Annot-method} 4 | \alias{richGO,ANY,Annot-method} 5 | \title{GO Enrichment analysis function} 6 | \usage{ 7 | \S4method{richGO}{ANY,Annot}( 8 | x, 9 | godata, 10 | ontology = "BP", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | minSize = 2, 14 | maxSize = 500, 15 | minGSSize = 10, 16 | maxGSSize = 500, 17 | keepRich = TRUE, 18 | filename = NULL, 19 | padj.method = "BH", 20 | sep = "," 21 | ) 22 | } 23 | \arguments{ 24 | \item{x}{vector contains gene names or dataframe with DEGs information} 25 | 26 | \item{godata}{GO annotation data} 27 | 28 | \item{ontology}{BP,MF or CC} 29 | 30 | \item{pvalue}{cutoff pvalue} 31 | 32 | \item{padj}{cutoff p adjust value} 33 | 34 | \item{minSize}{minimal number of genes included in significant terms} 35 | 36 | \item{maxSize}{maximum number of genes included in significant terms} 37 | 38 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 39 | 40 | \item{maxGSSize}{maximal size of each geneset for analyzing} 41 | 42 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 43 | 44 | \item{filename}{output filename} 45 | 46 | \item{padj.method}{pvalue adjust method(default:"BH")} 47 | 48 | \item{sep}{character string used to separate the genes when concatenating} 49 | 50 | \item{organism}{organism} 51 | 52 | \item{keytype}{keytype for input genes} 53 | } 54 | \description{ 55 | GO Enrichment analysis function 56 | } 57 | \examples{ 58 | \dontrun{ 59 | hsago<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 60 | gene=sample(unique(hsago$GeneID),1000) 61 | res<-richGO(gene,godata = hsago,ontology ="BP") 62 | } 63 | } 64 | \author{ 65 | Kai Guo 66 | } 67 | -------------------------------------------------------------------------------- /man/richGO-ANY-data.frame-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGO.R 3 | \name{richGO,ANY,data.frame-method} 4 | \alias{richGO,ANY,data.frame-method} 5 | \title{GO Enrichment analysis function} 6 | \usage{ 7 | \S4method{richGO}{ANY,data.frame}( 8 | x, 9 | godata, 10 | ontology = "BP", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = NULL, 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = TRUE, 20 | filename = NULL, 21 | padj.method = "BH", 22 | sep = "," 23 | ) 24 | } 25 | \arguments{ 26 | \item{x}{vector contains gene names or dataframe with DEGs information} 27 | 28 | \item{godata}{GO annotation data} 29 | 30 | \item{ontology}{BP,MF or CC} 31 | 32 | \item{pvalue}{cutoff pvalue} 33 | 34 | \item{padj}{cutoff p adjust value} 35 | 36 | \item{organism}{organism} 37 | 38 | \item{keytype}{keytype for input genes} 39 | 40 | \item{minSize}{minimal number of genes included in significant terms} 41 | 42 | \item{maxSize}{maximum number of genes included in significant terms} 43 | 44 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 45 | 46 | \item{maxGSSize}{maximal size of each geneset for analyzing} 47 | 48 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 49 | 50 | \item{filename}{output filename} 51 | 52 | \item{padj.method}{pvalue adjust method(default:"BH")} 53 | 54 | \item{sep}{character string used to separate the genes when concatenating} 55 | } 56 | \description{ 57 | GO Enrichment analysis function 58 | } 59 | \examples{ 60 | \dontrun{ 61 | hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 62 | hsago <- as.data.frame(hsago) 63 | gene <- sample(unique(hsago$GeneID),1000) 64 | res<-richGO(gene,godata = hsago,ontology ="BP") 65 | } 66 | } 67 | \author{ 68 | Kai Guo 69 | } 70 | -------------------------------------------------------------------------------- /man/richGO.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{richGO} 4 | \alias{richGO} 5 | \title{GO Enrichment analysis function} 6 | \usage{ 7 | richGO( 8 | x, 9 | godata, 10 | ontology = "BP", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = NULL, 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = TRUE, 20 | filename = NULL, 21 | padj.method = "BH", 22 | sep = ",", 23 | ... 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{godata}{GO annotation data} 30 | 31 | \item{ontology}{BP,MF or CC} 32 | 33 | \item{pvalue}{cutoff pvalue} 34 | 35 | \item{padj}{cutoff p adjust value} 36 | 37 | \item{organism}{organism} 38 | 39 | \item{keytype}{keytype for input genes} 40 | 41 | \item{minSize}{minimal number of genes included in significant terms} 42 | 43 | \item{maxSize}{maximum number of genes included in significant terms} 44 | 45 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 46 | 47 | \item{maxGSSize}{maximal size of each geneset for analyzing} 48 | 49 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 50 | 51 | \item{filename}{output filename} 52 | 53 | \item{padj.method}{pvalue adjust method(default:"BH")} 54 | 55 | \item{sep}{character string used to separate the genes when concatenating} 56 | } 57 | \value{ 58 | richResult 59 | } 60 | \description{ 61 | richGO 62 | } 63 | \examples{ 64 | \dontrun{ 65 | hsago <- buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 66 | hsago <- as.data.frame(hsago) 67 | gene <- sample(unique(hsago$GeneID),1000) 68 | res <- richGO(gene,godata = hsago,ontology ="BP") 69 | } 70 | } 71 | \author{ 72 | Kai Guo 73 | } 74 | -------------------------------------------------------------------------------- /man/richGO_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGO.R 3 | \name{richGO_internal} 4 | \alias{richGO_internal} 5 | \title{GO Enrichment analysis function} 6 | \usage{ 7 | richGO_internal( 8 | x, 9 | godata, 10 | ontology = "BP", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = "SYMBOL", 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = FALSE, 20 | filename = NULL, 21 | padj.method = "BH", 22 | sep = "," 23 | ) 24 | } 25 | \arguments{ 26 | \item{x}{vector contains gene names or dataframe with DEGs information} 27 | 28 | \item{godata}{GO annotation data} 29 | 30 | \item{ontology}{BP,MF or CC} 31 | 32 | \item{pvalue}{cutoff pvalue} 33 | 34 | \item{padj}{cutoff p adjust value} 35 | 36 | \item{organism}{organism} 37 | 38 | \item{keytype}{keytype for input genes} 39 | 40 | \item{minSize}{minimal number of genes included in significant terms} 41 | 42 | \item{maxSize}{maximum number of genes included in significant terms} 43 | 44 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 45 | 46 | \item{maxGSSize}{maximal size of each geneset for analyzing} 47 | 48 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: FALSE)} 49 | 50 | \item{filename}{output filename} 51 | 52 | \item{padj.method}{pvalue adjust method(default:"BH")} 53 | 54 | \item{sep}{character string used to separate the genes when concatenating} 55 | } 56 | \description{ 57 | GO Enrichment analysis function 58 | } 59 | \author{ 60 | Kai Guo 61 | } 62 | -------------------------------------------------------------------------------- /man/richGSEA-ANY-Annot-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGSEA.R 3 | \name{richGSEA,ANY,Annot-method} 4 | \alias{richGSEA,ANY,Annot-method} 5 | \title{GSEA Enrichment analysis function} 6 | \usage{ 7 | \S4method{richGSEA}{ANY,Annot}( 8 | x, 9 | object, 10 | keytype = "", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | KEGG = FALSE, 14 | minSize = 15, 15 | ontology = ontology, 16 | maxSize = 500, 17 | padj.method = "BH", 18 | organism = NULL, 19 | table = TRUE, 20 | sep = "," 21 | ) 22 | } 23 | \arguments{ 24 | \item{x}{a vector include all log2FC with gene name} 25 | 26 | \item{object}{annotation file for all genes} 27 | 28 | \item{pvalue}{pvalue cutoff value} 29 | 30 | \item{padj}{adjust p value cut off method} 31 | 32 | \item{KEGG}{a logical evaluating to TRUE or FALSE indicating whether KEGG GSEA were peformed or not.} 33 | 34 | \item{minSize}{Minimal size of a gene set to test. All pathways below the threshold are excluded.} 35 | 36 | \item{maxSize}{Maximal size of a gene set to test. All pathways above the threshold are excluded.} 37 | 38 | \item{padj.method}{p value adjust method} 39 | 40 | \item{table}{leadingEdge as vector} 41 | 42 | \item{sep}{character string used to separate the genes when concatenating} 43 | } 44 | \description{ 45 | GSEA Enrichment analysis function 46 | } 47 | \examples{ 48 | \dontrun{ 49 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 50 | name=sample(unique(hsako$GeneID),1000) 51 | gene<-rnorm(1000) 52 | names(gene)<-name 53 | res<-richGSEA(gene,object = hsako) 54 | } 55 | } 56 | \author{ 57 | Kai Guo 58 | } 59 | -------------------------------------------------------------------------------- /man/richGSEA-ANY-data.frame-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGSEA.R 3 | \name{richGSEA,ANY,data.frame-method} 4 | \alias{richGSEA,ANY,data.frame-method} 5 | \title{GSEA Enrichment analysis function} 6 | \usage{ 7 | \S4method{richGSEA}{ANY,data.frame}( 8 | x, 9 | object, 10 | keytype = "", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | KEGG = FALSE, 14 | minSize = 15, 15 | ontology = ontology, 16 | maxSize = 500, 17 | padj.method = "BH", 18 | organism = NULL, 19 | table = TRUE, 20 | sep = "," 21 | ) 22 | } 23 | \arguments{ 24 | \item{x}{a vector include all log2FC with gene name} 25 | 26 | \item{object}{annotation file for all genes} 27 | 28 | \item{keytype}{keytype for input genes} 29 | 30 | \item{pvalue}{pvalue cutoff value} 31 | 32 | \item{padj}{adjust p value cut off method} 33 | 34 | \item{KEGG}{a logical evaluating to TRUE or FALSE indicating whether KEGG GSEA were peformed or not.} 35 | 36 | \item{minSize}{Minimal size of a gene set to test. All pathways below the threshold are excluded.} 37 | 38 | \item{maxSize}{Maximal size of a gene set to test. All pathways above the threshold are excluded.} 39 | 40 | \item{padj.method}{pvalue adjust method(default:"BH")} 41 | 42 | \item{organism}{organism name} 43 | 44 | \item{table}{leadingEdge as vector} 45 | 46 | \item{sep}{character string used to separate the genes when concatenating} 47 | } 48 | \description{ 49 | GSEA Enrichment analysis function 50 | } 51 | \examples{ 52 | \dontrun{ 53 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 54 | hsako<-as.data.frame(hsako) 55 | name=sample(unique(hsako$GeneID),1000) 56 | gene<-rnorm(1000) 57 | names(gene)<-name 58 | res<-richGSEA(gene,object = hsako) 59 | } 60 | } 61 | \author{ 62 | Kai Guo 63 | } 64 | -------------------------------------------------------------------------------- /man/richGSEA-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{richGSEA} 4 | \alias{richGSEA} 5 | \title{richGSEA method} 6 | \usage{ 7 | richGSEA( 8 | x, 9 | object, 10 | keytype = "", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | KEGG = FALSE, 14 | minSize = 15, 15 | ontology = "", 16 | maxSize = 500, 17 | padj.method = "BH", 18 | organism = NULL, 19 | table = TRUE, 20 | sep = ",", 21 | ... 22 | ) 23 | } 24 | \arguments{ 25 | \item{x}{a vector include all log2FC with gene name} 26 | 27 | \item{object}{annotation file for all genes} 28 | 29 | \item{pvalue}{pvalue cutoff value} 30 | 31 | \item{padj}{adjust p value cut off method} 32 | 33 | \item{KEGG}{a logical evaluating to TRUE or FALSE indicating whether KEGG GSEA were peformed or not.} 34 | 35 | \item{minSize}{Minimal size of a gene set to test. All pathways below the threshold are excluded.} 36 | 37 | \item{maxSize}{Maximal size of a gene set to test. All pathways above the threshold are excluded.} 38 | 39 | \item{padj.method}{p value adjust method} 40 | 41 | \item{table}{leadingEdge as vector} 42 | 43 | \item{sep}{character string used to separate the genes when concatenating} 44 | } 45 | \value{ 46 | GSEAResult 47 | } 48 | \description{ 49 | richGSEA 50 | } 51 | \examples{ 52 | \dontrun{ 53 | set.seed(123) 54 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 55 | name <- sample(unique(hsako$GeneID),1000) 56 | gene<-rnorm(1000) 57 | names(gene) <- name 58 | res <- richGSEA(gene,object = hsako) 59 | } 60 | } 61 | \author{ 62 | Kai Guo 63 | } 64 | -------------------------------------------------------------------------------- /man/richGSEA_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richGSEA.R 3 | \name{richGSEA_internal} 4 | \alias{richGSEA_internal} 5 | \title{Enrichment analysis for any type of annotation data} 6 | \usage{ 7 | richGSEA_internal( 8 | x, 9 | object, 10 | keytype = "", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | KEGG = FALSE, 14 | minSize = 15, 15 | maxSize = 500, 16 | minGSSize = 10, 17 | maxGSSize = 500, 18 | padj.method = "BH", 19 | organism = NULL, 20 | ontology = NULL, 21 | table = TRUE, 22 | sep = "," 23 | ) 24 | } 25 | \arguments{ 26 | \item{x}{a vector include all log2FC with gene name} 27 | 28 | \item{object}{annotation file for all genes} 29 | 30 | \item{pvalue}{pvalue cutoff value} 31 | 32 | \item{padj}{adjust p value cut off method} 33 | 34 | \item{KEGG}{a logical evaluating to TRUE or FALSE indicating whether KEGG GSEA were peformed or not.} 35 | 36 | \item{minSize}{Minimal size of a gene set to test. All pathways below the threshold are excluded.} 37 | 38 | \item{maxSize}{Maximal size of a gene set to test. All pathways above the threshold are excluded.} 39 | 40 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 41 | 42 | \item{maxGSSize}{maximal size of each geneset for analyzing} 43 | 44 | \item{padj.method}{p value adjust method} 45 | 46 | \item{table}{leadingEdge as vector} 47 | 48 | \item{sep}{character string used to separate the genes when concatenating} 49 | } 50 | \description{ 51 | Enrichment analysis for any type of annotation data 52 | } 53 | \author{ 54 | Kai Guo 55 | } 56 | -------------------------------------------------------------------------------- /man/richKEGG-ANY-Annot-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richKEGG.R 3 | \name{richKEGG,ANY,Annot-method} 4 | \alias{richKEGG,ANY,Annot-method} 5 | \title{KEGG Enrichment analysis function} 6 | \usage{ 7 | \S4method{richKEGG}{ANY,Annot}( 8 | x, 9 | kodata, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | organism = NULL, 13 | ontology = "KEGG", 14 | keytype = NULL, 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = TRUE, 20 | filename = NULL, 21 | padj.method = "BH", 22 | builtin = TRUE, 23 | sep = "," 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{pvalue}{cutoff pvalue} 30 | 31 | \item{padj}{cutoff p adjust value} 32 | 33 | \item{organism}{organism} 34 | 35 | \item{ontology}{KEGG} 36 | 37 | \item{keytype}{keytype for input genes} 38 | 39 | \item{minSize}{minimal number of genes included in significant terms} 40 | 41 | \item{maxSize}{maximum number of genes included in significant terms} 42 | 43 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 44 | 45 | \item{maxGSSize}{maximal size of each geneset for analyzing} 46 | 47 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 48 | 49 | \item{filename}{output filename} 50 | 51 | \item{padj.method}{pvalue adjust method(default:"BH")} 52 | 53 | \item{sep}{character string used to separate the genes when concatenating} 54 | 55 | \item{bulitin}{use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data)} 56 | } 57 | \description{ 58 | KEGG Enrichment analysis function 59 | } 60 | \examples{ 61 | \dontrun{ 62 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 63 | gene=sample(unique(hsako$GeneID),1000) 64 | res<-richKEGG(gene,kodata = hsako) 65 | } 66 | } 67 | \author{ 68 | Kai Guo 69 | } 70 | -------------------------------------------------------------------------------- /man/richKEGG-ANY-data.frame-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richKEGG.R 3 | \name{richKEGG,ANY,data.frame-method} 4 | \alias{richKEGG,ANY,data.frame-method} 5 | \title{KEGG Pathway Enrichment analysis function} 6 | \usage{ 7 | \S4method{richKEGG}{ANY,data.frame}( 8 | x, 9 | kodata, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | organism = NULL, 13 | ontology = "KEGG", 14 | keytype = NULL, 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = TRUE, 20 | filename = NULL, 21 | padj.method = "BH", 22 | builtin = TRUE, 23 | sep = "," 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{pvalue}{cutoff pvalue} 30 | 31 | \item{padj}{cutoff p adjust value} 32 | 33 | \item{organism}{organism} 34 | 35 | \item{ontology}{KEGG} 36 | 37 | \item{keytype}{keytype for input genes} 38 | 39 | \item{minSize}{minimal number of genes included in significant terms} 40 | 41 | \item{maxSize}{maximum number of genes included in significant terms} 42 | 43 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 44 | 45 | \item{maxGSSize}{maximal size of each geneset for analyzing} 46 | 47 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 48 | 49 | \item{filename}{output filename} 50 | 51 | \item{padj.method}{pvalue adjust method(default:"BH")} 52 | 53 | \item{sep}{character string used to separate the genes when concatenating} 54 | 55 | \item{bulitin}{use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data)} 56 | } 57 | \description{ 58 | KEGG Pathway Enrichment analysis function 59 | } 60 | \examples{ 61 | \dontrun{ 62 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 63 | hsako<-as.data.frame(hsako) 64 | gene=sample(unique(hsako$GeneID),1000) 65 | res<-richKEGG(gene,kodata = hsako) 66 | } 67 | } 68 | \author{ 69 | Kai Guo 70 | } 71 | -------------------------------------------------------------------------------- /man/richKEGG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{richKEGG} 4 | \alias{richKEGG} 5 | \title{KEGG Enrichment analysis function} 6 | \usage{ 7 | richKEGG( 8 | x, 9 | kodata, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | organism = NULL, 13 | ontology = "KEGG", 14 | keytype = NULL, 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = TRUE, 20 | filename = NULL, 21 | padj.method = "BH", 22 | builtin = TRUE, 23 | sep = ",", 24 | ... 25 | ) 26 | } 27 | \arguments{ 28 | \item{x}{vector contains gene names or dataframe with DEGs information} 29 | 30 | \item{pvalue}{cutoff pvalue} 31 | 32 | \item{padj}{cutoff p adjust value} 33 | 34 | \item{organism}{organism} 35 | 36 | \item{ontology}{KEGG} 37 | 38 | \item{keytype}{keytype for input genes} 39 | 40 | \item{minSize}{minimal number of genes included in significant terms} 41 | 42 | \item{maxSize}{maximum number of genes included in significant terms} 43 | 44 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 45 | 46 | \item{maxGSSize}{maximal size of each geneset for analyzing} 47 | 48 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 49 | 50 | \item{filename}{output filename} 51 | 52 | \item{padj.method}{pvalue adjust method(default:"BH")} 53 | 54 | \item{sep}{character string used to separate the genes when concatenating} 55 | 56 | \item{bulitin}{use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data)} 57 | } 58 | \value{ 59 | richResult 60 | } 61 | \description{ 62 | richKEGG 63 | } 64 | \examples{ 65 | \dontrun{ 66 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 67 | gene <- sample(unique(hsako$GeneID),1000) 68 | res <- richKEGG(gene,kodata = hsako) 69 | } 70 | } 71 | \author{ 72 | Kai Guo 73 | } 74 | -------------------------------------------------------------------------------- /man/richKEGG_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richKEGG.R 3 | \name{richKEGG_internal} 4 | \alias{richKEGG_internal} 5 | \title{KEGG Pathway Enrichment analysis function} 6 | \usage{ 7 | richKEGG_internal( 8 | x, 9 | kodata, 10 | pvalue = 0.05, 11 | padj = NULL, 12 | ontology = "KEGG", 13 | organism = NULL, 14 | keytype = "SYMBOL", 15 | minSize = 2, 16 | maxSize = 500, 17 | minGSSize = 10, 18 | maxGSSize = 500, 19 | keepRich = TRUE, 20 | filename = NULL, 21 | padj.method = "BH", 22 | builtin = TRUE, 23 | sep = "," 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{kodata}{GO annotation data} 30 | 31 | \item{pvalue}{cutoff pvalue} 32 | 33 | \item{padj}{cutoff p adjust value} 34 | 35 | \item{ontology}{KEGG} 36 | 37 | \item{organism}{organism} 38 | 39 | \item{keytype}{keytype for input genes} 40 | 41 | \item{minSize}{minimal number of genes included in significant terms} 42 | 43 | \item{maxSize}{maximum number of genes included in significant terms} 44 | 45 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 46 | 47 | \item{maxGSSize}{maximal size of each geneSet for analyzing} 48 | 49 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 50 | 51 | \item{filename}{output filename} 52 | 53 | \item{padj.method}{pvalue adjust method(default:"BH")} 54 | 55 | \item{sep}{character string used to separate the genes when concatenating} 56 | 57 | \item{bulitin}{use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data)} 58 | } 59 | \description{ 60 | KEGG Pathway Enrichment analysis function 61 | } 62 | \author{ 63 | Kai Guo 64 | } 65 | -------------------------------------------------------------------------------- /man/richLevel-ANY-Annot-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richLevel.R 3 | \name{richLevel,ANY,Annot-method} 4 | \alias{richLevel,ANY,Annot-method} 5 | \title{Pathway Enrichment analysis for different level function} 6 | \usage{ 7 | \S4method{richLevel}{ANY,Annot}( 8 | x, 9 | kodata, 10 | level = "Level2", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = "SYMBOL", 15 | ontology = "", 16 | minSize = 2, 17 | maxSize = 500, 18 | minGSSize = 10, 19 | maxGSSize = 500, 20 | keepRich = TRUE, 21 | filename = NULL, 22 | padj.method = "BH", 23 | sep = "," 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{kodata}{KEGG annotation data} 30 | 31 | \item{pvalue}{cutoff pvalue} 32 | 33 | \item{padj}{cutoff p adjust value} 34 | 35 | \item{organism}{organism} 36 | 37 | \item{keytype}{keytype for input genes} 38 | 39 | \item{ontology}{ontology type} 40 | 41 | \item{minSize}{minimal number of genes included in significant terms} 42 | 43 | \item{maxSize}{maximum number of genes included in significant terms} 44 | 45 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 46 | 47 | \item{maxGSSize}{maximal size of each geneset for analyzing} 48 | 49 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 50 | 51 | \item{filename}{output filename} 52 | 53 | \item{padj.method}{pvalue adjust method(default:"BH")} 54 | 55 | \item{sep}{character string used to separate the genes when concatenating} 56 | } 57 | \description{ 58 | Pathway Enrichment analysis for different level function 59 | } 60 | \examples{ 61 | \dontrun{ 62 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 63 | gene=sample(unique(hsako$GeneID),1000) 64 | res<-richLevel(gene,kodata = hsako,level="Level2") 65 | } 66 | } 67 | \author{ 68 | Kai Guo 69 | } 70 | -------------------------------------------------------------------------------- /man/richLevel-ANY-data.frame-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richLevel.R 3 | \name{richLevel,ANY,data.frame-method} 4 | \alias{richLevel,ANY,data.frame-method} 5 | \title{Pathway Enrichment analysis for different level function} 6 | \usage{ 7 | \S4method{richLevel}{ANY,data.frame}( 8 | x, 9 | kodata, 10 | level = "Level2", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = "SYMBOL", 15 | ontology = "KEGG", 16 | minSize = 2, 17 | maxSize = 500, 18 | minGSSize = 10, 19 | maxGSSize = 500, 20 | keepRich = TRUE, 21 | filename = NULL, 22 | padj.method = "BH", 23 | sep = "," 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{kodata}{KEGG annotation data} 30 | 31 | \item{pvalue}{cutoff pvalue} 32 | 33 | \item{padj}{cutoff p adjust value} 34 | 35 | \item{organism}{organism} 36 | 37 | \item{keytype}{keytype for input genes} 38 | 39 | \item{ontology}{ontology type} 40 | 41 | \item{minSize}{minimal number of genes included in significant terms} 42 | 43 | \item{maxSize}{maximum number of genes included in significant terms} 44 | 45 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 46 | 47 | \item{maxGSSize}{maximal size of each geneset for analyzing} 48 | 49 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 50 | 51 | \item{filename}{output filename} 52 | 53 | \item{padj.method}{pvalue adjust method(default:"BH")} 54 | 55 | \item{sep}{character string used to separate the genes when concatenating} 56 | } 57 | \description{ 58 | Pathway Enrichment analysis for different level function 59 | } 60 | \examples{ 61 | \dontrun{ 62 | hsako<-buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 63 | hsako<-as.data.frame(hsako) 64 | gene=sample(unique(hsako$GeneID),1000) 65 | res<-richLevel(gene,kodata = hsako,level="Level2") 66 | } 67 | } 68 | \author{ 69 | Kai Guo 70 | } 71 | -------------------------------------------------------------------------------- /man/richLevel-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllGenerics.R 3 | \name{richLevel} 4 | \alias{richLevel} 5 | \title{richLevel method} 6 | \usage{ 7 | richLevel( 8 | x, 9 | kodata, 10 | level = "Level2", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = "SYMBOL", 15 | ontology = "", 16 | minSize = 2, 17 | maxSize = 500, 18 | minGSSize = 10, 19 | maxGSSize = 500, 20 | keepRich = TRUE, 21 | filename = NULL, 22 | padj.method = "BH", 23 | sep = ",", 24 | ... 25 | ) 26 | } 27 | \arguments{ 28 | \item{x}{vector contains gene names or dataframe with DEGs information} 29 | 30 | \item{kodata}{KEGG annotation data} 31 | 32 | \item{pvalue}{cutoff pvalue} 33 | 34 | \item{padj}{cutoff p adjust value} 35 | 36 | \item{organism}{organism} 37 | 38 | \item{keytype}{keytype for input genes} 39 | 40 | \item{ontology}{ontology type} 41 | 42 | \item{minSize}{minimal number of genes included in significant terms} 43 | 44 | \item{maxSize}{maximum number of genes included in significant terms} 45 | 46 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 47 | 48 | \item{maxGSSize}{maximal size of each geneset for analyzing} 49 | 50 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 51 | 52 | \item{filename}{output filename} 53 | 54 | \item{padj.method}{pvalue adjust method(default:"BH")} 55 | 56 | \item{sep}{character string used to separate the genes when concatenating} 57 | 58 | \item{bulitin}{use KEGG bulit in KEGG annotation or not(set FALSE if you want use newest KEGG data)} 59 | } 60 | \description{ 61 | richLevel 62 | } 63 | \examples{ 64 | \dontrun{ 65 | hsako <- buildAnnot(species="human",keytype="SYMBOL",anntype = "KEGG") 66 | gene <- sample(unique(hsako$GeneID),1000) 67 | res <- richLevel(gene,kodata = hsako,level="Level2") 68 | } 69 | } 70 | \author{ 71 | Kai Guo 72 | } 73 | -------------------------------------------------------------------------------- /man/richLevel_internal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/richLevel.R 3 | \name{richLevel_internal} 4 | \alias{richLevel_internal} 5 | \title{Pathway Enrichment analysis for different level function} 6 | \usage{ 7 | richLevel_internal( 8 | x, 9 | kodata, 10 | level = "Level2", 11 | pvalue = 0.05, 12 | padj = NULL, 13 | organism = NULL, 14 | keytype = "SYMBOL", 15 | ontology = "", 16 | minSize = 2, 17 | maxSize = 500, 18 | minGSSize = 10, 19 | maxGSSize = 500, 20 | keepRich = TRUE, 21 | filename = NULL, 22 | padj.method = "BH", 23 | sep = "," 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{vector contains gene names or dataframe with DEGs information} 28 | 29 | \item{kodata}{KEGG annotation data} 30 | 31 | \item{pvalue}{cutoff pvalue} 32 | 33 | \item{padj}{cutoff p adjust value} 34 | 35 | \item{organism}{organism} 36 | 37 | \item{keytype}{keytype for input genes} 38 | 39 | \item{ontology}{ontology type} 40 | 41 | \item{minSize}{minimal number of genes included in significant terms} 42 | 43 | \item{maxSize}{maximum number of genes included in significant terms} 44 | 45 | \item{minGSSize}{minimal size of genes annotated by ontology term for testing.} 46 | 47 | \item{maxGSSize}{maximal size of each geneset for analyzing} 48 | 49 | \item{keepRich}{keep terms with rich factor value equal 1 or not (default: TRUE)} 50 | 51 | \item{filename}{output filename} 52 | 53 | \item{padj.method}{pvalue adjust method(default:"BH")} 54 | 55 | \item{sep}{character string used to separate the genes when concatenating} 56 | } 57 | \description{ 58 | Pathway Enrichment analysis for different level function 59 | } 60 | \author{ 61 | Kai Guo 62 | } 63 | -------------------------------------------------------------------------------- /man/richResult-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/00-AllClasses.R 3 | \docType{class} 4 | \name{richResult-class} 5 | \alias{richResult-class} 6 | \alias{show,richResult-method} 7 | \alias{plot,richResult-method} 8 | \alias{summary,richResult-method} 9 | \title{Class "richResult" 10 | This class represents the result of enrichment analysis.} 11 | \description{ 12 | Class "richResult" 13 | This class represents the result of enrichment analysis. 14 | } 15 | \section{Slots}{ 16 | 17 | \describe{ 18 | \item{\code{result}}{enrichment analysis results} 19 | 20 | \item{\code{detail}}{genes included in significant terms and original information} 21 | 22 | \item{\code{pvalueCutoff}}{cutoff pvalue} 23 | 24 | \item{\code{pAdjustMethod}}{pvalue adjust method} 25 | 26 | \item{\code{padjCutoff}}{pvalue adjust cutoff value} 27 | 28 | \item{\code{genenumber}}{number of input genes} 29 | 30 | \item{\code{organism}}{organism used} 31 | 32 | \item{\code{ontology}}{biological ontology} 33 | 34 | \item{\code{gene}}{Gene IDs} 35 | 36 | \item{\code{keytype}}{Gene ID type} 37 | 38 | \item{\code{sep}}{character string used to separate the genes when concatenating} 39 | }} 40 | 41 | \author{ 42 | Kai Guo 43 | } 44 | \keyword{classes} 45 | -------------------------------------------------------------------------------- /man/s4-accessors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{s4-accessors} 4 | \alias{s4-accessors} 5 | \alias{row.names,Annot-method} 6 | \alias{row.names,richResult-method} 7 | \alias{row.names,GSEAResult-method} 8 | \alias{rownames,Annot-method} 9 | \alias{rownames,richResult-method} 10 | \alias{rownames,GSEAResult-method} 11 | \alias{names,Annot-method} 12 | \alias{names,richResult-method} 13 | \alias{names,GSEAResult-method} 14 | \alias{colnames,Annot-method} 15 | \alias{colnames,richResult-method} 16 | \alias{colnames,GSEAResult-method} 17 | \title{S4 row- and column-related methods for Annot, richResult, GSEAResult} 18 | \usage{ 19 | \S4method{row.names}{Annot}(x) 20 | 21 | \S4method{row.names}{richResult}(x) 22 | 23 | \S4method{row.names}{GSEAResult}(x) 24 | 25 | \S4method{rownames}{Annot}(x) 26 | 27 | \S4method{rownames}{richResult}(x) 28 | 29 | \S4method{rownames}{GSEAResult}(x) 30 | 31 | \S4method{names}{Annot}(x) 32 | 33 | \S4method{names}{richResult}(x) 34 | 35 | \S4method{names}{GSEAResult}(x) 36 | 37 | \S4method{colnames}{Annot}(x) 38 | 39 | \S4method{colnames}{richResult}(x) 40 | 41 | \S4method{colnames}{GSEAResult}(x) 42 | } 43 | \arguments{ 44 | \item{x}{An object of class Annot, richResult, or GSEAResult} 45 | 46 | \item{...}{Further arguments (ignored)} 47 | } 48 | \description{ 49 | These methods let you get rownames, colnames, names, etc. for your custom S4 classes. 50 | } 51 | -------------------------------------------------------------------------------- /man/showData.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{showData} 4 | \alias{showData} 5 | \title{show avaliable data based on bioconductor annotation package} 6 | \usage{ 7 | showData() 8 | } 9 | \description{ 10 | show avaliable data based on bioconductor annotation package 11 | } 12 | \author{ 13 | Kai Guo 14 | } 15 | -------------------------------------------------------------------------------- /man/subset-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{subset-methods} 4 | \alias{subset-methods} 5 | \alias{[,Annot,ANY,ANY,ANY-method} 6 | \alias{[,Annot-method} 7 | \alias{[,richResult,ANY,ANY,ANY-method} 8 | \alias{[,richResult-method} 9 | \alias{[,GSEAResult,ANY,ANY,ANY-method} 10 | \alias{[,GSEAResult-method} 11 | \title{S4 subsetting methods for Annot, richResult, and GSEAResult} 12 | \usage{ 13 | \S4method{[}{Annot,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE) 14 | 15 | \S4method{[}{richResult,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE) 16 | 17 | \S4method{[}{GSEAResult,ANY,ANY,ANY}(x, i, j, ..., drop = TRUE) 18 | } 19 | \arguments{ 20 | \item{x}{An S4 object (Annot, richResult, or GSEAResult)} 21 | 22 | \item{i, j}{indices for subsetting} 23 | 24 | \item{...}{further arguments (usually ignored)} 25 | 26 | \item{drop}{logical. Should dimensions be dropped?} 27 | } 28 | \description{ 29 | These methods define `[` subsetting on each respective S4 class. 30 | } 31 | -------------------------------------------------------------------------------- /man/summary-GSEAResult-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{summary,GSEAResult-method} 4 | \alias{summary,GSEAResult-method} 5 | \title{S4 summary method for GSEAResult objects} 6 | \usage{ 7 | \S4method{summary}{GSEAResult}(object, ...) 8 | } 9 | \arguments{ 10 | \item{object}{A \code{GSEAResult} object} 11 | 12 | \item{...}{Not used} 13 | } 14 | \value{ 15 | Prints summary info to the console 16 | } 17 | \description{ 18 | Summarizes the content of a \code{GSEAResult} object. 19 | } 20 | -------------------------------------------------------------------------------- /man/summary-richResult-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{summary,richResult-method} 4 | \alias{summary,richResult-method} 5 | \title{S4 summary method for richResult objects} 6 | \usage{ 7 | \S4method{summary}{richResult}(object, ...) 8 | } 9 | \arguments{ 10 | \item{object}{A \code{richResult} object} 11 | 12 | \item{...}{Not used} 13 | } 14 | \value{ 15 | Prints summary info to the console 16 | } 17 | \description{ 18 | Summarizes the content of a \code{richResult} object. 19 | } 20 | -------------------------------------------------------------------------------- /man/utilities-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{utilities-methods} 4 | \alias{utilities-methods} 5 | \alias{head,Annot-method} 6 | \alias{head,richResult-method} 7 | \alias{head,GSEAResult-method} 8 | \alias{tail,Annot-method} 9 | \alias{tail,richResult-method} 10 | \alias{tail,GSEAResult-method} 11 | \alias{dim,Annot-method} 12 | \alias{dim,richResult-method} 13 | \alias{dim,GSEAResult-method} 14 | \title{S4 methods for head, tail, dim on Annot, richResult, GSEAResult} 15 | \usage{ 16 | \S4method{head}{Annot}(x, n = 6L, ...) 17 | 18 | \S4method{head}{richResult}(x, n = 6L, ...) 19 | 20 | \S4method{head}{GSEAResult}(x, n = 6L, ...) 21 | 22 | \S4method{tail}{Annot}(x, n = 6L, ...) 23 | 24 | \S4method{tail}{richResult}(x, n = 6L, ...) 25 | 26 | \S4method{tail}{GSEAResult}(x, n = 6L, ...) 27 | 28 | \S4method{dim}{Annot}(x) 29 | 30 | \S4method{dim}{richResult}(x) 31 | 32 | \S4method{dim}{GSEAResult}(x) 33 | } 34 | \arguments{ 35 | \item{x}{An object of class \code{Annot}, \code{richResult}, or \code{GSEAResult}} 36 | 37 | \item{n}{Number of rows to display (for \code{head} or \code{tail})} 38 | 39 | \item{...}{Further arguments passed to the underlying data.frame method} 40 | } 41 | \description{ 42 | Defines how to call \code{head}, \code{tail}, and \code{dim} for these S4 classes. 43 | } 44 | -------------------------------------------------------------------------------- /man/vec_to_df.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{vec_to_df} 4 | \alias{vec_to_df} 5 | \title{vector to data.frame} 6 | \usage{ 7 | vec_to_df(x, name) 8 | } 9 | \description{ 10 | vector to data.frame 11 | } 12 | -------------------------------------------------------------------------------- /richR.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,vignette 22 | -------------------------------------------------------------------------------- /src/RcppExports.cpp: -------------------------------------------------------------------------------- 1 | // Generated by using Rcpp::compileAttributes() -> do not edit by hand 2 | // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 3 | 4 | #include 5 | 6 | using namespace Rcpp; 7 | 8 | #ifdef RCPP_USE_GLOBAL_ROSTREAM 9 | Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); 10 | Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); 11 | #endif 12 | 13 | // hyper_bench_vector 14 | NumericVector hyper_bench_vector(NumericVector xin, NumericVector yin, double N, double n); 15 | RcppExport SEXP _richR_hyper_bench_vector(SEXP xinSEXP, SEXP yinSEXP, SEXP NSEXP, SEXP nSEXP) { 16 | BEGIN_RCPP 17 | Rcpp::RObject rcpp_result_gen; 18 | Rcpp::RNGScope rcpp_rngScope_gen; 19 | Rcpp::traits::input_parameter< NumericVector >::type xin(xinSEXP); 20 | Rcpp::traits::input_parameter< NumericVector >::type yin(yinSEXP); 21 | Rcpp::traits::input_parameter< double >::type N(NSEXP); 22 | Rcpp::traits::input_parameter< double >::type n(nSEXP); 23 | rcpp_result_gen = Rcpp::wrap(hyper_bench_vector(xin, yin, N, n)); 24 | return rcpp_result_gen; 25 | END_RCPP 26 | } 27 | // name_table 28 | IntegerVector name_table(List lh); 29 | RcppExport SEXP _richR_name_table(SEXP lhSEXP) { 30 | BEGIN_RCPP 31 | Rcpp::RObject rcpp_result_gen; 32 | Rcpp::RNGScope rcpp_rngScope_gen; 33 | Rcpp::traits::input_parameter< List >::type lh(lhSEXP); 34 | rcpp_result_gen = Rcpp::wrap(name_table(lh)); 35 | return rcpp_result_gen; 36 | END_RCPP 37 | } 38 | // reverseList 39 | List reverseList(const List& lhs); 40 | RcppExport SEXP _richR_reverseList(SEXP lhsSEXP) { 41 | BEGIN_RCPP 42 | Rcpp::RObject rcpp_result_gen; 43 | Rcpp::RNGScope rcpp_rngScope_gen; 44 | Rcpp::traits::input_parameter< const List& >::type lhs(lhsSEXP); 45 | rcpp_result_gen = Rcpp::wrap(reverseList(lhs)); 46 | return rcpp_result_gen; 47 | END_RCPP 48 | } 49 | // fast_factor 50 | SEXP fast_factor(SEXP x); 51 | RcppExport SEXP _richR_fast_factor(SEXP xSEXP) { 52 | BEGIN_RCPP 53 | Rcpp::RObject rcpp_result_gen; 54 | Rcpp::RNGScope rcpp_rngScope_gen; 55 | Rcpp::traits::input_parameter< SEXP >::type x(xSEXP); 56 | rcpp_result_gen = Rcpp::wrap(fast_factor(x)); 57 | return rcpp_result_gen; 58 | END_RCPP 59 | } 60 | // sf 61 | List sf(DataFrame& x); 62 | RcppExport SEXP _richR_sf(SEXP xSEXP) { 63 | BEGIN_RCPP 64 | Rcpp::RObject rcpp_result_gen; 65 | Rcpp::RNGScope rcpp_rngScope_gen; 66 | Rcpp::traits::input_parameter< DataFrame& >::type x(xSEXP); 67 | rcpp_result_gen = Rcpp::wrap(sf(x)); 68 | return rcpp_result_gen; 69 | END_RCPP 70 | } 71 | // uniq 72 | StringVector uniq(StringVector& xa); 73 | RcppExport SEXP _richR_uniq(SEXP xaSEXP) { 74 | BEGIN_RCPP 75 | Rcpp::RObject rcpp_result_gen; 76 | Rcpp::RNGScope rcpp_rngScope_gen; 77 | Rcpp::traits::input_parameter< StringVector& >::type xa(xaSEXP); 78 | rcpp_result_gen = Rcpp::wrap(uniq(xa)); 79 | return rcpp_result_gen; 80 | END_RCPP 81 | } 82 | 83 | static const R_CallMethodDef CallEntries[] = { 84 | {"_richR_hyper_bench_vector", (DL_FUNC) &_richR_hyper_bench_vector, 4}, 85 | {"_richR_name_table", (DL_FUNC) &_richR_name_table, 1}, 86 | {"_richR_reverseList", (DL_FUNC) &_richR_reverseList, 1}, 87 | {"_richR_fast_factor", (DL_FUNC) &_richR_fast_factor, 1}, 88 | {"_richR_sf", (DL_FUNC) &_richR_sf, 1}, 89 | {"_richR_uniq", (DL_FUNC) &_richR_uniq, 1}, 90 | {NULL, NULL, 0} 91 | }; 92 | 93 | RcppExport void R_init_richR(DllInfo *dll) { 94 | R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); 95 | R_useDynamicSymbols(dll, FALSE); 96 | } 97 | -------------------------------------------------------------------------------- /src/hyper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace Rcpp; 3 | 4 | inline double hyp_test(double k, double M, double NM, double n) { 5 | return R::phyper(k, M, NM, n, false, false); 6 | } 7 | 8 | // [[Rcpp::export]] 9 | NumericVector hyper_bench_vector(NumericVector xin, 10 | NumericVector yin, 11 | double N, 12 | double n) { 13 | int xsize = xin.size(); 14 | NumericVector res(xsize); 15 | double* px = &xin[0]; 16 | double* py = &yin[0]; 17 | double* pr = &res[0]; 18 | 19 | for (int i = 0; i < xsize; i++) { 20 | double x_val = px[i]; 21 | double y_val = py[i]; 22 | pr[i] = hyp_test(x_val - 1.0, y_val, N - y_val, n); 23 | } 24 | 25 | res.attr("names") = xin.names(); 26 | return res; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/name_table.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace Rcpp; 4 | 5 | // [[Rcpp::export]] 6 | IntegerVector name_table(List lh) { 7 | // 长度 8 | int n = lh.size(); 9 | IntegerVector res(n); 10 | 11 | // 提取 List 的 names 12 | SEXP nm = Rf_getAttrib(lh, R_NamesSymbol); 13 | 14 | for (int i = 0; i < n; i++) { 15 | // 第 i 个元素 16 | SEXP elem = lh[i]; 17 | // 确认它是字符串向量 18 | if (TYPEOF(elem) != STRSXP) { 19 | // 如果不是字符串向量,可以根据需求决定抛错或标记 NA 20 | res[i] = NA_INTEGER; 21 | continue; 22 | } 23 | 24 | // 元素长度 25 | R_xlen_t len = Rf_xlength(elem); 26 | std::unordered_set uset; 27 | uset.reserve(len); 28 | 29 | for (R_xlen_t j = 0; j < len; j++) { 30 | // 取得 R 的 CHARSXP 31 | SEXP rstr = STRING_ELT(elem, j); 32 | if (rstr == NA_STRING) { 33 | uset.insert("NA"); 34 | } else { 35 | // 拷贝到 std::string 36 | uset.insert(std::string(CHAR(rstr))); 37 | } 38 | } 39 | res[i] = uset.size(); 40 | } 41 | 42 | Rf_setAttrib(res, R_NamesSymbol, nm); 43 | return res; 44 | } 45 | -------------------------------------------------------------------------------- /src/reverse_list.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace Rcpp; 3 | 4 | // [[Rcpp::export]] 5 | List reverseList(const List& lhs) { 6 | Function sf("sf"); // 从 R 全局环境中获取名为 "sf" 的函数 7 | 8 | // 1) 拿到 lhs 的名字向量 9 | CharacterVector nm = lhs.names(); 10 | int n = lhs.size(); // 列表的长度 11 | 12 | // 2) 统计所有子向量元素总数,为后面预分配做准备 13 | R_xlen_t total_length = 0; 14 | std::vector lens(n); 15 | for(int i = 0; i < n; i++){ 16 | SEXP elem = lhs[i]; 17 | R_xlen_t len = Rf_xlength(elem); 18 | lens[i] = len; 19 | total_length += len; 20 | } 21 | 22 | CharacterVector lhs_n(total_length); 23 | CharacterVector unl(total_length); 24 | 25 | // 4) 逐个子向量收集数据 26 | R_xlen_t idx = 0; 27 | for(int i = 0; i < n; i++){ 28 | R_xlen_t len = lens[i]; 29 | if(len == 0) continue; 30 | 31 | // 取出第 i 个子向量 (假设是字符串向量,可按需改成别的类型) 32 | CharacterVector sub = lhs[i]; 33 | 34 | for(R_xlen_t j = 0; j < len; j++){ 35 | lhs_n[idx] = nm[i]; // 重复 names(lhs)[i] 36 | unl[idx] = sub[j]; // 拿到子向量中的元素 37 | idx++; 38 | } 39 | } 40 | 41 | DataFrame df = DataFrame::create( 42 | _["V1"] = lhs_n, 43 | _["V2"] = unl, 44 | _["stringsAsFactors"] = false 45 | ); 46 | 47 | // 6) 调用您现有的 sf() 函数 48 | // 如果 sf() 是 C++ 导出的函数,也可以直接调用;若它在 R 里,可用 Function("sf") 49 | List res = sf(df); 50 | 51 | // 返回结果 52 | return res; 53 | } 54 | -------------------------------------------------------------------------------- /src/sf.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace Rcpp; 3 | using namespace std; 4 | template 5 | SEXP fast_factor_template( const Vector& x ) { 6 | Vector levs = sort_unique(x); 7 | IntegerVector out = match(x, levs); 8 | out.attr("levels") = as(levs); 9 | out.attr("class") = "factor"; 10 | return out; 11 | } 12 | 13 | //[[Rcpp::export]] 14 | SEXP fast_factor( SEXP x ) { //modified from RcppCore 15 | switch( TYPEOF(x) ) { 16 | case INTSXP: return fast_factor_template(x); 17 | case REALSXP: return fast_factor_template(x); 18 | case STRSXP: return fast_factor_template(x); 19 | } 20 | return R_NilValue; 21 | } 22 | 23 | //[[Rcpp::export]] 24 | List sf(DataFrame &x){ 25 | StringVector Gene=x(0); 26 | StringVector Fa=x(1); 27 | StringVector tmp=unique(Fa); 28 | List res(Fa.size()); 29 | Function sp("split"); 30 | res=sp(Gene,fast_factor(Fa)); 31 | return(res); 32 | } 33 | -------------------------------------------------------------------------------- /src/unique.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace Rcpp; 3 | //[[Rcpp::export]] 4 | StringVector uniq(StringVector& xa){ 5 | StringVector rhs=unique(xa); 6 | return(rhs); 7 | } 8 | NumericVector uniq(NumericVector& xa){ 9 | NumericVector rhs=unique(xa); 10 | return(rhs); 11 | } 12 | -------------------------------------------------------------------------------- /vignettes/richR.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Enrichment analysis for GO and KEGG Pathway" 3 | author: "Kai Guo" 4 | date: "`r Sys.Date()`" 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{Vignette Title} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | This document describes how to use the richR package. 13 | Below is a simple manual for using the package 14 | 15 | ## Introduction 16 | You can do enrichment analysis for different type of annotation data (GO,KEGG,Reactome(may need reactome.db if you work with Human). If you had bioAnno installed, you can do enrichment with all types of annotation data. 17 | 18 | ## Quick tour 19 | ```{r} 20 | set.seed(123) 21 | library(richR) 22 | # To check if your the current species if supported !!! 23 | showData() 24 | # Make the GO and KEGG Pathway data for your analysis 25 | # find suitable species name by using showensemble() 26 | hsa_go<-buildAnnot(species="human",keytype="SYMBOL",anntype = "GO") 27 | hsa_ko<-buildAnnot(species = "human",keytype="SYMBOL", anntype = "KEGG") 28 | ``` 29 | ### Support KEGG Module and MSIGDB anntation 30 | ``` 31 | hsamgi <- buildMSIGDB(species="human",keytype="SYMBOL",anntype="GO") 32 | hsakom <- buildAnnot(species = "human",keytype="SYMBOL", anntype = "KEGGM") 33 | ``` 34 | ____ 35 | 36 | ### You can make annotation data from ensemble 37 | * If had bioAnno installed, you can build annotation package with it 38 | ```{r} 39 | # library(bioAnno) 40 | # fromKEGG(species="ath") 41 | # athgo<-buildOwn(dbname="org.ath.eg.db",anntype="GO") 42 | # athko<-buildOwn(dbname="org.ath.eg.db",anntype="KEGG") 43 | # Please go over the bioAnno package webpage ("https://github.com/guokai8/bioAnno") to learn more 44 | ``` 45 | ---- 46 | 47 | ### Simple example for enrichment analysis 48 | 49 | ```{r,fig.height=6,fig.width=6,fig.align="center",dpi=100} 50 | gene <- sample(unique(hsa_go$GeneID),1000) 51 | res <- richGO(gene,godata = hsa_go,ontology ="BP") 52 | head(res) 53 | ggbar(res,top = 20,usePadj = F) 54 | ``` 55 | 56 | ```{r,fig.height=6,fig.width=6,fig.align="center"} 57 | resko<-richKEGG(gene,hsa_ko,pvalue=0.05) 58 | head(resko) 59 | ggdot(resko,top=10,usePadj = F) 60 | ``` 61 | ### Support DAVID analysis (Online) 62 | ``` 63 | gene <- sample(unique(hsako$GeneID),1000) 64 | res <- richDAVID(gene,keytype="ENTREZID",species="human") 65 | ``` 66 | #### You can also get network graphic for any type of enrichment analysis result and also combine different enrichment result 67 | ```{r,fig.height=6,fig.width=6,fig.align="center",dpi=100} 68 | ggnetplot(res,top=20) 69 | ggnetwork(res,top=20,weightcut = 0.01) 70 | 71 | ``` 72 | ### Directly support dplyr filter, select, mutate,group_by ... functions 73 | ``` 74 | filter(resko,Padj<0.05)%>%head() 75 | select(resko,Term) 76 | ``` 77 | ### Generate figures with mutiple enrichment results for groups 78 | ``` 79 | gene1 <- sample(unique(hsako$GeneID),1000) 80 | gene2 <- sample(unique(hsako$GeneID),1000) 81 | resko1 <- richKEGG(gene1,kodata = hsako) 82 | resko2 <- richKEGG(gene2,kodata = hsako) 83 | res <- compareResult(list(S1=resko1,S2=resko2)) 84 | comparedot(res) 85 | ``` 86 | ### Generate figures with different enrichment results 87 | ``` 88 | ggnetmap(list(res,resko),top=50,visNet=TRUE,smooth=FALSE) 89 | ``` 90 | ### Contact information 91 | For any questions please contact guokai8@gmail.com 92 | 93 | Congratulations ! You just done all Enrichment analysis 94 | --------------------------------------------------------------------------------