Pedigree {GeneticsPed} | R Documentation |
Pedigree
function creates a pedigree object
Pedigree(x, subject="id", ascendant=c("father", "mother"), ascendantSex=c(1, 2), ascendantLevel=c(1, 1), unknown=NA, sex=NA, dtBirth=NA, generation=NA, family=NA, generationOrder="increasing", check=TRUE, sort=FALSE, extend=FALSE, drop=TRUE, codes=FALSE)
x |
data.frame or matrix |
subject |
character, column name in x for subjects |
ascendant |
character, column name(s) in x for ascendants |
family |
character, column name in x for family |
ascendantSex |
integer orcharacter, sex of ascendant(s); see details |
ascendantLevel |
integer, generation level of ascendant(s); see details |
unknown |
vector or list, uknown representation of identification and other data in the pedigree; see details |
sex |
character, column name in x for sex |
dtBirth |
character, column name in x for date of birth |
generation |
character, column name in x for generation |
generationOrder |
character, generation value is "increasing" or "decreasing" through generations; see details |
check |
logical, check for common errors |
sort |
logical, sort pedigree |
extend |
logical, extend pedigree |
drop |
logical, drop unused levels if factors are used |
codes |
logical, code individuals into integers |
FIXME: study geneSet class
Pedigree can be one source of information on genetic relationship between relatives. Take for example the following pedigree:
paternal paternal maternal maternal grandfather grandmother grandfather grandmother | | | | ------------- ------------- | | father mother | | ------------------------- | subject
This information can be stored in a data.frame as
mother | maternal grandfather | maternal grandmother |
father | paternal grandfather | paternal grandmother |
subject | father | mother |
There is considerable variability in terminology between as well as
within various fields of genetics. We use the following terms throughout
the help and code: individual (any individual in a pedigree), subject
(individual whose pedigree is given i.e. individuals in the first column
in upper data.frame), ascendant and descendant. Additionally, family,
sex, dtBirth and generation are used for additional data in the
pedigree. Their meaning should be clear. For these, argument col
is usually used in function calls.
family
TODO
ascendantSex
can be used to define sex of ascendant(s); for
example c("Male", "Female") or c("M", "F") or even c(1, 2) for father
and mother or c(2, 1, 1) for mother and two possible fathers or c(1, 1)
for father and maternal father etc. This data is needed only for the
structure of the class and defaults should be ok for the majority. But
you need to make sure that data defined here must be in accordance with
values in sex
column.
ascendantLevel
can be used to define generation level of
ascendant(s) in relation to a subject; for example c(1, 1) for father
and mother or c(1, 1, 1) for mother and two possible fathers or c(1, 2)
for father and maternal father etc. This data is needed only for the
structure of the class and defaults should be ok for the majority.
There is no need for as.integer
TODO in arguments
ascendantLevel
as this is done internally.
unknown TODO
Sex TODO
Date of birth TODO
generationOrder
defines in which order are
generation
values: "increasing" if values increase from
ascendants to descendants and "decreasing" if values decrease from
ascendants to descendants.
check
, sort
, extend
, and
codes
are actions on the pedigree and have their own help
pages.
Individuals can be stored as either integer, numeric or factor TODO. In
any case all id columns must have the same class and this is
automatically checked. Argument drop
can be used to drop unused
levels, if factors are used.
as.Pedigree.*
FIXME
as.*.Pedigree
FIXME
Object of Pedigree class is a data.frame with columns that can be divided into core columns (subject, ascendant(s), sex, dtBirth and generationTODO) and possibly other columns such as data on phenotype and genotype and other subject attributes, for example factors and covariates TODO. Class name starts in upper case i.e. “Pedigree” and not “pedigree”, due to name clash with similar function in kinship package.
Additionally, the following attributes are set on pedigree:
Pedigree object as described in the details
Gregor Gorjanc
check
,
sort
, and extend
provide help on pedigree
utility functions. There is also pedigree
in
kinship package
data(Mrode2.1) Mrode2.1$dtB <- as.Date(Mrode2.1$dtB) x2.1 <- Pedigree(x=Mrode2.1, subject="sub", ascendant=c("fat", "mot"), ascendantSex=c("M", "F"), family="fam", sex="sex", generation="gen", dtBirth="dtB") if (FALSE) { ## How to handle different pedigree types ## * multiple parents ped2 <- ped ped2$father1 <- ped$father ped2$father2 <- ped$father ped2$father <- NULL ped2 <- as.data.frame(ped2) str(Pedigree(ped2, ascendant=c("father1", "father2", "mother"), ascendantSex=c(1, 1, 2), ascendantLevel=c(1, 1, 1))) ## * different level of parents ped3 <- as.data.frame(ped) ped3$m.grandfather <- ped3$mother ped3$mother <- NULL str(Pedigree(ped3, ascendant=c("father", "m.grandfather"), ascendantSex=c(1, 1), ascendantLevel=c(1, 2))) }