diff mixomics_blocksplsda_script.R @ 1:6595c17673cb draft

planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 7ed137ea956b8074c34d43a5e1d46b39ddef1482-dirty
author ppericard
date Wed, 12 Jun 2019 11:22:33 -0400
parents bea08702ed51
children 0a3c83f2197a
line wrap: on
line diff
--- a/mixomics_blocksplsda_script.R	Fri May 17 05:00:22 2019 -0400
+++ b/mixomics_blocksplsda_script.R	Wed Jun 12 11:22:33 2019 -0400
@@ -164,17 +164,17 @@
 # print("Block.splsda variates:")
 # print(mixomics_result$variates)
 
-for(bname in names(mixomics_result$variates))
+for(block_name in names(mixomics_result$variates))
 {
-    # print(bname)
-    # print(mixomics_result$variates[[bname]])
+    # print(block_name)
+    # print(mixomics_result$variates[[block_name]])
 
     # Format the column names to add the block name and replace spaces
-    colnames(mixomics_result$variates[[bname]]) <- paste("block.splsda", bname, gsub(" ", "_", colnames(mixomics_result$variates[[bname]])), sep = "_")
-    # print(mixomics_result$variates[[bname]])
+    colnames(mixomics_result$variates[[block_name]]) <- paste("block.splsda_variates", block_name, gsub(" ", "_", colnames(mixomics_result$variates[[block_name]])), sep = "_")
+    # print(mixomics_result$variates[[block_name]])
 
     # Append the new columns to the sample metadata matrix
-    sample_metadata <- cbind2(sample_metadata, mixomics_result$variates[[bname]])
+    sample_metadata <- cbind2(sample_metadata, mixomics_result$variates[[block_name]])
 }
 
 # print(sample_metadata)
@@ -196,6 +196,9 @@
     meta_variable <- mixomics_result$loadings[[block_name]]
     # print(head(meta_variable))
 
+    # Format the column names to add the block name and replace spaces
+    colnames(meta_variable) <- paste("block.splsda_loadings", gsub(" ", "_", colnames(meta_variable)), sep = "_")
+
     # Read input block variable metadata files if provided (optional)
     if(block_meta_var != "None")
     {