aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/computations/biweight.R31
1 files changed, 12 insertions, 19 deletions
diff --git a/gn3/computations/biweight.R b/gn3/computations/biweight.R
index 650c5fd..8730536 100644
--- a/gn3/computations/biweight.R
+++ b/gn3/computations/biweight.R
@@ -1,28 +1,21 @@
-# library(WGCNA)
+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=" ")))
-myArgs <- commandArgs(trailingOnly = TRUE)
-trait_vals <- as.numeric(unlist(strsplit(myArgs[1], split=" ")))
-target_vals <- as.numeric(unlist(strsplit(myArgs[2], split=" ")))
+ return(list(trait_vals= c(trait_vals),target_vals = c(target_vals)))
-BiweightMidCorrelation <- function(trait_val,target_val){
- results <- bicorAndPvalue(trait_val,target_val)
- return (list(c(results$bicor)[1],c(results$p)[1]))
}
+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]))
-
-
-# the idea is that you get the entire dataset in any format
-# and then do ther correlation
-
-ComputeAll <-function(trait_val,target_dataset) {
- for target_val in target_dataset {
- results = BiweightMidCorrelation(trait_val,target_val)
- cat(BiweightMidCorrelation(trait_vals,target_vals))
- }
-}
-
+cat(results) \ No newline at end of file