plot_pca {metaprotr} | R Documentation |
plot_pca
Description
Performs a Principal Components Analysis (PCA) from the spectral counts of the entities (peptides, subgroups, groups or taxonomic elements) in a "spectral_count_object" with or without taxonomy. PCA decomposition of high dimensional data allows to observe global effects in two dimensions. For more details of the used function check dudi.pca from ade4.
Usage
plot_pca(spectral_count_object, colors_var, pc_components, force = FALSE)
Arguments
spectral_count_object |
List described as "spectral_count_object" containing dataframes with abundance expressed as spectral counts from peptides, subgroups, groups or taxonomic levels. The format of this object is similar to that generated from the functions "getsc_specific" and "crumble_taxonomy". The PCA projections will be applied to these observations. |
colors_var |
Character indicating the name of one column from metadata. The samples will be represented in different colors in function of the levels of this variable (ex. conditions). |
pc_components |
Two numeric values indicating two principal components to be analyzed. |
force |
Logic value set as FALSE by default in order to ask permission to create a file in the workstation of the user. |
Value
A pdf file containing the results of PCA applied to the two provided principal components. Including a bar plot indicating the percentage of variance per principal component.
Examples
data(fecal_waters)
plot_pca(fecal_waters, "Methods", c(1, 2))
data(species_fw)
plot_pca(species_fw, "Methods", c(1, 3))
data(species_annot_fw)
plot_pca(species_annot_fw, "Condition", c(1, 2))