Skip to content

Commit

Permalink
Further tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusdv committed May 16, 2023
1 parent aead14d commit de37557
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions R/readFam.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ readFam = function(famfile, useDVI = NA, Xchrom = FALSE, prefixAdded = "added_",
frqs = as.numeric(x[als.lines + 1])

if("0" %in% als) {
warning(sprintf("Illegal allele '0' at locus %s. Changed to '00'.", loc.name), call. = FALSE)
als[als == "0"] = "00"
warning(sprintf("Database error, locus %s: Illegal allele '0'. Changed to 'z'.", loc.name), call. = FALSE)
als[als == "0"] = "z"
}

# Check for illegal alleles, including "Rest allele", with stepwise models
Expand All @@ -260,20 +260,20 @@ readFam = function(famfile, useDVI = NA, Xchrom = FALSE, prefixAdded = "added_",
alsNum = suppressWarnings(as.numeric(als))
if(any(is.na(alsNum))) {
change = TRUE
warning(sprintf("Non-numerical allele '%s' at locus %s incompatible with stepwise model. Changed to 'proportional.",
als[is.na(alsNum)][1], loc.name), call. = FALSE)
warning(sprintf("Database error, locus %s: Non-numerical allele '%s' incompatible with stepwise model. Changed to proportional model.",
loc.name, als[is.na(alsNum)][1]), call. = FALSE)
}
else if(any(alsNum < 1)) {
change = TRUE
warning(sprintf("Database error: Allele '%s' at locus %s is incompatible with stepwise model. Changed to 'proportional'.",
als[alsNum < 1][1], loc.name), call. = FALSE)
warning(sprintf("Database error, locus %s: Allele '%s' incompatible with stepwise model. Changed to proportional model.",
loc.name, als[alsNum < 1][1]), call. = FALSE)
}
else {
badMicro = round(alsNum, 1) != alsNum
if(any(badMicro)) {
change = TRUE
warning(sprintf("Database error: Illegal microvariant '%s' at locus %s. Changed mutation model to 'proportional'.",
als[badMicro][1], loc.name), call. = FALSE)
warning(sprintf("Database error, locus %s: Illegal microvariant '%s'. Changed to proportional model.",
loc.name, als[badMicro][1]), call. = FALSE)
}
}
if(change) {
Expand Down

0 comments on commit de37557

Please sign in to comment.