## ----knitr, echo=FALSE, results="hide"----------------------------------- knitr::opts_chunk$set(tidy = FALSE, out.truncate = 80, out.lines = 6, dev = 'pdf', include = TRUE, fig.width = 6, fig.height = 6, resolution = 100, message = FALSE, warning = FALSE) ## ----style-Sweave, eval=TRUE, echo=FALSE, results="asis"----------------- BiocStyle::latex() ## ----loadPKG, echo=FALSE------------------------------------------------- library(DOSE) library(GO.db) library(org.Hs.eg.db) library(clusterProfiler) ## ----options,echo=FALSE-------------------------------------------------- options(digits=3, width=80, prompt=" ", continue=" ") ## ----bitr---------------------------------------------------------------- x <- c("GPX3", "GLRX", "LBP", "CRYAB", "DEFB1", "HCLS1", "SOD2", "HSPA2", "ORM1", "IGFBP1", "PTHLH", "GPC3", "IGFBP3","TOB1", "MITF", "NDRG1", "NR1H4", "FGFR3", "PVR", "IL6", "PTPRM", "ERBB2", "NID2", "LAMB1", "COMP", "PLS3", "MCAM", "SPP1", "LAMC1", "COL4A2", "COL4A1", "MYOC", "ANXA4", "TFPI2", "CST6", "SLPI", "TIMP2", "CPM", "GGT1", "NNMT", "MAL", "EEF1A2", "HGD", "TCN2", "CDA", "PCCA", "CRYM", "PDXK", "STC1", "WARS", "HMOX1", "FXYD2", "RBP4", "SLC6A12", "KDELR3", "ITM2B") eg = bitr(x, fromType="SYMBOL", toType="ENTREZID", annoDb="org.Hs.eg.db") head(eg) ## ----idType-------------------------------------------------------------- idType("org.Hs.eg.db") ## ----bitr2--------------------------------------------------------------- ids <- bitr(x, fromType="SYMBOL", toType=c("UNIPROT", "ENSEMBL"), annoDb="org.Hs.eg.db") head(ids) ## ----groupGO------------------------------------------------------------- library("DOSE") data(geneList) gene <- names(geneList)[abs(geneList) > 2] head(gene) ggo <- groupGO(gene = gene, organism = "human", ont = "BP", level = 3, readable = TRUE) head(summary(ggo)) ## ----enrichGO------------------------------------------------------------ ego <- enrichGO(gene = gene, universe = names(geneList), organism = "human", ont = "CC", pAdjustMethod = "BH", pvalueCutoff = 0.01, qvalueCutoff = 0.05, readable = TRUE) head(summary(ego)) ## ----gseGO--------------------------------------------------------------- ego2 <- gseGO(geneList = geneList, organism = "human", ont = "CC", nPerm = 100, minGSSize = 120, pvalueCutoff = 0.01, verbose = FALSE) head(summary(ego2)) ## ----enrichKEGG---------------------------------------------------------- kk <- enrichKEGG(gene = gene, organism = "human", pvalueCutoff = 0.05, readable = TRUE, use_internal_data = TRUE) head(summary(kk)) ## ----gseKEGG------------------------------------------------------------- kk2 <- gseKEGG(geneList = geneList, organism = "human", nPerm = 100, minGSSize = 120, pvalueCutoff = 0.01, verbose = FALSE, use_internal_data = TRUE) head(summary(kk2)) ## ----enrichDAVID, eval=FALSE--------------------------------------------- ## david <- enrichDAVID(gene = gene, ## idType = "ENTREZ_GENE_ID", ## listType = "Gene", ## annotation = "KEGG_PATHWAY") ## ----barplot, fig.height=5, fig.width=6---------------------------------- barplot(ggo, drop=TRUE, showCategory=12) ## ----barplot-enrich, fig.height=5, fig.width=8--------------------------- barplot(ego, showCategory=8) ## ----enrichMap, fig.cap="enrichment map of enrichment result", fig.align="center", fig.height=16, fig.width=16, out.width="0.9\\textwidth", fig.pos="h"---- enrichMap(ego) ## ----cnetplot, fig.height=14, fig.width=14------------------------------- cnetplot(ego, categorySize="pvalue", foldChange=geneList) ## ----cnetplot-KEGG, fig.height=14, fig.width=14-------------------------- cnetplot(kk, categorySize="geneNum", foldChange=geneList) ## ----gseaplot, fig.cap="plotting gsea result", fig.align="center", fig.height=6, fig.width=8, out.width="0.6\\textwidth", fig.pos="h"---- gseaplot(kk2, geneSetID = "hsa04145") ## ----viewKEGG, eval=FALSE------------------------------------------------ ## library("pathview") ## hsa04110 <- pathview(gene.data = geneList, ## pathway.id = "hsa04110", ## species = "hsa", ## limit = list(gene=max(abs(geneList)), cpd=1)) ## ----gcSample------------------------------------------------------------ data(gcSample) lapply(gcSample, head) ## ----comparecluster------------------------------------------------------ ck <- compareCluster(geneCluster = gcSample, fun = "enrichKEGG", use_internal_data = TRUE) head(summary(ck)) ## ----formula------------------------------------------------------------- ## formula interface mydf <- data.frame(Entrez=c('1', '100', '1000', '100101467', '100127206', '100128071'), group = c('A', 'A', 'A', 'B', 'B', 'B'), othergroup = c('good', 'good', 'bad', 'bad', 'good', 'bad')) xx.formula <- compareCluster(Entrez~group, data=mydf, fun='groupGO') head(summary(xx.formula)) ## formula interface with more than one grouping variable xx.formula.twogroups <- compareCluster(Entrez~group+othergroup, data=mydf, fun='groupGO') head(summary(xx.formula.twogroups)) ## ----compareCluster, fig.height=8, fig.width=8--------------------------- plot(ck) ## ----sessInfo, results='asis', echo=FALSE-------------------------------- toLatex(sessionInfo())