Skip to contents

When individuals,or populations, are deleted from a genlight object, the locus metrics no longer apply. For example, the Call Rate may be different considering the subset of individuals, compared with the full set. This script recalculates those affected locus metrics, namely, avgPIC, CallRate, freqHets, freqHomRef, freqHomSnp, OneRatioRef, OneRatioSnp, PICRef and PICSnp. Metrics that remain unaltered are RepAvg and TrimmedSeq as they are unaffected by the removal of individuals.

Usage

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

Arguments

x

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

mono.rm

If TRUE, removes 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].

Value

A genlight object with the recalculated locus metadata.

Details

The script optionally removes resultant monomorphic loci or loci with all values missing and deletes them (using gl.filter.monomorphs.r).

The script returns a genlight object with the recalculated locus metadata.

Author

Custodian: Luis Mijangos (Post to https://groups.google.com/d/forum/dartr)

Examples

  gl <- gl.recalc.metrics(testset.gl, verbose=2)
#> Starting gl.recalc.metrics 
#>   Processing genlight object with SNP data
#> Starting utils.recalc.avgpic 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the  utils.recalc.avgpic  calculations
#>   Recalculating OneRatioRef, OneRatioSnp, PICRef, PICSnp, AvgPIC
#> Completed: utils.recalc.avgpic 
#> Starting utils.recalc.callrate 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the Call Rate calculations
#>   Recalculating locus metric CallRate
#> Completed: utils.recalc.callrate 
#> Starting utils.recalc.maf 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the  utils.recalc.maf  calculations
#>   Recalculating FreqHoms and FreqHets
#> Starting utils.recalc.freqhets 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the  utils.recalc.freqhets  calculations
#>   Recalculating locus metric freqHets
#> Completed: utils.recalc.freqhets 
#> Starting utils.recalc.freqhomref 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the  utils.recalc.freqhomref  calculations
#>   Recalculating locus metric freqHomRef
#> Completed: utils.recalc.freqhomref 
#> Starting utils.recalc.freqhomsnp 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the  utils.recalc.freqhomsnp  calculations
#>   Recalculating locus metric freqHomSnp
#> Completed: utils.recalc.freqhomsnp 
#>   Recalculating Minor Allele Frequency (MAF)
#> Completed: utils.recalc.maf 
#>   Locus metrics recalculated
#> Completed: gl.recalc.metrics 
#>