Repository 'intensity_checks'
hg clone https://toolshed.g2.bx.psu.edu/repos/melpetera/intensity_checks

Changeset 5:a31f3f802b2b (2020-01-22)
Previous changeset 4:49c36c54e0cf (2020-01-03) Next changeset 6:ec75de7f1e08 (2023-12-11)
Commit message:
Uploaded
modified:
Intchecks/Script_intensity_check.R
Intchecks/xml_intensity_check.xml
b
diff -r 49c36c54e0cf -r a31f3f802b2b Intchecks/Script_intensity_check.R
--- a/Intchecks/Script_intensity_check.R Fri Jan 03 11:09:05 2020 -0500
+++ b/Intchecks/Script_intensity_check.R Wed Jan 22 09:34:08 2020 -0500
[
@@ -69,12 +69,19 @@
   table.check <- match3(DM, SM, VM)
   check.err(table.check)
 
-  
+  # Transposing the dataMatrix
   rownames(DM) <- DM[,1]
   var_names <- DM[,1]
   DM <- DM[,-1]
   DM <- data.frame(t(DM))
-
+  
+  # Re-ordering the dataMatrix to match the sampleMetadata file order
+  DM <- merge(x=cbind(1:nrow(SM),SM), y=DM, by.x=2, by.y=0)
+  DM <- DM[order(DM[,2]),]
+  rownames(DM) <- DM[,1]
+  DM <- DM[,-c(1:(ncol(SM)+1))]
+  
+  
   stat.list <- strsplit(chosen.stat,",")[[1]]
   
   
@@ -103,13 +110,13 @@
     classnames <- levels(c_class)
   
     if((nb_class < 2)&&(test.fold=="Yes")){
-      err.1class <- c("\n The column",class.col, "contains only one class, fold calculation could not be executed \n")
+      err.1class <- c("\n The column",class.col, "contains only one class, fold calculation could not be executed. \n")
       cat(err.1class)  
     }
   
     if((nb_class > (nrow(SM))/3)&&(method == "each_class")){
       class.err <- c("\n There are too many classes, think about reducing the number of classes and excluding those
-                    with few samples \n")
+                    with few samples. \n")
       cat(class.err)
     }
 
@@ -139,6 +146,37 @@
     
   # Statistics ------------------------------------------------------------------------------------------------
   
+  # Check whether the dataMatrix contains non-numeric values
+  if(!(is.numeric(as.matrix(DM)))){
+    # findchar definition
+    findchar <- function(myval){
+      if(is.na(myval)){
+        return("ok")
+      }else{
+        mytest <- as.character(myval)
+        if(is.na(as.numeric(mytest[1]))){
+          return("char")
+        }else{
+          return("ok")
+        }
+      }
+    }
+    # findchar application
+    chardiag <- suppressWarnings(apply(DM,2,vapply,findchar,"character"))
+    charlist <- which(chardiag == "char")
+    err.stock <- paste("\n- - - - - - - - -\nYour dataMatrix contains",
+                       length(charlist),
+                       "non-numeric value(s). To help you check your data, please find below a short overview:\n")
+    charover <- 1
+    while((length(err.stock)<10)&(length(err.stock)<(length(charlist)+1))){
+      charex <- paste("variable",colnames(DM)[ceiling(charlist[charover]/nrow(DM))],
+                      "- sample",rownames(DM)[charlist[charover]-floor(charlist[charover]/nrow(DM))*nrow(DM)],
+                      "~> value:",as.matrix(DM)[charlist[charover]],"\n")
+      err.stock <- c(err.stock,charex)
+      charover <- charover + 1
+    }
+    stop(c(err.stock,"The dataMatrix file is supposed to contain only numeric values.\n- - - - - - - - -\n"))
+  }
   
   ### Initialization
   
b
diff -r 49c36c54e0cf -r a31f3f802b2b Intchecks/xml_intensity_check.xml
--- a/Intchecks/xml_intensity_check.xml Fri Jan 03 11:09:05 2020 -0500
+++ b/Intchecks/xml_intensity_check.xml Wed Jan 22 09:34:08 2020 -0500
b
@@ -129,6 +129,7 @@
  </outputs>
 
 
+
 
  <help>