View source: R/classes_methods.R
AddPCA | R Documentation |
This function uses read depth ratios or posterior genotype probabilities
(the latter preferentially) as input data for principal components analysis.
The PCA scores are then stored in the $PCA
slot of the
"RADdata"
object.
AddPCA(object, ...) ## S3 method for class 'RADdata' AddPCA(object, nPcsInit = 10, maxR2changeratio = 0.05, minPcsOut = 1, ...)
object |
A |
nPcsInit |
The number of principal component axes to initially calculate. |
maxR2changeratio |
This number determines how many principal component axes are retained. The
difference in R-squared values between the first and second axes
is multiplied by |
minPcsOut |
The minimum number of PC axes to output, which can override
|
... |
Additional arguments to be passed to the |
The PPCA (probabalistic PCA) method from pcaMethods is used, due to the high missing data rate that is typical of genotyping-by-sequencing datasets.
A "RADdata"
object identical to the one passed to the function, but with
a matrix added to the $PCA
slot. This matrix contains PCA scores, with
taxa in rows, and PC axes in columns.
If you see the error
Error in if (rel_ch < threshold & count > 5) { :
missing value where TRUE/FALSE needed
try lowering nPcsInit
.
Lindsay V. Clark
AddAlleleFreqByTaxa
# load data data(exampleRAD) # do PCA exampleRAD <- AddPCA(exampleRAD, nPcsInit = 3) plot(exampleRAD$PCA[,1], exampleRAD$PCA[,2])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.