## Not run:
# # Load the library
# library(XGR)
# library(igraph)
#
# # Enrichment analysis using your own data
# # a) provide your own data (eg InterPro domains and their annotations by GO terms)
# ## All InterPro domains
# input.file <-
# "http://dcgor.r-forge.r-project.org/data/InterPro/InterPro.txt"
# data <- utils::read.delim(input.file, header=F, row.names=NULL,
# stringsAsFactors=F)[,1]
# ## provide the input domains of interest (eg 100 randomly chosen domains)
# data.file <- sample(data, 100)
# ## InterPro domains annotated by GO Molecular Function (GOMF) terms
# annotation.file <-
# "http://dcgor.r-forge.r-project.org/data/InterPro/Domain2GOMF.txt"
#
# # b) perform enrichment analysis
# eTerm <- xEnricherYours(data.file=data.file,
# annotation.file=annotation.file)
#
# # c) view enrichment results for the top significant terms
# xEnrichViewer(eTerm)
#
# # d) save enrichment results to the file called 'Yours_enrichments.txt'
# output <- xEnrichViewer(eTerm, top_num=length(eTerm$adjp),
# sortBy="adjp", details=TRUE)
# utils::write.table(output, file="Yours_enrichments.txt", sep="\t",
# row.names=FALSE)
#
# # e) barplot of significant enrichment results
# bp <- xEnrichBarplot(eTerm, top_num="auto", displayBy="adjp")
# print(bp)
# ## End(Not run)
# Using ImmunoBase SNPs and associations/annotations with disease traits
## get ImmunoBase
ImmunoBase <- xRDataLoader(RData.customised='ImmunoBase')
## get disease associated variants/SNPs
variants_list <- lapply(ImmunoBase, function(x)
cbind(SNP=names(x$variants),
Disease=rep(x$disease,length(x$variants))))
## extract annotations as a data frame: Variant Disease_Name
annotation.file <- do.call(rbind, variants_list)
head(annotation.file)
## provide the input SNPs of interest
## for example, cis-eQTLs induced by interferon gamma
cis <- xRDataLoader(RData.customised='JKscience_TS2A')
data.file <- matrix(cis[which(cis$IFN_t>0),c('variant')], ncol=1)
# perform enrichment analysis
eTerm <- xEnricherYours(data.file=data.file,
annotation.file=annotation.file)
# view enrichment results for the top significant terms
xEnrichViewer(eTerm)
# barplot of significant enrichment results
bp <- xEnrichBarplot(eTerm, top_num="auto", displayBy="adjp")
print(bp)
Run the code above in your browser using DataLab