diff egsea.R @ 2:ba2111ae6eb4 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/egsea commit ee9b940a5ffa6c52e42a89e55c0f5bdda0a386d5
author iuc
date Mon, 28 Jan 2019 18:39:06 -0500
parents 73281fbdf6c1
children fba1660fb717
line wrap: on
line diff
--- a/egsea.R	Thu Feb 15 02:34:59 2018 -0500
+++ b/egsea.R	Mon Jan 28 18:39:06 2019 -0500
@@ -98,14 +98,19 @@
 
 } else {
  # Process the single count matrix
-    counts <- read.table(args$matrixPath, header=TRUE, sep="\t", stringsAsFactors=FALSE)
+    counts <- read.table(args$matrixPath, header=TRUE, sep="\t", stringsAsFactors=FALSE, check.names=FALSE)
     row.names(counts) <- counts[, 1]
     counts <- counts[ , -1]
     countsRows <- nrow(counts)
 
     # Process factors
     if (is.null(args$factInput)) {
-            factorData <- read.table(args$factFile, header=TRUE, sep="\t")
+            factorData <- read.table(args$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]
     }  else {
             factors <- unlist(strsplit(args$factInput, "|", fixed=TRUE))