create_popfile: Generate a popfile from STRUCTURE output Takes as input the...

View source: R/run_structure.R

create_popfileR 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.

Description

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.

Usage

create_popfile(xdir = NULL, K = 2)

Arguments

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.

Value

NULL; generates a two column matrix with the majority-population assignment of each individual

Examples

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


JeffWeinell/misc.wrappers documentation built on Sept. 20, 2023, 12:42 p.m.