This script allows you to perform PCA plot visualization using the results of the MetaProViz analysis PCA plot visualization
Source:R/VizPCA.R
viz_pca.Rd
This script allows you to perform PCA plot visualization using the results of the MetaProViz analysis PCA plot visualization
Usage
viz_pca(
data,
metadata_info = NULL,
metadata_sample = NULL,
color_palette = NULL,
scale_color = "discrete",
shape_palette = NULL,
show_loadings = FALSE,
scaling = TRUE,
pcx = 1,
pcy = 2,
theme = NULL,
plot_name = "",
save_plot = "svg",
print_plot = TRUE,
path = NULL
)
Arguments
- data
DF with unique sample identifiers as row names and metabolite numerical values in columns with metabolite identifiers as column names. Use NA for metabolites that were not detected. includes experimental design and outlier column.
- metadata_info
Optional: NULL or Named vector including at least one of those three information : c(color="ColumnName_Plot_SettingsFile", shape= "ColumnName_Plot_SettingsFile"). Default = NULL
- metadata_sample
Optional: DF which contains information about the samples, which will be combined with your input data based on the unique sample identifiers used as rownames. Column "Conditions" with information about the sample conditions (e.g. "N" and "T" or "Normal" and "Tumor"), can be used for feature filtering and colour coding in the PCA. Column "AnalyticalReplicate" including numerical values, defines technical repetitions of measurements, which will be summarised. Column "BiologicalReplicates" including numerical values. Please use the following names: "Conditions", "Biological_Replicates", "Analytical_Replicates".Default = NULL
- color_palette
Optional: Provide customiced color-palette in vector format. For continuous scale use e.g. scale_color_gradient(low = "#88CCEE", high = "red") and for discrete scale c("#88CCEE", "#DDCC77","#661100", "#332288")Default = NULL
- scale_color
Optional: Either "continuous" or "discrete" colour scale. For numeric or integer you can choose either, for character you have to choose discrete. Default = NULL
- shape_palette
Optional: Provide customiced shape-palette in vector format. Default = NULL
- show_loadings
Optional: TRUE or FALSE for whether PCA loadings are also plotted on the PCA (biplot) Default = FALSE
- scaling
Optional: TRUE or FALSE for whether a data scaling is used Default = TRUE
- pcx
Optional: Numeric value of the PC that should be plotted on the x-axis Default = 1
- pcy
Optional: Numeric value of the PC that should be plotted on the y-axis Default = 2
- theme
Optional: Selection of theme for plot, e.g. theme_grey(). You can check for complete themes here: https://ggplot2.tidyverse.org/reference/ggtheme.html. If default=NULL we use theme_classic(). Default = "discrete"
- plot_name
Optional: String which is added to the output files of the PCA Default = ""
- save_plot
Optional: Select the file type of output plots. Options are svg, png, pdf or NULL. Default = svg
- print_plot
Optional: TRUE or FALSE, if TRUE Volcano plot is saved as an overview of the results. Default = TRUE
- path
Optional: Path to the folder the results should be saved at. default: NULL
Examples
Intra <- intracell_raw[,-c(1:3)]%>%tibble::column_to_rownames("Code")
#> Error in tibble::column_to_rownames(., "Code"): Can't find column `Code` in `.data`.
Res <- viz_pca(Intra)
#> Error: object 'Intra' not found