diff IDchoice/IDchoice_script.R @ 1:bb19b1d15732 draft default tip

Uploaded
author melpetera
date Thu, 19 Dec 2019 05:29:57 -0500
parents b7a6a88f518a
children
line wrap: on
line diff
--- a/IDchoice/IDchoice_script.R	Thu Oct 11 05:47:29 2018 -0400
+++ b/IDchoice/IDchoice_script.R	Thu Dec 19 05:29:57 2019 -0500
@@ -4,6 +4,7 @@
 # User: Galaxy                                                                                 #
 # Starting date: 01-06-2017                                                                    #
 # V-0.1: First version of code                                                                 #
+# V-1.0: Code adjusted to user feedback                                                        #
 #                                                                                              #
 #                                                                                              #
 # Input files: dataMatrix ; Metadata file                                                      #
@@ -46,6 +47,10 @@
 table.check <- match2(DM,meta,metype)
 check.err(table.check)
 
+# Keep metadata original order tracked ----------------------------------------
+
+meta <- data.frame(meta,ori=1:nrow(meta))
+
 
 # Checking unicity of new IDs ----------------------------------------
 
@@ -67,11 +72,11 @@
 	
   }else{
     #Making unique names
-	meta <- cbind(meta,newID=make.unique(meta[,numcol],sep="_"),ori=c(1:nrow(meta)))
+	meta <- cbind(meta,newID=make.unique(meta[,numcol],sep="_"))
   }
 }else{
   #No unicity problem
-  meta <- cbind(meta,newID=meta[,numcol],ori=c(1:nrow(meta)))
+  meta <- cbind(meta,newID=meta[,numcol])
 }
 
 
@@ -92,12 +97,12 @@
 
 # Changing IDs -------------------------------------------------------
 
-DM <- comb.data[,-c(1:(ncol(meta)-2),ncol(meta))]
+DM <- comb.data[,-c(1:(ncol(meta)-1))]
 if(makeun=="no"){
   comb.data <- comb.data[,c(numcol,which(colnames(meta)!=coloname))]
   meta <- comb.data[,c(1:(ncol(meta)-2))]
 }else{
-  meta <- comb.data[,c(ncol(meta)-1,1:(ncol(meta)-2))]
+  meta <- comb.data[,c(ncol(meta),1:(ncol(meta)-2))]
 }
 
 #Transposing back the dataMatrix if necessary