Skip to contents

This is a support script, to subsample a genlight {adegenet} object based on loci. Two methods are used to subsample, random and based on information content.

Usage

gl.subsample.loci(x, n, method = "random", mono.rm = FALSE, verbose = NULL)

Arguments

x

Name of the genlight object containing the SNP or presence/absence (SilicoDArT) data [required].

n

Number of loci to include in the subsample [required].

method

Method: 'random', in which case the loci are sampled at random; or 'pic', in which case the top n loci ranked on information content are chosen. Information content is stored in AvgPIC in the case of SNP data and in PIC in the the case of presence/absence (SilicoDArT) data [default 'random'].

mono.rm

Delete monomorphic loci before sampling [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 n loci

Author

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

Examples

# SNP data
  gl2 <- gl.subsample.loci(testset.gl, n=200, method='pic')
#> Starting gl.subsample.loci 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the gl.subsample.loci selections
#> Completed: gl.subsample.loci 
#> 
# Tag P/A data
  gl2 <- gl.subsample.loci(testset.gl, n=100, method='random')
#> Starting gl.subsample.loci 
#>   Processing genlight object with SNP data
#>   Warning: Dataset contains monomorphic loci which will be included in the gl.subsample.loci selections
#>   Subsampling at random 100 loci from genlight object 
#> Completed: gl.subsample.loci 
#>