fst.pairwise.monoecious: Calculates Fst between two groups of monoecious individuals

Usage Arguments Value Examples

View source: R/fst.pairwise.monoecious.R

Usage

1
2
fst.pairwise.monoecious(N,i,j,xi,xj,ti,tj)
fst.pairwise.monoecious(folder.name,i,j,xi,xj,ti,tj)

Arguments

N

A 4-D array (ex: N[k,i,x,t]) of length c(m,n,z,T_max) giving the number of individuals of genotype k, age x in deme i at time t. Typically, the output of the function sim.metapopgen.monoecious

folder.name

Character string giving the name of the folder where the results of sim.metapopgen.monoecious are saved, when this function is used with the argument save.res set to TRUE.

i, xi, ti

Identifiers of the first group of individuals: it specifies the individuals of deme i, age xi at time ti

i, xi, ti

Identifiers of the second group of individuals: as above.

Value

Pairwise genetic differentiation index Fst calculated as ratio of heterozygosities: (Ht - Hs) / Ht. Ht is the expected heterozygosity over the population formed by the two groups. Hs is the average expected heterozygosity over the two groups. The average is weighted by the number of individuals in each group: Hs = (n_i * H_S_i + n_j * H_S_j)/(n_i + n_j) where n_i and n_j are the number of individuals in the first and second group, respectively, and H_s_i and H_s_j are the expected heterozygosities in the first and second group, respectively.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Load the example data and simulates metapopulation genetics
data(FourPopMonoecious)
N <- sim.metapopgen.monoecious(input.type="array",N1=N1, sigma=sigma, phi_F=phi_F, phi_M=phi_M, mu=mu, delta=delta, settler.surv=settler.surv)

# Calculates fst between various pairs of groups of individuals
fst.pairwise.monoecious(N,1,2,1,1,50,50) # Between one-year old individuals of deme 1 and 2 at time 50
fst.pairwise.monoecious(N,1,1,1,1,1,50) # Between one-year old individuals of deme 1 at time 50 and at time 1 (temporal fst)

# Temporal evolution of fst
fst <- array(NA,dim=c(3,50))
for (t in 1 : 50) {
for (deme in 1 : 3){
fst[deme,t] <- fst.pairwise.monoecious(N,1,(deme+1),1,1,t,t)
}
}
plot(c(1:50),fst[1,],type="l",col="blue",xlab="Year",ylab="Fst")
matplot(c(1:50),fst[2,],type="l",col="darkgreen",add=T)
matplot(c(1:50),fst[3,],type="l",col="red",add=T)
legend(30,1,c("1 vs 2","1 vs 3","1 vs 4"),col=c("blue","darkgreen","red"),lty=1)

# Example with results from sim.metapopgen.monoecious saved on disk
# Let us assume that results are stored in a folder named "2013-nov-13-12.04"
fst.pairwise.monoecious("2013-nov-13-12.04",1,1,1,1,1,50) # Between one-year old individuals of deme 1 at time 50 and at time 1 (temporal fst)

MarcoAndrello/MetaPopGen_0.0.8 documentation built on May 25, 2019, 12:23 p.m.