Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gl.recode.pop

Recode population assignments in a genlight object {adegenet}


Description

This script recodes population assignments and/or deletes populations from a DaRT genlight SNP file based on information provided in a csv population recode file.

Usage

gl.recode.pop(x, pop.recode, recalc = TRUE, mono.rm = TRUE, verbose = NULL)

Arguments

x

– name of the genlight object containing the SNP data [required]

pop.recode

– name of the csv file containing the population reassignments [required]

recalc

– Recalculate the locus metadata statistics if any individuals are deleted in the filtering [default FALSE]

mono.rm

– Remove monomorphic loci [default FALSE]

verbose

– verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log ; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity]

Details

Individuals are assigned to populations based on the specimen metadata data file (csv) used with gl.read.dart(). Recoding can be used to amalgamate populations or to selectively delete or retain populations.

The population recode file contains a list of populations in the genelight object as the first column of the csv file, and the new population assignments in the second column of the csv file. The keyword Delete used as a new population assignment will result in the associated specimen being dropped from the dataset.

The script, having deleted populations, optionally identifies resultant monomorphic loci or loci with all values missing and deletes them (using gl.filter.monomorphs.r). The script also optionally recalculates the locus metadata as appropriate.

Value

A genlight object with the recoded and reduced data

Author(s)

Arthur Georges (Post to https://groups.google.com/d/forum/dartr)

See Also

Examples

mfile <- system.file("extdata", "testset_pop_recode.csv", package="dartR")
  nPop(testset.gl)
  gl <- gl.recode.pop(testset.gl, pop.recode=mfile, verbose=3)

dartR

Importing and Analysing SNP and Silicodart Data Generated by Genome-Wide Restriction Fragment Analysis

v1.9.6
GPL-2
Authors
Bernd Gruber [aut, cre], Arthur Georges [aut], Jose L. Mijangos [aut], Peter J. Unmack [ctb], Oliver Berry [ctb], Lindsay V. Clark [ctb], Floriaan Devloo-Delva [ctb]
Initial release
2021-04-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.