changeset 8:ddaa0c318d65 draft

planemo upload commit d23909db127a655212b79d6826033889812f59b5-dirty
author proteore
date Fri, 23 Mar 2018 10:43:32 -0400
parents 1b2b81169c66
children 70c0c8757f5f
files enrichment_v3.R topGO.xml
diffstat 2 files changed, 47 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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]
 
--- 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 @@
     <inputs>
   <conditional name="inputtype">
     <param name="filetype" type="select" label="Select your type of input file" help="The identifiers must be Ensembl gene IDs (e.g : ENSG00000139618). If it is not the case, please use the ID Mapping tool.">
-      <option value="file_all">Input file containing your identifiers</option>
+      <option value="file_all" selected="true">Input file containing your identifiers</option>
       <option value="copy_paste">Copy/paste your list of IDs</option> 
     </param>
     <when value="copy_paste">
-      <param name="genelist" type="text" label="Enter a list of identifiers"/>
+      <param name="genelist" type="text" label="Enter a list of identifiers">
+        <sanitizer>
+            <valid initial="string.printable">
+                <remove value="&apos;"/>
+            </valid>
+            <mapping initial="none">
+                <add source="&apos;" target="__sq__"/>
+            </mapping>
+        </sanitizer>
+      </param>
     </when>
     <when value="file_all">
       <param name="genelist" type="data" format="txt,tabular" label="Choose an input file" help="This file must imperatively have 1 column filled with IDs consistent with the database that will be used. Please use the MappingIDs component if this is not the case."/>
@@ -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.