aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/biweight.R
diff options
context:
space:
mode:
authorAlexander Kabui2021-06-16 08:44:56 +0300
committerAlexander Kabui2021-06-16 08:44:56 +0300
commit88e3bd10a2481e6c00c454a6bf2c60448ada363c (patch)
tree54ce73f76b23bac4b6bbf8683cbd3398c6261d3f /gn3/computations/biweight.R
parentc708f435f14e5394aa4e6e8f556aec976d61341f (diff)
downloadgenenetwork3-88e3bd10a2481e6c00c454a6bf2c60448ada363c.tar.gz
add fetch args function
Diffstat (limited to 'gn3/computations/biweight.R')
-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