Learn R Programming

polyRAD (version 1.6)

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

Description

This function is used for removing some of the ploidies (inheritance modes) 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 RADdata
SubsetByPloidy(object, ploidies, ...)

Value

A RADdata object identical to object, but only containing data relevant to the inheritance modes listed in 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).

Author

Lindsay V. Clark

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.

See Also

SubsetByTaxon, SubsetByLocus

Examples

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

Run the code above in your browser using DataLab