Dimensionality reduction through PCA

dimred_pca(
  MAE,
  tax_level,
  color,
  shape = NULL,
  pcx = 1,
  pcy = 2,
  pcz = NULL,
  datatype = c("logcpm", "relabu", "counts")
)

Arguments

MAE

A multi-assay experiment object

tax_level

The taxon level used for organisms

color

A condition to color data points by e.g. "AGE"

shape

A condition to shape data points by e.g. "SEX"

pcx

Principal component on the x-axis e.g. 1

pcy

Principal component on the y-axis e.g. 2

pcz

Principal component on the z-axis e.g. 3

datatype

Datatype to use e.g. c("logcpm", "relabu", "counts")

Value

A list with a plotly object and summary table

Examples

data_dir <- system.file("extdata/MAE.rds", package = "animalcules")
toy_data <- readRDS(data_dir)
result <- dimred_pca(toy_data,
  tax_level = "genus",
  color = "AGE",
  shape = "DISEASE",
  pcx = 1,
  pcy = 2,
  datatype = "logcpm"
)
result$plot
result$table #> PC Standard Deviation Variance Explained Cumulative Variance #> PC1 PC1 2.44 9.622% 9.622% #> PC2 PC2 2.17 7.598% 17.220% #> PC3 PC3 1.98 6.317% 23.537% #> PC4 PC4 1.88 5.688% 29.225% #> PC5 PC5 1.8 5.247% 34.472% #> PC6 PC6 1.69 4.620% 39.092% #> PC7 PC7 1.67 4.474% 43.566% #> PC8 PC8 1.62 4.216% 47.782% #> PC9 PC9 1.59 4.068% 51.850% #> PC10 PC10 1.52 3.714% 55.565% #> PC11 PC11 1.46 3.451% 59.016% #> PC12 PC12 1.41 3.219% 62.235% #> PC13 PC13 1.37 3.048% 65.283% #> PC14 PC14 1.32 2.821% 68.104% #> PC15 PC15 1.27 2.607% 70.711% #> PC16 PC16 1.24 2.481% 73.192% #> PC17 PC17 1.19 2.274% 75.466% #> PC18 PC18 1.15 2.116% 77.582% #> PC19 PC19 1.13 2.052% 79.635% #> PC20 PC20 1.08 1.866% 81.501% #> PC21 PC21 1.04 1.754% 83.255% #> PC22 PC22 1.04 1.736% 84.992% #> PC23 PC23 0.972 1.524% 86.516% #> PC24 PC24 0.961 1.490% 88.006% #> PC25 PC25 0.881 1.253% 89.259% #> PC26 PC26 0.851 1.168% 90.427% #> PC27 PC27 0.836 1.128% 91.555% #> PC28 PC28 0.785 0.994% 92.549% #> PC29 PC29 0.741 0.885% 93.434% #> PC30 PC30 0.705 0.801% 94.235% #> PC31 PC31 0.694 0.778% 95.013% #> PC32 PC32 0.654 0.690% 95.704% #> PC33 PC33 0.618 0.617% 96.320% #> PC34 PC34 0.572 0.527% 96.847% #> PC35 PC35 0.539 0.468% 97.316% #> PC36 PC36 0.519 0.434% 97.750% #> PC37 PC37 0.482 0.374% 98.124% #> PC38 PC38 0.472 0.360% 98.484% #> PC39 PC39 0.437 0.308% 98.792% #> PC40 PC40 0.402 0.260% 99.052% #> PC41 PC41 0.369 0.220% 99.272% #> PC42 PC42 0.348 0.195% 99.467% #> PC43 PC43 0.288 0.134% 99.601% #> PC44 PC44 0.272 0.119% 99.720% #> PC45 PC45 0.25 0.101% 99.821% #> PC46 PC46 0.206 0.068% 99.889% #> PC47 PC47 0.183 0.054% 99.943% #> PC48 PC48 0.15 0.036% 99.979% #> PC49 PC49 0.114 0.021% 100.000% #> PC50 PC50 2.27e-15 0.000% 100.000%