plot_pca: Run and visualise PCA

Description Usage Arguments Value Examples

Description

Function creates feature matrix from non-zero SNPs and feature types indicated in features. The feature matrix used for calculating PCA has n rows and k columns, while n corresponds to number of individuals in the data frame and k is defined as length of features x number of non-zero SNPs across all samples.

Usage

1
plot_pca(.data,by_chrom=TRUE,features=c('x','y'),importances=TRUE,metadata=NULL,labels=TRUE)

Arguments

.data

dataframe from scbasic or compatible

by_chrom

boolean flag indicating whether to run PCA by chromosome (TRUE or FALSE)

features

vector of feature types to use for PCA (columns from .data , i.e. c('x','y'))

importances

boolean flag indicating whether to render dimension importances (TRUE or FALSE)

metadata

data frame with metadata - currently grouping by family is supported, given that metadata contains familyid and individual columns and metadata will be merged to internal data frame by matching individual

labels

boolean flag indicating whether to render sample names using package ggrepel to prevent overplotting (TRUE or FALSE)

Value

ggplot object with PCA plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
setwd(system.file(package='SureTypeSCR'))

samplesheet=system.file('files/GSE19247_example.csv',package='SureTypeSCR')
manifest=system.file('files/HumanCytoSNP-12v2_H.bpm',package='SureTypeSCR')
cluster=system.file('files/HumanCytoSNP-12v2_H.egt',package='SureTypeSCR')

#Load data
df=scbasic(manifest,cluster,samplesheet)

#create ggplot object with PCA
#df %>% plot_pca(by_chrom=TRUE,features=c('x','y'),labels=TRUE)

Meiomap/SureTypeSCR documentation built on Dec. 17, 2021, 3:22 a.m.