plot PCA
Usage
plot_pca(
matrix,
annotation,
sample_name,
factor_keys,
PC = c(1, 2),
add_txt = FALSE,
nudge = 0.1
)Arguments
- matrix
numeric matrix — wide-format intensity data
- annotation
data.frame — sample annotation
- sample_name
character — sample name column
- factor_keys
character vector — factor column names (first for color, second for shape)
- PC
which principal components to plot
- add_txt
show sample labels
- nudge
label nudge distance
See also
Other plotting:
ContrastsPlotter,
INTERNAL_FUNCTIONS_BY_FAMILY,
medpolish_estimate_df(),
missigness_histogram(),
missingness_per_condition(),
missingness_per_condition_cumsum(),
plot_estimate(),
plot_heatmap(),
plot_heatmap_cor(),
plot_hierarchies_add_quantline(),
plot_hierarchies_boxplot_df(),
plot_hierarchies_line(),
plot_hierarchies_line_df(),
plot_intensity_distribution_violin(),
plot_na_heatmap(),
plot_raster(),
plot_sample_correlation(),
upset_interaction_missing_stats(),
upset_missing_stats()
Examples
istar <- sim_lfq_data_protein_config(with_missing = TRUE, weight_missing = .8, Nprot = 3000)
#> creating sampleName from file_name column
#> completing cases
#> completing cases done
#> setup done
lfq <- LFQData$new(istar$data, istar$config)
wide <- lfq$to_wide(as.matrix = TRUE)
tmp <- plot_pca(wide$data, wide$annotation, lfq$sample_name(), lfq$factor_keys(),
add_txt = TRUE, nudge = 0.01)
#> PCA: removed 2459 of 2986 features with missing values. For PCA with all features, impute first using impute_with_zcomp().
#> Joining with `by = join_by(sampleName)`
stopifnot("ggplot" %in% class(tmp))
tmp <- plot_pca(wide$data, wide$annotation, lfq$sample_name(), lfq$factor_keys())
#> PCA: removed 2459 of 2986 features with missing values. For PCA with all features, impute first using impute_with_zcomp().
#> Joining with `by = join_by(sampleName)`
stopifnot("ggplot" %in% class(tmp))