5
5
# VersionX: 02 Aug 2018
6
6
7
7
library(Gimpute )
8
+ library(lattice )
9
+ library(doParallel )
8
10
9
11
# # Start an R session in a directory where you'd like to generate the data.
10
12
system(" mkdir 1-genoUpdate" )
@@ -30,31 +32,20 @@ toolDIR <- "/home/junfang.chen/Gimpute/tools/"
30
32
plink <- paste0(toolDIR , " plink" )
31
33
gcta <- paste0(toolDIR , " gcta64" )
32
34
shapeit <- paste0(toolDIR , " shapeit" )
33
- gtool <- paste0(toolDIR , " gtool" )
34
- # # Gimpute has the following dependencies:
35
+ gtool <- paste0(toolDIR , " gtool" )
35
36
qctool <- paste0(toolDIR , " qctool" )
36
-
37
37
imputeTool <- " impute4"
38
- if (imputeTool == " impute2" ){
39
- impute <- paste0(toolDIR , " impute2" )
40
- } else if (imputeTool == " impute4" ){
38
+ if (imputeTool == " impute2" ){
39
+ impute <- paste0(toolDIR , " impute2" )
40
+ } else if (imputeTool == " impute4" ){
41
41
impute <- paste0(toolDIR , " impute4.1_r291.2" )
42
- } else {
43
- print(" Wrong imputeTool or no imputation tool is provided!" )
44
- }
45
-
42
+ }
46
43
47
- library(lattice )
48
- library(doParallel )
49
-
50
44
51
45
# ###########################################################
52
-
53
46
# # Run the following code, only if you have the above tools
54
47
# # and the imputation reference files, configuration files.
55
-
56
48
# ###########################################################
57
-
58
49
59
50
# ###########################################################
60
51
# # code chunk number 1: SNP information update
@@ -162,12 +153,14 @@ plotPCA4plink(gcta, inputPrefix, nThread=nCores,
162
153
163
154
164
155
# # remove outliers
156
+ # cutoff <- NULL
165
157
cutoff <- c(- 0.4 , 0.2 )
166
158
cutoffSign <- " greater" # # not used if cutoff == NULL, and with two values
167
159
inputPC4subjFile <- " 2_14_eigenvalAfterQC.txt"
168
160
outputPC4outlierFile <- " 2_14_eigenval4outliers.txt"
169
161
outputPCplotFile <- " 2_14_removedOutliers.png"
170
162
outputPrefix <- " 2_14_removedOutliers"
163
+ nCores <- detectCores()
171
164
removeOutlierByPCs(plink , gcta , inputPrefix , nThread = nCores ,
172
165
cutoff , cutoffSign , inputPC4subjFile ,
173
166
outputPC4outlierFile , outputPCplotFile , outputPrefix )
@@ -206,6 +199,7 @@ out3.snp <- "3_3_snpMissPos"
206
199
out4 <- " 3_4_removedSnpDiffAlleles"
207
200
out4.snp <- " 3_4_snpDiffAlleles"
208
201
out4.snpRetained <- " 3_4_snpImpRefAlleles"
202
+ nCores <- detectCores()
209
203
checkAlign2ref(plink , inputPrefix , referencePanel , bimReferenceFile ,
210
204
out2 , out2.snp , out3 , out3.snp ,
211
205
out4 , out4.snp , out4.snpRetained , nCore = nCores )
@@ -266,7 +260,7 @@ out2 <- "4_4_removedMonoSnpAfter"
266
260
out3 <- " 4_5_addedMonoSnpAfter"
267
261
out4 <- " 4_6_removedSnpMissPostImp"
268
262
outputInfoFile <- " 4_2_snpImputedInfoScore.txt"
269
- outputMonoSNPfile <- " 4_1_snpMonoRemoved.txt" # will be used in step 4,5.
263
+ outputMonoSNPfile <- " 4_1_snpMonoRemoved.txt"
270
264
prefixAlign2ref <- " 3_4_removedSnpDiffAlleles"
271
265
outRemovedSNPfile <- " 4_6_snpRemovedMissPostImp.txt"
272
266
outRetainSNPfile <- " 4_6_snpRetainMissPostImp.txt"
0 commit comments