Previous changeset 38:8112bc642858 (2016-10-25) Next changeset 40:8541f9a21aec (2016-10-25) |
Commit message:
Uploaded |
modified:
qualityControl.R |
b |
diff -r 8112bc642858 -r f818e787d0c0 qualityControl.R --- a/qualityControl.R Tue Oct 25 14:41:32 2016 -0400 +++ b/qualityControl.R Tue Oct 25 14:41:59 2016 -0400 |
[ |
@@ -6,8 +6,7 @@ # owner : IRRI # ######################################################## -log <- file(paste(getwd(), "log_QC.txt", sep="/"), open = "wt") -sink(file = log, type="message") + ####################################################### dataStats.nbNA <- function(x) { return(length(x[is.na(x)])) @@ -32,6 +31,7 @@ createReport <- function(genoFile, freqFile, hweFile, out="report.txt") { # get basic statistics (nb markers, nb samples, nb NA) data <- read.table(genoFile, sep="\t", h=T) + missingData <- dataStats.nbNA(data)/length(data) dataDimension <- dataStats.matrixSize(data) # get MAF info freq <- parseFrq(freqFile) @@ -42,7 +42,8 @@ # write report write(paste("number of marker :", dataDimension$nbMarker), file=out) write(paste("number of sample :", dataDimension$nbSample), file=out, append = T) - write.table(info, file=out, append = T) + write(paste("ratio of missing data :", missingData), file=out, append = T) + suppressWarnings(suppressMessages(write.table(info, file=out, append = T))) } ############################ main ########################## cmd <- commandArgs(T) |