SubsetByPloidy: Create a RADdata object with a Subset of Possible Ploidies

View source: R/classes_methods.R

SubsetByPloidyR Documentation

Create a RADdata object with a Subset of Possible Ploidies

Description

This function is used for removing some of the ploidies (i.e. inheritance modes possible across loci) stored in a RADdata object. If genotype calling has already been performed, all of the relevant slots will be subsetted to only keep the ploidies that the user indicates.

Usage

SubsetByPloidy(object, ...)
## S3 method for class 'RADdata'
SubsetByPloidy(object, ploidies, ...)

Arguments

object

A RADdata object.

ploidies

A list, formatted like object$possiblePloidies, indicating ploidies to retain. Each item in the list is a vector, where 2 indicates diploid, c(2, 2) allotetraploid, 4 autotetraploid, etc.

...

Other arguments (none implemented).

Details

Note that slots of object are subsetted but not recalculated. For example, GetWeightedMeanGenotypes takes a weighted mean across ploidies, which is in turn used for estimating allele frequencies and performing PCA. If the values in object$ploidyChiSq are considerably higher for the ploidies being removed than for the ploidies being retained, this difference is likely to be small and not substantially impact genotype calling. Otherwise, it may be advisable to re-run genotype calling after running SubsetByPloidy.

Value

A RADdata object identical to object, but only containing data relevant to the inheritance modes listed in ploidies.

Note

If you only wish to retain taxa of a certain ploidy, instead do

object <- SubsetByTaxon(object, GetTaxaByPloidy(object, 4))

to, for example, only retain tetraploid taxa.

Author(s)

Lindsay V. Clark

See Also

SubsetByTaxon, SubsetByLocus

Examples

# Example dataset assuming diploidy or autotetraploidy
data(exampleRAD)
exampleRAD <- IterateHWE(exampleRAD)
# Subset to only keep tetraploid results
exampleRAD <- SubsetByPloidy(exampleRAD, ploidies = list(4))

lvclark/polyRAD documentation built on Jan. 15, 2024, 4:19 a.m.