-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
83 lines (62 loc) · 3.32 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.align = "center",
dpi = 300
)
```
# pedtools <img src="man/figures/logo.png" align="right" height=140/>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/pedtools)](https://CRAN.R-project.org/package=pedtools)
[![](https://cranlogs.r-pkg.org/badges/grand-total/pedtools?color=yellow)](https://cran.r-project.org/package=pedtools)
[![](https://cranlogs.r-pkg.org/badges/last-month/pedtools?color=yellow)](https://cran.r-project.org/package=pedtools)
<!-- badges: end -->
## Introduction
The goal of **pedtools** is to provide a lightweight, but comprehensive tool set for creating, manipulating and visualizing pedigrees with or without marker data. Common pedigree structures are quickly produced with tailor-made functions, while a range of utilities enable modifications like adding or removing individuals, extracting subsets, loop breaking, and merging pedigrees. The plotting feature imports machinery from the [kinship2](https://CRAN.R-project.org/package=kinship2) package.
**pedtools** is the hub of the **pedsuite**, a collection of R packages for pedigree analysis, including applications in forensic and medical genetics. The **pedsuite** has its own [GitHub repository](https://github.com/magnusdv/pedsuite) and a dedicated [website](https://magnusdv.github.io/pedsuite/) offering more information.
#### Citation
If you use **pedtools** in a publication, please cite the book [Pedigree Analysis in R](https://shop.elsevier.com/books/pedigree-analysis-in-r/vigeland/978-0-12-824430-2)
(Vigeland, 2021. Academic Press. ISBN:<span>9780128244302</span>).
#### Online app
Try the online app **QuickPed** for building and analysing pedigrees here: [https://magnusdv.shinyapps.io/quickped/](https://magnusdv.shinyapps.io/quickped/)
## Installation
To get **pedtools**, install from CRAN as follows:
```{r, eval = FALSE}
install.packages("pedtools")
```
Alternatively, fetch the latest development version from GitHub:
```{r, eval = FALSE}
devtools::install_github("magnusdv/pedtools")
```
## Example
The following example illustrates a step-by-step creation of a pedigree with a marker object.
```{r example, fig.height = 3, fig.width = 3.5, out.width = "40%", message = FALSE}
library(pedtools)
# Start with two half brothers
x = halfSibPed(type = "paternal")
# Make 5 female
x = swapSex(x, 5)
# Add a sister to 5 (parents are 2 and 3)
x = addDaughter(x, parents = 2:3)
# Add inbred child
x = addSon(x, parents = 4:5)
# Create marker
x = addMarker(x, "7" = "a/b")
# Plot pedigree with genotypes
plot(x, marker = 1, hatched = 7)
```
The process of building pedigrees is perfectly suited for the pipe operator `|>` recently introduced in R. For example, the above pedigree could have been created as follows:
```{r}
x = halfSibPed(type = "paternal") |>
swapSex(5) |>
addDaughter(parents = 2:3) |>
addSon(parents = 4:5) |>
addMarker("7" = "a/b")
```
For details about what **pedtools** can do, and many other examples, [the vignette](https://cran.r-project.org/package=pedtools/vignettes/pedtools.html) is a good place to start.