ped {pedtools} | R Documentation |
Pedigree construction
Description
This is the basic constructor of ped
objects. Utility functions for
creating many common pedigree structures are described in ped_basic. See
also as.ped()
and readPed()
, which are more liberal regarding the input
format.
Usage
ped(
id,
fid,
mid,
sex,
famid = "",
reorder = TRUE,
validate = TRUE,
detectLoops = TRUE,
isConnected = FALSE,
verbose = FALSE
)
singleton(id = 1, sex = 1, famid = "")
singletons(id, sex = 1)
Arguments
id |
A vector (coercible to character) of individual ID labels. |
fid , mid |
Vectors of the same length as |
sex |
A numeric of the same length as |
famid |
A character string. Default: An empty string. |
reorder |
A logical indicating if the pedigree should be reordered so that all parents precede their children. Default: TRUE. |
validate |
A logical indicating if a validation of the pedigree structure should be performed. Default: TRUE. |
detectLoops |
A logical indicating if the presence of loops should be detected. Setting this to FALSE may speed up the processing of large pedigrees. Default: TRUE. |
isConnected |
A logical indicating if the input is known to be a connected pedigree. Setting this to TRUE speeds up the processing. Default: FALSE. |
verbose |
A logical. |
Details
Each individual must have either both parents specified, or no parents.
Missing parents are indicated with entries "0", "" or NA in fid
and mid
.
Note that id
,fid
,mid
are all converted to character vectors before
matching to establish the parent connections.
If the pedigree is disconnected, it is split into its connected components
and returned as a list of ped
objects.
A singleton is a special ped
object whose pedigree contains 1 individual.
The class attribute of a singleton is c('singleton', 'ped')
.
singletons()
creates a list of singletons with the indicated labels and
sexes.
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 sex (sex = 0
).
Value
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 equalsas.character(id)
-
FIDX
: An integer vector with paternal indices: For eachj = 1,2,...
, the entryFIDX[j]
is 0 ifID[j]
has no father within the pedigree; otherwiseID[FIDX[j]]
is the father ofID[j]
. -
MIDX
: An integer vector with maternal indices: For eachj = 1,2,...
, the entryMIDX[j]
is 0 ifID[j]
has no mother within the pedigree; otherwiseID[MIDX[j]]
is the mother ofID[j]
. -
SEX
: An integer vector with gender codes. Unless the pedigree is reordered, this equalsas.integer(sex)
. -
FAMID
: The family ID. -
UNBROKEN_LOOPS
: A logical indicating if the pedigree has unbroken loops, or NA if the status is currently unknown. -
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 bybreakLoops()
. -
FOUNDER_INBREEDING
: A list of two potential entries, "autosomal" and "x"; both numeric vectors with the same length asfounders(x)
.FOUNDER_INBREEDING
is always NULL when a newped
is created. SeefounderInbreeding()
. -
MARKERS
: A list ofmarker
objects, or NULL.
Author(s)
Magnus Dehli Vigeland
See Also
newPed()
, ped_basic, ped_modify, ped_subgroups, relabel()
Examples
# 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
ped(id = 1:4, fid = c(2,0,0,0), mid = c(3,0,0,0), sex = c(1,1,2,1))
# List of singletons
singletons(1:2)