Skip to contents

Individuals are assigned to populations based on the specimen metadata file (csv) used with gl.read.dart. The script, having deleted populations, 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 redundant by the deletion of individuals from the dataset.

The script returns a genlight object with the new population assignments and the recalculated locus metadata.

Usage

gl.drop.pop(
  x,
  pop.list,
  as.pop = NULL,
  recalc = FALSE,
  mono.rm = FALSE,
  verbose = NULL
)

Arguments

x

Name of the genlight object containing SNP genotypes or Tag P/A data (SilicoDArT) [required].

pop.list

A list of populations to be removed [required].

as.pop

Temporarily assign another metric to represent population for the purposes of deletions [default NULL].

recalc

Recalculate the locus metadata statistics [default FALSE].

mono.rm

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].

Value

A genlight object with the reduced data

See also

gl.keep.pop to keep rather than drop specified populations

Author

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

Examples

 # SNP data
   gl2 <- gl.drop.pop(testset.gl,
   pop.list=c('EmsubRopeMata','EmvicVictJasp'),verbose=3)
#> Starting gl.drop.pop 
#>   Processing genlight object with SNP data
#>   Checking for presence of nominated populations, deleting them
#>   Deleting populations EmsubRopeMata, EmvicVictJasp 
#>   Warning: Resultant dataset may contain monomorphic loci
#>   Locus metrics not recalculated
#>   Summary of recoded dataset
#>     No. of loci: 255 
#>     No. of individuals: 240 
#>     Original no. of populations 30 
#>     No. of populations remaining:  28 
#> Completed: gl.drop.pop 
#> 
   gl2 <- gl.drop.pop(testset.gl, pop.list=c('EmsubRopeMata','EmvicVictJasp'),
   mono.rm=TRUE,recalc=TRUE)
#> Starting gl.drop.pop 
#>   Processing genlight object with SNP data
#>   Checking for presence of nominated populations, deleting them
#>   Deleting monomorphic loc
#>   Recalculating locus metrics
#> Completed: gl.drop.pop 
#> 
   gl2 <- gl.drop.pop(testset.gl, pop.list=c('Male','Unknown'),as.pop='sex')
#> Starting gl.drop.pop 
#>   Processing genlight object with SNP data
#>   Temporarily assigning sex as population
#>   Checking for presence of nominated populations, deleting them
#>   Warning: Resultant dataset may contain monomorphic loci
#>   Locus metrics not recalculated
#>   Restoring population assignments to initial state
#> Completed: gl.drop.pop 
#> 
 # Tag P/A data
   gs2 <- gl.drop.pop(testset.gs, pop.list=c('EmsubRopeMata','EmvicVictJasp'))
#> Starting gl.drop.pop 
#>   Processing genlight object with Presence/Absence (SilicoDArT) data
#>   Checking for presence of nominated populations, deleting them
#>   Warning: Resultant dataset may contain monomorphic loci
#>   Locus metrics not recalculated
#> Completed: gl.drop.pop 
#>