plot_pcoa: plot_pcoa

View source: R/plot_pcoa.R

plot_pcoaR Documentation

plot_pcoa

Description

This is a simple PCoA function that colours all points by one metadata variable. It can be helpful to visualise metadata variables independently when assessing potential confounding metadtaa factors

Usage

plot_pcoa(relab, met, colour = NULL, shape = NULL, CI = 0.95)

Arguments

relab

dataframe. relative abundance data with features in rows and samples in columns. feature IDs in rowname.

met

dataframe. metadata with samples in rows. sample IDs in rowname

colour

string. defulat NULL. metadata variable to colour points by

shape

string. default NULL. metadata variable to set shape of points by

CI

numeric. Default 0.95. Confidence interval used to draw ellipse around colour variable. set to NULL to omit drawing ellipse

Examples

data(dss_example)
met_df <- dss_example$metadata

count_df <- dss_example$merged_abundance_id %>%
  column_to_rownames('featureID')
count_df <- count_df[,met_df$sampleID]
relab <- relab(count_df)

iter_var <- c('Genotype','Phenotype')
for(i in iter_var) {
  plot_pcoa(relab, met_df, colour = i)
}

OxfordCMS/OCMSutility documentation built on Feb. 27, 2025, 8:19 p.m.