View source: R/run_structure.R
create_popfile | R Documentation |
Generate a popfile from STRUCTURE output
Takes as input the output files from strucutre runs and generates a two-column population file with the assignment of individuals to the population in which they are most assigned to.
create_popfile(xdir = NULL, K = 2)
xdir |
Path to the directory containing all STRUCTURE output files plus the '.*_sampleIDs.txt' file generated by run_structure. Default NULL. If supplied, this overides save.as, method, labels, and x arguments. |
K |
Number indicating the value of K to use. |
NULL; generates a two column matrix with the majority-population assignment of each individual
outdir.temp <- "PATH/TO/STRUCTURE/OUTPUT"
names.df.path <- list.files(outdir.temp, full.names=T, pattern="_sampleIDs.txt$")
samplenames.df <- read.table(names.df.path, header=T)
samplenames <- samplenames.df$IndvNames
# Character vector with paths to output structure files
qfiles <- list.files(outdir.temp, full.names=T, pattern="log_f$")
assignmentPlots(x=qfiles,labels=samplenames,userun=c(1:5))
assignmentPlots(xdir="PATH/TO/STRUCTURE/OUTPUT",userun=c(1:5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.