Skip to content

Commit 75ecedf

Browse files
committed
update: clean and re-arrange
1 parent 61d5999 commit 75ecedf

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

tests/runTests.R

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# VersionX: 02 Aug 2018
66

77
library(Gimpute)
8+
library(lattice)
9+
library(doParallel)
810

911
## Start an R session in a directory where you'd like to generate the data.
1012
system("mkdir 1-genoUpdate")
@@ -30,31 +32,20 @@ toolDIR <- "/home/junfang.chen/Gimpute/tools/"
3032
plink <- paste0(toolDIR, "plink")
3133
gcta <- paste0(toolDIR, "gcta64")
3234
shapeit <- paste0(toolDIR, "shapeit")
33-
gtool <- paste0(toolDIR, "gtool")
34-
## Gimpute has the following dependencies:
35+
gtool <- paste0(toolDIR, "gtool")
3536
qctool <- paste0(toolDIR, "qctool")
36-
3737
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"){
4141
impute <- paste0(toolDIR, "impute4.1_r291.2")
42-
} else {
43-
print("Wrong imputeTool or no imputation tool is provided!")
44-
}
45-
42+
}
4643

47-
library(lattice)
48-
library(doParallel)
49-
5044

5145
############################################################
52-
5346
## Run the following code, only if you have the above tools
5447
## and the imputation reference files, configuration files.
55-
5648
############################################################
57-
5849

5950
############################################################
6051
## code chunk number 1: SNP information update
@@ -162,12 +153,14 @@ plotPCA4plink(gcta, inputPrefix, nThread=nCores,
162153

163154

164155
## remove outliers
156+
# cutoff <- NULL
165157
cutoff <- c(-0.4, 0.2)
166158
cutoffSign <- "greater" ## not used if cutoff == NULL, and with two values
167159
inputPC4subjFile <- "2_14_eigenvalAfterQC.txt"
168160
outputPC4outlierFile <- "2_14_eigenval4outliers.txt"
169161
outputPCplotFile <- "2_14_removedOutliers.png"
170162
outputPrefix <- "2_14_removedOutliers"
163+
nCores <- detectCores()
171164
removeOutlierByPCs(plink, gcta, inputPrefix, nThread=nCores,
172165
cutoff, cutoffSign, inputPC4subjFile,
173166
outputPC4outlierFile, outputPCplotFile, outputPrefix)
@@ -206,6 +199,7 @@ out3.snp <- "3_3_snpMissPos"
206199
out4 <- "3_4_removedSnpDiffAlleles"
207200
out4.snp <- "3_4_snpDiffAlleles"
208201
out4.snpRetained <- "3_4_snpImpRefAlleles"
202+
nCores <- detectCores()
209203
checkAlign2ref(plink, inputPrefix, referencePanel, bimReferenceFile,
210204
out2, out2.snp, out3, out3.snp,
211205
out4, out4.snp, out4.snpRetained, nCore=nCores)
@@ -266,7 +260,7 @@ out2 <- "4_4_removedMonoSnpAfter"
266260
out3 <- "4_5_addedMonoSnpAfter"
267261
out4 <- "4_6_removedSnpMissPostImp"
268262
outputInfoFile <- "4_2_snpImputedInfoScore.txt"
269-
outputMonoSNPfile <- "4_1_snpMonoRemoved.txt" # will be used in step 4,5.
263+
outputMonoSNPfile <- "4_1_snpMonoRemoved.txt"
270264
prefixAlign2ref <- "3_4_removedSnpDiffAlleles"
271265
outRemovedSNPfile <- "4_6_snpRemovedMissPostImp.txt"
272266
outRetainSNPfile <- "4_6_snpRetainMissPostImp.txt"

0 commit comments

Comments
 (0)