Skip to main content
v2026.11,986 entries · CC-BY 4.0

poppr: R Package for Clonal Population Genetics, Install and Core Functions

poppr is an R package for populations with sexual and clonal reproduction: install routes, core functions, output columns and how to cite it.

Written and maintained by CASRAI Editorial Board

Published

On this page

poppr is a free R package for analysing the genetic data of populations that reproduce both sexually and clonally. Built on adegenet’s genind and genlight objects, it counts and compares multilocus genotypes (MLGs), clone-corrects datasets, measures genotypic diversity, tests the index of association and draws trees and minimum spanning networks. You install it from CRAN with install.packages(“poppr”) and cite it in published work.

What poppr is used for in research

The package’s own documentation describes poppr as “an R package designed for analysis of populations with mixed modes of sexual and clonal reproduction”. In practice the researchers who use it study organisms such as plant pathogens and other fungi or oomycetes, where many isolates can carry an identical genotype because they descend from the same clone. Standard population-genetic summaries assume each individual is an independent draw, so repeated clonal genotypes can bias them. poppr makes the clonal structure explicit and gives you tools to measure it and correct for it.

The feature list on the official site covers clone censoring at any hierarchical level, counting and subsetting MLGs, defining MLGs by custom rules, genotypic diversity, evenness and richness with rarefaction, dendrograms with bootstrap support, minimum spanning networks, the index of association (IA and the standardized r̄d reported as rbarD), Bruvo’s distance for microsatellite (SSR) data implemented in C, batch processing on a server, and import and export of GenAlEx files. Version 2.0 added genomic SNP data, collapsing MLGs into lineages by genetic distance with mlg.filter(), reticulate minimum spanning networks, the index of association in a sliding window across SNPs with win.ia(), bootstrapping of MLG diversity statistics, and interactive network exploration with imsn().

It handles haploid and diploid data with dominant or co-dominant markers, including microsatellites, SNPs and AFLPs. The package ships four example datasets, which are the quickest way to try every function: Pinf (SSR data, Phytophthora infestans), monpop (SSR data, Monilinia fructicola), Aeut (AFLP data, Aphanomyces euteiches) and Pram (SSR data, Phytophthora ramorum).

If your data are SNP calls rather than multilocus microsatellite genotypes, see the plain-language explainer what is an SNP first, because poppr treats SNP matrices (genlight objects) differently from allele-based genind objects.

Install or access

poppr is distributed through three official routes. The CRAN page lists version 2.9.8, published 2025-08-24, under the licence GPL-2 or GPL-3. It requires R 2.15.1 or later and the adegenet package (version 2.0.0 or later), imports vegan, ggplot2, ape, igraph, ade4, pegas, polysat, dplyr, boot and shiny among others, and needs compilation. The package maintainer is Zhian N. Kamvar; Jose F. Tabima, Jonah C. Brooks, Ayotunde Folarin and Niklaus J. Grünwald are listed as authors.

