Learn R Programming

RClone (version 1.0)

genet_dist: Genetic distance

Description

Defining MLL (MultiLocus Lineage): ascertaining that each distinct MLG (MultiLocus Genotype) belongs to a distinct genet (Halkett et al., 2005a).

Usage

genet_dist(data1, haploid = FALSE, vecpop = NULL, manh = FALSE, manh_w = FALSE, 
graph = FALSE, breaking = NULL, alpha1 = NULL, alpha2 = NULL, export = FALSE)
genet_dist_sim(data1, haploid = FALSE, vecpop = NULL, nbrepeat = 1000, 
genet = FALSE, manh = FALSE, manh_w = FALSE, graph = FALSE, breaking = NULL,
export = FALSE)

Arguments

data1
a Rclone table with one allele per column.
haploid
logical, option, haploid indicates the ploidy level of data1.
vecpop
vector, option, vecpop indicates the population name of each unit of data1, if data1 contains several populations. If data1 contains only one population, leave vecpop =
manh
option, if TRUE, computes genetic distances among MLG in terms of divergence of microsatellites motifs (Rozenfeld et al., 2007).
manh_w
option, if TRUE, computes genetic distances among MLG in terms of weighted divergence of microsatellites motifs (Rozenfeld et al., 2007).
graph
option, if TRUE, displays a barplot with breaking and pas arguments.
breaking
numeric, option, if breaking != NULL, adds breaks argument for barplot as breaks = seq(0, max, X), with X, the numerical value of breaking.
alpha1
numeric, option, if alpha1 is not NULL, a vertical significativity line is added on graph at alpha1
alpha2
numeric, option, if alpha2 is not NULL, a vertical significativity line is added on graph at alpha2.
nbrepeat
numeric, the number of repeats for simulation (i.e. reproduction event).
genet
option, if FALSE, selfing is taking into account in simulation through ramets.
export
option, if TRUE, graph is saved as .eps into working directory.

Value

  • genet_dist returns:
    • distance_matrix, adistobject with genetic distances by pair of units.
    • potential_clones, a table containing names and genetic distances of pairs of units underalpha1distribution or of maximal genetic distance ofalpha2.
    • all_pairs, a table containing names and genetic distances of every pairs of units.
    • sign, the numeric value ofalpha1oralpha2.
    If vecpop != NULL, a list for every population. genet_dist_sim returns a dist object of genetic distances by pair of units after a sexual reproduction event.

Details

genet_dist and genet_dist_sim help determining MLL, i.e. if slightly different MLG belong or not to the same lineage. genet_dist computes genetic distances between pairs of units in terms of number of alleles (Chakraborty and Jin, 1993) by default. If manh = TRUE or manh_w = TRUE, divergence of SSR motifs (Rozenfeld et al., 2007) is used as genetic distance. These distance distributions help defining MLL with significativity of alpha: every pair under alpha could be ramets of a genet. genet_dist_sim computes genetic distances but after a reproduction event between the units. The simulated distance distribution allows to distinguish slightly differences due to somatic mutation or scoring errors by stacking the two distributions.

References

Chakraborty & Jin, 1993, Determination of relatedness between individuals using DNA-fingerprinting. Arnaud-Haond et al., 2007, Standardizing methods to address clonality in population studies. Rozenfeld et al., 2007, Spectrum of genetic diversity and networks of clonal populations.

Examples

Run this code
data(posidonia)

res <- genet_dist(posidonia, manh = TRUE, graph = TRUE, alpha1 = 0.05)

#Combining functions:
res1 <- genet_dist(posidonia, manh = TRUE)$distance_matrix
res2 <- genet_dist_sim_core(posidonia, nbrepeat = 100, manh = TRUE, genet = TRUE)$distance_matrix

p1 <- hist(res1, freq = FALSE, col = rgb(0,0.4,1,1), breaks = seq(0, max(res1), 2))
p2 <- hist(res2, freq = FALSE, col = rgb(0.7,0.9,1,0.5), breaks = seq(0, max(res2), 2))

limx <- max(max(res1), max(res2))
plot(p1, col = rgb(0,0.4,1,1), freq = FALSE, xlim = c(0,limx))
plot(p2, col = rgb(0.7,0.9,1,0.5), freq = FALSE, add = TRUE)

#Other way:
p1 <- as.data.frame(table(res1))
p2 <- as.data.frame(table(res2))
barplot(p1$Freq/sum(p1$Freq), col=rgb(0,0.4,1,1), axis.lty = 1, 
names.arg = as.numeric(as.character(p1[,1])))
barplot(p2$Freq/sum(p2$Freq), col=rgb(0.7,0.9,1,0.5), add = TRUE)
title("Genetic distances between pairs of MLG")

#Adding a legend:
leg.txt <- c("original data","simulated data")
col <- c(rgb(0,0.4,1,1), rgb(0.7,0.9,1,0.5))
legend("topright", fill = col, leg.txt, plot = TRUE, bty = "o", box.lwd = 1.5, 
bg = "white")

Run the code above in your browser using DataLab