plotBar: Generate a barplot of a Structure or Admixture run.

Description Usage Arguments Examples

Description

Generate a barplot of a Structure or Admixture run.

Usage

1
plotBar(x, populations = NULL, plot = TRUE, facet = TRUE)

Arguments

x

an object of type struct or admix or a Q-matrix

populations

a data.frame that contains the sample number as the first column and the population as the second.

plot

if FALSE returns a data.frame for customised plots

facet

whether or not to split the barplot by cluster. This is recommended.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Read file using K = 6 and plot results
k6_data <- exampleStructure("barplot")
# Generate standard 'structure' barplot
plotBar(k6_data, facet = FALSE)
# adding group information
set.seed(212)
pops <- data.frame(id = k6_data$ancest_df[,1],
population = sample(letters[1:3], nrow(k6_data$ancest_df), replace = TRUE))
# our facetted structure plot
plotBar(k6_data, pops)
# standard 'structure' bar plot
plotBar(k6_data, pops, facet = FALSE)
#' admixture example
k3_data <- exampleAdmixture()[[3]]
plotBar(k3_data)

Example output

Extracting population labels from STRUCTURE output.

starmie documentation built on May 1, 2019, 8:01 p.m.