This is the basic constructor of ped
objects. Utility functions for
creating many common pedigree structures are described in ped_basic.
ped(
id,
fid,
mid,
sex,
famid = "",
reorder = TRUE,
validate = TRUE,
verbose = FALSE
)singleton(id = 1, sex = 1, famid = "")
a vector (numeric or character) of individual ID labels.
a vector of the same length as id
, containing the labels of the
fathers. In other words fid[i]
is the father of id[i]
, or 0 if id[i]
is a founder.
a vector of the same length as id
, containing the labels of the
mothers. In other words mid[i]
is the mother of id[i]
, or 0 if id[i]
is a founder.
a numeric of the same length as id
, describing the genders of
the individuals (in the same order as id
.) Each entry must be either 1
(=male), 2 (=female) or 0 (=unknown).
a character string. Default: An empty string.
a logical. If TRUE, the pedigree is reordered so that all parents precede their children.
a logical. If TRUE, validatePed()
is run before returning
the pedigree.
a logical.
A ped
object, which is essentially a list with the following
entries:
ID
: A character vector of ID labels. Unless the pedigree is reordered
during creation, this equals as.character(id)
FIDX
: An integer vector with paternal indices: For each FIDX[j]
is 0 if ID[j]
has no father within the
pedigree; otherwise ID[FIDX[j]]
is the father of ID[j]
.
MIDX
: An integer vector with maternal indices: For each MIDX[j]
is 0 if ID[j]
has no mother within the
pedigree; otherwise ID[MIDX[j]]
is the mother of ID[j]
.
SEX
: An integer vector with gender codes. Unless the pedigree is
reordered, this equals as.integer(sex)
.
FAMID
: The family ID.
UNBROKEN_LOOPS
: A logical: TRUE if the pedigree is inbred.
LOOP_BREAKERS
: A matrix with loop breaker ID's in the first column and
their duplicates in the second column. All entries refer to the internal
IDs. This is usually set by breakLoops()
.
FOUNDER_INBREEDING
: A list of two potential entries, "autosomal" and "x"; both numeric vectors with the same length as
founders(x)
. FOUNDER_INBREEDING
is always NULL when a new ped
is created.
See founderInbreeding()
.
MARKERS
: A list of marker
objects, or NULL.
A singleton is a special ped
object whose pedigree contains 1 individual.
The class attribute of a singleton is c('singleton', 'ped')
.
Selfing, i.e. the presence of pedigree members whose father and mother are
the same individual, is allowed in ped
objects. Any such "self-fertilizing"
parent must have undecided gender (sex = 0
).
If the pedigree is disconnected, it is split into its connected components
and returned as a list of ped
objects.
# NOT RUN {
# Trio
x = ped(id = 1:3, fid = c(0,0,1), mid = c(0,0,2), sex = c(1,2,1))
# Female singleton
y = singleton('NN', sex = 2)
# Selfing
z = ped(id = 1:2, fid = 0:1, mid = 0:1, sex = 0:1)
stopifnot(hasSelfing(z))
# Disconnected pedigree: Trio + singleton
w = ped(id = 1:4, fid = c(2,0,0,0), mid = c(3,0,0,0), sex = c(1,1,2,1))
stopifnot(is.pedList(w), length(w) == 2)
# }
Run the code above in your browser using DataLab