changeset 4:9590fac86f63 draft

planemo upload for repository https://github.com/workflow4metabolomics/checkformat.git commit 46e92656192f2714265cc525b283c7cbb87b9093
author ethevenot
date Wed, 28 Feb 2018 05:47:44 -0500
parents 80a38d36f946
children e7c5811ec12f
files checkformat_config.xml checkformat_script.R
diffstat 2 files changed, 9 insertions(+), 193 deletions(-) [+]
line wrap: on
line diff
--- a/checkformat_config.xml	Thu Jan 11 10:24:56 2018 -0500
+++ b/checkformat_config.xml	Wed Feb 28 05:47:44 2018 -0500
@@ -2,7 +2,7 @@
   <description>Checking/formatting the sample and variable names of the dataMatrix, sampleMetadata, and variableMetadata files</description>
   
   <requirements>
-    <requirement type="package">r-batch</requirement>
+    <requirement type="package" version="1.1_4">r-batch</requirement>
   </requirements>
 
   <stdio>
--- a/checkformat_script.R	Thu Jan 11 10:24:56 2018 -0500
+++ b/checkformat_script.R	Wed Feb 28 05:47:44 2018 -0500
@@ -82,20 +82,24 @@
     if(nrow(datMN) != nrow(samDF)) {
         if(nrow(datMN) > nrow(samDF)) {
             print(setdiff(rownames(datMN), rownames(samDF)))
-            stop("The sample names above from dataMatrix were not found in sampleMetadata")
+            stop("The sample names above from dataMatrix were not found in sampleMetadata",
+                 call. = FALSE)
         } else {
             print(setdiff(rownames(samDF), rownames(datMN)))
-            stop("The sample names above from sampleMetadata were not found in dataMatrix")
+            stop("The sample names above from sampleMetadata were not found in dataMatrix",
+                 call. = FALSE)
         }
     }
 
     if(ncol(datMN) != nrow(varDF)) {
         if(ncol(datMN) > nrow(varDF)) {
             print(setdiff(colnames(datMN), rownames(varDF)))
-            stop("The variable names above from dataMatrix were not found in variableMetadata")
+            stop("The variable names above from dataMatrix were not found in variableMetadata",
+                 call. = FALSE)
         } else {
             print(setdiff(rownames(varDF), colnames(datMN)))
-            stop("The variable names above from variableMetadata were not found in dataMatrix")
+            stop("The variable names above from variableMetadata were not found in dataMatrix",
+                 call. = FALSE)
         }
     }
     
@@ -181,191 +185,3 @@
 
 } ## end of checkAndReadF
 
