comparison 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
comparison
equal deleted inserted replaced
0:bea08702ed51 1:6595c17673cb
162 162
163 ## Save output sample metadata file 163 ## Save output sample metadata file
164 # print("Block.splsda variates:") 164 # print("Block.splsda variates:")
165 # print(mixomics_result$variates) 165 # print(mixomics_result$variates)
166 166
167 for(bname in names(mixomics_result$variates)) 167 for(block_name in names(mixomics_result$variates))
168 { 168 {
169 # print(bname) 169 # print(block_name)
170 # print(mixomics_result$variates[[bname]]) 170 # print(mixomics_result$variates[[block_name]])
171 171
172 # Format the column names to add the block name and replace spaces 172 # Format the column names to add the block name and replace spaces
173 colnames(mixomics_result$variates[[bname]]) <- paste("block.splsda", bname, gsub(" ", "_", colnames(mixomics_result$variates[[bname]])), sep = "_") 173 colnames(mixomics_result$variates[[block_name]]) <- paste("block.splsda_variates", block_name, gsub(" ", "_", colnames(mixomics_result$variates[[block_name]])), sep = "_")
174 # print(mixomics_result$variates[[bname]]) 174 # print(mixomics_result$variates[[block_name]])
175 175
176 # Append the new columns to the sample metadata matrix 176 # Append the new columns to the sample metadata matrix
177 sample_metadata <- cbind2(sample_metadata, mixomics_result$variates[[bname]]) 177 sample_metadata <- cbind2(sample_metadata, mixomics_result$variates[[block_name]])
178 } 178 }
179 179
180 # print(sample_metadata) 180 # print(sample_metadata)
181 181
182 write.table(sample_metadata, file = args$sample_metadata_out, quote = TRUE, sep = "\t", row.names = TRUE, col.names = NA) 182 write.table(sample_metadata, file = args$sample_metadata_out, quote = TRUE, sep = "\t", row.names = TRUE, col.names = NA)
194 block_meta_var <- args$blocks_list[i,4] 194 block_meta_var <- args$blocks_list[i,4]
195 195
196 meta_variable <- mixomics_result$loadings[[block_name]] 196 meta_variable <- mixomics_result$loadings[[block_name]]
197 # print(head(meta_variable)) 197 # print(head(meta_variable))
198 198
199 # Format the column names to add the block name and replace spaces
200 colnames(meta_variable) <- paste("block.splsda_loadings", gsub(" ", "_", colnames(meta_variable)), sep = "_")
201
199 # Read input block variable metadata files if provided (optional) 202 # Read input block variable metadata files if provided (optional)
200 if(block_meta_var != "None") 203 if(block_meta_var != "None")
201 { 204 {
202 input_meta_variable <- read.table(block_meta_var, sep='\t', header=TRUE, row.names=1) 205 input_meta_variable <- read.table(block_meta_var, sep='\t', header=TRUE, row.names=1)
203 # print(head(input_meta_variable)) 206 # print(head(input_meta_variable))