Route Command (from the project documentation) What you need
CRAN release install.packages(“poppr”) A working R installation
R-Universe (latest build) universe = c(“https://zkamvar.r-universe.dev”, “https://cloud.r-project.org”) then install.packages(“poppr”, repos = universe) A working R installation
GitHub development branch remotes::install_github(repo = “grunwaldlab/poppr@devel”, build_vignettes = TRUE) The remotes package, plus Xcode (macOS) or Rtools (Windows) to compile; set build_vignettes = FALSE if LaTeX is not installed

On Linux, the install notes add one setting: if getOption(“unzip”) is neither “unzip” nor “internal”, run options(unzip = “internal”) before installing. For the general mechanics of installing, updating and troubleshooting R packages, see our guide on how to install R packages.

After installing, load the package with library(poppr). Help for the package as a whole is available with ?poppr (equivalently package?poppr), and news(Version >= “2.0.0”, package = “poppr”) prints the change log since 2.0.0. The project runs a user forum at https://groups.google.com/d/forum/poppr and accepts bug reports at https://github.com/grunwaldlab/poppr/issues.

Step-by-step: from a data file to a clone-corrected analysis

The steps below use only functions and example calls shown in the official reference pages and the “Data import and manipulation in poppr” vignette. They run on bundled data, so you can reproduce them before using your own files.

  1. Load the package and a dataset. Run library(poppr), then data(Aeut). Aeut is the AFLP dataset for Aphanomyces euteiches.
  2. Import your own data (when you are ready). For a GenAlEx-formatted CSV file use read.genalex(), whose arguments include ploidy (default 2), geo, region, genclone (default TRUE), sep (default “,”) and recode; the vignette’s example is rootrot = read.genalex(system.file(“files/rootrot.csv”, package = “poppr”)). Files in Fstat, Genpop, Genetix or Structure formats are read with adegenet’s import2genind(); a data frame read with read.table goes through df2genind(); sequences read with ape’s read.dna() go through DNAbin2genind(). The helper getfile() opens a file picker and stores the choice in a list with $files and $path.
  3. Convert to a genclone object. The vignette recommends genclone (and snpclone) objects for multilocus genotype analysis: agc = as.genclone(Aeut). genclone2genind() reverses the conversion.
  4. Attach population strata. A data frame of stratification factors is assigned with strata(), for example strata(Aeut) = other(Aeut)$population_hierarchy[-1]. Choose the population factor from a strata column with setPop(), for example setPop(H3N2) = ~country, and rename levels with nameStrata().
  5. Count MLGs. mlg(Aeut) reports the number of multilocus genotypes. The mlg family also includes mlg.table(), mlg.vector(), mlg.crosspop() and mlg.id() for tabulating genotypes, labelling individuals and finding genotypes that cross populations.
  6. Clone-correct. The usage is clonecorrect(pop, strata = 1, combine = FALSE, keep = 1). The reference example is Aeut.pop = clonecorrect(Aeut, strata = ~Pop), followed by mlg(Aeut.pop) to confirm the new count and popNames(Aeut.pop) to list the populations. Setting strata = NA clone-corrects without regard to population structure; combine = TRUE merges the chosen strata into one new population.
  7. Summarise the data with poppr(). poppr(dat, total = TRUE, sublist = “ALL”, exclude = NULL, sample = 0, method = 1, missing = “ignore”, cutoff = 0.05, quiet = FALSE, clonecorrect = FALSE, strata = 1, keep = 1, plot = TRUE, index = “rbarD”, minsamp = 10, …) returns a data frame with one row per population. The reference example is data(nancycats) followed by poppr(nancycats).
  8. Test for clonality with the index of association. ia(nancycats) computes the index over all loci; pair.ia(partial_clone) computes it for each locus pair; resample.ia(Pinf, reps = 99) recalculates it on reduced datasets. To get permutation p-values, set sample, for example ia(nancycats, sample = 999).

The vignette also shows how to inspect and repair polyploid data: Pinf prints as a genclone object with 72 MLGs among 86 tetraploid individuals, 11 co-dominant loci and 2 strata; info_table(Pinf, type = “ploidy”, plot = TRUE) shows the ploidy and missing-data pattern; genind2df(Pinf, sep = “/”) shows readable genotypes; and recode_polyploids(Pinf, newploidy = TRUE) removes zero padding. Export back to GenAlEx with genind2genalex(), which overwrites an existing file of the same name.

Which poppr function for which task

The data table below pairs each core task with the function that performs it, what it returns, and the reference page it comes from. The function index lists many more helpers, including aboot() (a dendrogram with bootstrap support using any distance), bruvo.dist(), bruvo.boot() and bruvo.msn() for microsatellite distances and networks, diversity_stats(), diversity_boot() and diversity_ci() for diversity statistics, genotype_curve() for a genotype accumulation curve, locus_table() and info_table() for locus summaries, informloci() for removing uninformative loci, missingno() for missing data, and mlg.filter() and mll() for lineage definitions.

Output and how to read it

The poppr() summary table

poppr() returns a data frame with populations in rows. The columns documented on the reference page are: Pop (population label), N (number of individuals), MLG (number of multilocus genotypes), eMLG (expected number of MLGs at the smallest common sample size, set by minsamp), SE (standard error of the rarefaction), H (Shannon-Wiener index), G (Stoddard and Taylor’s index), lambda (Simpson’s index), E.5 (evenness), Hexp (Nei’s gene diversity), Ia and p.Ia (index of association and its p-value), rbarD and p.rD (the standardized index and its p-value), and File (the source file name). Read MLG against N first: a large gap shows many repeated genotypes, which is the signal that clone correction is warranted. Compare eMLG across populations rather than raw MLG, because eMLG adjusts for unequal sample sizes.

The index of association

Without permutations, ia() returns a named numeric vector of length 2 (Ia and rbarD). With sample set, it returns a vector of length 4 (Ia, p.Ia, rbarD, p.rD), and the p-values come from a one-sided permutation test. With sample set and valuereturn = TRUE it returns a list holding the index and a data frame of the permuted values, which you can plot against the observed value. pair.ia() returns a matrix with one row per locus pair (choose(nLoc(gid), 2) rows), and resample.ia() returns a data frame whose number of rows equals the number of replicates. The documentation describes these indices as tools for detecting clonal reproduction; interpret a significant result as evidence against random mating in your sample, and report the number of permutations you used.

Clone-corrected versus uncorrected comparisons

A common pattern in the package’s own examples is to compare the observed rbarD with the resampled distribution and with the value after clonecorrect(): geom_vline(xintercept = ia(Pinf)[2]) and geom_vline(xintercept = ia(clonecorrect(Pinf))[2]). That comparison shows how much of an apparent association comes from repeated genotypes.

Troubleshooting

  • Installation from GitHub fails or compiles nothing. The package needs compilation. Install Xcode on macOS or Rtools on Windows, and install remotes first.
  • Vignette build errors during a GitHub install. If LaTeX is not installed, repeat the install with build_vignettes = FALSE.
  • Linux unzip error. Run options(unzip = “internal”) when getOption(“unzip”) is not “unzip” or “internal”.
  • Genotypes look wrong in a polyploid dataset. Zero-padded alleles are expected in the underlying table; use genind2df() to view genotypes and recode_polyploids() to remove or restore padding.
  • Populations are not what you expected. The population factor comes from the strata column you choose; set it explicitly with setPop() and check popNames().
  • Slow runs. The reference page notes that its viral H3N2 demonstration is a large dataset that can take a couple of minutes on slower computers, and that pairwise IA with 999 permutations takes about a minute on the partial_clone example. Start with sample = 0 and add permutations once the workflow is correct.
  • Cannot find a function you remember. jack.ia() is deprecated in favour of resample.ia(), and the hist argument is deprecated in favour of plot.

poppr does not replace the general population-genetics tooling in R; it sits on top of it. The table lists the free packages that the CRAN page and reference pages show poppr depending on or calling, so you can see what to learn alongside it.

Package Relationship to poppr Where documented
adegenet Depends (version 2.0.0 or later); provides the genind and genlight objects poppr is built on, and import functions such as import2genind() and df2genind() CRAN page; poppr home page; data vignette
vegan Imported; the poppr() reference example calls vegan::diversity() to define a custom statistic CRAN page; poppr() reference
pegas, ape, ade4, polysat Imported by poppr; ape’s read.dna() output is converted with DNAbin2genind() CRAN page; data vignette
GenAlEx file format Not an R package: poppr reads it with read.genalex() and writes it with genind2genalex() Home page; data vignette

For another vegan-based workflow see our guide to the vegan R package, and for the resampling idea behind several poppr statistics see bootstrapping in R.

How to cite poppr

The authors ask users to cite Kamvar ZN, Tabima JF, Grünwald NJ (2014), “Poppr: an R package for genetic analysis of populations with clonal, partially clonal, and/or sexual reproduction”, PeerJ 2:e281, doi 10.7717/peerj.281. If you use the minimum spanning network with reticulation, mlg.filter(), mlg.custom(), win.ia(), samp.ia() or aboot(), also cite Kamvar ZN, Brooks JC, Grünwald NJ (2015), Frontiers in Genetics 6:208, doi 10.3389/fgene.2015.00208. Record the poppr version too: the version on CRAN at the time of writing is 2.9.8. For general conventions on citing R packages and code, see how to cite software, code and R packages. Sharing the script and package versions you used also supports computational reproducibility.

Frequently asked questions

What is poppr used for?

poppr is an R package for analysing populations with mixed sexual and clonal reproduction. It counts multilocus genotypes, clone-corrects data, estimates genotypic diversity and tests the index of association, using adegenet data objects.

How do I install poppr?

Run install.packages(“poppr”) in R to get the CRAN release. For the latest build, point repos at the R-Universe address https://zkamvar.r-universe.dev together with a CRAN mirror, or install the devel branch from GitHub with remotes::install_github, which needs Xcode on macOS or Rtools on Windows.

What data formats does poppr read?

It works with adegenet objects and reads GenAlEx CSV files directly through read.genalex(). Fstat, Genpop, Genetix and Structure files are imported with adegenet’s import2genind(), and data frames with df2genind(). It supports microsatellite, SNP and AFLP data for haploid and diploid organisms.

What does clonecorrect() do?

It removes duplicated multilocus genotypes within the population strata you specify, which reduces bias from clonal lineages. Setting strata = NA corrects without regard to population structure.

How do I cite poppr?

Cite Kamvar, Tabima and Grünwald (2014), PeerJ 2:e281. Add Kamvar, Brooks and Grünwald (2015), Frontiers in Genetics 6:208, when you use the features the authors list for that second paper.

Sources

  • poppr project site, https://grunwaldlab.github.io/poppr/ (read 2026-11-15)
  • CRAN, poppr package page (version 2.9.8), https://cran.r-project.org/web/packages/poppr/index.html (read 2026-11-15)
  • poppr reference index, https://grunwaldlab.github.io/poppr/reference/index.html (read 2026-11-15)
  • poppr(), clonecorrect() and ia() reference pages under https://grunwaldlab.github.io/poppr/reference/ (read 2026-11-15)
  • Data import and manipulation in poppr, https://grunwaldlab.github.io/poppr/articles/poppr_manual.html (read 2026-11-15)

Data: poppr core functions: task, return value and reference page

Compiled from the official poppr reference pages and data-import vignette (read 2026-11-15): each row pairs a common clonal-population analysis task with the poppr or adegenet function that performs it, what the function returns and the usage detail shown in its reference page.

poppr core functions: task, return value and reference page
FunctionTaskReturns or key argumentsReference page
read.genalex()Import a GenAlEx CSV filegenclone object by default; arguments ploidy (default 2), geo, region, genclone (default TRUE), sep (default ","), recodeData import and manipulation in poppr (vignette)
as.genclone()Convert a genind object for MLG analysisgenclone object; genclone2genind() reverses itData import and manipulation in poppr (vignette)
mlg()Count multilocus genotypesNumber of MLGs in the datasetpoppr reference index; clonecorrect() examples
clonecorrect()Remove duplicated MLGs within population strataClone-corrected object; arguments pop, strata = 1, combine = FALSE, keep = 1clonecorrect() reference
poppr()Summarise diversity, evenness and linkage per populationData frame with Pop, N, MLG, eMLG, SE, H, G, lambda, E.5, Hexp, Ia, p.Ia, rbarD, p.rD, Filepoppr() reference
ia()Index of association over all lociNamed vector: Ia and rbarD (length 2); with sample also p.Ia and p.rD (length 4)ia() reference
pair.ia()Index of association for each locus pairMatrix with Ia and rbarD columns, choose(nLoc(gid), 2) rowsia() reference
resample.ia()Recalculate the index on reduced datasetsData frame with Ia and rbarD; rows equal reps (default 999)ia() reference
genind2genalex()Export to a GenAlEx CSV fileCSV file; overwrites an existing file of the same nameData import and manipulation in poppr (vignette)

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about poppr: R Package for Clonal Population Genetics, Install and Core Functions

2 free questions a day, no account.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →