aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/biweight.R
blob: 650c5fdf84c0a94e150c5f3fe90530e78d7a1ec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# library(WGCNA)


myArgs <- commandArgs(trailingOnly = TRUE)
trait_vals <- as.numeric(unlist(strsplit(myArgs[1], split=" ")))
target_vals <- as.numeric(unlist(strsplit(myArgs[2], split=" ")))

BiweightMidCorrelation <- function(trait_val,target_val){
    results <- bicorAndPvalue(trait_val,target_val)
    return (list(c(results$bicor)[1],c(results$p)[1]))
}






# 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))
	}
}