PAC_pca: Principle component analysis with scatterplots from PAC

View source: R/PAC_pca.R

PAC_pcaR Documentation

Principle component analysis with scatterplots from PAC

Description

PAC_pca PAC principle component analysis.

Usage

PAC_pca(
  PAC,
  norm = "counts",
  type = "pheno",
  graphs = TRUE,
  pheno_target = NULL,
  anno_target = NULL,
  labels = NULL,
  ...
)

Arguments

PAC

PAC-list object.

norm

Character indicating what type of data to be used. If type="counts" the PCA will be conducted on the raw Counts. If type="cpm" the analysis will be done on cpm values returned from PAC_norm function and stored in the norm folder of the PAC-list object. The name of any other table in the norm(PAC) folder can also be used.

type

Character indicating what type of pca and plot to be drawn. When type="pheno" then results will be drawned from a sample perspective, while if type="anno" then results will be presented from a sequence perspective. If type="both" then a biplot will be drawn, representing both pheno and anno features. Note, the 1st object (target column name) in the pheno_target or anno_taget can be used to specifically highlight sample and sequence groups (see below).

graphs

Logical whether or not scatter plots should be plotted. (default=TRUE)

pheno_target

List with: 1st object being a character vector of target column(s) in Pheno, 2nd object being a character vector of the target group(s) in the target column (1st object). The 1st object also control group colors when type="pheno" or "both". (default=NULL)

anno_target

List with: 1st object being a character vector of target column(s) in Anno, 2nd object being a character vector of the target features(s) in the target column (1st object). The 1st object also control sequence feature colors when type="anno". (default=NULL)

labels

If labels="sample", then points will be labeled with the names rownames in pheno(PAC) or anno(PAC) depending on type="pheno" or type="anno", respectively. Point labels can also be manually provided as a character vector in the same length as the intended target. As default, labels=NULL where only point are plotted.

...

parsing to the fviz_pca functions of the factoextra package.

Details

Given a PAC object the function will perform a principle component analysis by calling the PCA function in the FactoMineR package, and then plot scatter plots with the fviz_pca functions of the factoextra package.

Value

A PCA list object generated by the PCA function in the FactoMineR package

See Also

https://github.com/Danis102 for updates on the current package.

Other PAC analysis: PAC_covplot(), PAC_deseq(), PAC_filter(), PAC_filtsep(), PAC_gtf(), PAC_jitter(), PAC_mapper(), PAC_nbias(), PAC_norm(), PAC_pie(), PAC_saturation(), PAC_sizedist(), PAC_stackbar(), PAC_summary(), PAC_trna(), as.PAC(), filtsep_bin(), map_rangetype(), tRNA_class()

Examples


# Load a PAC-object 
load(system.file("extdata", "drosophila_sRNA_pac_filt_anno.Rdata", 
                  package = "seqpac", mustWork = TRUE))

# Simple sample counts pca and scatterplots with no groupings: 
pca_cnt <- PAC_pca(pac, norm="counts")

# Sample cpm pca and scatterplots with color groupings from 
# pheno(PAC)$type column:    
pca_cpm <- PAC_pca(pac, norm="cpm", type="pheno", 
                   pheno_target=list("stage"))

# Same but with or without text labels: 
pca_cpm_lab <- PAC_pca(pac, norm="cpm", type="pheno", 
                       pheno_target=list("stage"), labels="samples")
pca_cpm_lab2 <- PAC_pca(pac, norm="cpm", type="pheno", 
                        pheno_target=list("stage"), 
                        labels=pheno(pac)$batch)

# Cpm pca with anno(PAC) sequence features instead of Pheno samples and 
# restricted to read size 20-22:
pca_cpm_anno <- PAC_pca(pac, norm="cpm", type="anno", 
                        anno_target=list("Size", 20:22))

# Cpm pca as biplot:
pca_cpm_bi <- PAC_pca(pac, norm="cpm", type="both", 
                      pheno_target=list("stage"))

# Plot individual graphs
pca_cpm_bi$graphs[[1]]
pca_cpm_lab$graphs[[1]]
pca_cpm_anno$graphs[[3]]

# Extract pca output
pca_cpm_anno$pca


Danis102/seqpac documentation built on Aug. 26, 2023, 10:15 a.m.