Skip to content

The first argument can be a multiOmicDataset object (moo) or a data.frame containing counts. For a moo, choose which counts slot to use with count_type & (optionally) sub_count_type. For a data.frame, you must also set sample_metadata. All other arguments are optional.

Usage

plot_pca(moo_counts, principal_components = c(1, 2), ...)

Arguments

moo_counts

counts dataframe or multiOmicDataSet containing count_type & sub_count_type in the counts slot

principal_components

vector with numbered principal components to plot. Use 2 for a 2D pca with ggplot, or 3 for a 3D pca with plotly. (Default: c(1,2))

...

additional arguments forwarded to method (see Details below)

Value

PCA plot (2D or 3D depending on the number of principal_components)

Details

See the low-level function docs for additional arguments depending on whether you're plotting 2 or 3 PCs:

  • plot_pca_2d - used when there are 2 principal components

  • plot_pca_3d - used when there are 3 principal components

Methods

link to docsclass
plot_pca_moomultiOmicDataSet
plot_pca_datdata.frame

Examples

# multiOmicDataSet
moo <- multiOmicDataSet(
  sample_metadata = nidap_sample_metadata,
  anno_dat = data.frame(),
  counts_lst = list(
    "raw" = nidap_raw_counts,
    "clean" = nidap_clean_raw_counts
  )
)
plot_pca(moo, count_type = "clean", principal_components = c(1, 2))


# 3D
plot_pca(moo, count_type = "clean", principal_components = c(1, 2, 3))
# dataframe plot_pca(nidap_clean_raw_counts, sample_metadata = nidap_sample_metadata, principal_components = c(1, 2) )