aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/biweight.R
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/computations/biweight.R')
-rw-r--r--gn3/computations/biweight.R14
1 files changed, 8 insertions, 6 deletions
diff --git a/gn3/computations/biweight.R b/gn3/computations/biweight.R
index 8730536..e424360 100644
--- a/gn3/computations/biweight.R
+++ b/gn3/computations/biweight.R
@@ -1,10 +1,11 @@
library(WGCNA)
-FetchArgs <- function(){
- myArgs <- commandArgs(trailingOnly = TRUE)
- trait_vals <- as.numeric(unlist(strsplit(myArgs[1], split=" ")))
- target_vals <- as.numeric(unlist(strsplit(myArgs[2], split=" ")))
+arg_values <- commandArgs(trailingOnly = TRUE)
+ParseArgs <- function(args){
+
+ trait_vals <- as.numeric(unlist(strsplit(args[1], split=" ")))
+ target_vals <- as.numeric(unlist(strsplit(args[2], split=" ")))
return(list(trait_vals= c(trait_vals),target_vals = c(target_vals)))
@@ -13,9 +14,10 @@ BiweightMidCorrelation <- function(trait_val,target_val){
results <- bicorAndPvalue(c(trait_val),c(target_val))
return ((c(c(results$bicor)[1],c(results$p)[1])))
+
}
-results <- (BiweightMidCorrelation(FetchArgs()[1],FetchArgs()[2]))
+parsed_values <- ParseArgs(arg_values)
-cat(results) \ No newline at end of file
+cat((BiweightMidCorrelation(parsed_values[1],parsed_values[2]))) \ No newline at end of file