# HG changeset patch # User proteore # Date 1521816212 14400 # Node ID ddaa0c318d65503060f24a1e07d93b1a7fd662cb # Parent 1b2b81169c66a093ba92f69872b0b542e47f3186 planemo upload commit d23909db127a655212b79d6826033889812f59b5-dirty diff -r 1b2b81169c66 -r ddaa0c318d65 enrichment_v3.R --- a/enrichment_v3.R Thu Mar 08 11:25:05 2018 -0500 +++ b/enrichment_v3.R Fri Mar 23 10:43:32 2018 -0400 @@ -32,7 +32,27 @@ # loading topGO library -library(topGO) +library(topGO) + +# Read file and return file content as data.frame +readfile = function(filename, header) { + if (header == "true") { + # Read only first line of the file as header: + headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") + #Read the data of the files (skipping the first row) + file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") + # Remove empty rows + file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE] + #And assign the header to the data + names(file) <- headers + } + else { + file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") + # Remove empty rows + file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE] + } + return(file) +} '%!in%' <- function(x,y)!('%in%'(x,y)) @@ -50,11 +70,11 @@ # for each input, split the arguments with blank space as separator, unlist, # and delete the first element which is the input name (e.g --inputtype) options.args <- sapply(listoptions,function(x){ - unlist(strsplit(x, ' '))[-1] + unlist(strsplit(x, '[ \t\n]+'))[-1] }) # same as the step above, except that only the names are kept options.names <- sapply(listoptions,function(x){ - option <- unlist(strsplit(x, ' '))[1] + option <- unlist(strsplit(x, '[ \t\n]+'))[1] }) names(options.args) <- unlist(options.names) @@ -83,9 +103,9 @@ if (typeinput=="tabfile"){ if (header=="TRUE"){ - sample = read.table(listfile,header=TRUE,sep="\t",na.strings="NA",fill=TRUE) + sample = readfile(listfile, "true") }else{ - sample = read.table(listfile,header=FALSE,sep="\t",na.strings="NA",fill=TRUE) + sample = readfile(listfile, "false") } sample = sample[,column] diff -r 1b2b81169c66 -r ddaa0c318d65 topGO.xml --- a/topGO.xml Thu Mar 08 11:25:05 2018 -0500 +++ b/topGO.xml Fri Mar 23 10:43:32 2018 -0400 @@ -56,11 +56,20 @@ - + - + + + + + + + + + + @@ -216,14 +225,25 @@ **Multiple testing corrections** Furthermore, the following corrections for multiple testing can also be applied : + - holm + - hochberg + - hommel + - bonferroni + - BH + - BY + - fdr +----- + +.. class:: infomark + **Authors** Alexa A and Rahnenfuhrer J (2016). topGO: Enrichment Analysis for Gene Ontology. R package version 2.30.0.