changeset 6:083886b3f3db draft

Uploaded
author spficklin
date Thu, 21 Nov 2019 09:26:15 +0000
parents 75b87f1278a2
children ffbafe466107
files aurora_wgcna_render.R
diffstat 1 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/aurora_wgcna_render.R	Thu Nov 21 09:26:00 2019 +0000
+++ b/aurora_wgcna_render.R	Thu Nov 21 09:26:15 2019 +0000
@@ -30,6 +30,8 @@
 library(DT)
 library(htmltools)
 library(ggplot2)
+library(reshape2)
+library(caret)
 
 # ------------------------------------------------------------------
 # Handle arguments from command line
@@ -40,7 +42,7 @@
     # Input Files
     'trait_data',                  't', 2, 'character',
     'expression_data',             'e', 1, 'character',
-  
+
     # Input Arguments
     'missing_value',               'i', 1, 'character',
     'sname_col',                   'c', 2, 'integer',
@@ -48,8 +50,10 @@
     'height_cut',                  'h', 2, 'double',
     'power',                       'p', 2, 'double',
     'block_size',                  'b', 1, 'integer',
-    'hard_threshold',              'j', 1, 'integer',
-    
+    'hard_threshold',              'j', 1, 'double',
+    'one_hot_cols',                'y', 2, 'character',
+    'ignore_cols',                 'x', 2, 'character',
+
     # Output Files
     'gene_module_file',            'k', 1, 'character',
     'network_edges_file',          'w', 1, 'character',
@@ -64,6 +68,17 @@
 
 opt = getopt(spec)
 
+# We have to have values for the one_hot_cols and ignore_cols but the
+# fact these are optional means that we might not get a value for them and the
+# getopt function will then leave them out.  So, we need to make sure they are
+# there.
+if (!"one_hot_cols" %in% names(opt)) {
+  opt[["one_hot_cols"]] <- ''
+}
+if (!"ignore_cols" %in% names(opt)) {
+  opt[["ignore_cols"]] <- ''
+}
+
 # Define environment variables for all input values. This will allow use
 # of the input arguments in the Rmarkdown template file.
 do.call(Sys.setenv, opt[-1])
@@ -79,11 +94,14 @@
 sink(zz)
 sink(zz, type = 'message')
 
+# Print the options
+print(opt)
+
 # Next render the R markdown template file.
 system(command = paste0('cp ', tool_directory, '/aurora_wgcna.Rmd ./'))
 render(input = 'aurora_wgcna.Rmd',  output_file = opt$network_construction_report)
 
-# If the trait data was provided then we'll continue the 
+# If the trait data was provided then we'll continue the
 # analysis.
 if (!is.null(opt$trait_data)) {
   system(command = paste0('cp ', tool_directory, '/aurora_wgcna_trait.Rmd ./'))