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

Changeset 0:902ab790fb7b (2017-02-23)
Next changeset 1:e44c5246247a (2019-11-14)
Commit message:
Uploaded
added:
TableMerge/.shed.yml
TableMerge/.travis.yml
TableMerge/README.txt
TableMerge/RcheckLibrary.R
TableMerge/miniTools.R
TableMerge/planemo_test.sh
TableMerge/tablemerge.xml
TableMerge/tablemerge_script.R
TableMerge/tablemerge_wrap.R
TableMerge/test-data/input_TM12_dataMatrix.txt
TableMerge/test-data/input_TM1_variableMetadata.txt
TableMerge/test-data/input_TM2_sampleMetadata.txt
TableMerge/test-data/output_TM1_expected.tabular
TableMerge/test-data/output_TM2_expected.tabular
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/.shed.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/.shed.yml Thu Feb 23 04:37:49 2017 -0500
[
@@ -0,0 +1,8 @@
+categories: [Metabolomics]
+description: '[W4M][Utils] Merging dataMatrix with a metadata table.'
+homepage_url: http://workflow4metabolomics.org
+long_description: 'Part of the W4M project: http://workflow4metabolomics.org / The
+  R script merges the data matrix with a selected metadata file (sample metadata or
+  variable metadata) to obtain a single file.'
+name: tablemerge
+owner: melpetera
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/.travis.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/.travis.yml Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,19 @@
+# This is a special configuration file to run tests on Travis-CI via
+# GitHub notifications when changes are committed.
+#
+# See http://travis-ci.org/ for details
+language: python
+
+before_install:
+ - sudo apt-get install -y python-virtualenv
+ - virtualenv planemo-venv
+ - . planemo-venv/bin/activate
+ - pip install --upgrade pip setuptools
+ - pip install planemo
+ - planemo conda_init
+
+install:
+ - planemo conda_install ${TRAVIS_BUILD_DIR}
+
+script:
+- planemo test --install_galaxy --no_cache_galaxy --conda_dependency_resolution ${TRAVIS_BUILD_DIR}
\ No newline at end of file
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/README.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/README.txt Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,39 @@
+## ****** Table Merge environment: ****** ##
+# version 2016-07-20 M Petera
+
+## --- PERL compilator / libraries: --- ##
+NA
+--
+
+## --- R bin and Packages: --- ##
+$ R --version
+R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
+Platform: x86_64-redhat-linux-gnu (64-bit)
+
+The dependent libs are :
+library(batch)
+-- 
+
+## --- Binary dependencies --- ##
+NA
+--
+
+## --- Config: --- ##
+NA
+--
+
+## --- XML HELP PART --- ##
+NA
+--
+
+## --- DATASETS --- ##
+No data set ! waiting for galaxy pages
+--
+
+## --- ??? COMMENTS ??? --- ##
+!WARNING! : Its existence made obsolete the old "Filters" tool
+--
+
+## --- Changelog/News --- ##
+NA
+--
\ No newline at end of file
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/RcheckLibrary.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/RcheckLibrary.R Thu Feb 23 04:37:49 2017 -0500
[
@@ -0,0 +1,124 @@
+######################################################
+# R check library
+# Coded by: M.Petera, 
+# - -
+# R functions to use in R scripts  
+# (management of various generic subroutines)
+# - -
+# V0: script structure + first functions
+# V1: More detailed error messages in match functions
+######################################################
+
+
+# Generic function to return an error if problems have been encountered - - - -
+
+check.err <- function(err.stock){
+
+ # err.stock = vector of results returned by check functions
+
+ if(length(err.stock)!=0){ stop("\n- - - - - - - - -\n",err.stock,"\n- - - - - - - - -\n") }
+
+}
+
+
+
+
+# Table match check functions - - - - - - - - - - - - - - - - - - - - - - - - -
+
+# To check if dataMatrix and (variable or sample)Metadata match regarding identifiers
+match2 <- function(dataMatrix, Metadata, Mtype){
+
+ # dataMatrix = data.frame containing dataMatrix
+ # Metadata = data.frame containing sampleMetadata or variableMetadata
+ # Mtype = "sample" or "variable" depending on Metadata content
+
+ err.stock <- NULL # error vector
+
+ id2 <- Metadata[,1]
+ if(Mtype=="sample"){ id1 <- colnames(dataMatrix)[-1] }
+ if(Mtype=="variable"){ id1 <- dataMatrix[,1] }
+
+ if( length(which(id1%in%id2))!=length(id1) || length(which(id2%in%id1))!=length(id2) ){
+ err.stock <- c("\nData matrix and ",Mtype," metadata do not match regarding ",Mtype," identifiers.")
+ if(length(which(id1%in%id2))!=length(id1)){
+ if(length(which(!(id1%in%id2)))<4){ err.stock <- c(err.stock,"\n    The ")
+ }else{ err.stock <- c(err.stock,"\n    For example, the ") }
+ err.stock <- c(err.stock,"following identifiers found in the data matrix\n",
+ "    do not appear in the ",Mtype," metadata file:\n")
+ identif <- id1[which(!(id1%in%id2))][1:min(3,length(which(!(id1%in%id2))))]
+ err.stock <- c(err.stock,"    ",paste(identif,collapse="\n    "),"\n")
+ }
+ if(length(which(id2%in%id1))!=length(id2)){
+ if(length(which(!(id2%in%id1)))<4){ err.stock <- c(err.stock,"\n    The ")
+ }else{ err.stock <- c(err.stock,"\n    For example, the ") }
+ err.stock <- c(err.stock,"following identifiers found in the ",Mtype," metadata file\n",
+ "    do not appear in the data matrix:\n")
+ identif <- id2[which(!(id2%in%id1))][1:min(3,length(which(!(id2%in%id1))))]
+ err.stock <- c(err.stock,"    ",paste(identif,collapse="\n    "),"\n")
+ }
+ err.stock <- c(err.stock,"\nPlease check your data.\n")
+ }
+
+ return(err.stock)
+
+}
+
+# To check if the 3 standard tables match regarding identifiers
+match3 <- function(dataMatrix, sampleMetadata, variableMetadata){
+
+ # dataMatrix = data.frame containing dataMatrix
+ # sampleMetadata = data.frame containing sampleMetadata
+ # variableMetadata = data.frame containing variableMetadata
+
+ err.stock <- NULL # error vector
+
+ id1 <- colnames(dataMatrix)[-1]
+ id2 <- sampleMetadata[,1]
+ id3 <- dataMatrix[,1]
+ id4 <- variableMetadata[,1]
+
+ if( length(which(id1%in%id2))!=length(id1) || length(which(id2%in%id1))!=length(id2) ){
+ err.stock <- c(err.stock,"\nData matrix and sample metadata do not match regarding sample identifiers.")
+ if(length(which(id1%in%id2))!=length(id1)){
+ if(length(which(!(id1%in%id2)))<4){ err.stock <- c(err.stock,"\n    The ")
+ }else{ err.stock <- c(err.stock,"\n    For example, the ") }
+ err.stock <- c(err.stock,"following identifiers found in the data matrix\n",
+ "    do not appear in the sample metadata file:\n")
+ identif <- id1[which(!(id1%in%id2))][1:min(3,length(which(!(id1%in%id2))))]
+ err.stock <- c(err.stock,"    ",paste(identif,collapse="\n    "),"\n")
+ }
+ if(length(which(id2%in%id1))!=length(id2)){
+ if(length(which(!(id2%in%id1)))<4){ err.stock <- c(err.stock,"\n    The ")
+ }else{ err.stock <- c(err.stock,"\n    For example, the ") }
+ err.stock <- c(err.stock,"following identifiers found in the sample metadata file\n",
+ "    do not appear in the data matrix:\n")
+ identif <- id2[which(!(id2%in%id1))][1:min(3,length(which(!(id2%in%id1))))]
+ err.stock <- c(err.stock,"    ",paste(identif,collapse="\n    "),"\n")
+ }
+ }
+
+ if( length(which(id3%in%id4))!=length(id3) || length(which(id4%in%id3))!=length(id4) ){
+ err.stock <- c(err.stock,"\nData matrix and variable metadata do not match regarding variable identifiers.")
+ if(length(which(id3%in%id4))!=length(id3)){
+ if(length(which(!(id3%in%id4)))<4){ err.stock <- c(err.stock,"\n    The ")
+ }else{ err.stock <- c(err.stock,"\n    For example, the ") }
+ err.stock <- c(err.stock,"following identifiers found in the data matrix\n",
+ "    do not appear in the variable metadata file:\n")
+ identif <- id3[which(!(id3%in%id4))][1:min(3,length(which(!(id3%in%id4))))]
+ err.stock <- c(err.stock,"    ",paste(identif,collapse="\n    "),"\n")
+ }
+ if(length(which(id4%in%id3))!=length(id4)){
+ if(length(which(!(id4%in%id3)))<4){ err.stock <- c(err.stock,"\n    The ")
+ }else{ err.stock <- c(err.stock,"\n    For example, the ") }
+ err.stock <- c(err.stock,"following identifiers found in the variable metadata file\n",
+ "    do not appear in the data matrix:\n")
+ identif <- id4[which(!(id4%in%id3))][1:min(3,length(which(!(id4%in%id3))))]
+ err.stock <- c(err.stock,"    ",paste(identif,collapse="\n    "),"\n")
+ }
+ }
+
+ if(length(err.stock)!=0){ err.stock <- c(err.stock,"\nPlease check your data.\n") }
+
+ return(err.stock)
+
+}
\ No newline at end of file
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/miniTools.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/miniTools.R Thu Feb 23 04:37:49 2017 -0500
[
@@ -0,0 +1,133 @@
+#####################################################
+# Mini tools for Galaxy scripting
+# Coded by: M.Petera, 
+# - -
+# R functions to use in R scripts and wrappers
+# to make things easier (lightening code, reducing verbose...)
+# - -
+# V0: script structure + first functions
+# V1: addition of functions to handle special characters in identifiers
+#####################################################
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+# Function to call packages without printing all the verbose
+# (only getting the essentials, like warning messages for example)
+
+shyLib <- function(...){
+ for(i in 1:length(list(...))){
+ suppressPackageStartupMessages(library(list(...)[[i]],character.only=TRUE))
+ }
+}
+
+#example: shyLib("xcms","pcaMethods")
+
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+# Fonction pour sourcer les scripts R requis
+# /!\ ATTENTION : actuellement la fonction n'est pas chargee au lancement du script,
+# il faut donc la copier-coller dans le wrapper R pour pouvoir l'utiliser. 
+
+if(FALSE){
+source_local <- function(...){
+ argv <- commandArgs(trailingOnly = FALSE)
+ base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
+ for(i in 1:length(list(...))){
+ source(paste(base_dir, list(...)[[i]], sep="/"))
+ }
+}
+}
+
+#example: source_local("filter_script.R","RcheckLibrary.R")
+
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+# Functions to stock identifiers before applying make.names() and
+# to reinject it into final matrices
+# Note: it reproduces the original order of datasets' identifiers
+# - - -
+# stockID: stocks original identifiers and original order
+# -> needs checked data regarding table match
+# reproduceID: reinjects original identifiers and original order into final tables
+# -> function to be used at the very end, when exporting tables
+
+stockID <- function(dataMatrix, Metadata, Mtype){
+  # dataMatrix = data.frame containing dataMatrix
+  # Metadata = data.frame containing sampleMetadata or variableMetadata
+  # Mtype = "sample" or "variable" depending on Metadata content
+  cname <- colnames(dataMatrix)[1]
+      # dataMatrix temporary-stock + transfo - - - -
+  if(Mtype=="sample"){
+    id.ori <- colnames(dataMatrix)[-1] 
+    colnames(dataMatrix) <- make.names(colnames(dataMatrix)) 
+  }
+  if(Mtype=="variable"){
+    id.ori <- dataMatrix[,1] 
+    dataMatrix[,1] <- make.names(dataMatrix[,1]) 
+  }
+      # global stock - - - - - - - - - - - - - - - -
+  id.new <- data.frame(order.ori=c(1:length(Metadata[,1])),Metadata[,1],
+    id.new=make.names(Metadata[,1]),id.ori,
+    id.new.DM=make.names(id.ori),stringsAsFactors=FALSE)
+  colnames(id.new)[c(2,4)] <- c(colnames(Metadata)[1],cname)
+      # Metadata transfo + returning data - - - - - 
+  Metadata[,1] <- make.names(Metadata[,1]) 
+  return(list(id.match=id.new, dataMatrix=dataMatrix, Metadata=Metadata))
+}
+#example: A<-stockID(myDM,mysM,"sample") ; myDM<-A$dataMatrix ; mysM<-A$Metadata ; A<-A$id.match
+
+reproduceID <- function(dataMatrix, Metadata, Mtype, id.match){
+  # dataMatrix = data.frame containing dataMatrix
+  # Metadata = data.frame containing sampleMetadata or variableMetadata
+  # Mtype = "sample" or "variable" depending on Metadata content
+  # id.match = 'id.match' element produced by stockID
+      #Metadada - - - - - - - - - - - - - - 
+  temp.table <- id.match[,c(1,2,3)]
+  ## Removing deleted rows
+  for(i in 1:(dim(id.match)[1])){
+ if(!(temp.table[i,3]%in%Metadata[,1])){temp.table[i,1] <- 0}
+  }
+  if(length(which(temp.table[,1]==0))!=0){
+ temp.table <- temp.table[-c(which(temp.table[,1]==0)),]
+  }
+  ## Restoring original identifiers and order
+  temp.table <- merge(x=temp.table,y=Metadata,by.x=3,by.y=1)
+  temp.table <- temp.table[order(temp.table$order.ori),]
+  Metadata <- temp.table[,-c(1,2)]
+  rownames(Metadata) <- NULL
+      #dataMatrix - - - - - - - - - - - - - 
+  rownames(dataMatrix)<-dataMatrix[,1]
+  if(Mtype=="sample"){
+    dataMatrix <- t(dataMatrix[,-1])
+  }
+  temp.table <- id.match[,c(1,4,5)]
+  ## Removing deleted rows
+  for(i in 1:(dim(id.match)[1])){
+ if(!(temp.table[i,3]%in%rownames(dataMatrix))){temp.table[i,1] <- 0}
+  }
+  if(length(which(temp.table[,1]==0))!=0){
+ temp.table <- temp.table[-c(which(temp.table[,1]==0)),]
+  }
+  ## Restoring original identifiers and order
+  temp.table <- merge(x=temp.table,y=dataMatrix,by.x=3,by.y=0)
+  temp.table <- temp.table[order(temp.table$order.ori),]
+  if(Mtype=="variable"){
+ dataMatrix <- temp.table[,-c(1,2,4)]
+ colnames(dataMatrix)[1] <- colnames(id.match)[4]
+  } else {
+ rownames(temp.table) <- temp.table[,3]
+ temp.table <- t(temp.table[,-c(1,2,3)])
+ dataMatrix <- data.frame(rownames(temp.table),temp.table)
+ colnames(dataMatrix)[1] <- colnames(id.match)[4]
+  }
+  rownames(dataMatrix) <- NULL
+      # return datasets - - - - - - - - - - - 
+  return(list(dataMatrix=dataMatrix, Metadata=Metadata))
+}
+#example: B<-reproduceID(myDM,mysM,"sample",A) ; myDM<-B$dataMatrix ; mysM<-B$Metadata
+
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/planemo_test.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/planemo_test.sh Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,3 @@
+planemo conda_init --conda_prefix /tmp/mc/
+planemo conda_install --conda_prefix /tmp/mc/ .
+planemo test --install_galaxy --conda_dependency_resolution --conda_prefix /tmp/mc/ --no_cleanup
\ No newline at end of file
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/tablemerge.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/tablemerge.xml Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,126 @@
+<tool id="tablemerge" name="Table Merge" version="1.0.1">
+  <description>Merging dataMatrix with a metadata table</description>
+  <requirements>
+     <requirement type="package" version="1.1_4">r-batch</requirement>
+  </requirements>
+  <command interpreter="Rscript">
+ tablemerge_wrap.R
+      dataMatrix_in "$dataMatrix_in"
+      Metadata_in "$Metadata_in"
+              
+      metatype "$metatype"
+      
+      combined_out "$combined_out"
+
+  </command>
+  
+  <inputs>
+    <param name="dataMatrix_in" type="data" label="Data matrix file" help="" format="tabular" />
+    <param name="Metadata_in" type="data" label="Metadata file" help="Sample metadata or variable metadata" format="tabular" />
+
+    <param name="metatype" label="Type of metadata" type="select" display="radio" help="">
+      <option value="sample">Sample metadata</option>
+      <option value="variable">Variable metadata</option>
+    </param>
+
+  </inputs>
+  
+  <outputs>
+    <data name="combined_out" label="Combined_${Metadata_in.name}" format="tabular" ></data>
+  </outputs>
+  
+  <tests>
+ <test>
+      <param name="dataMatrix_in" value="input_TM12_dataMatrix.txt"/>
+      <param name="Metadata_in" value="input_TM1_variableMetadata.txt"/>
+      <param name="metatype" value="variable"/>
+      <output name="combined_out" file="output_TM1_expected.tabular"/>
+ </test>
+ <test>
+      <param name="dataMatrix_in" value="input_TM12_dataMatrix.txt"/>
+      <param name="Metadata_in" value="input_TM2_sampleMetadata.txt"/>
+      <param name="metatype" value="sample"/>
+      <output name="combined_out" file="output_TM2_expected.tabular"/>
+ </test>
+  </tests>
+  
+  
+  <help>
+
+.. class:: infomark
+
+**Authors** 
+  | Melanie Petera - PFEM ; INRA ; MetaboHUB 
+
+---------------------------------------------------
+
+========================
+Table Merge
+========================
+
+-----------
+Description
+-----------
+
+Merges the data matrix with a selected metadata file (sample metadata or variable metadata)
+to obtain a single file. 
+
+
+
+-----------
+Input files
+-----------
+
++----------------------------+---------+
+| Parameter : num + label    |  Format |
++============================+=========+
+| 1 : Data matrix file       | tabular |
++----------------------------+---------+
+| 2 : Metadata file          | tabular |
++----------------------------+---------+
+
+
+Data matrix file contains the intensity values of the variables.
+ | 
+
+Metadata file is meant to be chosen from sample metadata and variable metadata files. 
+ | 
+
+----------
+Parameter
+----------
+
+Type of metadata
+ | Specify which type of metadata table is given as Metadata file
+ | 
+
+
+------------
+Output file
+------------
+
+
+Combined_Metadata
+ | tabular output
+ | Corresponds to the input metadata file completed as new columns by the intensities in the input data matrix file
+ |
+
+
+---------------------------------------------------
+
+---------------
+Working example
+---------------
+
+
+.. class:: warningmark
+
+For more information about input files, refer to the corresponding "W4M HowTo" page:
+ | `W4M table format for Galaxy &lt;http://workflow4metabolomics.org/sites/workflow4metabolomics.org/files/files/w4m_TableFormatForGalaxy_150908.pdf&gt;`_
+ |
+
+
+
+
+ </help>
+</tool>
\ No newline at end of file
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/tablemerge_script.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/tablemerge_script.R Thu Feb 23 04:37:49 2017 -0500
[
@@ -0,0 +1,82 @@
+################################################################################################
+# TABLE MERGE                                                                                  #
+#                                                                                              #
+# User: Galaxy                                                                                 #
+# Starting date: 16-04-2015                                                                    #
+# V-0.1: First version of merge code                                                           #
+# V-0.2: Addition of data check and handling of special characters                             #
+#                                                                                              #
+#                                                                                              #
+# Input files: dataMatrix ; Metadata file                                                      #
+# Output files: dataMatrix ; Metadata file                                                     #
+#                                                                                              #
+# Dependencies: RcheckLibrary.R ; miniTools.R                                                  #
+#                                                                                              #
+################################################################################################
+
+# Parameters (for dev)
+if(FALSE){
+  DM.name <- "dataMatrix_CleanIons_CleanEch.txt"
+  meta.name <- "sampleMetadata_CleanEch.txt"
+  metype <- "sample"
+  output <- "Combined_${Metadata_in.name}"
+}
+
+
+
+tab.merge <- function(DM.name,meta.name,metype,output){
+  # This function allows to merge the dataMatrix with one metadata table.
+  #
+  # Parameters:
+  # - DM.name, meta.name: dataMatrix and metadata files' access respectively
+  # - metype: "sample" or "variable" depending on metadata content
+  # - output: output file's access
+  
+  
+# Input --------------------------------------------------------------
+
+DM <- read.table(DM.name,header=TRUE,sep="\t",check.names=FALSE)
+meta <- read.table(meta.name,header=TRUE,sep="\t",check.names=FALSE,colClasses="character")
+
+# Table match check 
+table.check <- match2(DM,meta,metype)
+check.err(table.check)
+
+# StockID
+meta.id <- stockID(DM,meta,metype)
+DM<-meta.id$dataMatrix ; meta<-meta.id$Metadata ; meta.id<-meta.id$id.match
+
+
+# Merging tables -----------------------------------------------------
+
+if(metype=="sample"){
+  ori.DM <- DM
+  rownames(DM) <- DM[,1]
+  DM <- DM[,-1]
+  DM <- t(DM)
+  DM <- data.frame(sample=row.names(DM),DM,check.names=FALSE)
+  rownames(DM) <- NULL
+}
+
+comb.data <- merge(x=meta,y=DM,by.x=1,by.y=1)
+
+
+# Output -------------------------------------------------------------
+
+# Getting back original identifiers
+if(metype=="sample"){
+  id.ori <- reproduceID(ori.DM,comb.data,metype,meta.id)
+}else{
+  id.ori <- reproduceID(DM,comb.data,metype,meta.id)
+}
+comb.data <- id.ori$Metadata
+
+# Writing the table
+write.table(comb.data,output,sep="\t",quote=FALSE,row.names=FALSE)
+
+
+} # End of tab.merge
+
+
+# Typical function call
+# tab.merge(DM.name,meta.name,metype,output)
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/tablemerge_wrap.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/tablemerge_wrap.R Thu Feb 23 04:37:49 2017 -0500
[
@@ -0,0 +1,38 @@
+#!/usr/bin/Rscript --vanilla --slave --no-site-file
+
+################################################################################################
+# WRAPPER FOR tablemerge_script.R (TABLE MERGE)                                                #
+#                                                                                              #
+# Author: Melanie PETERA                                                                       #
+# User: Galaxy                                                                                 #
+# Original data: used with tablemerge_script.R                                                 #
+# Starting date: 11-05-2015                                                                    #
+# V-1: Firt version of wrapper                                                                 #
+#                                                                                              #
+#                                                                                              #
+# Input files: dataMatrix ; Metadata file                                                      #
+# Output files: dataMatrix ; Metadata file                                                     #
+#                                                                                              #
+################################################################################################
+
+
+library(batch) #necessary for parseCommandArgs function
+args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
+
+source_local <- function(...){
+ argv <- commandArgs(trailingOnly = FALSE)
+ base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
+ for(i in 1:length(list(...))){source(paste(base_dir, list(...)[[i]], sep="/"))}
+}
+#Import the different functions
+source_local("tablemerge_script.R","RcheckLibrary.R","miniTools.R")
+
+
+if(length(args) < 4){ stop("NOT enough argument !!!") }
+
+
+tab.merge(args$dataMatrix_in, args$Metadata_in, args$metatype, args$combined_out)
+
+
+#delete the parameters to avoid the passage to the next tool in .RData image
+rm(args)
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/test-data/input_TM12_dataMatrix.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/test-data/input_TM12_dataMatrix.txt Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,18 @@
+data j 785 y54j 68y4j6 5-6 4 hrh 5h - 3 t564 t54 66 y6y t6 5h (5y g51 ( 6 98 j7-0 06654h 60
+5d_-kkcùf 0.356426723610756 0.380152310071702 0.0306944207412024 0.334137638848017 0.298147485608469 0.975073793297568 0.129099504745855 0.973451663994064 0.334792719284834 0.0751565260418877 0.322897933010729 0.129033714279026 0.722966330196726 0.580654367692078 0.644502528016206 0.352827235332827 0.511778286438001
+npèt 0.801750949101246 0.535593104115636 0.258351312473067 0.599475573145688 0.0763319665667417 0.504558103160623 0.367963830290116 0.440540211857668 0.158066366765388 0.609574253877002 0.550590276177951 0.232864384033621 0.637065775537391 0.424098276140436 0.662053737304139 0.0217541227637467 0.299053946391647
+5PY4(*3 0.875199970420953 0.0825428101366147 0.253659010703906 0.507762246807195 0.856444177031262 0.291594962324086 0.616538655402613 0.388475672176377 0.914254939740854 0.449607330807756 0.628469388494906 0.436558212905713 0.951198610265672 0.956459387015831 0.0113483457928278 0.611559621193868 0.127393349941781
+k 0.235214515530521 0.50917637648828 0.0303152651414629 0.305595242012361 0.470145996588881 0.356776179776951 0.569840649303474 0.720070419680388 0.875026990189028 0.97246313990283 0.936423978578332 0.810603455355391 0.903046784946495 0.667091730522105 0.0282601148338295 0.276666638740528 0.747503427028951
+t v^ptok!R/; 0.251801918471682 0.871383805557867 0.285183681272061 0.552739436194454 0.863766301215097 0.182656918760194 0.977603710051043 0.204845724382198 0.751690583305025 0.751475804910098 0.938399878874186 0.218163132174348 0.523463794277572 0.987156468237196 0.630938391969655 0.495061607430081 0.815474132321848
+ojt* 0.907412839750932 0.857498273276021 0.370137361785406 0.76678484779183 0.213299689296413 0.521214352529346 0.0851731095099456 0.868227767553325 0.0711706993343434 0.70186429888193 0.700568035764899 0.7467824290166 0.570332959002042 0.23270290523468 0.126423339798572 0.816262268500797 0.466363859676536
+lmtki 0.344288940919619 0.308219131305663 0.218449898667526 0.700869668247368 0.932538878977527 0.396198994630489 0.710306820874376 0.124235068279782 0.56608643523601 0.887647287670482 0.0375011938139768 0.282378766400105 0.757492159558571 0.506567258021703 0.990910788272054 0.326205008250378 0.61003856679129
+1h6-(587 t 0.308709890328272 0.717202505490233 0.777934118812417 0.604807545422864 0.588458968776734 0.940112596977594 0.788662314418432 0.133046934771924 0.891405172730758 0.915119678712577 0.401136527896346 0.996068607925829 0.049077648050296 0.157657286859101 0.598183619914656 0.439531332356748 0.11995300831499
+r154 (54 86 0.0861033910635205 0.243889357950567 0.848801588667359 0.972183114768299 0.311829870889657 0.434854970574638 0.0240613698880671 0.273335646139236 0.902686361056168 0.73479376111027 0.232132726965829 0.471097756642369 0.511949019774828 0.934158039531663 0.60125450357768 0.972297241140637 0.63149263296722
+(h4 0.336373953934809 0.521412085356266 0.281632887739949 0.67004516763179 0.0199332367594847 0.867732114278491 0.973477443505332 0.883197938525362 0.334509105447652 0.793947578560618 0.465167375556954 0.508757674191867 0.983758014396725 0.100582744588671 0.501301982240787 0.789637338939369 0.967382850752139
+2 0.65083934802851 0.915695024588 0.0376667088550816 0.514003854683931 0.274761574286474 0.652108809243866 0.689393057486628 0.262205073769319 0.871958663956254 0.709490850507154 0.854477673591409 0.672918329289054 0.141693817710263 0.00543057257281332 0.273084303937691 0.39570748778882 0.303196826092465
+m(yk 0.798331012769621 0.806128809071498 0.519974578571807 0.0237856823099186 0.396426673475168 0.75979784245693 0.0589336105092753 0.763144123705766 0.16086904822931 0.301000258395631 0.321186481311644 0.0091434029302796 0.0346149352313591 0.276366137673702 0.686099471259438 0.0548240244354505 0.909361338008149
+-546 -3 -3 0.981561422839383 0.755973696318293 0.328878596436459 0.233341270249666 0.14569201922932 0.458105216271765 0.191023237667199 0.775603857680909 0.146769440956804 0.86812372109824 0.601678275863019 0.782019307745586 0.955614654474782 0.836058192741214 0.454550085076576 0.181788519803465 0.325277631599655
+nz^à  t 0.920089977342539 0.249031996586174 0.105577675363886 0.805216649434891 0.505774902707566 0.619612431793644 0.337662179244335 0.672829320507873 0.387228581340173 0.209795853201976 0.0403285073621635 0.540614252108851 0.43362855410287 0.160204078494507 0.924783730297701 0.116837628312753 0.58763473928668
+kzjù 0.418651623550921 0.668434005412235 0.845525871017258 0.567468950919516 0.111441846749533 0.411424602517146 0.0743349602270699 0.583730221710347 0.0105008018078939 0.918789674284249 0.808643595994088 0.33578972219198 0.536848200622412 0.898842910125025 0.333954421105444 0.0390509357521919 0.159857705429294
+. Glk(ôepjg$ 0.3266193089274 0.806668730531573 0.87265879590923 0.934940869880726 0.548967615908753 0.250539517744596 0.75436043048449 0.597444122305604 0.343955002787363 0.560987092777944 0.134929631392942 0.958047956861493 0.870429681664852 0.66286672214456 0.441523248613101 0.437073092741238 0.265031623006715
+rmlgj*lr , 0.462672931523031 0.74679446664976 0.151929368261195 0.165870989887449 0.90931621240424 0.423706631494886 0.337742032589001 0.184993498717115 0.0792523932129463 0.071353352835237 0.525247607449536 0.647744088759121 0.158725526449032 0.203927461340644 0.20055683200405 0.897053444943847 0.506954538974894
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/test-data/input_TM1_variableMetadata.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/test-data/input_TM1_variableMetadata.txt Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,18 @@
+variable A B C D
+5d_-kkcùf 0 a ze$ùj 0
+npèt 1 b  g 0
+5PY4(*3 2 c  15j-è, 0
+k 3 a 6jè 1
+t v^ptok!R/; 4 b 8j4, 1
+ojt* 5 c 5èj1 1
+lmtki 6 a j84 2
+1h6-(587 t 7 b j4e54 2
+r154 (54 86 8 c j 2
+(h4 9 a 54j6@44èu6(è4 3
+2 10 b (51h 3
+m(yk 11 c 8-1 3
+-546 -3 -3 12 a hy-81u 4
+nz^à  t 13 b zs5-hj1 4
+kzjù 14 c 861h 4
+. Glk(ôepjg$ 15 a (8168(h1 9
+rmlgj*lr , 16 b 8hjè1 9
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/test-data/input_TM2_sampleMetadata.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/test-data/input_TM2_sampleMetadata.txt Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,18 @@
+sample A B C D E F
+j 785 1 y z 1.2 F jkh52è16
+y54j 68y4j6 3 y e 1.6 F 1è5hj4-
+5-6 4 5 y z 1.5 F -
+hrh 9 y e 6.3 F è1484j
+5h - 8 y z 6.9 F h3254
+3 7 y e 0 F
+t564 4 y z 2 F th651
+t54 66 5 y e 6 F h4+
+y6y 6 y z 8 F he+65+(
+t6 5h 8 y e 4 F h56h4+
+(5y 5 y z 5 F
+g51 1 y e 7 F
+( 2 y z 6 F 5h4te+4
+6 6 y e 5 F yhe6
+98 j7-0 4 y z 3 F theh
+06654h 4 y e 7 F 56
+60 2 y z 3 F
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/test-data/output_TM1_expected.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/test-data/output_TM1_expected.tabular Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,18 @@
+variable A B C D j 785 y54j 68y4j6 5-6 4 hrh 5h - 3 t564 t54 66 y6y t6 5h (5y g51 ( 6 98 j7-0 06654h 60
+5d_-kkcùf 0 a ze$ùj 0 0.356426723610756 0.380152310071702 0.0306944207412024 0.334137638848017 0.298147485608469 0.975073793297568 0.129099504745855 0.973451663994064 0.334792719284834 0.0751565260418877 0.322897933010729 0.129033714279026 0.722966330196726 0.580654367692078 0.644502528016206 0.352827235332827 0.511778286438001
+npèt 1 b  g 0 0.801750949101246 0.535593104115636 0.258351312473067 0.599475573145688 0.0763319665667417 0.504558103160623 0.367963830290116 0.440540211857668 0.158066366765388 0.609574253877002 0.550590276177951 0.232864384033621 0.637065775537391 0.424098276140436 0.662053737304139 0.0217541227637467 0.299053946391647
+5PY4(*3 2 c  15j-è, 0 0.875199970420953 0.0825428101366147 0.253659010703906 0.507762246807195 0.856444177031262 0.291594962324086 0.616538655402613 0.388475672176377 0.914254939740854 0.449607330807756 0.628469388494906 0.436558212905713 0.951198610265672 0.956459387015831 0.0113483457928278 0.611559621193868 0.127393349941781
+k 3 a 6jè 1 0.235214515530521 0.50917637648828 0.0303152651414629 0.305595242012361 0.470145996588881 0.356776179776951 0.569840649303474 0.720070419680388 0.875026990189028 0.97246313990283 0.936423978578332 0.810603455355391 0.903046784946495 0.667091730522105 0.0282601148338295 0.276666638740528 0.747503427028951
+t v^ptok!R/; 4 b 8j4, 1 0.251801918471682 0.871383805557867 0.285183681272061 0.552739436194454 0.863766301215097 0.182656918760194 0.977603710051043 0.204845724382198 0.751690583305025 0.751475804910098 0.938399878874186 0.218163132174348 0.523463794277572 0.987156468237196 0.630938391969655 0.495061607430081 0.815474132321848
+ojt* 5 c 5èj1 1 0.907412839750932 0.857498273276021 0.370137361785406 0.76678484779183 0.213299689296413 0.521214352529346 0.0851731095099456 0.868227767553325 0.0711706993343434 0.70186429888193 0.700568035764899 0.7467824290166 0.570332959002042 0.23270290523468 0.126423339798572 0.816262268500797 0.466363859676536
+lmtki 6 a j84 2 0.344288940919619 0.308219131305663 0.218449898667526 0.700869668247368 0.932538878977527 0.396198994630489 0.710306820874376 0.124235068279782 0.56608643523601 0.887647287670482 0.0375011938139768 0.282378766400105 0.757492159558571 0.506567258021703 0.990910788272054 0.326205008250378 0.61003856679129
+1h6-(587 t 7 b j4e54 2 0.308709890328272 0.717202505490233 0.777934118812417 0.604807545422864 0.588458968776734 0.940112596977594 0.788662314418432 0.133046934771924 0.891405172730758 0.915119678712577 0.401136527896346 0.996068607925829 0.049077648050296 0.157657286859101 0.598183619914656 0.439531332356748 0.11995300831499
+r154 (54 86 8 c j 2 0.0861033910635205 0.243889357950567 0.848801588667359 0.972183114768299 0.311829870889657 0.434854970574638 0.0240613698880671 0.273335646139236 0.902686361056168 0.73479376111027 0.232132726965829 0.471097756642369 0.511949019774828 0.934158039531663 0.60125450357768 0.972297241140637 0.63149263296722
+(h4 9 a 54j6@44èu6(è4 3 0.336373953934809 0.521412085356266 0.281632887739949 0.67004516763179 0.0199332367594847 0.867732114278491 0.973477443505332 0.883197938525362 0.334509105447652 0.793947578560618 0.465167375556954 0.508757674191867 0.983758014396725 0.100582744588671 0.501301982240787 0.789637338939369 0.967382850752139
+2 10 b (51h 3 0.65083934802851 0.915695024588 0.0376667088550816 0.514003854683931 0.274761574286474 0.652108809243866 0.689393057486628 0.262205073769319 0.871958663956254 0.709490850507154 0.854477673591409 0.672918329289054 0.141693817710263 0.00543057257281332 0.273084303937691 0.39570748778882 0.303196826092465
+m(yk 11 c 8-1 3 0.798331012769621 0.806128809071498 0.519974578571807 0.0237856823099186 0.396426673475168 0.75979784245693 0.0589336105092753 0.763144123705766 0.16086904822931 0.301000258395631 0.321186481311644 0.0091434029302796 0.0346149352313591 0.276366137673702 0.686099471259438 0.0548240244354505 0.909361338008149
+-546 -3 -3 12 a hy-81u 4 0.981561422839383 0.755973696318293 0.328878596436459 0.233341270249666 0.14569201922932 0.458105216271765 0.191023237667199 0.775603857680909 0.146769440956804 0.86812372109824 0.601678275863019 0.782019307745586 0.955614654474782 0.836058192741214 0.454550085076576 0.181788519803465 0.325277631599655
+nz^à  t 13 b zs5-hj1 4 0.920089977342539 0.249031996586174 0.105577675363886 0.805216649434891 0.505774902707566 0.619612431793644 0.337662179244335 0.672829320507873 0.387228581340173 0.209795853201976 0.0403285073621635 0.540614252108851 0.43362855410287 0.160204078494507 0.924783730297701 0.116837628312753 0.58763473928668
+kzjù 14 c 861h 4 0.418651623550921 0.668434005412235 0.845525871017258 0.567468950919516 0.111441846749533 0.411424602517146 0.0743349602270699 0.583730221710347 0.0105008018078939 0.918789674284249 0.808643595994088 0.33578972219198 0.536848200622412 0.898842910125025 0.333954421105444 0.0390509357521919 0.159857705429294
+. Glk(ôepjg$ 15 a (8168(h1 9 0.3266193089274 0.806668730531573 0.87265879590923 0.934940869880726 0.548967615908753 0.250539517744596 0.75436043048449 0.597444122305604 0.343955002787363 0.560987092777944 0.134929631392942 0.958047956861493 0.870429681664852 0.66286672214456 0.441523248613101 0.437073092741238 0.265031623006715
+rmlgj*lr , 16 b 8hjè1 9 0.462672931523031 0.74679446664976 0.151929368261195 0.165870989887449 0.90931621240424 0.423706631494886 0.337742032589001 0.184993498717115 0.0792523932129463 0.071353352835237 0.525247607449536 0.647744088759121 0.158725526449032 0.203927461340644 0.20055683200405 0.897053444943847 0.506954538974894
b
diff -r 000000000000 -r 902ab790fb7b TableMerge/test-data/output_TM2_expected.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TableMerge/test-data/output_TM2_expected.tabular Thu Feb 23 04:37:49 2017 -0500
b
@@ -0,0 +1,18 @@
+sample A B C D E F 5d_-kkcùf npèt 5PY4(*3 k t v^ptok!R/; ojt* lmtki 1h6-(587 t r154 (54 86 (h4 2 m(yk -546 -3 -3 nz^à  t kzjù . Glk(ôepjg$ rmlgj*lr ,
+j 785 1 y z 1.2 F jkh52è16 0.356426723610756 0.801750949101246 0.875199970420953 0.235214515530521 0.251801918471682 0.907412839750932 0.344288940919619 0.308709890328272 0.0861033910635205 0.336373953934809 0.65083934802851 0.798331012769621 0.981561422839383 0.920089977342539 0.418651623550921 0.3266193089274 0.462672931523031
+y54j 68y4j6 3 y e 1.6 F 1è5hj4- 0.380152310071702 0.535593104115636 0.0825428101366147 0.50917637648828 0.871383805557867 0.857498273276021 0.308219131305663 0.717202505490233 0.243889357950567 0.521412085356266 0.915695024588 0.806128809071498 0.755973696318293 0.249031996586174 0.668434005412235 0.806668730531573 0.74679446664976
+5-6 4 5 y z 1.5 F - 0.0306944207412024 0.258351312473067 0.253659010703906 0.0303152651414629 0.285183681272061 0.370137361785406 0.218449898667526 0.777934118812417 0.848801588667359 0.281632887739949 0.0376667088550816 0.519974578571807 0.328878596436459 0.105577675363886 0.845525871017258 0.87265879590923 0.151929368261195
+hrh 9 y e 6.3 F è1484j 0.334137638848017 0.599475573145688 0.507762246807195 0.305595242012361 0.552739436194454 0.76678484779183 0.700869668247368 0.604807545422864 0.972183114768299 0.67004516763179 0.514003854683931 0.0237856823099186 0.233341270249666 0.805216649434891 0.567468950919516 0.934940869880726 0.165870989887449
+5h - 8 y z 6.9 F h3254 0.298147485608469 0.0763319665667417 0.856444177031262 0.470145996588881 0.863766301215097 0.213299689296413 0.932538878977527 0.588458968776734 0.311829870889657 0.0199332367594847 0.274761574286474 0.396426673475168 0.14569201922932 0.505774902707566 0.111441846749533 0.548967615908753 0.90931621240424
+3 7 y e 0 F 0.975073793297568 0.504558103160623 0.291594962324086 0.356776179776951 0.182656918760194 0.521214352529346 0.396198994630489 0.940112596977594 0.434854970574638 0.867732114278491 0.652108809243866 0.75979784245693 0.458105216271765 0.619612431793644 0.411424602517146 0.250539517744596 0.423706631494886
+t564 4 y z 2 F th651 0.129099504745855 0.367963830290116 0.616538655402613 0.569840649303474 0.977603710051043 0.0851731095099456 0.710306820874376 0.788662314418432 0.0240613698880671 0.973477443505332 0.689393057486628 0.0589336105092753 0.191023237667199 0.337662179244335 0.0743349602270699 0.75436043048449 0.337742032589001
+t54 66 5 y e 6 F h4+ 0.973451663994064 0.440540211857668 0.388475672176377 0.720070419680388 0.204845724382198 0.868227767553325 0.124235068279782 0.133046934771924 0.273335646139236 0.883197938525362 0.262205073769319 0.763144123705766 0.775603857680909 0.672829320507873 0.583730221710347 0.597444122305604 0.184993498717115
+y6y 6 y z 8 F he+65+( 0.334792719284834 0.158066366765388 0.914254939740854 0.875026990189028 0.751690583305025 0.0711706993343434 0.56608643523601 0.891405172730758 0.902686361056168 0.334509105447652 0.871958663956254 0.16086904822931 0.146769440956804 0.387228581340173 0.0105008018078939 0.343955002787363 0.0792523932129463
+t6 5h 8 y e 4 F h56h4+ 0.0751565260418877 0.609574253877002 0.449607330807756 0.97246313990283 0.751475804910098 0.70186429888193 0.887647287670482 0.915119678712577 0.73479376111027 0.793947578560618 0.709490850507154 0.301000258395631 0.86812372109824 0.209795853201976 0.918789674284249 0.560987092777944 0.071353352835237
+(5y 5 y z 5 F 0.322897933010729 0.550590276177951 0.628469388494906 0.936423978578332 0.938399878874186 0.700568035764899 0.0375011938139768 0.401136527896346 0.232132726965829 0.465167375556954 0.854477673591409 0.321186481311644 0.601678275863019 0.0403285073621635 0.808643595994088 0.134929631392942 0.525247607449536
+g51 1 y e 7 F 0.129033714279026 0.232864384033621 0.436558212905713 0.810603455355391 0.218163132174348 0.7467824290166 0.282378766400105 0.996068607925829 0.471097756642369 0.508757674191867 0.672918329289054 0.0091434029302796 0.782019307745586 0.540614252108851 0.33578972219198 0.958047956861493 0.647744088759121
+( 2 y z 6 F 5h4te+4 0.722966330196726 0.637065775537391 0.951198610265672 0.903046784946495 0.523463794277572 0.570332959002042 0.757492159558571 0.049077648050296 0.511949019774828 0.983758014396725 0.141693817710263 0.0346149352313591 0.955614654474782 0.43362855410287 0.536848200622412 0.870429681664852 0.158725526449032
+6 6 y e 5 F yhe6 0.580654367692078 0.424098276140436 0.956459387015831 0.667091730522105 0.987156468237196 0.23270290523468 0.506567258021703 0.157657286859101 0.934158039531663 0.100582744588671 0.00543057257281332 0.276366137673702 0.836058192741214 0.160204078494507 0.898842910125025 0.66286672214456 0.203927461340644
+98 j7-0 4 y z 3 F theh 0.644502528016206 0.662053737304139 0.0113483457928278 0.0282601148338295 0.630938391969655 0.126423339798572 0.990910788272054 0.598183619914656 0.60125450357768 0.501301982240787 0.273084303937691 0.686099471259438 0.454550085076576 0.924783730297701 0.333954421105444 0.441523248613101 0.20055683200405
+06654h 4 y e 7 F 56 0.352827235332827 0.0217541227637467 0.611559621193868 0.276666638740528 0.495061607430081 0.816262268500797 0.326205008250378 0.439531332356748 0.972297241140637 0.789637338939369 0.39570748778882 0.0548240244354505 0.181788519803465 0.116837628312753 0.0390509357521919 0.437073092741238 0.897053444943847
+60 2 y z 3 F 0.511778286438001 0.299053946391647 0.127393349941781 0.747503427028951 0.815474132321848 0.466363859676536 0.61003856679129 0.11995300831499 0.63149263296722 0.967382850752139 0.303196826092465 0.909361338008149 0.325277631599655 0.58763473928668 0.159857705429294 0.265031623006715 0.506954538974894