-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
101 lines (67 loc) · 7.66 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
fig.align = "center",
comment = "#>",
dpi = 300
)
```
# QuickPed
::: { .greeting .message style="color: red;"}
**_Try QuickPed here_**: https://magnusdv.shinyapps.io/quickped.
:::
## What is QuickPed?
QuickPed is an interactive web application for drawing and analysing pedigrees. A created pedigree may be saved as an image, as a *.ped* file (see [below](#ped-files)) or in the form of R code to reproduce the plot. You may also obtain various information about the pedigree, including relatedness coefficients and verbal descriptions of relationships.
QuickPed is powered by the [pedsuite](https://magnusdv.github.io/pedsuite/), and uses [kinship2](https://CRAN.R-project.org/package=kinship2) for plot alignment calculations. The web app was built with Shiny.
## Getting started
Creating pedigrees with QuickPed is very intuitive: Select a suitable start pedigree and modify it as needed. You may also load an existing ped file (see below). Modifications are done by clicking on one or several individuals and then applying appropriate buttons, for instance to add children, siblings or parents. At any time you may change attributes like sex, affection status, twin status and ID labels.
## Tips and tricks
* __Selecting individuals__. Select/deselect pedigree members by clicking on them. Selected individuals are shown in red colour. To deselect everyone, click the <img src="www/hand-pointer-strikethrough.svg" height = "18px" width = "18px" style="border: 1px solid gray; border-radius: 3px;"> button.
* __Adding parents__. If you select a single founder and click "Add Parents," new parents will be created for this individual. From version 4.1.1, you can also assign _existing_ members as parents. First, select the child, then the intended parent(s) — the order of selection matters! Finally, click "Add Parents."
* __Labels__: Automatic labelling of the pedigree members are available in two different formats. The button marked `1,2,..` applies numeric labels to all individuals, in the order of their appearance in the pedigree plot. Alternatively, the `I-1, I-2,..` button numbers the members generation-wise, using roman numerals to indicate the generation number.
* __Line breaks in labels__. By default, pedigree labels are folded automatically to width approximately 12 characters. To insert hard line breaks, use a double space. For instance, if you want "King Lear" to appear on two lines, modify the label to "King`r knitr::asis_output("\U2423\U2423")`Lear", i.e., with two spaces between the words.
* __Text annotation__. Double clicking on a pedigree member opens a popup window, in which text may be added around and inside the symbol for this individual.
* __Plot settings__. If the pedigree gets too large, increase the plot region using the control panel on the far right. Here you may also adjust the margins, the size of pedigree symbols and text labels.
* __R code__. The "R code" button, located on the right side of QuickPed, opens a text window containing R code that reproduces the current pedigree plot. By saving this to a .R file, or simply copy-pasting the code into R, you can explore further plot options (see `?pedtools::plot.ped` for lots of examples!) or use the pedigree as starting point for analysis with the **pedsuite**.
## Built-in pedigrees
In the left-most panel of QuickPed the user may choose among a selection of standard pedigrees, including trios, full/half siblings, avuncular and cousin pedigrees of different kinds. Also included are several interesting (albeit less common) pedigree structures like double cousins and quad half first cousins. Finally, the following *historic pedigrees* are available:
* `Habsburg`: A subset of the infamously inbred family tree of the Habsburg royalties. The inbreeding coefficient of King Charles II of Spain (1661-1700) was approximately 0.25, i.e., equivalent to that of a child produced by full siblings. Pedigree adapted from [Wikipedia](https://en.wikipedia.org/wiki/Habsburg_family_tree). See also [The Role of Inbreeding in the Extinction of a European Royal Dynasty](https://doi.org/10.1371/journal.pone.0005174).
* `Jicaque`: A pedigree of Jicaque Indians originally studied by Chapman & Jacquard (1971) and subsequently used in many papers on relatedness and pedigree coefficients.
* `Queen Victoria (haemophilia)`: The royal family tree descending from Queen Victoria, showing the X-linked inheritance of *haemophilia*. Adapted from Figure S1 of [Genotype Analysis Identifies the Cause of the “Royal Disease"](https://doi.org/10.1126/science.1180660).
* `Tutankhamun`: The family tree of the Egyptian pharao Tutankhamun, as inferred from genetic evidence presented by Hawass et al. (2010), [Ancestry and Pathology in King Tutankhamun's Family](https://doi.org/10.1001/jama.2010.121).
## Relationship information
Under `Relationships` there are four buttons offering different analyses of relationships within the loaded pedigree. The buttons are, in order:
* __Describe relationship__. Prints a standardised description of the relationship between two selected individuals. The text is generated by [verbalisr](https://github.com/magnusdv/verbalisr).
* __Calculate coefficients__. Prints the most important relatedness coefficients between two selected individuals:
* The inbreeding coefficient of each individual.
* The kinship coefficient $\varphi$.
* The degree of relationship.
* The IBD coefficients $\kappa = (\kappa_0, \kappa_1, \kappa_2)$, if both individuals are non-inbred.
* The condensed identity coefficients $\Delta = (\Delta_1, ..., \Delta_9)$, if either individual is inbred.
* __Relatedness triangle__. Produces a plot representing the IBD coefficients $\kappa$ as a point in a *relatedness triangle*.
* __Table of coefficients__. Activates a popup window where the user can choose among a variety of coefficients, including detailed identity and X-chromosomal coefficients, to be computed for each pair of pedigree members. Generates a tab-separated file for download.
More information about these coefficients can be found in the documentation of the [ribd](https://github.com/magnusdv/ribd) package, which is used in the calculations.
## Ped files
A useful feature of QuickPed is to produce text files describing pedigrees in so-called *ped format*. Such files are often required by software for pedigree analysis.
For a simple illustration, consider this pedigree:
```{r trio-ped, echo = F, fig.height = 2, fig.width = 2.2, out.width = "25%", fig.align = "center"}
df = data.frame(id = 1:3, fid = c(0,0,1), mid = c(0,0,2), sex = c(1,2,2), aff = c(1,1,2))
x = pedtools::as.ped(df[1:4])
plot(x, aff = which(df$aff == 2))
```
A text file describing this pedigree may contain the following.
```{r, echo = F, comment = NA}
print(df, row.names = F)
```
The columns are:
* `id`: Individual ID
* `fid`: Father's ID (or 0 if not included in the pedigree)
* `mid`: Mother's ID (or 0 if not included in the pedigree)
* `sex`: Sex (1 = male; 2 = female; 0 = unknown)
* `aff`: Affection status (1 = unaffected; 2 = affected; 0 = unknown)
It should be noted that the ped format is not completely standardised, and different software may use slightly different versions. For example, a first column with *Family ID* is sometimes required. Also, the `aff` column may not be needed in non-medical applications. These and other details may be specified when using QuickPed.
Some pedigree information may be shown on the plot, but is *not* stored in the ped file. In the current version of QuickPed, this includes colours, text annotations (expect main labels), twin relationships, and `deceased` status.