PedPolish: Fix Pedigree

View source: R/PedPolish.R

PedPolishR 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 TRUE).

NAToZero

logical, replace NA's for missing values by 0's. If TRUE, ZeroToNA is automatically set to FALSE.

DropNonSNPd

logical, remove any non-genotyped individuals (but keep non-genotyped parents), & sort pedigree in order of gID.

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 kinship.

KeepAllColumns

Keep all columns in Pedigree (TRUE, default), or only id - dam - sire (FALSE).

KeepAllRows

Keep all rows in Pedigree (TRUE), or drop rows where id = NA (FALSE, default). Duplicated rows are always removed.

NullOK

logical, is it OK for Ped to be NULL? Then NULL will be returned.

LoopCheck

logical, check for invalid pedigree loops by calling getGenerations.

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)


sequoia documentation built on Sept. 8, 2023, 5:29 p.m.