gl.read.structure: Read output files produced by the program STRUCTURE

View source: R/gl.read.structure.r

gl.read.structureR Documentation

Read output files produced by the program STRUCTURE

Description

Reads and processes STRUCTURE output files, extracting run summaries and Q-matrices. Optionally associates Q-matrices with population information from a genlight object.

Usage

gl.read.structure(
  folder.path,
  x = NULL,
  pattern = NULL,
  recursive = FALSE,
  rename_files = FALSE,
  prefix = NULL,
  verbose = NULL
)

Arguments

folder.path

Path to folder containing STRUCTURE output files [required].

x

Optional genlight object used to attach population labels to individuals [default NULL].

pattern

Optional regex to filter files in folder.path (e.g. ".*_f$" or "out$") [default NULL].

recursive

Logical; search folder recursively [default FALSE].

rename_files

Logical; if TRUE, renames source files on disk based on K and replicate [default FALSE].

prefix

Optional prefix used for renaming/labels. If NULL, uses longest common prefix of filenames [default NULL].

verbose

Verbosity (as in dartR) [default 2 / gl.set.verbosity()].

Value

A list of class "structure.result". Each element contains:

  • summary: named numeric vector (k, est.ln.prob, mean.lnL, var.lnL)

  • q.mat: data.frame (id, pct.miss, orig.pop, Group.1..Group.K)

  • prior.anc: optional list of ancestry matrices (if present)

  • files: file path

  • label: run label


dartR.popgen documentation built on March 16, 2026, 9:07 a.m.