Flexible Genotyping for Polyploids

Implements empirical Bayes approaches to genotype polyploids from next generation sequencing data while accounting for allele bias, overdispersion, and sequencing error. The main functions are flexdog() and multidog(), which allow the specification of many different genotype distributions. Also provided are functions to simulate genotypes, rgeno(), and read-counts, rflexdog(), as well as functions to calculate oracle genotyping error rates, oracle_mis(), and correlation with the true genotypes, oracle_cor(). These latter two functions are useful for read depth calculations. Run browseVignettes(package = "updog") in R for example usage. See Gerard et al. (2018) and Gerard and Ferrao (2020) for details on the implemented methods.

Build Status Appveyor Build status codecov License: GPL v3 Rdoc CRAN_Status_Badge

Updog provides a suite of methods for genotyping polyploids from next-generation sequencing (NGS) data. It does this while accounting for many common features of NGS data: allelic bias, overdispersion, sequencing error, and (possibly) outlying observations. It is named updog for "Using Parental Data for Offspring Genotyping" because we originally developed the method for full-sib populations, but it works now for more general populations.

The main function is flexdog, which provides many options for the distribution of the genotypes in your sample.

Also provided are:

  • An experimental function mupdog, which allows for correlation between the individuals' genotypes while jointly estimating the genotypes of the individuals at all provided SNPs. The implementation uses a variational approximation. This is designed for samples where the individuals share a complex relatedness structure (e.g. siblings, cousins, uncles, half-siblings, etc). Right now there are no guarantees about this function's performance.
  • Functions to simulate genotypes (rgeno) and read-counts (rflexdog). These support all of the models available in flexdog.
  • Functions to evaluate oracle genotyping performance: oracle_joint, oracle_mis, oracle_mis_vec, and oracle_cor. We mean "oracle" in the sense that we assume that the entire data generation process is known (i.e. the genotype distribution, sequencing error rate, allelic bias, and overdispersion are all known). These are good approximations when there are a lot of individuals (but not necessarily large read-depth).

The original updog package is now named updogAlpha and may be found here.

See also ebg, fitPoly, and TET. Our best "competitor" is probably fitPoly.

See NEWS for the latest updates on the package.


I've included many vignettes in updog, which you can access online here.

Bug Reports

If you find a bug or want an enhancement, please submit an issue here.


You can install updog from CRAN in the usual way:


You can install the current (unstable) version of updog from Github with:



If you want to use the use_cvxr = TRUE option in flexdog (not generally recommended), you will need to install the CVXR package. Before I could install CVXR in Ubuntu, I had to run in the terminal

sudo apt-get install libmpfr-dev

and then run in R


How to Cite

Please cite

Or, using BibTex:

@article {gerard2018harnessing,
    author = {Gerard, David and Ferr{\~a}o, Luis Felipe Ventorim and Garcia, Antonio Augusto Franco and Stephens, Matthew},
    title = {Harnessing Empirical Bayes and Mendelian Segregation for Genotyping Autopolyploids from Messy Sequencing Data},
    year = {2018},
    doi = {10.1101/281550},
    publisher = {Cold Spring Harbor Laboratory},
    URL = {https://www.biorxiv.org/content/early/2018/03/16/281550},
    eprint = {https://www.biorxiv.org/content/early/2018/03/16/281550.full.pdf},
    journal = {bioRxiv}

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


updog 1.0.1

  • Fixes a bug with option model = "s1pp" in flexdog. I was originally not constraining the levels of preferential pairing to be the same in both segregations of the same parent. This is now fixed. But the downside is that model = "s1pp" is now only supported for ploidy = 4 or ploidy = 6. This is because the optimization becomes more difficult for larger ploidy levels.

  • I fixed some documentation. Perhaps the biggest error comes from this snippet from the original documentation of flexdog:

    The value of prop_mis is a very intuitive measure for the quality of the SNP. prop_mis is the posterior proportion of individuals mis-genotyped. So if you want only SNPS that accurately genotype, say, 95% of the individuals, you could discard all SNPs with a prop_mis under 0.95.

    This now says

    The value of prop_mis is a very intuitive measure for the quality of the SNP. prop_mis is the posterior proportion of individuals mis-genotyped. So if you want only SNPS that accurately genotype, say, 95% of the individuals, you could discard all SNPs with a prop_mis over 0.05.

  • I've now exported some C++ functions that I think are useful. You can call them in the usual way: http://r-pkgs.had.co.nz/src.html#cpp-import.

updog 0.99.0

  • This is a complete re-working of the code in updog. The old version may be found in the updogAlpha package.
  • The main function is now flexdog.
  • An experimental approach mupdog is now live. We provide no guarantees about mupdog's performance.
  • Oracle misclassification error rates may be calculated in oracle_mis.
  • Genotypes can be simulated using rgeno.
  • Next-generation sequencing data can be simulated using rflexdog.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2.0.2 by David Gerard, 13 days ago

Report a bug at http://github.com/dcgerard/updog/issues

Browse source code at https://github.com/cran/updog

Authors: David Gerard [aut, cre]

Documentation:   PDF Manual  

GPL-3 license

Imports Rcpp, RcppArmadillo, assertthat, foreach, doParallel, ggplot2, ggthemes, reshape2

Suggests covr, testthat, SuppDists, knitr, rmarkdown

Linking to Rcpp, RcppArmadillo

Suggested by ldsep.

See at CRAN