correlatePCs: Principal components (cor)relation with experimental...

View source: R/correlatePCs.R

correlatePCsR Documentation

Principal components (cor)relation with experimental covariates

Description

Computes the significance of (cor)relations between PCA scores and the sample experimental covariates, using Kruskal-Wallis test for categorial variables and the cor.test based on Spearman's correlation for continuous variables

Usage

correlatePCs(pcaobj, coldata, pcs = 1:4)

Arguments

pcaobj

A prcomp object

coldata

A data.frame object containing the experimental covariates

pcs

A numeric vector, containing the corresponding PC number

Value

A data.frame object with computed p values for each covariate and for each principal component

Examples

library(DESeq2)
dds <- makeExampleDESeqDataSet_multifac(betaSD_condition = 3, betaSD_tissue = 1)
rlt <- DESeq2::rlogTransformation(dds)
pcaobj <- prcomp(t(assay(rlt)))
correlatePCs(pcaobj, colData(dds))


federicomarini/pcaExplorer documentation built on April 8, 2024, 3:15 a.m.