Movatterモバイル変換


[0]ホーム

URL:


pedmut

CRAN status

Introduction

Thepedmut package is part of thepedsuiteecosystem for pedigree analysis in R. Its aim is to provide a frameworkfor modelling mutations in pedigree computations.

Althoughpedmut is self-contained, its main purposeis to be imported by otherpedsuite packages, likepedprobr (markerprobabilities and pedigree likelihoods),forrel (forensic pedigreeanalysis) anddvir.

For the theoretical background of mutation models and theirproperties (stationarity, reversibility, lumpability), I recommendChapter 5 ofPedigreeanalysis in R, and the references therein.

Installation

# The easiest way to get `pedmut` is to install the entire `pedsuite`:install.packages("pedsuite")# Alternatively, you can install just `pedmut`:install.packages("pedmut")# If you need the latest development version, install it from GitHub:# install.packages("devtools")devtools::install_github("magnusdv/pedmut")

A simple likelihood example

The examples below require the packagespedtools andpedprobr in addition topedmut. Thefirst two are core members of the pedsuite and can be loadedcollectively withlibrary(pedsuite).

library(pedsuite)library(pedmut)

The figure below shows a father and son who are homozygous fordifferent alleles. We assume that the locus is an autosomal marker withtwo alleles, labelled 1 and 2.

# Create pedigreex=nuclearPed(father ="fa",mother ="mo",child ="boy")# Add markerx=addMarker(x,fa ="1/1",boy ="2/2")# Plot with genotypesplot(x,marker =1)

The data clearly constitutes aMendelian error, and gives alikelihood of 0 without mutation modelling:

likelihood(x)#> [1] 0

The following code sets a simple mutation model and recomputes thepedigree likelihood.

x2=setMutmod(x,model ="equal",rate =0.1)likelihood(x2)#> [1] 0.0125

Under the mutation model, the combination of genotypes is no longerimpossible, yielding a non-zero likelihood. To see details about themutation model, we can use themutmod() accessor:

mutmod(x2,marker =1)#> Unisex mutation matrix:#>     1   2#> 1 0.9 0.1#> 2 0.1 0.9#>#> Model: Equal#> Rate: 0.1#> Frequencies: 0.5, 0.5#>#> Bounded: Yes#> Stationary: Yes#> Reversible: Yes#> Lumpable: Always

Mutation models

A mutation matrix inpedmut is a stochastic matrix,with each row summing to 1, where the rows and columns are named withallele labels.

Two central functions of package aremutationMatrix()andmutationModel(). The first constructs a single mutationmatrix according to various model specifications. The second produceswhat is typically required in applications, namely a list oftwo mutation matrices, named “male” and “female”.

The mutation models currently implemented inpedmutare:

Model properties

Several properties of mutation models are of interest (boththeoretical and practical) for likelihood computations. Thepedmut package provides utility functions for quicklychecking these:

Further examples

Anequal model with rate 0.1:

mutationMatrix("equal",rate =0.1,alleles =c("a","b","c"))#>      a    b    c#> a 0.90 0.05 0.05#> b 0.05 0.90 0.05#> c 0.05 0.05 0.90#>#> Model: Equal#> Rate: 0.1#>#> Lumpable: Always

Next, aproportional model with rate 0.1. Note that thismodel depends on the allele frequencies.

mutationMatrix("prop",rate =0.1,alleles =c("a","b","c"),afreq =c(0.7,0.2,0.1))#>            a          b          c#> a 0.93478261 0.04347826 0.02173913#> b 0.15217391 0.82608696 0.02173913#> c 0.15217391 0.04347826 0.80434783#>#> Model: Proportional#> Rate: 0.1#> Frequencies: 0.7, 0.2, 0.1#>#> Bounded: Yes#> Stationary: Yes#> Reversible: Yes#> Lumpable: Always

To illustrate thestepwise model, we recreate themutation matrix in Section 2.1.3 of Simonsson and Mostad (FSI:Genetics,2015). This is done as follows:

mutationMatrix(model ="stepwise",alleles =c("16","17","18","16.1","17.1"),rate =0.003,rate2 =0.001,range =0.5)#>                16           17           18         16.1         17.1#> 16   0.9960000000 0.0020000000 0.0010000000 0.0005000000 0.0005000000#> 17   0.0015000000 0.9960000000 0.0015000000 0.0005000000 0.0005000000#> 18   0.0010000000 0.0020000000 0.9960000000 0.0005000000 0.0005000000#> 16.1 0.0003333333 0.0003333333 0.0003333333 0.9960000000 0.0030000000#> 17.1 0.0003333333 0.0003333333 0.0003333333 0.0030000000 0.9960000000#>#> Model: Stepwise#> Rate: 0.003#>#> Lumpable: Not always

A simpler version of thestepwise model above, is theonestep model, in which only the immediate neighbouringintegers are reachable by mutation. This model is only applicable whenall alleles are integers.

mutationMatrix(model ="onestep",alleles =c("16","17","18"),rate =0.04)#>      16   17   18#> 16 0.96 0.04 0.00#> 17 0.02 0.96 0.02#> 18 0.00 0.04 0.96#>#> Model: Onestep#> Rate: 0.04#>#> Lumpable: Not always

[8]ページ先頭

©2009-2025 Movatter.jp