calculate.pairwise.Fst: Calculates unbiased pairwise Fst between a pair of...

Description Usage Arguments Value Author(s) References Examples

Description

This function calculates unbiased F_{ST} (based on Weir and Hill's θ, 2002), between a pair of populations/individuals. Loci for which either of the populations/individuals has missing data (i.e. - the sample size is zero) are excluded.

Usage

1
calculate.pairwise.Fst(allele.counts, sample.sizes)

Arguments

allele.counts

A matrix of allele counts of dimensions nrow = 2, one for each of the two populations/individuals between which pairwise F_{ST} is being calculated, and ncol = the number of loci genotyped.

sample.sizes

A matrix of sample sizes of dimensions nrow = 2, one for each of the two populations/individuals between which pairwise F_{ST} is being calculated, and ncol = the number of loci genotyped (i.e. - the dimensions of sample.sizes must match those of counts). Each cell gives the number of chromosomes successfully genotyped at each locus in each population.

Value

Pairwise unbiased F_{ST} between a pair of populations/individuals

Author(s)

Gideon Bradburd

References

Weir,B.S. and W.G. Hill. 2002. Estimating F-statistics. Ann.Rev.Gen. 36:949-952.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#With the HGDP dataset
	data(HGDP.bedassle.data)

#Draw 2 populations at random from the Eurasian HGDP dataset
	pop1 <- sample(nrow(HGDP.bedassle.data$allele.counts),1)
	pop2 <- sample(nrow(HGDP.bedassle.data$allele.counts),1)

#Calculate unbiased Fst between them
	pairwise.Fst <- calculate.pairwise.Fst(
		HGDP.bedassle.data$allele.counts[c(pop1,pop2),],
		HGDP.bedassle.data$sample.sizes[c(pop1,pop2),]	
	)

#Print that Fst to the console
	print(sprintf("Fst between the %s population and the %s population is %s",
		HGDP.bedassle.data$hgdp.metadata[pop1,1],
		HGDP.bedassle.data$hgdp.metadata[pop2,1],
		round(pairwise.Fst,3))
	 )

Example output

[1] "Fst between the Mongola population and the French population is 0.094"

BEDASSLE documentation built on May 2, 2019, 6:10 a.m.