The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Olink® Analyze is an R package that provides a versatile toolbox to enable fast and easy handling of Olink® NPX data for your proteomics research. Olink® Analyze provides functions for using Olink data, including functions for importing Olink® NPX datasets, as well as quality control (QC) plot functions and functions for various statistical tests. This package is meant to provide a convenient pipeline for your Olink NPX data analysis.
Preprocessing
Statistical analysis
Visualization
Sample datasets
The package contains two test data files named npx_data1 and npx_data2. These are synthetic datasets that resemble Olink® data accompanied by clinical variables. Olink® data that is delivered in long format or imported with the function read_NPX (that converts the data into a long format) contain the following columns:
Note: There are 5 additional variables in the sample datasets npx_data1 and npx_data2 that include clinical or other information, namely: Subject <chr>, Treatment <chr>, Site <chr>, Time <chr>, Project <chr>.
The columns found in an Olink data set may vary based on the version and product.
The read_NPX function imports an NPX file into a tidy format to work with in R. No prior alterations to the NPX output file should be made for this function to work as expected.
A tibble in long format containing:
In order to import multiple NPX data files at once, the read_NPX function can be used in combination with the list.files, lapply and dplyr::bind_rows functions, as seen below. The pattern argument of the list.files function specifies the NPX file format (.csv, .parquet, or either). This method requires that all NPX files are stored in the same folder and have identical column names. No prior alterations to the NPX output file should be made for this method to work as expected.
# Read in multiple NPX files in .csv format
data <- list.files(path = "path/to/dir/with/NPX/files",
pattern = "csv$",
full.names = TRUE) |>
lapply(FUN = function(x){
OlinkAnalyze::read_NPX(x) |>
dplyr::mutate(File = x) # Optionally add additional columns to add file identifiers
} |>
dplyr::bind_rows() # optional to return a single data frame of all files instead of a list of data frames
# Read in multiple NPX files in .parquet format
data <- list.files(path = "path/to/dir/with/NPX/files",
pattern = "parquet$",
full.names = TRUE) |>
lapply(OlinkAnalyze::read_NPX) |>
dplyr::bind_rows()
# Read in multiple NPX files in either format
data <- list.files(path = "path/to/dir/with/NPX/files",
pattern = "parquet$|csv$",
full.names = TRUE) |>
lapply(OlinkAnalyze::read_NPX) |>
dplyr::bind_rows()
The olink_plate_randomizer function randomly assigns samples to a plate well with the option to keep the same individuals on the same plate. Olink® does not recommend to force balance based on other clinical variables.
For more information on plate randomization, consult the Plate Randomization Vignette.
The bridge selection function selects a number of bridge samples based on the input data. Bridge samples are used to normalize two dataframes/projects that have been ran at different time points, hence, a batch effect is expected. It select samples that fulfill certain criteria that include good detectability, passing quality control and covering a wide range of data points.
For more information on bridge sample selection, consult the Introduction to bridging Olink® NPX datasets tutorial
The olink_normalization is a function used to normalize NPX values between two different dataframes/projects which have been ran at different times. Commonly, there is a shift in (mean) NPX values between runs, however, the spread of the data remains the same. This is why normalization between dataframes/projects is required. When normalization is performed, one of the two provided dataframes/projects shall be used as a reference. If two dataframes/projects from the same product have been normalized to one another, Olink® by default uses the chronologically older one as reference. The function handles four different types of normalization:
The olink_lod function adds LOD information to an Explore HT or Explore 3072 NPX dataframe. This function can incorporate LOD based on either an Explore dataset’s negative controls or using predetermined fixed LOD values, which can be downloaded from the Document Download Center at olink.com, or using both methods. The default LOD calculation method is based off of the negative controls. If an NPX file is intensity normalized, both intensity normalized and PC normalized LODs are provided.
For more information on calculating LOD, consult the Calculating LOD from Olink® Explore data tutorial
The olink_ttest function performs a Welch 2-sample t-test or paired t-test at confidence level 0.95 for every protein (by OlinkID) for a given grouping variable using the function t.test from the R library stats and corrects for multiple testing using the Benjamini-Hochberg method (“fdr”) using the function p.adjust from the R library stats. Adjusted p-values are logically evaluated towards adjusted p-value<0.05. The resulting t-test table is arranged by ascending p-values.
A tibble with the following columns:
The olink_wilcox function performs a 2-sample Mann-Whitney U test or paired Mann-Whitney U test at confidence level 0.95 for every protein (by OlinkID) for a given grouping variable using the function wilcox.test from the R library stats and corrects for multiple testing using the Benjamini-Hochberg method (“fdr”) based on the function p.adjust from the R library stats. Adjusted p-values are logically evaluated towards adjusted p-value<0.05. The resulting Mann-Whitney U table is arranged by ascending p-values.
A tibble with the following columns:
The olink_anova is a wrapper function that performs an ANOVA F-test for each assay using the function Anova from the R library car and Type III sum of squares. The function handles both factor and numerical variables, and/or confounding factors.
Samples with missing variable information or factor levels are excluded from the analysis. Character columns in the input data frame are converted to factors. The automatic handling of the data from above is announced by a message if the flag verbose=TRUE.
Control samples and control assays (AssayType is not “assay”, or Assay contains “control” or “ctrl”) should be removed before using this function.
Crossed/interaction analysis, i.e. A*B formula notation, is inferred from the variable argument in the following cases:
Inference is specified in a message if verbose=TRUE.
For covariates, crossed analyses need to be specified explicitly, i.e. two main effects will not be expanded with a c(‘A’,‘B’) notation. Main effects present in the variable take precedence. The formula notation of the final model is specified in a message if verbose=TRUE.
Adjusted p-values are calculated using the function p.adjust from the R library stats with the Benjamini & Hochberg (1995) method (“fdr”). The threshold is determined by logic evaluation of Adjusted_pval < 0.05. Covariates are not included in the p-value adjustment.
# Remove control samples and assays
npx_data1_no_controls <- npx_data1 |>
filter(!str_detect(SampleID,
regex("control|ctrl",
ignore_case = TRUE))) |>
filter(!str_detect(Assay,
regex("control|ctrl",
ignore_case = TRUE)))
# One-way ANOVA, no covariates
anova_results_oneway <- olink_anova(df = npx_data1_no_controls,
variable = 'Site')
# Two-way ANOVA, no covariates
anova_results_twoway <- olink_anova(df = npx_data1_no_controls,
variable = c('Site', 'Time'))
# One-way ANOVA, Treatment as covariates
anova_results_oneway <- olink_anova(df = npx_data1_no_controls,
variable = 'Site',
covariates = 'Treatment')
A tibble with the following columns:
olink_anova_posthoc performs a post-hoc ANOVA test using the function emmeans from the R library emmeans with Tukey p-value adjustment per assay (by OlinkID) at confidence level 0.95.
The function handles both factor and numerical variables and/or covariates. The post-hoc test for a numerical variable compares the difference in means of the outcome variable (default: NPX) for 1 standard deviation (SD) difference in the numerical variable, e.g. mean NPX at mean (numerical variable) versus mean NPX at mean (numerical variable) + 1*SD (numerical variable).
Control samples and control assays (AssayType is not “assay”, or Assay contains “control” or “ctrl”) should be removed before using this function.
# calculate the p-value for the ANOVA
anova_results_oneway <- olink_anova(df = npx_data1_no_controls,
variable = 'Site')
# extracting the significant proteins
anova_results_oneway_significant <- anova_results_oneway %>%
filter(Threshold == 'Significant') %>%
pull(OlinkID)
anova_posthoc_oneway_results <- olink_anova_posthoc(df = npx_data1_no_controls,
olinkid_list = anova_results_oneway_significant,
variable = 'Site',
effect = 'Site')
A tibble with the following columns:
The olink_lmer fits a linear mixed effects model for every protein (by OlinkID) in every panel, using the function lmer from the R library lmerTest and the function anova from the R library stats. The function handles both factor and numerical variables and/or covariates.
Samples with missing variable information or factor levels are excluded from the analysis. Character columns in the input data frame are converted to factors. The automatic handling of the data from above is announced by a message if the flag verbose=TRUE.
Crossed/interaction analysis, i.e. A*B formula notation, is inferred from the variable argument in the following cases:
Inference is specified in a message if verbose=TRUE.
For covariates, crossed analyses need to be specified explicitly, i.e. two main effects will not be expanded with a c(‘A’,‘B’) notation. Main effects present in the variable take precedence. The formula notation of the final model is specified in a message if verbose=TRUE.
Adjusted p-values are calculated using the function p.adjust from the R library stats with the Benjamini & Hochberg (1995) method (“fdr”). The threshold is determined by logic evaluation of Adjusted_pval < 0.05. Covariates are not included in the p-value adjustment.
if (requireNamespace("lme4", quietly = TRUE) & requireNamespace("lmerTest", quietly = TRUE)){
# Linear mixed model with one variable.
lmer_results_oneway <- olink_lmer(df = npx_data1,
variable = 'Site',
random = 'Subject')
# Linear mixed model with two variables.
lmer_results_twoway <- olink_lmer(df = npx_data1,
variable = c('Site', 'Treatment'),
random = 'Subject')
}
A tibble with the following columns:
The olink_lmer_posthoc function is similar to olink_lmer but performs a post-hoc analysis based on a linear mixed model effects model using the function lmer from the R library lmerTest and the function emmeans from the R library emmeans. The function handles both factor and numerical variables and/or covariates. Differences in estimated marginal means are calculated for all pairwise levels of a given output variable. Degrees of freedom are estimated using Satterthwaite’s approximation. The post-hoc test for a numerical variable compares the difference in means of the outcome variable (default: NPX) for 1 standard deviation difference in the numerical variable, e.g. mean NPX at mean(numerical variable) versus mean NPX at mean(numerical variable) + 1*SD(numerical variable). The output tibble is arranged by ascending adjusted p-values.
if (requireNamespace("lme4", quietly = TRUE) & requireNamespace("lmerTest", quietly = TRUE)){
# Linear mixed model with two variables.
lmer_results_twoway <- olink_lmer(df = npx_data1,
variable = c('Site', 'Treatment'),
random = 'Subject')
# extracting the significant proteins
lmer_results_twoway_significant <- lmer_results_twoway %>%
filter(Threshold == 'Significant', term == 'Treatment') %>%
pull(OlinkID)
# performing post-hoc analysis
lmer_posthoc_twoway_results <- olink_lmer_posthoc(df = npx_data1,
olinkid_list = lmer_results_twoway_significant,
variable = c('Site', 'Treatment'),
random = 'Subject',
effect = 'Treatment')
}
A tibble with the following columns:
Many other statistical functions can be found within Olink Analyze, including:
To learn more about these function, consult their help documentation
using the help()
function.
The olink_pathway_enrichment function can be used to perform Gene Set Enrichment Analysis (GSEA) or Over-representation Analysis (ORA) using MSigDB, Reactome, KEGG, or GO. MSigDB includes curated gene sets (C2) and ontology gene sets (C5) which encompasses Reactome, KEGG, and GO. This function performs enrichment using the gsea or enrich functions from clusterProfiler from BioConductor. The function uses the estimate from a previous statistical analysis for one contrast for all proteins. MSigDB is subset if ontology is KEGG, GO, or Reactome. test_results must contain estimates for all assays. Posthoc results can be used but should be filtered for one contrast to improve interpretability.
Alternative statistical results can be used as input as long as they include the columns “OlinkID”, “Assay”, and “estimate”. A column named “Adjusted_pal” is also needed for ORA. Any statistical results that contains one estimate per protein will work as long as the estimates are comparable to each other.
clusterProfiler is originally developed by Guangchuang Yu at the School of Basic Medical Sciences at Southern Medical University.
T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu. clusterProfiler 4.0: A universal enrichment tool for interpreting omics data. The Innovation. 2021, 2(3):100141. doi: 10.1016/j.xinn.2021.100141
npx_df <- npx_data1 %>% filter(!grepl("control", SampleID, ignore.case = TRUE))
ttest_results <- olink_ttest(
df = npx_df,
variable = "Treatment",
alternative = "two.sided")
try({ # This expression might fail if dependencies are not installed
gsea_results <- olink_pathway_enrichment(data = npx_data1, test_results = ttest_results)
ora_results <- olink_pathway_enrichment(
data = npx_data1,
test_results = ttest_results, method = "ORA")
}, silent = TRUE)
A data frame of enrichment results. Columns for ORA include:
Columns for GSEA:
Generates PCA projection of all samples from NPX data along two principal components (Default PC2 vs PC1) colored by the variable QC_Warning and including the percentage of explained variance. The function used the functions prcomp and ggplot from the R libraries stats and ggplot2, respectively. By default, the values scaled and centered in the PCA and proteins with missing NPX values removed from the corresponding assay(s). Unique sample names are required. Imputation by median value is done for assays with missingness <10% and for multi-plate projects, and for missingness <5% for single plate projects.
The values are by default scaled and centered in the PCA and proteins with missing NPX values are by default removed from the corresponding assay. Unique sample names are required. Imputation by the median is done for assays with missingness <10% for multi-plate projects and <5% for single plate projects. The plot is printed, and a list of ggplot objects is returned.
More information about olink_pca()
can be found in the
Outlier Exclusion Vignette.
Computes a manifold approximation and projection using umap::umap and plots the two specified components. Unique sample names are required and imputation by the median is done for assays with missingness <10% for multi-plate projects and <5% for single plate projects.
If byPanel = TRUE, the data processing (imputation of missing values etc) and subsequent UMAP is performed separately per panel. A faceted plot is printed, while the individual ggplot objects are returned.
The arguments outlierDefX and outlierDefY can be used to identify outliers in the UMAP results. Samples more than +/-outlierDef[X,Y] standard deviations from the mean of the plotted UMAP component will be labelled. Both arguments have to be specified. NOTE: UMAP is a non-linear data transformation that might not accurately preserve the properties of the data. Distances in the UMAP plane should therefore be interpreted with caution
A list of objects of class ggplot (silently returned). Plots
are also printed unless option quiet = TRUE
is set.
The olink_boxplot function is used to generate boxplots of NPX values stratified on a variable for a given list of proteins. olink_boxplot uses the functions ggplot and geom_boxplot of the R library ggplot2.
In order to annotate the plot with ANOVA posthoc analysis results, control samples and control assays (AssayType is not “assay”, or Assay contains “control” or “ctrl”) should be removed.
# Remove control samples and assays
npx_data1_no_controls <- npx_data1 |>
filter(!str_detect(SampleID,
regex("control|ctrl",
ignore_case = TRUE))) |>
filter(!str_detect(Assay,
regex("control|ctrl",
ignore_case = TRUE)))
plot <- npx_data1_no_controls %>%
na.omit() %>% # removing missing values which exists for Site
olink_boxplot(variable = "Site",
olinkid_list = c("OID00488", "OID01276"),
number_of_proteins_per_plot = 2)
plot[[1]]
anova_posthoc_results<-npx_data1_no_controls %>%
olink_anova_posthoc(olinkid_list = c("OID00488", "OID01276"),
variable = 'Site',
effect = 'Site')
plot2 <- npx_data1_no_controls %>%
na.omit() %>% # removing missing values which exists for Site
olink_boxplot(variable = "Site",
olinkid_list = c("OID00488", "OID01276"),
number_of_proteins_per_plot = 2,
posthoc_results = anova_posthoc_results)
plot2[[1]]
A list of objects of class ggplot.
Note: Please note that plots will not appear in the plots panel of Rstudio if not assigned to a variable and printing it (see sample code above).
The olink_dist_plot function generates boxplots of NPX values for each sample, faceted by Olink panel. This is used as an initial QC step to identify potential outliers. olink_dist_plot uses the functions ggplot and geom_boxplot of the R library ggplot2.
More information about olink_dist_plot()
can be found in
the Outlier Exclusion Vignette.
The function olink_lmer_plot generates a point-range plot for a given list of proteins based on linear mixed effect model. The points illustrate the mean NPX level for each group and the error bars illustrate 95% confidence intervals. Facets are labeled by the protein name and corresponding OlinkID for the protein.
A list of objects of class ggplot.
Note: Please note that plots will not appear in the plots panel of Rstudio if not assigned to a variable and printing it (see sample code above).
The olink_pathway_heatmap function generates a heatmap of proteins related to pathways using the enrichment results from the olink_pathway_enrichment function. Either the top terms can be visualized or terms containing a certain keyword. For each term, the proteins in the test_result data frame that are related to that term will be visualized by their estimate. This visualization can be used to determining how many proteins of interest are involved in a particular pathway and in which direction their estimates are.
A heatmap as a ggplot object
The olink_pathway_visualization function generates a bar graph of the top terms or terms related to a certain keyword for results from the olink_pathway_enrichment function. The bar represents either the normalized enrichment score (NES) for GSEA results or counts (number of proteins) for ORA results colored by adjusted p-value. The ORA visualization also contains the number of proteins out of the total proteins in that pathway as a ratio after the bar.
A bar graph as a ggplot object.
The olink_qc_plot function generates a facet plot per Panel using ggplot and ggplot2::geom_point and stats::IQR plotting IQR vs. median for all samples. This is a good first check to find out if any samples have a tendency to be classified as outliers. Horizontal dashed lines indicate +/-3 standard deviations from the mean IQR. Vertical dashed lines indicate +/-3 standard deviations from the mean sample median.
More information about olink_qc_plot()
can be found in
the Outlier Exclusion Vignette.
The olink_heatmap_plot function generates a heatmap for all samples and proteins using pheatmap::pheatmap. By default the heatmap center and scaled NPX across all proteins and cluster samples and proteins using a dendrogram. Unique sample names are required.
Group variable can be annotated and colored in the left side of the heatmap.
first10 <- npx_data1 %>%
pull(OlinkID) %>%
unique() %>%
head(10)
first15samples <- npx_data1$SampleID %>%
unique() %>%
head(15)
npx_data_small <- npx_data1 %>%
filter(!str_detect(SampleID, 'CONT')) %>%
filter(OlinkID %in% first10) %>%
filter(SampleID %in% first15samples)
try({ #This statement might fail if dependencies are not installed
olink_heatmap_plot(npx_data_small, variable_row_list = 'Treatment')
})
An object of class ggplot.
The olink_volcano_plot function generates a volcano plot using results from the olink_ttest function using the function ggplot and geom_point of the R library ggplot2. The estimated difference is shown in the x-axis and -log10(p-value) in the y-axis. A horizontal dotted line indicates p-value = 0.05. Dots are colored based on Benjamini-Hochberg adjusted p-value cutoff 0.05 and can optionally be annotated by OlinkID.
# perform t-test
ttest_results <- olink_ttest(df = npx_data1,
variable = 'Treatment')
# select names of proteins to show
top_10_name <- ttest_results %>%
slice_head(n = 10) %>%
pull(OlinkID)
# volcano plot
olink_volcano_plot(p.val_tbl = ttest_results,
x_lab = 'Treatment',
olinkid_list = top_10_name)
An object of class ggplot.
This function sets a coherent plot theme for plots by adding it to a ggplot object. It is mainly used for aesthetic reasons.
These functions sets a coherent coloring theme for the plots by adding it to a ggplot object. It is mainly used for aesthetic reasons.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.