Skip to contents

This script deletes deletes loci or individuals with all calls missing (NA), from a genlight object

A DArT dataset will not have loci for which the calls are scored all as missing (NA) for a particular individual, but such loci can arise rarely when populations or individuals are deleted. Similarly, a DArT dataset will not have individuals for which the calls are scored all as missing (NA) across all loci, but such individuals may sneak in to the dataset when loci are deleted. Retaining individual or loci with all NAs can cause issues for several functions.

Also, on occasion an analysis will require that there are some loci scored in each population. Setting by.pop=TRUE will result in removal of loci when they are all missing in any one population.

Note that loci that are missing for all individuals in a population are not imputed with method 'frequency' or 'HW'. Consider using the function gl.filter.allna with by.pop=TRUE.

Usage

gl.filter.allna(x, by.pop = FALSE, recalc = FALSE, verbose = NULL)

Arguments

x

Name of the input genlight object [required].

by.pop

If TRUE, loci that are all missing in any one population are deleted [default FALSE]

recalc

Recalculate the locus metadata statistics if any individuals are deleted in the filtering [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, unless specified using gl.set.verbosity].

Value

A genlight object having removed individuals that are scored NA across all loci, or loci that are scored NA across all individuals.

Author

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

Examples

# SNP data
  result <- gl.filter.allna(testset.gl, verbose=3)
#> Starting gl.filter.allna 
#>   Processing genlight object with SNP data
#>   Identifying and removing loci and individuals scored all 
#>                 missing (NA)
#>   Deleting loci that are scored as all missing (NA)
#>   Zero loci that are missing (NA) across all individuals
#>   Deleting individuals that are scored as all missing (NA)
#>   Zero individuals that are missing (NA) across all loci
#> Completed: gl.filter.allna 
#> 
# Tag P/A data
  result <- gl.filter.allna(testset.gs, verbose=3)
#> Starting gl.filter.allna 
#>   Processing genlight object with Presence/Absence (SilicoDArT) data
#>   Identifying and removing loci and individuals scored all 
#>                 missing (NA)
#>   Deleting loci that are scored as all missing (NA)
#>   Zero loci that are missing (NA) across all individuals
#>   Deleting individuals that are scored as all missing (NA)
#>   Zero individuals that are missing (NA) across all loci
#> Completed: gl.filter.allna 
#>