ped_basic: Create simple pedigrees

ped_basicR Documentation

Create simple pedigrees

Description

Utility functions for creating some common pedigree structures.

Usage

nuclearPed(nch = 1, sex = 1, father = "1", mother = "2", children = NULL)

halfSibPed(
  nch1 = 1,
  nch2 = 1,
  sex1 = 1,
  sex2 = 1,
  type = c("paternal", "maternal")
)

linearPed(n, sex = 1)

cousinPed(
  degree,
  removal = 0,
  side = c("right", "left"),
  half = FALSE,
  child = FALSE
)

avuncularPed(
  top = c("uncle", "aunt"),
  bottom = c("nephew", "niece"),
  side = c("right", "left"),
  type = c("paternal", "maternal"),
  removal = 1,
  half = FALSE
)

halfCousinPed(degree, removal = 0, side = c("right", "left"), child = FALSE)

ancestralPed(g)

selfingPed(s, sex = 1)

Arguments

nch

The number of children, by default 1. If children is not NULL, nch is set to length(children)

sex

A vector with integer gender codes (0=unknown, 1=male, 2=female). In nuclearPed(), it contains the genders of the children and is recycled (if necessary) to length nch. In linearPed() it also contains the genders of the children (1 in each generation) and should have length at most n (recycled if shorter than this). In selfingPed() it should be a single number, indicating the gender of the last individual (the others must necessarily have gender code 0.)

father

The label of the father. Default: "1".

mother

The label of the mother. Default: "2".

children

A character with labels of the children. Default: "3", "4", ...

nch1, nch2

The number of children in each sibship.

sex1, sex2

Vectors of gender codes for the children in each sibship. Recycled (if necessary) to lengths nch1 and nch2 respectively.

type

Either "paternal" or "maternal".

n

The number of generations, not including the initial founders.

degree

A non-negative integer: 0=siblings, 1=first cousins; 2=second cousins, a.s.o.

removal

A non-negative integer. See Details and Examples.

side

Either "right" or "left"; the side on which removals should be added.

half

A logical indicating if the relationship should be "half-like". Default: FALSE.

child

A logical: Should an inbred child be added to the two bottom individuals?

top, bottom

Words indicating the gender combination in avuncular relationships. The first must be either "uncle" or "aunt", while the second is "nephew" or "niece". Both can be abbreviated.

g

A nonnegative integer indicating the number of ancestral generations to include. The resulting pedigree has 2^(g+1)-1 members. The case g = 0 results in a singleton.

s

A nonnegative integer indicating the number of consecutive selfings. The case s = 0 results in a singleton.

Details

halfSibPed(nch1, nch2) produces a pedigree containing two sibships (of sizes nch1 and nch2) with the same father, but different mothers. If maternal half sibs are wanted instead, add type = "maternal".

cousinPed(degree = n, removal = k) creates a pedigree with two n'th cousins, k times removed. By default, removals are added on the right side, but this can be changed by adding side = left.

halfCousinPed(...) is a synonym for cousinPed(..., half = TRUE).

avuncularPed() creates uncle/aunt - nephew/niece pedigrees. The empty call avuncularPed() is equivalent to avuncularPed("uncle", "nephew"). Note that the arguments can be abbreviated, so that e.g. avuncularPed("a", "ni") produces an aunt-niece relationship. Grand (and great-grand etc) uncles/aunts can be produced by specifying removal greater than 1.

ancestralPed(g) returns the family tree of a single individual, including all ancestors g generations back.

selfingPed(s) returns a line of s consecutive selfings.

Value

A ped object.

See Also

ped(), singleton(), ped_complex, ped_subgroups

Examples


# A nuclear family with 2 boys and 3 girls
nuclearPed(5, sex = c(1, 1, 2, 2, 2))

# A straight line of females
linearPed(3, sex = 2)

# Paternal half brothers
halfSibPed()

# Maternal half sisters
halfSibPed(sex1 = 2, sex2 = 2, type = "maternal")

# Larger half sibships: boy and girl on one side; 3 girls on the other
halfSibPed(nch1 = 2, sex = 1:2, nch2 = 3, sex2 = 2)

# Grand aunt:
cousinPed(degree = 0, removal = 2)

# Second cousins once removed.
cousinPed(degree = 2, removal = 1)

# Same, but with the 'removal' on the left side.
cousinPed(2, 1, side = "left")

# A child of half first cousins.
halfCousinPed(degree = 1, child = TRUE)

# The 'family tree' of a person
ancestralPed(g = 2)


pedtools documentation built on Nov. 5, 2023, 5:06 p.m.