barplot.tess3Q: Barplot representation of a Q-matrix

View source: R/plotQ.R

barplot.tess3QR Documentation

Barplot representation of a Q-matrix

Description

This function displays a barplot representation of the ancestry coefficient matrix. It includes a sort-by-Q option.

Usage

## S3 method for class 'tess3Q'
barplot(height, sort.by.Q = TRUE, col.palette = NULL,
  palette.length = 9, lab = FALSE, ...)

Arguments

height

an object of class tess3Q (Q matrix) containing a matrix of ancestry coefficients computed from tess3 or converted from other program formats.

sort.by.Q

a Boolean value indicating whether individuals should be sorted by their ancestry level or not.

col.palette

is a list of color palettes. If NULL, a default list with 8 color palettes is used.

palette.length

an integer value for the number of colors in each element of the palette list.

lab

a list of individual labels.

...

other parameters of the function barplot.default.

Value

A permutation of individual labels used in the sort.by.Q option (order). Displays the Q matrix.

Author(s)

Kevin Caye, Olivier François

See Also

plot.tess3Q as.qmatrix CreatePalette

Examples

library(tess3r)

# Retrieve a dataset
data(data.at)

# Run of TESS3
obj <- tess3(data.at$X, coord = data.at$coord, K = 5,
                 ploidy = 1, method = "projected.ls", openMP.core.num = 4)

# Get the ancestry matrix
Q.matrix <- qmatrix(obj, K = 5)

# Display a barplot for the Q matrix
barplot(Q.matrix, border = NA, space = 0, xlab = "Individuals",
        ylab = "Ancestry proportions", main = "Ancestry matrix") -> bp
axis(1, at = 1:nrow(Q.matrix), labels = bp$order, las = 3, cex.axis = .4)

bcm-uga/TESS3_encho_sen documentation built on June 30, 2023, 3:08 a.m.