qmatrix: Get Q matrix estimate

View source: R/getter.R

qmatrixR Documentation

Get Q matrix estimate

Description

Get the Q ancestry coefficient matrix computed by the tess3 function.

Usage

qmatrix(tess3, K, rep = "best")

Arguments

tess3

a tess3 object.

K

number of ancestral populations.

rep

an integer indicating which run to display (default = lowest error run).

Value

a Q matrix of ancestry coefficients from a specified run.

See Also

tess3 barplot.tess3Q plot.tess3Q CreatePalette

Examples

library(tess3r)

# load Arabidopsis data
data(data.at)

# Running 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)

# Plot the barplot
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)

cayek/TESS3_encho_sen documentation built on July 4, 2023, 7:51 p.m.