readQ: Load an ADMIXTURE Q file

Description Usage Arguments Value See Also Examples

View source: R/helperFunctions.R

Description

Read ADMIXTURE output, and assign row names to it. Optionally, reorder it (if poporder is specified)

Usage

1
readQ(filename, ids, poporder = NULL, thresh = 0.95)

Arguments

filename

Name of the ADMIXTURE Q file to read

ids

An ids dataframe; individual ids in column 1, population ids in column 2

poporder

The order that we we want populations to be displayed in. Should correspond to the unique labels in the ids file. No reordering done if not provided

thresh

A threshold for counting an individual as a member of a population, for use in reordering columns of Q to match the order in poporder

Value

A matrix of normalised chunkcounts

See Also

reorderQ

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
## Admixture Q matrices don't have row names. Read an ID file for this:
recent_ariids=read.table(system.file("extdata",
  "Recent_admix.ids", package = "badMIXTURE"),as.is=T)
## Now read the Q matrix
recent_ariQ=readQ(system.file("extdata",
  "Recent_admix.pruned.11.Q", package = "badMIXTURE"),recent_ariids)

## Now we want to reorder the individuals, specifying the order that
we would like our populations to appear
poporder=paste0("Pop",c(7,5,6,13,4,8,9,11:12,1:3))
recent_ariQ=readQ(system.file("extdata",
  "Recent_admix.pruned.11.Q", package = "badMIXTURE"),recent_ariids,poporder)

## End(Not run)

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