Description Usage Arguments Value Note Examples
View source: R/gwscaR_popgen.R
sliding window pi and rho - across all snps
1 | calc.pi(vcf.row)
|
vcf.row |
A row of a vcf file; use this in conjunction with apply |
The nucleotide diversity at that site
pi = 1-sum((ni choose 2)/(n choose i)); ni is number of alleles i in sample, n = sum(ni)
Jones et al. (2012) used 2500bp sliding windows with a step size 500bp<-more than just SNPs, but I'll just focus on SNPs
Hohenlohe did a similar thing and weighted pi by all nt sites (not just SNPs) but rho by SNPs only
1 2 3 | vcf.file<-system.file("extdata", "example.vcf.txt",package = "gwscaR")
vcf<-parse.vcf(vcf.file)
all.pi<-apply(vcf,1,calc.pi)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.