# \donttest{
if (rlang::is_installed(pkg = c("ggrepel", "ggpubr"))) {
npx_data <- npx_data1 |>
dplyr::filter(
!grepl(pattern = "CONTROL",
x = .data[["SampleID"]],
ignore.case = TRUE)
)
# PCA using all the data
OlinkAnalyze::olink_pca_plot(
df = npx_data,
color_g = "QC_Warning"
)
# PCA per panel
g <- OlinkAnalyze::olink_pca_plot(
df = npx_data,
color_g = "QC_Warning",
byPanel = TRUE
)
g[[2L]] # Plot only the second panel
# Label outliers
OlinkAnalyze::olink_pca_plot(
df = npx_data,
color_g = "QC_Warning",
outlierDefX = 2L,
outlierDefY = 4L
) # All data
OlinkAnalyze::olink_pca_plot(
df = npx_data,
color_g = "QC_Warning",
outlierDefX = 2.5,
outlierDefY = 4L,
byPanel = TRUE
) # Per panel
# Retrieve the outliers
g <- OlinkAnalyze::olink_pca_plot(
df = npx_data,
color_g = "QC_Warning",
outlierDefX = 2.5,
outlierDefY = 4L,
byPanel = TRUE
)
outliers <- lapply(g, function(x) {
return(x$data)
}) |>
dplyr::bind_rows() |>
dplyr::filter(
.data[["Outlier"]] == 1L
)
}
# }
Run the code above in your browser using DataLab