jane* docs
Sequencing

Population Genetics

Read a cohort's genotypes by population: allele frequencies, heterozygosity and Hardy–Weinberg tests per site, differentiation between populations, linkage disequilibrium between sites, the principal components that show how the samples are structured, and each sample's ancestry as a mixture of ancestral populations.

Reached byTools → Population Genetics

What it does

Works on a variant call set with genotypes (VCF or VCF.gz) and, for anything that compares groups, a sample table: a header row with a sample column and one or more columns that group the samples, such as the population and super-population columns of a 1000 Genomes panel file. Choose both from the project or load them from disk, pick the column that groups the samples, then ask one of five questions. Its picture opens beside the panel: sites along the chromosome, the LD matrix, the samples in principal-component space, or one ancestry bar per sample.

What this computes

Allele frequencies, heterozygosity and Hardy–Weinberg, for every sample or one population

  • allele counts and frequencies per site, over the alleles actually called, and the allele number
  • called and missing genotypes, and heterozygous, homozygous reference and homozygous alternate calls per site and per sample, with each sample's missing rate and heterozygosity rate
  • observed heterozygosity (Ho): heterozygous calls over called calls
  • expected heterozygosity (He): one minus the sum of squared allele frequencies
  • inbreeding coefficient F: one minus Ho over He
  • the exact Hardy–Weinberg test (Wigginton, Cutler and Abecasis 2005) per alternate allele, and its one-sided tail for an excess of heterozygotes. A half-missing or haploid call is left out of the test; a heterozygote carrying two different alternate alleles counts for both
  • the sites furthest from Hardy–Weinberg, and a Bonferroni bound over the tests the run made

Fst between populations

  • Weir and Cockerham's θ from the variance components between populations, between individuals within populations and between gametes, over two or more populations at once
  • Hudson's Fst (as Bhatia et al. 2013 recommend): one minus within-population diversity over between-population divergence, for every pair
  • Patterson's Fst, from the F2 statistic, over biallelic sites
  • per-site values and an average over all sites taken as a ratio of sums, with a block-jackknife standard error over blocks of sites you size; a pairwise matrix when more than two populations are compared

Linkage disequilibrium, over biallelic sites with a minimum allele count, in a window you set

  • Rogers–Huff r: the correlation of alternate-allele counts between two sites, which needs no phasing
  • haplotype r² and D′: from the maximum-likelihood two-site haplotype frequency, solving the cubic that the classic EM converges to; the sign of D′ says whether the two alternate alleles travel together
  • mean r², the number of pairs in strong LD, the strongest pairs, and pairs left undefined because a site does not vary in the samples called at both
  • LD pruning: sliding windows of sites that drop the later site of any pair whose r² exceeds a threshold, reporting which sites remain

Principal components

  • site selection: biallelic sites whose reference and alternate alleles are each seen at least a minimum number of times, optionally LD-pruned first
  • scaling per site: Patterson's (centre, then divide by √(p(1−p))), the standard deviation, or centring only; in double precision, or in the half precision one common implementation uses
  • every sample's coordinates on each component, with its population, and the share of variance each component explains (the scree)

Ancestry coefficients (sparse non-negative matrix factorisation, the sNMF method of Frichot et al. 2014, an ADMIXTURE-style estimate)

  • site selection: every record whose reference and alternate alleles are each a single base, coded as the count of alternate alleles; indels and multiallelic records are set aside and counted
  • ancestry coefficients (Q): each sample's share of each of K ancestral populations, summing to one, for every K in a range you set
  • ancestral genotype frequencies (G): each ancestral population's frequency of each genotype at each site, shown at the best K as each ancestral population's alternate-allele frequency for the sites where those frequencies differ most
  • regularisation (alpha): a penalty that pushes each sample toward fewer ancestries
  • masked cross-entropy: a share of genotypes is held out at random, each K is fitted without them, and K is scored by how well it predicts them; the K with the lowest cross-entropy is the number of ancestral populations the data support best
  • missing genotypes are imputed from the site's observed genotype frequencies before fitting
  • the mean ancestry of each group at the best K, the passes each fit took, and a warning when the lowest cross-entropy sits at the largest K tried or a fit stopped at the pass limit
  • one seed fixes the held-out genotypes and every K's random start, so a run is reproducible

Controls

Call set takes a VCF with genotypes, every record's GT being read; Sample table takes a header row naming a sample column and the columns that group samples; Group samples by picks which of those columns defines the populations; and Compute picks the statistic. For ancestry, K from and K to set the range of K, Hold out and Hold out share the masked genotypes, and Seed the random stream; Advanced holds alpha, the tolerance, the pass limit and the ploidy. Stop ends a run that is taking too long.

Where the numbers come from

Allele counts, heterozygosity, F, Rogers–Huff r, LD pruning, Fst and principal components are checked against scikit-allel, the Hardy–Weinberg tests against bcftools, and haplotype r² and D′ against PLINK 1.9, over every site and every sample of the 1000 Genomes phase 3 genotypes across APOL1 (619 records, 2,504 people, 5 super-populations and 26 populations). Principal components agree to nine significant digits, up to each component's sign, which no implementation fixes. Ancestry coefficients, ancestral genotype frequencies, pass counts and cross-entropies are checked against LEA's sNMF in R on the same call set for K from 1 to 5, and on small matrices with missing calls and haploid genotypes, with the six-digit tables LEA writes matching character for character.

On this page