Back to Manny's Bioinformatics Workshop Home
This step was tricky because there were characters such as quotes and hash marks. We need to reset the default values to allow the file to load without a problem. Download the Arabidopsis annotation file here here
anno<-read.table("Athaliana_167_TAIR10.annotation_info.txt", header=FALSE, sep="\t", quote="", comment.char="")
First create a new data frame with only gene name and go-ids. Then simply source the createGOdata.R script. Make sure you put the script in your working directory before you source it. This will create two different lists in your workspace: go2gene and gene2go
justGeneGo<-anno[,c(2,10)] source("createGOdata.R")
Let's use the significant genes identified from Deseq as our example. resSig
gene.list<-read.table("resSig.txt", header=T)
Start by sourcing the GoTermEnrichment.R script. The function itself is called doFisherTest. It has four arguments: gene.list, gene2go , go2gene, and goAnnot. The first is your list of genes. The next two use gene2go and go2gene as default but different lists can be provided here and the Last is an annotation file for the terms. Download goterm_annot
To run the function:
source("GoTermEnrichment.R") goterm_annot<-read.table("goterm_annot", sep="|", strip.white=TRUE, row.names=1, quote="") goresults=doFisherTest(as.character(gene.list[,1]), goAnnot=goterm_annot) write.table(goresults, "goresults.xls", col.names=NA, quote=F, sep="\t")
Visualizing your results in the GO-term graph. Use the RamiGO package. Simply provide the GO terms that are enriched and the corresponding p-value for the go-terms. By default it will save a file to your working directory called RamiGO.png
source("http://bioconductor.org/biocLite.R") biocLite("RamiGO") library(RamiGO) getAmigoTree(rownames(gotermresults)[1:3], c("blue","red","green"), gotermresults$AdjPval[1:3])