-
-
-
-    ## if(!identical(rownames(datMN), rownames(samDF))) {
-    ##     ## checking sample names
-
-    ##     chkL <- FALSE
-
-    ##     datSamDifVc <- setdiff(rownames(datMN), rownames(samDF))
-
-    ##     if(length(datSamDifVc)) {
-    ##         cat("\nThe following samples were found in the dataMatrix column names but not in the sampleMetadata row names:\n", sep="")
-    ##         print(cbind.data.frame(col = as.numeric(sapply(datSamDifVc, function(samC) which(rownames(datMN) == samC))),
-    ##                                name = datSamDifVc))
-    ##     }
-
-    ##     samDatDifVc <- setdiff(rownames(samDF), rownames(datMN))
-
-    ##     if(length(samDatDifVc)) {
-    ##         cat("\n\nThe following samples were found in the sampleMetadata row names but not in the dataMatrix column names:\n", sep="")
-    ##         print(cbind.data.frame(row = as.numeric(sapply(samDatDifVc, function(samC) which(rownames(samDF) == samC))),
-    ##                                name = samDatDifVc))
-    ##     }
-
-    ##     if(nrow(datMN) != nrow(samDF)) {
-    ##         cat("\n\nThe dataMatrix has ", nrow(datMN), " columns (ie samples) whereas the sampleMetadata has ", nrow(samDF), " rows\n", sep="")
-    ##     } else if(identical(gsub("^X", "", rownames(datMN)), rownames(samDF))) {
-    ##         cat("\n\nThe dataMatrix column names start with an 'X' but not the sampleMetadata row names\n", sep="")
-    ##     } else if(identical(gsub("^X", "", rownames(samDF)), rownames(datMN))) {
-    ##         cat("\n\nThe sampleMetadata row names start with an 'X' but not the dataMatrix column names\n", sep="")
-    ##     } else if(identical(sort(rownames(datMN)), sort(rownames(samDF)))) {
-    ##         cat("\n\nThe dataMatrix column names and the sampleMetadata row names are not in the same order:\n", sep="")
-    ##         print(cbind.data.frame(indice = 1:nrow(datMN),
-    ##                                dataMatrix_columnnames=rownames(datMN),
-    ##                                sampleMetadata_rownames=rownames(samDF))[rownames(datMN) != rownames(samDF), , drop = FALSE])
-    ##     } else {
-    ##         cat("\n\nThe dataMatrix column names and the sampleMetadata row names are not identical:\n", sep="")
-    ##         print(cbind.data.frame(indice = 1:nrow(datMN),
-    ##                                dataMatrix_columnnames=rownames(datMN),
-    ##                                sampleMetadata_rownames=rownames(samDF))[rownames(datMN) != rownames(samDF), , drop = FALSE])
-    ##     }
-
-    ## }
-    ##     datRowVc <- rownames(datMN)
-    ##     datRowMakVc <- make.names(datRowVc, unique = TRUE)
-    ##     if(datRowMakVc != datRowVc) {
-    ##         rownames(datMN) <- datRowMakVc
-    ##         cat("\n\nMessage: The sample names of the dataMatrix have been converted to the standard R format\n")
-    ##     }
-
-    ##     datColVc <- colnames(datMN)
-    ##     datColMakVc <- make.names(datColVc, unique = TRUE)
-    ##     if(datColMakVc != datColVc) {
-    ##         colnames(datMN) <- datColMakVc
-    ##         cat("\n\nMessage: The variable names of the dataMatrix have been converted to the standard R format\n")
-    ##     }
-
-    ##     samRowVc <- rownames(datMN)
-    ##     samRowMakVc <- make.names(samRowVc, unique = TRUE)
-    ##     if(samRowMakVc != samRowVc) {
-    ##         rownames(datMN) <- samRowMakVc
-    ##         cat("\n\nMessage: The sample names of the sampleMetadata have been converted to the standard R format\n")
-    ##     }
-
-    ##     datRowVc <- rownames(datMN)
-    ##     datRowMakVc <- make.names(datRowVc, unique = TRUE)
-    ##     if(datRowMakVc != datRowVc) {
-    ##         rownames(datMN) <- datRowMakVc
-    ##         cat("\n\nMessage: The sample names of the dataMatrix have been converted to the standard R format\n")
-    ##     }
-
-    ## }
-
-    ## checking names (optional)
-
-    
-
-
-    ## datRowMakVc <- make.names(datRowVc, unique = TRUE)
-    ## if(datRowMakVc != datRowVc) {
-    ##     if(makNamL) {
-    ##         rownames(datMN) <- datRowMakVc
-    ##         cat("\n\nMessage: The sample names of the dataMatrix have been converted to the standard R format; select the make names argument to convert them\n")
-    ##     } else {
-    ##         cat("\n\nWarning: Some of the sample names of the dataMatrix are not in the standard R format; select the make names argument to convert them\n")
-    ##     }
-
-    ## if(makNamL) {
-
-    ##     rownames(datMN) <- make.names(rownames(datMN), unique = TRUE)
-    ##     colnames(datMN) <- make.names(colnames(datMN), unique = TRUE)
-    ##     rownames(samDF) <- make.names(rownames(samDF), unique = TRUE)
-    ##     rownames(varDF) <- make.names(rownames(varDF), unique = TRUE)
- 
-    ##     }
-        ## checking sample names
-
-    ##     if(nrow(datMN) == nrow(samDF)) {
-
-            
-            
-    ##     }
-
-    ##     chkL <- FALSE
-
-    ##     datSamDifVc <- setdiff(rownames(datMN), rownames(samDF))
-
-    ##     if(length(datSamDifVc)) {
-    ##         cat("\nThe following samples were found in the dataMatrix column names but not in the sampleMetadata row names:\n", sep="")
-    ##         print(cbind.data.frame(col = as.numeric(sapply(datSamDifVc, function(samC) which(rownames(datMN) == samC))),
-    ##                                name = datSamDifVc))
-    ##     }
-
-    ##     samDatDifVc <- setdiff(rownames(samDF), rownames(datMN))
-
-    ##     if(length(samDatDifVc)) {
-    ##         cat("\n\nThe following samples were found in the sampleMetadata row names but not in the dataMatrix column names:\n", sep="")
-    ##         print(cbind.data.frame(row = as.numeric(sapply(samDatDifVc, function(samC) which(rownames(samDF) == samC))),
-    ##                                name = samDatDifVc))
-    ##     }
-
-    ##     if(nrow(datMN) != nrow(samDF)) {
-    ##         cat("\n\nThe dataMatrix has ", nrow(datMN), " columns (ie samples) whereas the sampleMetadata has ", nrow(samDF), " rows\n", sep="")
-    ##     } else if(identical(gsub("^X", "", rownames(datMN)), rownames(samDF))) {
-    ##         cat("\n\nThe dataMatrix column names start with an 'X' but not the sampleMetadata row names\n", sep="")
-    ##     } else if(identical(gsub("^X", "", rownames(samDF)), rownames(datMN))) {
-    ##         cat("\n\nThe sampleMetadata row names start with an 'X' but not the dataMatrix column names\n", sep="")
-    ##     } else if(identical(sort(rownames(datMN)), sort(rownames(samDF)))) {
-    ##         cat("\n\nThe dataMatrix column names and the sampleMetadata row names are not in the same order:\n", sep="")
-    ##         print(cbind.data.frame(indice = 1:nrow(datMN),
-    ##                                dataMatrix_columnnames=rownames(datMN),
-    ##                                sampleMetadata_rownames=rownames(samDF))[rownames(datMN) != rownames(samDF), , drop = FALSE])
-    ##     } else {
-    ##         cat("\n\nThe dataMatrix column names and the sampleMetadata row names are not identical:\n", sep="")
-    ##         print(cbind.data.frame(indice = 1:nrow(datMN),
-    ##                                dataMatrix_columnnames=rownames(datMN),
-    ##                                sampleMetadata_rownames=rownames(samDF))[rownames(datMN) != rownames(samDF), , drop = FALSE])
-    ##     }
-
-    ## }
-
-
-    ## if(!identical(colnames(datMN), rownames(varDF))) {
-    ##     ## checking variable names
-
-    ##     chkL <- FALSE
-
-    ##     datVarDifVc <- setdiff(colnames(datMN), rownames(varDF))
-
-    ##     if(length(datVarDifVc)) {
-    ##         cat("\nThe following variables were found in the dataMatrix row names but not in the variableMetadata row names:\n", sep="")
-    ##         print(cbind.data.frame(row = as.numeric(sapply(datVarDifVc, function(varC) which(colnames(datMN) == varC))),
-    ##                     name = datVarDifVc))
-
-    ##     }
-
-    ##     varDatDifVc <- setdiff(rownames(varDF), colnames(datMN))
-
-    ##     if(length(varDatDifVc)) {
-    ##         cat("\n\nThe following variables were found in the variableMetadata row names but not in the dataMatrix row names:\n", sep="")
-    ##         print(cbind.data.frame(row = as.numeric(sapply(varDatDifVc, function(varC) which(rownames(varDF) == varC))),
-    ##                     name = varDatDifVc))
-    ##     }
-
-    ##     if(ncol(datMN) != nrow(varDF)) {
-    ##         cat("\n\nThe dataMatrix has ", nrow(datMN), " rows (ie variables) whereas the variableMetadata has ", nrow(varDF), " rows\n", sep="")
-    ##     } else if(identical(sort(colnames(datMN)), sort(rownames(varDF)))) {
-    ##         cat("\n\nThe dataMatrix row names and the variableMetadata row names are not in the same order:\n", sep="")
-    ##         print(cbind.data.frame(row = 1:ncol(datMN),
-    ##                                dataMatrix_rownames=colnames(datMN),
-    ##                                variableMetadata_rownames=rownames(varDF))[colnames(datMN) != rownames(varDF), , drop = FALSE])
-    ##     } else {
-    ##         cat("\n\nThe dataMatrix row names and the variableMetadata row names are not identical:\n", sep="")
-    ##         print(cbind.data.frame(row = 1:ncol(datMN),
-    ##                                dataMatrix_rownames=colnames(datMN),
-    ##                                variableMetadata_rownames=rownames(varDF))[colnames(datMN) != rownames(varDF), , drop = FALSE])
-    ##     }
-    ## }
-## checkF <- function(datInpMN,
-##                    samInpDF,
-##                    varInpDF) {
-
-##     mode(datInpMN) == "numeric" &&
-##         identical(rownames(datInpMN), rownames(samInpDF)) &&
-##         identical(colnames(datInpMN), rownames(varInpDF))
-    
-
-## }