Principal Component Analysis

methrix_pca(
  m,
  var = "top",
  top_var = 1000,
  ranges = NULL,
  pheno = NULL,
  do_plot = TRUE,
  n_pc = 2
)

Arguments

m

Input methrix object

var

Choose between random CpG sites ('rand') or most variable CpGs ('top').

top_var

Number of variable CpGs to use. Default 1000 Set it to NULL to use all CpGs (which is not recommended due to memory requirements). This option is mutually exclusive with ranges.

ranges

genomic regions to be summarized. Could be a data.table with 3 columns (chr, start, end) or a GenomicRanges object

pheno

Column name of colData(m). Default NULL. Will be used as a factor to color different groups

do_plot

Should a plot be generated?

n_pc

Default 2.

Value

PCA results

Examples

data('methrix_data') methrix_pca(methrix_data, do_plot = FALSE)
#> $PC_matrix #> PC1 PC2 PC3 PC4 #> C1 -1.539691 5.1212315 -0.3385356 1.079377e-15 #> C2 -6.255857 -2.7330127 0.2598231 -3.866346e-15 #> N1 3.774638 -1.5860181 -3.1984009 5.011880e-15 #> N2 4.020911 -0.8022007 3.2771133 -1.991029e-15 #> #> $var_explained #> PC1 PC2 PC3 PC4 #> 0.55 0.28 0.16 0.00 #>