diff edger.R @ 5:fb9b9f0f2f06 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 91bdcc6a5a46173be6546d590cdf3f311c2b1476
author iuc
date Tue, 05 Feb 2019 20:57:30 -0500
parents 4730985c816f
children 555659de7321
line wrap: on
line diff
--- a/edger.R	Sat Jan 05 05:32:33 2019 -0500
+++ b/edger.R	Tue Feb 05 20:57:30 2019 -0500
@@ -261,7 +261,7 @@
     
 } else {
     # Process the single count matrix
-    counts <- read.table(opt$matrixPath, header=TRUE, sep="\t", stringsAsFactors=FALSE)
+    counts <- read.table(opt$matrixPath, header=TRUE, sep="\t", strip.white=TRUE, stringsAsFactors=FALSE)
     row.names(counts) <- counts[, 1]
     counts <- counts[ , -1]
     countsRows <- nrow(counts)
@@ -269,6 +269,9 @@
     # Process factors
     if (is.null(opt$factInput)) {
             factorData <- read.table(opt$factFile, header=TRUE, sep="\t", strip.white=TRUE)
+            # check samples names match
+            if(!any(factorData[, 1] %in% colnames(counts)))
+                stop("Sample IDs in factors file and count matrix don't match")
             # order samples as in counts matrix
             factorData <- factorData[match(colnames(counts), factorData[, 1]), ]
             factors <- factorData[, -1, drop=FALSE]
@@ -293,7 +296,7 @@
 
  # if annotation file provided
 if (haveAnno) {
-    geneanno <- read.table(opt$annoPath, header=TRUE, sep="\t", stringsAsFactors=FALSE)
+    geneanno <- read.table(opt$annoPath, header=TRUE, sep="\t", quote= "", strip.white=TRUE, stringsAsFactors=FALSE)
 }
 
 #Create output directory