# here is a toy admixture proportions matrix with columns in no meaningful order
Q <- matrix(
c(
0.1, 0.8, 0.1,
0.1, 0.7, 0.2,
0.0, 0.4, 0.6,
0.0, 0.3, 0.7,
0.9, 0.0, 0.1
),
nrow = 5,
ncol = 3,
byrow = TRUE
)
# get nicer order
indexes <- admix_order_cols( Q )
# apply reordering to columns
Q <- Q[ , indexes ]
# notice that now the first columns takes on the highest values initially,
# followed by the second column, and lastly the third column.
Run the code above in your browser using DataLab