Commit 000aeca3 authored by Celine Noirot's avatar Celine Noirot
Browse files

Debug new parameters and add package svglite

parent 80056632
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
##DATE = "03/2016" ##DATE = "03/2016"
##AUTHORS = "Gaëlle Lefort" ##AUTHORS = "Gaëlle Lefort"
##KEYWORDS = "RNAseq gene ontology barplot" ##KEYWORDS = "RNAseq gene ontology barplot"
##DESCRIPTION = "GOEnrichment.R carries out a barplot to compare gene ontology between multiple set of files." ##DESCRIPTION = "GOEnrichment.R carries out a barplot to compare gene ontology between multiple set of files."
############################# Enrichment analysis ############################## ############################# Enrichment analysis ##############################
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
#common packages #common packages
packages <- c("optparse", # to read arguments from a command line packages <- c("optparse", # to read arguments from a command line
"ggplot2", # nice plots "ggplot2", # nice plots
"RJSONIO") # work with JSON file "RJSONIO", # work with JSON file
"DBI")
for(package in packages){ for(package in packages){
# if package is installed locally, load # if package is installed locally, load
...@@ -22,7 +23,7 @@ for(package in packages){ ...@@ -22,7 +23,7 @@ for(package in packages){
install.packages(package) install.packages(package)
} }
do.call('library', list(package)) do.call('library', list(package))
} }
#Bioconductor package #Bioconductor package
if (!("topGO" %in% rownames(installed.packages()))) { if (!("topGO" %in% rownames(installed.packages()))) {
...@@ -38,19 +39,19 @@ library(topGO) # GO enrichment ...@@ -38,19 +39,19 @@ library(topGO) # GO enrichment
###### Parameter initialization when the script is launched from command line ###### Parameter initialization when the script is launched from command line
############ ############
option_list = list( option_list = list(
make_option(c("-f", "--files"), type = "character", default = NULL, make_option(c("-f", "--files"), type = "character", default = NULL,
help = "geneID2GO files: list of tabulated matrix with the correspondence help = "geneID2GO files: list of tabulated matrix with the correspondence
gene to GO separated by ','", metavar = "character"), gene to GO separated by ','", metavar = "character"),
make_option(c("-n", "--names"), type = "character", default = NULL, make_option(c("-n", "--names"), type = "character", default = NULL,
help = "names of the samples (same order than files)", metavar = "character"), help = "names of the samples (same order than files)", metavar = "character"),
make_option(c("--fileFormat"), type = "character", default = "topGO", make_option(c("--fileFormat"), type = "character", default = "topGO",
help = "two types of file can be used : topGO (gene_id1 GO_1,GO_2,... help = "two types of file can be used : topGO (gene_id1 GO_1,GO_2,...
\n gene_id2 GO_3,...) or twoColumns (only 2 columns \n gene_id2 GO_3,...) or twoColumns (only 2 columns
#gene_id GO_id)", metavar = "character"), #gene_id GO_id)", metavar = "character"),
make_option(c("-o", "--out"), type = "character", default = NULL, make_option(c("-o", "--out"), type = "character", default = NULL,
help = "folder path where results are stored", help = "folder path where results are stored",
metavar = "character") metavar = "character")
); );
opt_parser = OptionParser(usage="Carries out a barplot to compare gene ontology between multiple set of files", option_list = option_list); opt_parser = OptionParser(usage="Carries out a barplot to compare gene ontology between multiple set of files", option_list = option_list);
opt = parse_args(opt_parser); opt = parse_args(opt_parser);
...@@ -66,11 +67,11 @@ opt = parse_args(opt_parser); ...@@ -66,11 +67,11 @@ opt = parse_args(opt_parser);
#opt$out <- XXX # for example "C:/My documents/results" #opt$out <- XXX # for example "C:/My documents/results"
# table with genes and GO, genes of interest, test and algorithm are needed to # table with genes and GO, genes of interest, test and algorithm are needed to
#continue #continue
if (is.null(opt$files)) { if (is.null(opt$files)) {
print_help(opt_parser) print_help(opt_parser)
stop("Tables with genes and GO missing.\n", stop("Tables with genes and GO missing.\n",
call. = FALSE) call. = FALSE)
} }
...@@ -83,7 +84,7 @@ ifelse(!dir.exists(opt$out), dir.create(opt$out), FALSE) ...@@ -83,7 +84,7 @@ ifelse(!dir.exists(opt$out), dir.create(opt$out), FALSE)
### ---------------------Input data and preprocessing ### ---------------------Input data and preprocessing
##################################################### #####################################################
## read tables with all genes ## read tables with all genes
l <- unlist(strsplit(opt$files, ',')) l <- unlist(strsplit(opt$files, ','))
opt$names <- unlist(strsplit(opt$names, ',')) opt$names <- unlist(strsplit(opt$names, ','))
...@@ -92,50 +93,50 @@ if (opt$fileFormat == "topGO"){ ...@@ -92,50 +93,50 @@ if (opt$fileFormat == "topGO"){
for(i in seq_along(l)){ for(i in seq_along(l)){
geneID2GO[[i]] <- readMappings(normalizePath(l[i]), sep = "\t", IDsep = ",") geneID2GO[[i]] <- readMappings(normalizePath(l[i]), sep = "\t", IDsep = ",")
} }
} else { } else {
for(i in seq_along(l)){ for(i in seq_along(l)){
go <- read.table(normalizePath(l[i]), header = TRUE, sep = "\t", go <- read.table(normalizePath(l[i]), header = TRUE, sep = "\t",
comment.char="") comment.char="")
# obtains a list of GO by genes for all genes (mandatory for topGO package) # obtains a list of GO by genes for all genes (mandatory for topGO package)
geneID2GO[[i]] <- list() geneID2GO[[i]] <- list()
for (i in unique(go[, 1])){ for (x in unique(go[, 1])){
gene <- go[go[,1] == i,] gene <- go[go[,1] == x,]
listGO <- vector() listGO <- vector()
for (j in 1:nrow(gene)){ for (j in 1:nrow(gene)){
listGO <- c(listGO, as.character(gene[j, 2])) listGO <- c(listGO, as.character(gene[j, 2]))
} }
geneID2GO[[i]] <- c(geneID2GO[[i]], list(listGO)) geneID2GO[[i]] <- c(geneID2GO[[i]], list(listGO))
} }
names(geneID2GO[[i]]) <- unique(go[, 1]) names(geneID2GO[[i]]) <- unique(go[, 1])
} }
} }
geneList <- list() geneList <- list()
for(i in seq_along(geneID2GO)){ for(i in seq_along(geneID2GO)){
geneList[[i]] <- factor(rep(1, length(geneID2GO[[i]]))) geneList[[i]] <- factor(rep(1, length(geneID2GO[[i]])))
levels(geneList[[i]]) <- c(levels(geneList[[i]]),0) levels(geneList[[i]]) <- c(levels(geneList[[i]]),0)
names(geneList[[i]]) <- names(geneID2GO[[i]]) names(geneList[[i]]) <- names(geneID2GO[[i]])
} }
######################### Functions ######################### Functions
########## get name/definition of a GO (hidden function in topGO) ########## get name/definition of a GO (hidden function in topGO)
getTermsDefinition <- function(whichTerms, ontology, numChar = 20, getTermsDefinition <- function(whichTerms, ontology, numChar = 20,
multipLines = FALSE) { multipLines = FALSE) {
qTerms <- paste(paste("'", whichTerms, "'", sep = ""), collapse = ",") qTerms <- paste(paste("'", whichTerms, "'", sep = ""), collapse = ",")
retVal <- dbGetQuery(GO_dbconn(), retVal <- dbGetQuery(GO_dbconn(),
paste("SELECT term, go_id FROM go_term WHERE ontology IN", paste("SELECT term, go_id FROM go_term WHERE ontology IN",
"('", ontology, "') AND go_id IN (", "('", ontology, "') AND go_id IN (",
qTerms, ");", sep = "")) qTerms, ");", sep = ""))
termsNames <- retVal$term termsNames <- retVal$term
names(termsNames) <- retVal$go_id names(termsNames) <- retVal$go_id
if(!multipLines) if(!multipLines)
shortNames <- paste(substr(termsNames, 1, numChar), shortNames <- paste(substr(termsNames, 1, numChar),
ifelse(nchar(termsNames) > numChar, '...', ''), sep = '') ifelse(nchar(termsNames) > numChar, '...', ''), sep = '')
else else
...@@ -144,7 +145,7 @@ getTermsDefinition <- function(whichTerms, ontology, numChar = 20, ...@@ -144,7 +145,7 @@ getTermsDefinition <- function(whichTerms, ontology, numChar = 20,
a <- strwrap(x, numChar) a <- strwrap(x, numChar)
return(paste(a, sep = "", collapse = "\\\n")) return(paste(a, sep = "", collapse = "\\\n"))
}) })
names(shortNames) <- names(termsNames) names(shortNames) <- names(termsNames)
return(shortNames[whichTerms]) return(shortNames[whichTerms])
} }
...@@ -152,27 +153,27 @@ getTermsDefinition <- function(whichTerms, ontology, numChar = 20, ...@@ -152,27 +153,27 @@ getTermsDefinition <- function(whichTerms, ontology, numChar = 20,
########## find GO at levels 2 for ONE ontology ########## find GO at levels 2 for ONE ontology
nbLevels2 <- function(geneListI, ontology, geneID2GO){ nbLevels2 <- function(geneListI, ontology, geneID2GO){
myGOdata <- NULL myGOdata <- NULL
try(myGOdata <- new("topGOdata", description="My project", ontology=ontology, try(myGOdata <- new("topGOdata", description="My project", ontology=ontology,
allGenes=geneListI, annot = annFUN.gene2GO, gene2GO = geneID2GO), allGenes=geneListI, annot = annFUN.gene2GO, gene2GO = geneID2GO),
silent = TRUE) silent = TRUE)
count <- 0 count <- 0
if (!is.null(myGOdata)){ if (!is.null(myGOdata)){
# calculate levels for each GO in our data and his ancestors # calculate levels for each GO in our data and his ancestors
levels <- buildLevels(myGOdata@graph) levels <- buildLevels(myGOdata@graph)
# select only GO at level 2 # select only GO at level 2
goLevels2 <- mget(ls(levels$nodes2level), envir=levels$nodes2level)==2 goLevels2 <- mget(ls(levels$nodes2level), envir=levels$nodes2level)==2
goLevels2 <- names(goLevels2)[goLevels2] goLevels2 <- names(goLevels2)[goLevels2]
# count genes in each GO # count genes in each GO
count <- NULL count <- NULL
for (i in goLevels2){ for (i in goLevels2){
count <- c(count,countGenesInTerm(myGOdata, i)) count <- c(count,countGenesInTerm(myGOdata, i))
} }
} }
return(count) return(count)
} }
...@@ -181,29 +182,29 @@ nbLevels2 <- function(geneListI, ontology, geneID2GO){ ...@@ -181,29 +182,29 @@ nbLevels2 <- function(geneListI, ontology, geneID2GO){
percentOfGene <- function(geneList, ontology, DefOntology){ percentOfGene <- function(geneList, ontology, DefOntology){
prop <- list() prop <- list()
count <- NULL count <- NULL
#create a table with GO names and proportion of genes #create a table with GO names and proportion of genes
for(i in seq_along(geneList)){ for(i in seq_along(geneList)){
prop[[i]] <- nbLevels2(geneList[[i]], ontology, geneID2GO[[i]])/length(geneList[[i]]) prop[[i]] <- nbLevels2(geneList[[i]], ontology, geneID2GO[[i]])/length(geneList[[i]])
count <- rbind(count,data.frame(name=getTermsDefinition(names(prop[[i]]), ontology, count <- rbind(count,data.frame(name=getTermsDefinition(names(prop[[i]]), ontology,
numChar = 40), numChar = 40),
nbGene=as.vector(prop[[i]]), sample=opt$names[i], nbGene=as.vector(prop[[i]]), sample=opt$names[i],
ontology=DefOntology)) ontology=DefOntology))
} }
# table with all GO # table with all GO
all <- data.frame(name = rep(unique(count$name), length(names)), all <- data.frame(name = rep(unique(count$name), length(names)),
nbGene = 0, sample = rep(opt$names, nbGene = 0, sample = rep(opt$names,
each = length(unique(count$name))), each = length(unique(count$name))),
ontology=DefOntology) ontology=DefOntology)
#only GO-name not in count #only GO-name not in count
not_in_count <- all[!(paste0(all$name,".", all$sample) %in% not_in_count <- all[!(paste0(all$name,".", all$sample) %in%
paste0(count$name,".", count$sample)),] paste0(count$name,".", count$sample)),]
count <- rbind(count, not_in_count) count <- rbind(count, not_in_count)
return(count) return(count)
} }
...@@ -221,15 +222,12 @@ ggplot(count, aes(x=as.factor(name), y=nbGene, fill=sample)) + ...@@ -221,15 +222,12 @@ ggplot(count, aes(x=as.factor(name), y=nbGene, fill=sample)) +
geom_bar(stat="identity", position=position_dodge()) + geom_bar(stat="identity", position=position_dodge()) +
facet_grid( ~ ontology, scales="free_x") + facet_grid( ~ ontology, scales="free_x") +
theme(axis.text.x = element_text(angle = 70, vjust = 1, hjust=1, colour = "black")) + theme(axis.text.x = element_text(angle = 70, vjust = 1, hjust=1, colour = "black")) +
scale_fill_discrete(name = "") + ylab(paste0("Percent of ", opt$target)) + scale_fill_discrete(name = "") + ylab(paste0("Percent of ", opt$target)) +
xlab("GO term") xlab("GO term")
ggsave(filename = normalizePath(file.path(opt$out, "barplot.svg"), ggsave(filename = normalizePath(file.path(opt$out, "barplot.svg"),
mustWork = FALSE), width = 11, height = 7) mustWork = FALSE), width = 11, height = 7)
write.table(count, file = normalizePath(file.path(opt$out, write.table(count, file = normalizePath(file.path(opt$out,
paste0("barplot.csv")), paste0("barplot.csv")),
mustWork = FALSE), sep = "\t", mustWork = FALSE), sep = "\t",
row.names = FALSE, quote = FALSE) row.names = FALSE, quote = FALSE)
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
##DATE = "03/2016" ##DATE = "03/2016"
##AUTHORS = "Gaëlle Lefort" ##AUTHORS = "Gaëlle Lefort"
##KEYWORDS = "RNAseq GO enrichment" ##KEYWORDS = "RNAseq GO enrichment"
##DESCRIPTION = "GOEnrichment.R perform an enrichment analysis for Gene Ontology (GO)." ##DESCRIPTION = "GOEnrichment.R perform an enrichment analysis for Gene Ontology (GO)."
############################# Enrichment analysis ############################## ############################# Enrichment analysis ##############################
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
#common packages #common packages
packages <- c("optparse", # to read arguments from a command line packages <- c("optparse", # to read arguments from a command line
"ggplot2", # nice plots "ggplot2", # nice plots
"RJSONIO") # work with JSON file "RJSONIO", # work with JSON file
"DBI")
for(package in packages){ for(package in packages){
# if package is installed locally, load # if package is installed locally, load
...@@ -22,7 +23,7 @@ for(package in packages){ ...@@ -22,7 +23,7 @@ for(package in packages){
install.packages(package) install.packages(package)
} }
do.call('library', list(package)) do.call('library', list(package))
} }
#Bioconductor package #Bioconductor package
if (!("topGO" %in% rownames(installed.packages()))) { if (!("topGO" %in% rownames(installed.packages()))) {
...@@ -38,43 +39,43 @@ library(topGO) # GO enrichment ...@@ -38,43 +39,43 @@ library(topGO) # GO enrichment
###### Parameter initialization when the script is launched from command line ###### Parameter initialization when the script is launched from command line
############ ############
option_list = list( option_list = list(
make_option(c("-f", "--file"), type = "character", default = NULL, make_option(c("-f", "--file"), type = "character", default = NULL,
help = "geneID2GO file: tabulated matrix with the correspondence help = "geneID2GO file: tabulated matrix with the correspondence
gene to GO", metavar = "character"), gene to GO", metavar = "character"),
make_option(c("--fileFormat"), type = "character", default = "topGO", make_option(c("--fileFormat"), type = "character", default = "topGO",
help = "two types of file can be used : topGO (gene_id1 GO_1,GO_2,... help = "two types of file can be used : topGO (gene_id1 GO_1,GO_2,...
\n gene_id2 GO_3,...) or twoColumns (only 2 columns \n gene_id2 GO_3,...) or twoColumns (only 2 columns
#gene_id GO_id)", metavar = "character"), #gene_id GO_id)", metavar = "character"),
make_option(c("-i", "--interest"), type = "character", default = NULL, make_option(c("-i", "--interest"), type = "character", default = NULL,
help = "matrix with id of genes of interest in the first column help = "matrix with id of genes of interest in the first column
(all these genes must be in the geneID2GO file)", (all these genes must be in the geneID2GO file)",
metavar = "character"), metavar = "character"),
make_option(c("-o", "--out"), type = "character", default = NULL, make_option(c("-o", "--out"), type = "character", default = NULL,
help = "folder path where results are stored", help = "folder path where results are stored",
metavar = "character"), metavar = "character"),
make_option(c("-t", "--test"), type = "character", default = NULL, make_option(c("-t", "--test"), type = "character", default = NULL,
help = "test used to find significant GO ('fisher' or 'KS' help = "test used to find significant GO ('fisher' or 'KS'
Kolmogorov-Smirnov)", metavar = "character"), Kolmogorov-Smirnov)", metavar = "character"),
make_option(c("-a", "--algorithm"), type = "character", default = NULL, make_option(c("-a", "--algorithm"), type = "character", default = NULL,
help = "algorithm used to correct p-value ('classic', 'elim' help = "algorithm used to correct p-value ('classic', 'elim'
or 'weight')", metavar = "character"), or 'weight')", metavar = "character"),
make_option(c("--paramAlgo"), type = "character", default = NULL, make_option(c("--paramAlgo"), type = "character", default = NULL,
help = "- for 'classic' algorithm: method used to correct help = "- for 'classic' algorithm: method used to correct
p-values ('bonferroni' or 'BH') [default=BH] p-values ('bonferroni' or 'BH') [default=BH]
- for 'elim' algorithm: value used to remove genes from - for 'elim' algorithm: value used to remove genes from
significant GO [default=0.01] significant GO [default=0.01]
- for 'weight' algorithm: weighted function used - for 'weight' algorithm: weighted function used
('ratio' or 'log') [default=ratio] ", ('ratio' or 'log') [default=ratio] ",
metavar = "character"), metavar = "character"),
make_option(c("--alpha"), type = "character", default = 0.05, make_option(c("--alpha"), type = "character", default = 0.05,
help = "significance level of the tests [default=%default]", help = "significance level of the tests [default=%default]",
metavar = "character"), metavar = "character"),
make_option(c("--target"), type = "character", default = "gene", make_option(c("--target"), type = "character", default = "gene",
help = "type of data [default=%default]", help = "type of data [default=%default]",
metavar = "character") metavar = "character")
); );
opt_parser = OptionParser(usage="Perform an enrichment analysis for opt_parser = OptionParser(usage="Perform an enrichment analysis for
Gene Ontology (GO)", option_list = option_list); Gene Ontology (GO)", option_list = option_list);
opt = parse_args(opt_parser); opt = parse_args(opt_parser);
...@@ -94,12 +95,12 @@ opt = parse_args(opt_parser); ...@@ -94,12 +95,12 @@ opt = parse_args(opt_parser);
#opt$target <- "contigs" # for example contigs, gene... #opt$target <- "contigs" # for example contigs, gene...
# table with genes and GO, genes of interest, test and algorithm are needed to # table with genes and GO, genes of interest, test and algorithm are needed to
#continue #continue
if (is.null(opt$file) || is.null(opt$interest) || is.null(opt$test) || if (is.null(opt$file) || is.null(opt$interest) || is.null(opt$test) ||
is.null(opt$algorithm)) { is.null(opt$algorithm)) {
print_help(opt_parser) print_help(opt_parser)
stop("Table with genes and GO, genes of interest, test or algorithm missing.\n", stop("Table with genes and GO, genes of interest, test or algorithm missing.\n",
call. = FALSE) call. = FALSE)
} }
...@@ -109,7 +110,7 @@ ifelse(!dir.exists(opt$out), dir.create(opt$out), FALSE) ...@@ -109,7 +110,7 @@ ifelse(!dir.exists(opt$out), dir.create(opt$out), FALSE)
#Stop the script if files doesn't exist #Stop the script if files doesn't exist
if (!file.exists(normalizePath(opt$file))) { if (!file.exists(normalizePath(opt$file))) {
print_help(opt_parser) print_help(opt_parser)
stop("table with genes and GO doesn't exist.\n", stop("table with genes and GO doesn't exist.\n",
call. = FALSE) call. = FALSE)
} }
...@@ -124,12 +125,12 @@ if(is.null(opt$paramAlgo)){ ...@@ -124,12 +125,12 @@ if(is.null(opt$paramAlgo)){
} }
if(opt$algorithm == "classic" & !(opt$paramAlgo == "bonferroni" | opt$paramAlgo == "BH")){ if(opt$algorithm == "classic" & !(opt$paramAlgo == "bonferroni" | opt$paramAlgo == "BH")){
stop("paramAlgo need to be equals to 'bonferroni' or 'BH'\n", stop("paramAlgo need to be equals to 'bonferroni' or 'BH'\n",
call. = FALSE) call. = FALSE)
} }
if(opt$algorithm == "classic" & !(opt$paramAlgo == "bonferroni" | opt$paramAlgo == "BH")){ if(opt$algorithm == "classic" & !(opt$paramAlgo == "bonferroni" | opt$paramAlgo == "BH")){
stop("paramAlgo need to be equals to 'bonferroni' or 'BH'\n", stop("paramAlgo need to be equals to 'bonferroni' or 'BH'\n",
call. = FALSE) call. = FALSE)
} }
...@@ -137,17 +138,17 @@ if(opt$algorithm == "classic" & !(opt$paramAlgo == "bonferroni" | opt$paramAlgo ...@@ -137,17 +138,17 @@ if(opt$algorithm == "classic" & !(opt$paramAlgo == "bonferroni" | opt$paramAlgo
if(opt$algorithm == "elim"){ if(opt$algorithm == "elim"){
opt$paramAlgo <- as.numeric(opt$paramAlgo) opt$paramAlgo <- as.numeric(opt$paramAlgo)
if(is.na(opt$paramAlgo)){ if(is.na(opt$paramAlgo)){
stop("paramAlgo need to be a number\n", stop("paramAlgo need to be a number\n",
call. = FALSE) call. = FALSE)
} }
if(opt$paramAlgo > 1){ if(opt$paramAlgo > 1){
stop("paramAlgo need to be inferior to 1\n", stop("paramAlgo need to be inferior to 1\n",
call. = FALSE) call. = FALSE)
} }
} }
if(opt$algorithm == "weight" & !(opt$paramAlgo == "ratio" | opt$paramAlgo == "log")){ if(opt$algorithm == "weight" & !(opt$paramAlgo == "ratio" | opt$paramAlgo == "log")){
stop("paramAlgo need to be equals to 'ratio' or 'log'\n", stop("paramAlgo need to be equals to 'ratio' or 'log'\n",
call. = FALSE) call. = FALSE)
} }
...@@ -159,7 +160,7 @@ if(opt$algorithm == "weight" & !(opt$paramAlgo == "ratio" | opt$paramAlgo == "lo ...@@ -159,7 +160,7 @@ if(opt$algorithm == "weight" & !(opt$paramAlgo == "ratio" | opt$paramAlgo == "lo
if (opt$fileFormat == "topGO"){ if (opt$fileFormat == "topGO"){
geneID2GO <- readMappings(normalizePath(opt$file), sep = "\t", IDsep = ",") geneID2GO <- readMappings(normalizePath(opt$file), sep = "\t", IDsep = ",")
} else { } else {
go <- read.table(normalizePath(opt$file), header = TRUE, sep = "\t", go <- read.table(normalizePath(opt$file), header = TRUE, sep = "\t",
comment.char="") comment.char="")
# obtains a list of GO by genes for all genes (mandatory for topGO package) # obtains a list of GO by genes for all genes (mandatory for topGO package)
geneID2GO <- list() geneID2GO <- list()
...@@ -171,19 +172,19 @@ if (opt$fileFormat == "topGO"){ ...@@ -171,19 +172,19 @@ if (opt$fileFormat == "topGO"){
} }
geneID2GO <- c(geneID2GO, list(listGO)) geneID2GO <- c(geneID2GO, list(listGO))
} }
names(geneID2GO) <- unique(go[, 1]) names(geneID2GO) <- unique(go[, 1])
} }
## read table with genes of interest ## read table with genes of interest
genesOfInterest <- read.table(normalizePath(opt$interest), header = TRUE, sep = "\t", genesOfInterest <- read.table(normalizePath(opt$interest), header = TRUE, sep = "\t",
comment.char="") comment.char="")
genesOfInterest <- genesOfInterest[,1] genesOfInterest <- genesOfInterest[,1]
#names of all genes #names of all genes
geneUniverse <- names(geneID2GO)