-
Notifications
You must be signed in to change notification settings - Fork 0
/
lassosum.R
139 lines (111 loc) · 4.33 KB
/
lassosum.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# .libPaths(c('../R-env/prs-R',.libPaths()))
source('constants.R')
source('utils.R')
library(dplyr)
library(lassosum)
# Prefer to work with data.table as it speeds up file reading
library(data.table)
library(methods)
library(magrittr)
# For multi-threading, you can use the parallel package and
# invoke cl which is then passed to lassosum.pipeline
library(parallel)
grid.ids.default <- "0.2,0.5,0.9,1"
method<-'ls'
args <- commandArgs(trailing = TRUE)
parse.args(args, grid.ids.default,method)
print("0. Prepare workspace")
# This will invoke multiple threads.
cl <- makeForkCluster(7)
# print("1. Read in the phenotype and covariate files")
print('Read in the phenotype file')
ds.train.file.name <- paste(imp.train.path, paste0(ds.prefix, train.suffix), sep="/")
ds.test.file.name <- paste(imp.test.path, paste0("ds", test.suffix), sep="/")
# pheno.test.file.name <- paste(imp.test.path, paste0("pheno", sub, test.suffix), sep="/")
# print(paste0("pheno file: ", pheno.test.file.name))
print(paste0("train bed file: ", ds.train.file.name))
print(paste0("test bed file: ", ds.test.file.name))
# phenotype <- read.table(pheno.test.file.name, header=T)
# print('Filter samples w/o phenotype')
# phenotype=phenotype[phenotype$label!=-1,]
# print("Calibrate label values")
# phenotype[,'label']<- phenotype[,'label']-1
# print('Read in the PCs')
# pcs <-