Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
src/*.o
src/*.gcda
src/*.so
src/*.dylib
src/Makevars
Expand Down
4 changes: 3 additions & 1 deletion R/QtlDataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ setMethod("getScaleResiduals", "QtlDataset", function(x) x@scaleResiduals)
si <- x@genotypes@snpInfo
snpMask <- nchar(as.character(si$A1[snpIdx])) == 1L &
nchar(as.character(si$A2[snpIdx])) == 1L
snpIdx <- snpIdx[snpMask]
# which() (not snpMask directly) so any NA in the mask drops that variant
# rather than injecting an NA index that would corrupt the extracted block.
snpIdx <- snpIdx[which(snpMask)]
if (length(snpIdx) == 0L) {
return(list(
geno = matrix(numeric(0), nrow = 0L, ncol = 0L,
Expand Down
6 changes: 5 additions & 1 deletion R/genotypeIo.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ setMethod("readGenotypes",
stop("Plink file not found: ", f)
}

# colClasses = "character" so type.convert() never coerces a column: a bim
# whose allele column is uniformly "T"/"F" (e.g. all-A/T SNPs) would otherwise
# be read as logical TRUE/FALSE, silently corrupting A1/A2 (BP is cast to
# integer explicitly below).
bim <- read.table(bimFile, header = FALSE,
stringsAsFactors = FALSE,
colClasses = "character",
col.names = c("CHR", "SNP", "CM", "BP", "A1", "A2"))
fam <- read.table(famFile, header = FALSE, stringsAsFactors = FALSE)
sampleIds <- as.character(fam[, 2]) # IID column
Expand Down
Loading