assignmentPlots: Generate a pdf with assignment plots for each K Takes as...

View source: R/run_structure.R

assignmentPlotsR Documentation

Generate a pdf with assignment plots for each K Takes as input the output files from strucure runs and generates a pdf with plots of proportion of each population represented in each individual.

Description

Generate a pdf with assignment plots for each K

Takes as input the output files from strucure runs and generates a pdf with plots of proportion of each population represented in each individual.

Usage

assignmentPlots(
  x,
  xdir = NULL,
  labels = NULL,
  save.as = file.path(getwd(), "assignmentPlots.pdf"),
  userun = 1
)

Arguments

x

Character vector with paths to input files. Ignored if 'xdir' is non-NULL. These are either '.log_f' files generated by STRUCTURE, or a sinle '.Qlog' file generated by 'run_DAPC', 'run_fastStructure', or 'run_SNMF' functions.

xdir

Optional 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, labels, and x arguments.

labels

Character vector with names of individuals. Default NULL. Ignored if 'xdir' non-NULL.

save.as

Character string with path/name to use for the output PDF file. Default is to save the output in the current directory with the name "assignmentPlots.pdf".

userun

Number or numerical vector indicating which runs should be used for assignment plots. Default is 1 (the first run). When multiple runs are used, the mean is used across runs after aligning clusters.

Value

NULL; generates pdf with assignment plots for each K

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$")
admixturePlots(x=qfiles,labels=samplenames,userun=c(1:5))

admixturePlots(xdir="PATH/TO/STRUCTURE/OUTPUT",userun=c(1:5))

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