Individuals are assigned to populations based on associated specimen metadata stored in the dartR genlight object. This function deletes all individuals in the nominated populations (pop.list). Monomorphic loci and loci that are scored all NA are optionally deleted (mono.rm=TRUE). The script also optionally recalculates locus metatdata statistics to accommodate the deletion of individuals from the dataset (recalc=TRUE).
The script returns a dartR genlight object with the retained populations and the recalculated locus metadata. The script works with both genlight objects containing SNP genotypes and Tag P/A data (SilicoDArT).
gl.drop.pop(
x,
pop.list,
as.pop = NULL,
recalc = FALSE,
mono.rm = FALSE,
verbose = NULL
)
Name of the genlight object [required].
List of populations to be removed [required].
Temporarily assign another locus metric as the population for the purposes of deletions [default NULL].
If TRUE, recalculate the locus metadata statistics [default FALSE].
If TRUE, remove monomorphic and all NA loci [default FALSE].
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress but not results; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity].
A reduced dartR genlight object
gl.keep.pop
to keep rather than drop specified populations
Other dartR-base:
gl.drop.ind()
,
gl.drop.loc()
,
gl.edit.recode.ind()
,
gl.edit.recode.pop()
,
gl.keep.loc()
,
gl.make.recode.ind()
,
gl.read.dart()
,
gl.recode.ind()
,
gl.recode.pop()
,
gl.set.verbosity()
# 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,as.pop='sex',pop.list=c('Male','Unknown'),verbose=3)
#> Starting gl.drop.pop
#> Processing genlight object with SNP data
#> Temporarily assigning sex as population
#> Checking for presence of nominated populations, deleting them
#> Deleting populations Male, Unknown
#> Warning: Resultant dataset may contain monomorphic loci
#> Locus metrics not recalculated
#> Summary of recoded dataset
#> No. of loci: 255
#> No. of individuals: 114
#> No. of levels of sex remaining: 1
#> Original no. of populations 30
#> No. of populations remaining: 26
#> 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
#>