Learn R Programming

GENESIS (version 2.2.2)

plot.pcair: PC-AiR: Plotting PCs

Description

plot.pcair is used to plot pairs of principal components contained in a class 'pcair' object obtained as output from the pcair function.

Usage

"plot"(x, vx = 1, vy = 2, pch = NULL, col = NULL, xlim = NULL, ylim = NULL, main = NULL, sub = NULL, xlab = NULL, ylab = NULL, ...)

Arguments

x
An object of class 'pcair' obtained as output from the pcair function.
vx
An integer indicating which principal component to plot on the x-axis; the default is 1.
vy
An integer indicating which principal component to plot on the y-axis; the default is 2.
pch
Either an integer specifying a symbol or a single character to be used in plotting points. If NULL, the default is dots for the 'unrelated subset' and + for the 'related subset'.
col
A specification for the plotting color for points. If NULL, the default is black for the 'unrelated subset' and blue for the 'related subset'.
xlim
The range of values shown on the x-axis. If NULL, the default shows all points.
ylim
The range of values shown on the y-axis. If NULL, the default shows all points.
main
An overall title for the plot. If NULL, the default specifies which PC-AiR PCs are plotted.
sub
A sub title for the plot. If NULL, the default is none.
xlab
A title for the x-axis. If NULL, the default specifies which PC-AiR PC is plotted.
ylab
A title for the y-axis. If NULL, the default specifies which PC-AiR PC is plotted.
...
Other parameters to be passsed through to plotting functions, (see par).

Value

Details

This function provides a quick and easy way to plot principal components obtained with the function pcair to visualize the population structure captured by PC-AiR.

See Also

pcair for obtaining principal components that capture population structure in the presence of relatedness. par for more in depth descriptions of plotting parameters. The generic function plot.

Examples

Run this code
# file path to GDS file
gdsfile <- system.file("extdata", "HapMap_ASW_MXL_geno.gds", package="GENESIS")
# read in GDS data
HapMap_geno <- GdsGenotypeReader(filename = gdsfile)
# create a GenotypeData class object
HapMap_genoData <- GenotypeData(HapMap_geno)
# load saved matrix of KING-robust estimates
data("HapMap_ASW_MXL_KINGmat")
# run PC-AiR
mypcair <- pcair(genoData = HapMap_genoData, kinMat = HapMap_ASW_MXL_KINGmat, 
                divMat = HapMap_ASW_MXL_KINGmat)
# plot top 2 PCs
plot(mypcair)
# plot PCs 3 and 4
plot(mypcair, vx = 3, vy = 4)
close(HapMap_genoData)

Run the code above in your browser using DataLab