This is a fork and the new version of the kinship2 package.
Initially a set of functions to view pedigrees while developing models that use kinship matrices, the functions were useful enough to put into a package of its own. It has now an S4 class for pedigrees, a kinship function that calculates the kinship matrix from a Pedigree object, and the Pedigree plotting routines that adhere to many of the standards for genetics counselors.
To install this package from Github you can use the following R script:
if (!require("remotes", quietly = TRUE))
install.packages("remotes")
remotes::install_github("louislenezet/Pedixplorer",
build_vignettes=TRUE
)
To install this package you can use the following R script:
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Pedixplorer")
To view documentation for the version of this package installed in your system, start R and enter:
browseVignettes("Pedixplorer")
To see the new functions / modification please use:
utils::news(package="Pedixplorer")
Pedigree()
is a function that creates an S4 class Pedigree object.
The core slot of the Pedigree object is the ped
slot built from having a row
per person, linked by the father id and mother id. Other relationships can be
specified, and affection status can be a matrix of multiple categories in the
rel
slot. All the informations about affection and availability are be stored
respectively in scales$fill
and scales$border
slots and are therefore used
to fill and color the border for each elements of the Pedigree graph.
generate_colors()
is a function that generates a color palette for an
affection status. This function is used by the Pedigree()
function to
generate the scales$fill
and scales$border
slots. The user can also
use this function to generate a color palette for a specific affection
status that will be added to the Pedigree object.
plot.Pedigree()
is a method for a Pedigree object that plots as a
"family tree", with relatives of the same generation on the same row,
and affection statuses divided over the plot symbol for each person.
This function is designed in two steps:
- First the Pedigree object is converted into a data frame with all the
elements needed to plot the Pedigree (i.e. boxes, lines, text, etc.).
This is done by the
ped_to_plotdf()
function. - Then the data frame is plotted using the
plot_fromdf()
function.
kinship()
is a function that creates the kinship matrix from a Pedigree
object. It is coded for dyplotype organisms, handling all relationships that
can be specified for the Pedigree object, including inbreeding, monozygotic
twins, etc. A recent addition is handling the kinship matrix for the X and Y
chromosomes.
-
shrink()
will shrink a Pedigree to a given size, keeping the most informative individuals for a single affection variable. -
fix_parents()
will add parents for children who have a mother or dad listed that is not already included. It will also fix the sex status for the parent if it is mis-specified. This is useful to use before creating the Pedigree object.
The diagrams below show the main functions of the package and how they are related.
Here is the details of the different parts of the diagram.