reorderQ: Reorder a Q matrix into the order that we

Description Usage Arguments Value

View source: R/helperFunctions.R

Description

A function to reorder the data to make the populations appear in the same order as the latent clusters. Takes an admixture matrix and reorders the rows according to a desired vector of population names. It then reorders the columns so that the latent clusters are ordered similarly to the labels.

Usage

1
reorderQ(Q, ids, poporder = NULL, thresh = 0.95)

Arguments

Q

A matrix of admixture estimates for each individual

ids

A data frame containing 2 or more columns. The first are individual identifiers, the second are population identifiers. Any further columns are ignored. NB: Chromopainter excludes individuals in the third column that have a 0; you are advised to do this before passing to this function.

poporder

A list of the order that we want populations to appear in. If NULL, populations will be ordered as they appear in the data

thresh

A threshold for the admixture memberships when counting how to order columns of Q

Value

A reordered matrix of the Q values


danjlawson/badMIXTURE documentation built on Sept. 27, 2019, 9:11 p.m.