gl.recode.ind: Recodes individual (=specimen = sample) labels in a genlight...

View source: R/gl.recode.ind.r

gl.recode.indR Documentation

Recodes individual (=specimen = sample) labels in a genlight object

Description

This script recodes individual labels and/or deletes individuals from a DaRT genlight SNP file based on a lookup table provided as a csv file.

Usage

gl.recode.ind(x, ind.recode, recalc = FALSE, mono.rm = FALSE, verbose = NULL)

Arguments

x

Name of the genlight object containing SNP genotypes [required].

ind.recode

Name of the csv file containing the individual relabelling [required].

recalc

If TRUE, recalculate the locus metadata statistics if any individuals are deleted in the filtering [default FALSE].

mono.rm

If TRUE, 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

Renaming individuals may be required when there have been errors in labelling arising in the process from sample to DArT files. There may be occasions where renaming individuals is required for preparation of figures. When caution needs to be exercised because of the potential for breaking the 'chain of evidence' associated with the samples, recoding individuals using a recode table (csv) can provide a clear record of the changes.

The script, having deleted individuals, optionally identifies resultant monomorphic loci or loci with all values missing and deletes them (using gl.filter.monomorphs.r). The script also optionally recalculates statistics made incorrect by the deletion of individuals from the dataset.

The script returns a genlight object with the new individual labels, the monomorphic loci optionally removed and the optionally recalculated locus metadata.

Value

A genlight or genind object with the recoded and reduced data.

Author(s)

Custodian: Arthur Georges – Post to https://groups.google.com/d/forum/dartr

See Also

gl.filter.monomorphs for filtering monomorphs, gl.recalc.metrics for recalculating locus metrics, gl.recode.pop for recoding populations

Examples

  file <- system.file('extdata','testset_ind_recode.csv', package='dartR')
  gl <- gl.recode.ind(testset.gl, ind.recode=file, verbose=3)

dartR documentation built on June 8, 2023, 6:48 a.m.