PedPolish {sequoia} | R Documentation |
Fix Pedigree
Description
Ensure all parents & all genotyped individuals are included, remove duplicates, rename columns, and replace 0 by NA or v.v..
Usage
PedPolish(
Pedigree,
gID = NULL,
ZeroToNA = TRUE,
NAToZero = FALSE,
DropNonSNPd = TRUE,
FillParents = FALSE,
KeepAllColumns = TRUE,
KeepAllRows = FALSE,
NullOK = FALSE,
LoopCheck = TRUE,
StopIfInvalid = TRUE
)
Arguments
Pedigree |
dataframe where the first 3 columns are id, dam, sire. |
gID |
character vector with ids of genotyped individuals (rownames of genotype matrix). |
ZeroToNA |
logical, replace 0's for missing values by NA's (defaults to
|
NAToZero |
logical, replace NA's for missing values by 0's. If
|
DropNonSNPd |
logical, remove any non-genotyped individuals (but keep
non-genotyped parents), & sort pedigree in order of |
FillParents |
logical, for individuals with only 1 parent assigned, set
the other parent to a dummy (without assigning siblings or grandparents).
Makes the pedigree compatible with R packages and software that requires
individuals to have either 2 or 0 parents, such as
|
KeepAllColumns |
Keep all columns in |
KeepAllRows |
Keep all rows in |
NullOK |
logical, is it OK for Ped to be NULL? Then NULL will be returned. |
LoopCheck |
logical, check for invalid pedigree loops by calling
|
StopIfInvalid |
if a pedigree loop is detected, stop with an error (TRUE, default). |
Details
Recognized column names are an exact or partial match with (case is ignored):
- id
"id", "iid", "off"
- dam
"dam", "mother", "mot", "mom", "mum", "mat"
- sire
"sire", "father", "fat", "dad", "pat"
sequoia
requires the column order id - dam - sire; columns 2 and 3 are
swapped by this function if necessary.
Examples
## Not run:
# To get the output pedigree into kinship2 compatible format:
PedP <- sequoia::PedPolish(SeqOUT$Pedigree, DropNonSNPd=FALSE,
FillParents = TRUE)
PedP$Sex <- with(PedP, ifelse(id %in% dam, "female", "male"))
# default to 'male' to avoid warning: "More than 25% of the gender values are
# 'unknown'"
Ped.fix <- with(PedP, kinship2::fixParents(id=id, dadid=sire, momid=dam,
sex=Sex))
Ped.k <- with(Ped.fix, kinship2::pedigree(id, dadid, momid, sex, missid=0))
## End(Not run)