Install SBGNview through Bioconductor
BiocManager::install(c("SBGNview"))
Install gage through Bioconductor
BiocManager::install(c("gage"))
In this example, we analyze a RNA-SEQ dataset of wild type mice and IFNg KO mice. It contains normalized RNA-seq gene expression data described in this study: Greer, Renee L., Xiaoxi Dong, et al. “Akkermansia muciniphila mediates negative effects of IFNg on glucose metabolism.” Nature communications 2016.
The RNA abundance data was quantile normalized and log2 transformed, stored in a “SummarizedExperiment” object
library(SBGNview)
library(SummarizedExperiment)
library(SBGNview.data)
data("IFNg")
count.data <- assays(IFNg)$counts
wt <- colnames(IFNg)[IFNg$group == "wt"]
ko <- colnames(IFNg)[IFNg$group == "ko"]
head(count.data)
ensemble.to.pathway <- getMolList(
database = "pathwayCommons"
,mol.list.ID.type = "ENSEMBL"
,org = "mmu"
,cpd.or.gene = "gene"
,output.pathway.name = TRUE
)
head(ensemble.to.pathway[[2]])
gage is an R package for pathway enrichment analysis.
library(gage)
degs <- gage(exprs = count.data
,gsets = ensemble.to.pathway
,ref = which(colnames(count.data) %in% wt)
,samp = which(colnames(count.data) %in% ko)
,compare = "as.group"
)
head(degs$greater)[,c(1,4:5)]
head(degs$less)
down.pathways <- degs$less
head(down.pathways)
The abundance table was log2 transformed. Here we calculate the fold change of KO group v.s. WT group.
mean.wt <- apply(count.data[,wt] ,1 ,"mean")
head(mean.wt)
mean.ko <- apply(count.data[,ko],1,"mean")
head(mean.ko)
ensemble.to.koVsWt <- mean.ko - mean.wt
head(ensemble.to.koVsWt)
down.pathways <- do.call(rbind,strsplit(row.names(down.pathways),"::"))[,1]
head(down.pathways)
sbgnview.obj <- SBGNview(
gene.data = ensemble.to.koVsWt,
gene.id.type = "ENSEMBL",
input.sbgn = down.pathways[1],
output.file = "ifn.sbgnview.less",
show.pathway.name = TRUE,
max.gene.value = 2,
min.gene.value = -2,
mid.gene.value = 0,
node.sum = "mean",
label.spliting.string = c("-","_"," "),
output.format = c("png"),
inhibition.edge.end.shift = 1,
font.size = 2,
logic.node.font.scale = 6,
font.size.scale.compartment = 1.5,
org = "mmu",
text.length.factor.macromolecule = 0.8,
text.length.factor.compartment = 2,
text.length.factor.complex = 3,
if.scale.compartment.font.size = TRUE,
node.width.adjust.factor.compartment = 0.058
)
sbgnview.obj
data("cancer.ds")
sbgnview.obj <- SBGNview(
gene.data = cancer.ds,
gene.id.type = "ENTREZID",
input.sbgn = "R-HSA-877300",
output.file = "demo.SummarizedExperiment",
show.pathway.name = TRUE,
max.gene.value = 1,
min.gene.value = -1,
mid.gene.value = 0,
node.sum = "mean",
label.spliting.string = c("-","_"," "),
output.format = c("png"),
inhibition.edge.end.shift = 1,
font.size = 2,
logic.node.font.scale = 6,
font.size.scale.compartment = 1.5,
org = "hsa",
text.length.factor.macromolecule = 0.8,
text.length.factor.compartment = 2,
text.length.factor.complex = 3,
if.scale.compartment.font.size = TRUE,
node.width.adjust.factor.compartment = 0.058
)
sbgnview.obj
sessionInfo()
## R version 4.0.0 (2020-04-24)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.4 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.11-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.11-bioc/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] parallel stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] gage_2.38.0 SummarizedExperiment_1.18.0
## [3] DelayedArray_0.14.0 matrixStats_0.56.0
## [5] GenomicRanges_1.40.0 GenomeInfoDb_1.24.0
## [7] SBGNview_1.2.0 SBGNview.data_1.1.0
## [9] pathview_1.28.0 org.Hs.eg.db_3.10.0
## [11] AnnotationDbi_1.50.0 IRanges_2.22.0
## [13] S4Vectors_0.26.0 Biobase_2.48.0
## [15] BiocGenerics_0.34.0 knitr_1.28
##
## loaded via a namespace (and not attached):
## [1] KEGGREST_1.28.0 xfun_0.13 lattice_0.20-41
## [4] vctrs_0.2.4 htmltools_0.4.0 yaml_2.2.1
## [7] blob_1.2.1 XML_3.99-0.3 rlang_0.4.5
## [10] DBI_1.1.0 Rgraphviz_2.32.0 bit64_0.9-7
## [13] GenomeInfoDbData_1.2.3 stringr_1.4.0 zlibbioc_1.34.0
## [16] Biostrings_2.56.0 memoise_1.1.0 evaluate_0.14
## [19] rsvg_1.3 gbRd_0.4-11 highr_0.8
## [22] Rcpp_1.0.4.6 graph_1.66.0 XVector_0.28.0
## [25] bit_1.1-15.2 png_0.1-7 digest_0.6.25
## [28] stringi_1.4.6 bookdown_0.18 grid_4.0.0
## [31] bibtex_0.4.2.2 Rdpack_0.11-1 tools_4.0.0
## [34] bitops_1.0-6 magrittr_1.5 RCurl_1.98-1.2
## [37] RSQLite_2.2.0 crayon_1.3.4 pkgconfig_2.0.3
## [40] Matrix_1.2-18 xml2_1.3.2 KEGGgraph_1.48.0
## [43] rmarkdown_2.1 httr_1.4.1 R6_2.4.1
## [46] igraph_1.2.5 compiler_4.0.0