Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gl.keep.pop

Remove all but specified populations from a genelight {adegenet} object


Description

Individuals are assigned to populations based on the specimen metadata data file (csv) used with gl.read.dart().

Usage

gl.keep.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 a genind object containing presence/absence data [required]

pop.list

– a list of populations to be kept [required]

as.pop

– assign another metric to represent population [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]

Details

The script, having deleted the specified 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.

Value

A genlight object with the reduced data

Author(s)

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

See Also

gl.filter.monomorphs for when mono.rm=TRUE, gl.recalc.metrics for when recalc=TRUE

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

Examples

# SNP data
   gl2 <- gl.keep.pop(testset.gl, pop.list=c("EmsubRopeMata","EmvicVictJasp"))
   gl2 <- gl.keep.pop(testset.gl, pop.list=c("EmsubRopeMata","EmvicVictJasp"),
   mono.rm=TRUE,recalc=TRUE)
   gl2 <- gl.keep.pop(testset.gl, pop.list=c("Female"),as.pop="sex")
 # Tag P/A data  
   gs2 <- gl.keep.pop(testset.gs, pop.list=c("EmsubRopeMata","EmvicVictJasp"))

dartR

Importing and Analysing SNP and Silicodart Data Generated by Genome-Wide Restriction Fragment Analysis

v1.9.6
GPL-2
Authors
Bernd Gruber [aut, cre], Arthur Georges [aut], Jose L. Mijangos [aut], Peter J. Unmack [ctb], Oliver Berry [ctb], Lindsay V. Clark [ctb], Floriaan Devloo-Delva [ctb]
Initial release
2021-04-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.