-
Notifications
You must be signed in to change notification settings - Fork 1
/
2_MetaSKATO.R
54 lines (36 loc) · 1.11 KB
/
2_MetaSKATO.R
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
library('MetaSKAT')
library(SKAT)
# Parameters
args = unlist(strsplit(commandArgs(trailingOnly = TRUE)," "))
inputPath <- args[1]
outputPath <- args[2]
list_cohort <- args[3:length(args)]
# Work path
setwd(inputPath)
# Data path
n_cohort <- length(list_cohort)
File.Mat.vec <- rep("", n_cohort)
File.Info.vec <- rep("", n_cohort)
Group_Idx <- c()
# Load cohort data
for (nc_ in 1:length(list_cohort)){
cohort_ <- list_cohort[nc_]
print(cohort_)
# Data path
File.Mat <- sprintf("./%s.cohort_%s.MSSD", cohort_, cohort_)
File.SetInfo <- sprintf("./%s.cohort_%s.MInfo", cohort_, cohort_)
# List
File.Mat.vec[nc_] <- File.Mat
File.Info.vec[nc_] <- File.SetInfo
# Group_Idx
if (cohort_ == 'ZIB_AD'){
Group_Idx <- c(Group_Idx, 1)
} else{
Group_Idx <- c(Group_Idx, 2)
}
}
# Execute the SKAT-O analysis
Cohort.Info <- Open_MSSD_File_2Read(File.Mat.vec, File.Info.vec)
table_res <- MetaSKAT_MSSD_ALL(Cohort.Info, combined.weight=FALSE, is.separate = TRUE, MAF.cutoff=0.05, method='optimal', Group_Idx=Group_Idx)
# Write
write.table(table_res, outputPath, quote=F, row.names=F, sep=",")