From 88e3bd10a2481e6c00c454a6bf2c60448ada363c Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 16 Jun 2021 08:44:56 +0300 Subject: add fetch args function --- gn3/computations/biweight.R | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'gn3') 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 -- cgit v1.2.3