-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathapstest.R
82 lines (64 loc) · 1.95 KB
/
apstest.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
myFile <- "apstest.txt"
writeLines(capture.output(sessionInfo()), myFile)
writeLines(capture.output(sessionInfo()))
cat("\n", file = myFile, append = TRUE)
cat("\n", file = myFile, append = TRUE)
cat("\n")
cat("\n")
myString <- "Testing to see if you are ready for the Population Genomics in R Workshop!"
cat(myString)
cat("\n")
cat("\n")
cat(myString, file = myFile, append = TRUE)
cat("\n", file = myFile, append = TRUE)
cat("\n", file = myFile, append = TRUE)
pkgTest <- function(x){
if( suppressPackageStartupMessages( require(x, quietly = TRUE, character.only = TRUE)) ){
myString <- paste(x, "is installed.")
# print(myString)
# write(myString)
cat(myString)
cat("\n")
cat(myString, file = myFile, append = TRUE)
cat("\n", file = myFile, append = TRUE)
} else {
myString <- paste(x, "is not installed.")
cat(myString)
cat("\n")
cat(myString, file = myFile, append = TRUE)
cat("\n", file = myFile, append = TRUE)
}
flush.console()
}
myPackages <- c("adegenet", "ape", "cowplot", "dplyr", "ggplot2", "hierfstat",
"igraph", "knitr", "lattice", "magrittr", "mmod", "pegas", "pinfsc50",
"poppr", "RColorBrewer", "reshape2", "treemap", "vcfR", "vegan",
"viridisLite")
for(i in 1:length(myPackages)){
pkgTest(myPackages[i])
}
cat("\n", file = myFile, append = TRUE)
myString <- "Testing to see if you can load your data."
cat("\n")
#cat("\n")
cat(myString)
cat("\n")
cat(myString, file = myFile, append = TRUE)
cat("\n", file = myFile, append = TRUE)
#cat("\n", file = myFile, append = TRUE)
dataTest <- function(x){
vcf <- read.vcfR(x, verbose = FALSE)
myShow <- capture.output(vcf)
cat("\n")
cat("\n", file = myFile, append = TRUE)
for(i in 1:length(myShow)){
cat(myShow[i])
cat("\n")
cat(myShow[i], file = myFile, append = TRUE)
cat("\n", file = myFile, append = TRUE)
}
}
myData <- c("pinfsc50_filtered.vcf.gz", "prubi_gbs.vcf.gz")
for(i in 1:length(myData)){
dataTest(myData[i])
}