Skip to main content

Genetic diversity metrics from popoulation genomic datasets.

Project description

Pypgen provides various utilities for estimating standard genetic diversity measures including Gst, G’st, G’‘st, and Jost’s D from large genomic datasets (Hedrick, 2005; Jost, 2008; Masatoshi Nei, 1973; Nei & Chesser, 1983). Pypgen operates both on the level of individual SNPs as well as on user defined regions (e.g., five kilobase windows tiled across each chromosome). For the windowed analyses, pypgen estimates the multi-locus versions of each estimators.


  • Operates on standard VCF (Variant Call Format) formatted SNP calls
  • Uses bgziped input for fast random access
  • Takes advantage of multiple processor cores
  • Handles multiallelic SNP calls
  • Allows a single VCF file to contain multiple populations
  • Calculates additional metrics:
    • snp count per window
    • mean read depth (+/- STDEV) per window
    • populations with fixed alleles per SNP
    • more as I think of them

Important Note:

PYPGEN IS STILL IN ACTIVE DEVELOPMENT AND ALMOST CERTAINLY CONTAINS BUGS. If you find a bug please file a report in the ‘issues’ section of this repository and I’ll address it as soon as I can.

Enclosed Scripts:

  • Sliding window analysis (
  • Per SNP analysis (



First install samtools. On OS X I recommend using homebrew to do this. Once you have samtools installed you can use either pip or setuptools to install pypgen:

pip install pypgen


easy_install pypgen

Information about each script can be obtained by running:

python [script name].py -h

Output: (note this will probably change)

  • chrm = Name of chromosome
  • start = Starting position of window
  • stop = Ending position of window
  • snp_count = Total Number of SNPs in window
  • total_depth_mean = Mean read depth across window
  • total_depth_stdev = Standard deviation of read depth across window
  • Pop1.sample_count.mean = Mean number of samples per snp for ‘Pop1’
  • Pop1.sample_count.stdev = Standard deviation of samples per snp for - ‘Pop1’
  • Pop2.sample_count.mean = Mean number of samples per snp for ‘Pop2’
  • Pop2.sample_count.stdev = Standard deviation of samples per snp for ‘Pop2’
  • Pop2.Pop1.D_est = Multilocus Dest (Jost 2008)
  • Pop2.Pop1.G_double_prime_st_est = (Meirmans & Hedrick 2011)
  • Pop2.Pop1.G_prime_st_est = Standardized Gst (Hedrick 2005)
  • Pop2.Pop1.Gst_est = Fst corrected for sample size and allowing for multiallelic loci (Nei & Chesser 1983)
  • cont…

  • chrm = Name of chromosome
  • pos = Position of SNP
  • outgroups = Number of samples
  • pop1 = Population ID
  • pop1.outgroups.D_est= Multilocus Dest (Jost 2008)
  • pop1.outgroups.G_double_prime_st_est = (Meirmans & Hedrick 2011)
  • pop1.outgroups.G_prime_st_est = Standardized Gst (Hedrick 2005)
  • pop1.outgroups.Gst_est = Fst corrected for sample size and allowing for multiallelic loci (Nei & Chesser 1983)
  • pop1.outgroups.Hs_est
  • pop1.outgroups.Ht_est
  • cont…,
  • outgroups_fixed = If a sample is fixed at a particular allele this flag is set to 1 (= “True” in binary).
  • cont…

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pypgen, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pypgen-0.2.0.tar.gz (20.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page