6 args = commandArgs(trailingOnly = TRUE)
8 # (input_file_name, output_file_name, trait_name)
9 input_file_name <- args[1]
10 print(input_file_name)
11 output_file_name <- args[2]
12 print(output_file_name)
15 # errorMessages <- c()
17 table <- read.csv(input_file_name)
20 table <- table[rowSums(is.na(table)) != ncol(table), ]
25 test <- rosnerTest(table[, 1], k = outliers_number)
27 # table[test$all.stats$Obs.Num, 2]
29 ##### Default for test k = 3 loop if more outliers then 3 - it should return table with one extra row with first non outlier value #####
30 while (test$n.outliers == outliers_number) {
31 outliers_number = outliers_number + 1
32 test <- rosnerTest(table[, 1], k = outliers_number)
35 # change observation number in data frame to phenotype id
36 test$all.stats$Obs.Num <- table[test$all.stats$Obs.Num, 2]
38 # write csv file without first row
39 write.csv(file = output_file_name, test$all.stats, row.names = FALSE)