gl.recode.ind {dartR.base} | R Documentation |
Recodes individual (=specimen = sample) labels in a genlight object
Description
This function 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 [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 labeling arising in the process from sample to sequence 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 durable record of the changes. The function works with genlight objects containing SNP genotypes and Tag P/A data (SilicoDArT). For SNP genotype data, the function, having deleted individuals, optionally identifies resultant monomorphic loci or loci with all values missing and deletes them. The script also optionally recalculates the locus metadata as appropriate. The optional deletion of monomorphic loci and the optional recalculation of locus statistics is not available for Tag P/A data (SilicoDArT). The script returns a dartR genlight object with the new individual names and the 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
Other data manipulation:
gl.define.pop()
,
gl.drop.ind()
,
gl.drop.loc()
,
gl.drop.pop()
,
gl.edit.recode.pop()
,
gl.impute()
,
gl.join()
,
gl.keep.ind()
,
gl.keep.loc()
,
gl.keep.pop()
,
gl.make.recode.ind()
,
gl.merge.pop()
,
gl.reassign.pop()
,
gl.recode.pop()
,
gl.rename.pop()
,
gl.sample()
,
gl.sim.genotypes()
,
gl.sort()
,
gl.subsample.ind()
,
gl.subsample.loc()
Examples
file <- system.file('extdata','testset_ind_recode.csv', package='dartR.data')
gl <- gl.recode.ind(testset.gl, ind.recode=file, verbose=3)