Learn R Programming

⚠️There's a newer version (2.10.0) of this package.Take me there.

pedtools

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 package.

pedtools is the hub of the ped suite, a collection of R packages for pedigree analysis, including applications in forensic and medical genetics. The ped suite has its own GitHub repository and a dedicated website offering more information.

Try the QuickPed app for building and analysing pedigrees here: https://magnusdv.shinyapps.io/quickped/

Installation

To get pedtools, install from CRAN as follows:

install.packages("pedtools")

Alternatively, fetch the latest development version from GitHub:

devtools::install_github("magnusdv/pedtools")

Example

The following example illustrates a step-by-step creation of a pedigree with a marker object.

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:

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 is a good place to start.

Copy Link

Version

Install

install.packages('pedtools')

Monthly Downloads

710

Version

2.6.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Magnus Vigeland

Last Published

March 31st, 2024

Functions in pedtools (2.6.0)

getGenotypes

Genotype matrix
getAlleles

Allele matrix manipulation
internalplot

Internal plot methods
is.ped

Is an object a ped object?
getSex

Get or set the sex of pedigree members
getComponent

Pedigree component
marker_getattr

Get marker attributes
marker_select

Select or remove attached markers
mendelianCheck

Check for Mendelian errors
mergePed

Merge two pedigrees
marker_prop

Marker properties
marker_inplace

Set marker attributes
maskPed

Mask and unmask pedigree datasets
marker_setattr

Set marker attributes
marker

Marker objects
marker_attach

Attach markers to pedigrees
ped_internal

Internal ordering of pedigree members
ped_modify

Add/remove pedigree members
ped_complex

Complex pedigree structures
ped_basic

Create simple pedigrees
newMarker

Internal marker constructor
nMarkers

The number of markers attached to a pedigree
pedtools-package

pedtools: Creating and Working with Pedigrees and Marker Data
ped_utils

Pedigree utilities
print.ped

Printing pedigrees
ped_subgroups

Pedigree subgroups
readPed

Read a pedigree from file
plot.ped

Plot pedigree
relabel

Get or modify pedigree labels
sortGenotypes

Sort the alleles in each genotype
writePed

Write a pedigree to file
validatePed

Pedigree errors
randomPed

Random pedigree
newPed

Internal ped constructor
ped

Pedigree construction
transferMarkers

Transfer marker data
setMutmod

Set a mutation model
print.nucleus

S3 methods
plotPedList

Plot a collection of pedigrees.
setSNPs

Attach SNP loci to a pedigree
as_kinship2_pedigree

Convert pedigree to kinship2 format
as.matrix.ped

Convert ped to matrix
addAllele

Add allele
as.data.frame.ped

Convert ped to data.frame
distributeMarkers

Distribute markers evenly along a set of chromosomes
famid

Family identifier
founderInbreeding

Inbreeding coefficients of founders
as.ped

Conversions to ped objects
freqDatabase

Allele frequency database
inbreedingLoops

Pedigree loops
is.marker

Test if something is a marker
connectedComponents

Connected pedigree components
locusAttributes

Get or set locus attributes
getMap

Tabulate marker positions