gl.select.panel: Select Loci Panel Based on Various Methods

View source: R/gl.select.panel.R

gl.select.panelR Documentation

Select Loci Panel Based on Various Methods

Description

This function selects a panel of loci from a genomic dataset ('dartR or genlight' object) based on various selection methods.

Usage

gl.select.panel(
  x,
  method = "random",
  nl = 10,
  exact = TRUE,
  plot.out = TRUE,
  plot.file = NULL,
  plot.dir = NULL,
  verbose = NULL
)

Arguments

x

A 'dartR or genlight' object containing the genomic data.

method

A character string specifying the selection method. Options include:

  • '"dapc"': Select loci contributing most to discrimination between populations using DAPC (Discriminant Analysis of Principal Components).

  • '"pahigh"': Select loci with private alleles having high frequency.

  • '"random"': Randomly select loci.

  • '"monopop"': Select monomorphic loci within populations.

  • '"stratified"': Stratified sampling of loci based on allele frequencies.

  • '"hafall"': Select loci with the highest allele frequencies across all populations.

  • '"hafpop"': Select loci with the highest allele frequencies within each population.

nl

An integer specifying the number of loci to select.

exact

Logical. If 'TRUE', ensures that the number of selected loci is exactly 'nl'. If 'FALSE', allows for a random selection that may not match 'nl' exactly.

plot.out

Logical. If 'TRUE', generates plots summarizing selected loci.

plot.file

A character string specifying the file name for saving plots. If 'NULL', plots are not saved.

plot.dir

A character string specifying the directory to save plots. Defaults to the working directory.

verbose

Integer level of verbosity for reporting progress and information.

Details

The function applies various methods to select loci based on the input 'dartR or genlight' object. Each method has specific criteria for selecting loci:

  • 'dapc': Performs DAPC and identifies loci with the highest contributions to discrimination between population pairs.

  • 'pahigh': Identifies loci with private alleles that have high frequency differences between populations.

  • 'random': Selects loci randomly.

  • 'monopop': Selects loci that are monomorphic within populations.

  • 'stratified': Uses stratified sampling to select loci based on allele frequencies.

  • 'hafall': Selects loci with the highest allele frequencies across the dataset.

  • 'hafpop': Selects loci with the highest allele frequencies within individual populations.

  • 'pic': Selects loci based on the highest polymorphic information content (PIC).

  • ‘picdart': Selects loci based on the average PIC calculated from the ’dartR' metrics.

Value

A 'dartR or genlight' object containing the selected loci.

Examples

# Example usage:

# Select 20 loci randomly
selected <- gl.select.panel(possums.gl, method = "random", nl = 50)

# Select loci based on DAPC
selected <- gl.select.panel(possums.gl, method = "dapc", nl = 5)


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