plot.pcair: PC-AiR: Plotting PCs

View source: R/pcair_S3methods.R

plot.pcairR Documentation

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

## S3 method for class 'pcair'
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).

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.

Value

A figure showing the selected principal components plotted against each other.

Author(s)

Matthew P. Conomos

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

# file path to GDS file
gdsfile <- system.file("extdata", "HapMap_ASW_MXL_geno.gds", package="GENESIS")
# read in GDS data
HapMap_geno <- gdsfmt::openfn.gds(gdsfile)
# load saved matrix of KING-robust estimates
data("HapMap_ASW_MXL_KINGmat")
# run PC-AiR
mypcair <- pcair(HapMap_geno, kinobj = HapMap_ASW_MXL_KINGmat, 
                 divobj = HapMap_ASW_MXL_KINGmat)
# plot top 2 PCs
plot(mypcair)
# plot PCs 3 and 4
plot(mypcair, vx = 3, vy = 4)
gdsfmt::closefn.gds(HapMap_geno)

UW-GAC/GENESIS documentation built on March 30, 2024, 11:28 p.m.