Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

⚠️There's a newer version (2.3.1) of this package.Take me there.

pophelper 2.1.0

pophelper is an R package and web app to analyse and visualise population structure. pophelper curently supports output run files generated from population analysis programs such as STRUCTURE, TESS and numeric delimited formats such as ADMIXTURE or fastSTRUCTURE. The pophelper package can be used to read run files to R, tabulate runs, summarise runs, estimate K using the Evanno method, export files for CLUMPP, export files for DISTRUCT and generate barplot figures.

For a detailed demonstration and walkthrough, refer the online vignette. A quick intro video is available here. New versions and updates are shown only on this GitHub page.

Latest version

This version 2.1.0 no longer supports any of the functions deprecated in version <2.0.0. ggplot2 version must be 2.2.0 or above. Some of the important changes from the previous version 2.0.0 are listed below:

  • Order of arguments have changed in plotQ(),plotQMultiline() and evannoMethodStructure()
  • plotQMultiline(): Group labels, sorting within groups, subsetting groups, reordering groups etc
  • plotQMultiline(): Sorting by individual labels
  • plotQ(): Sorting by individual labels
  • More plot customisation arguments added to evannoMethodStructure()
  • tiff export added to all export functions
  • Argument 'barwidth' replaced with 'barsize'
  • Argument 'linethick' replaced with 'linesize'
  • Argument 'divthick' replaced with 'divsize'
  • Argument 'res' replaced with 'dpi'

For full list of changes, refer to the NEWS.

Installation

You need to have R (> 3.3.0) statistical package installed on your system. R is open-source and freely available to download for Windows, Mac and other OS. Then, install the devtools and other dependency packages. Then, you can install pophelper from github using the devtools package.

# install dependencies and devtools
install.packages(c("Cairo","ggplot2","gridExtra","gtable","tidyr","devtools"),dependencies=T)

# load package
library(devtools)

# install pophelper package from GitHub
install_github('royfrancis/pophelper')

# load library for use
library(pophelper)

Note that pophelper 1.2.0 and later includes binary executables for CLUMPP and DISTRUCT. This is experimental and may not work on all OS and versions.

pophelper 2.1.0 has been tested on the following systems:

  • Windows 10 64bit, R 3.3.3
  • Windows 7 64bit, R 3.3.3 (DISTRUCT is unstable)
  • Scientific Linux 6.8 (Carbon) 64bit, R 3.3.2

Web App

An online interactive version of pophelper is available at pophelper.com. Not all features of the R package is supported in the online app.

List of Functions

For help on any function, use
?tabulateQ
?evannoMethodStructure

readQ()                   # Read q-matrix run files to R qlist
tabulateQ()               # Tabulate a qlist
summariseQ()              # Summarise an output from tabulateQ()
clumppExport()            # Generate CLUMPP input/output files
collectClumppOutput()     # Collect CLUMPP output into a common directory
plotQ()                   # Create single-line barplots from qlist
PlotQMultiline()          # Create multi-line barplots from qlist
distructExport()          # Export files for DISTRUCT from qlist

evannoMethodStructure()   # Perform the Evanno method for STRUCTURE data
collectRunsTess()         # Collect TESS output from multiple directories into one

analyseQ()                # A wrapper function to quickly tabulate, summarise, 
                          # perform evanno method, clumpp output and generate
                          # barplots from filenames/paths.

Workflow


Fig: Workflow for all filetypes.


Fig: Plots from Evanno method.


Fig: Barplots from q-matrices.

For detailed demonstration and description, refer the vignette.

Disclaimer

The pophelper R package is offered free and without warranty of any kind, either expressed or implied. I will not be held liable to you for any damage arising out of the use, modification or inability to use this program. pophelper R package can be used, redistributed and/or modified freely for non-commercial purposes subject to the original source being properly cited. Licensed under GPL-3. Please make sure you verify all your results.

Contact

If you have an comments, suggestions, corrections or ideas on ways to improve or extend this package, feel free to contact me. Submit a report on the Github issues page.

2017 Roy M Francis

Copy Link

Version

Version

2.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Roy Francis

Last Published

December 29th, 2020

Functions in pophelper (2.1.0)

clumppExportMatrix

Deprecated
clumppExportStructure

Deprecated
distructColours

Internal: Vector of 90 Distruct colours
distructExport

Generate files for DISTRUCT.
readQStructure

Convert STRUCTURE run files to qlist.
readQTess

Convert TESS cluster files to qlist.
tabulateRunsStructure

Deprecated
tabulateRunsTess

Deprecated
analyseQ

Analyse STRUCTURE, TESS or BASIC text runs. Wrapper around several smaller functions.
ellipseCI

Internal: ellipseCI
analyseRuns

Deprecated.
evannoMethodStructure

Perform the Evanno method for STRUCTURE runs.
getPlotParams

Internal: Generate parameters for plots with labels
grpLabels

Internal: Handles grp subset/order
popLabels

Internal: Handles pop subset/order
readQ

Convert run files (q-matrices) to qlist.
summariseRunsTess

Deprecated
tabulateQ

Tabulate runs from a qlist
unitConverter

Internal: Convert value between dimension units
collectRunsTess

Collect TESS cluster run files from multiple folders
determineRowsAndCols

Internal: Determine rows and columns for arbitrary number of plots
plotMultiline

Deprecated.
plotQ

Generate barplots from qlists.
runsToDfStructure

Deprecated.
runsToDfTess

Deprecated.
clumppExport

Generate CLUMPP output from a qlist
clumppExportAdmixture

Deprecated
plotQMultiline

Plot a qlist as individual-level multiline barplot
plotRuns

Deprecated.
summariseRunsMatrix

Deprecated
summariseRunsStructure

Deprecated
clumppExportTess

Deprecated
collectClumppOutput

Collect CLUMPP output files from multiple folders
getDim

Internal: Get dimensions for figures.
getOS

Internal: Find current OS
is.qlist

Verify if a qlist is formatted correctly.
llToUtmzone

Internal: Find UTM zone from a latitude and longitude
runsToDfAdmixture

Deprecated.
runsToDfMatrix

Deprecated.
tabulateRunsAdmixture

Deprecated
tabulateRunsMatrix

Deprecated
checkQ

Internal: Check input filetype.
checkRuns

Internal: Check if a selected run is STRUCTURE, TESS, MATRIX or TAB file.
getColors

Internal: Generate colours based on number of K
getColours

Internal: Get Colours
plotRunsInterpolate

Deprecated.
plotRunsSpatial

Deprecated.
readQBasic

Convert delimited text files to qlist.
readQClumpp

Convert CLUMPP format numeric text files to qlist.
summariseQ

Summarise a tabulated dataframe
summariseRunsAdmixture

Deprecated