read_npx: Read Olink data in R.

View source: R/read_npx.R

read_npxR Documentation

Read Olink data in R.

Description

Imports a file exported from Olink software that quantifies protein levels in NPX, Ct or absolute quantification.

Note: Do not modify the Olink software output file prior to importing it with read_npx as it might fail.

Usage

read_npx(
  filename,
  preferred_names = NULL,
  out_df = "tibble",
  long_format = NULL,
  olink_platform = NULL,
  data_type = NULL,
  .ignore_files = c("README.txt"),
  quiet = TRUE,
  legacy = FALSE
)

read_NPX(
  filename,
  preferred_names = NULL,
  out_df = "tibble",
  long_format = NULL,
  olink_platform = NULL,
  data_type = NULL,
  .ignore_files = c("README.txt"),
  quiet = TRUE,
  legacy = FALSE
)

Arguments

filename

Path to Olink software output file in wide or long format. Expecting extensions "xls" or "xlsx" for excel files, "csv" or "txt" for delim files, "parquet" for parquet files, and "zip" for compressed files.

preferred_names

A named character vector where names are internal column names and values are column names to be selected from the input data frame. Read the description of check_npx()for further information.

out_df

The class of the output dataset. One of "tibble" or "arrow". Defaults to "tibble".

long_format

Boolean marking format of input file. One of TRUE for long format and FALSE for wide format files. Defaults to NULL for auto-detection.

olink_platform

Olink platform used to generate the input file. One of "Target 48", "Flex", "Target 96", "Explore 3072", "Explore HT", "Focus", or "Reveal". Defaults to NULL for auto-detection.

data_type

Quantification method of the input data. One of "Ct", "NPX", or "Quantified". Defaults to NULL for auto-detection.

.ignore_files

Character vector of files included in the zip-compressed Olink software output files that should be ignored. Used only for zip-compressed input files (default = c("README.txt")).

quiet

Boolean to print a confirmation message when reading the input file. Applies to excel or delimited input only. TRUE skips printing the message, and FALSE otherwise.

legacy

Boolean to run the legacy version of the read_npx function. Important: should be used only to wide format files from Target 96 or Target 48 with NPX Software version earlier than 1.8! (default FALSE).

Details

OlinkAnalyze uses pre-defined names of columns of data frames to perform downstream analyses. At the same time, different Olink platforms export data with different column names (e.g. different protein quantification metric). The output of this function aims to instruct each function of OlinkAnalyze on the column it should be using for the downstream analysis. This should be seamless for data exported from Olink Software and imported to R using the read_npx() or processed using the clean_npx() function.

However, in certain cases the columns of interest might be named differently. The argument preferred_names allows assigning custom-named columns of a data frame to internally expected variables that will in turn instruct Olink Analyze functions to use them for downstream analysis. For example, if one wished to use the column PCNormalizedNPX for their analysis instead of the column NPX, then they can assign this new name to the internal variable quant to inform the package that in the downstream analysis PCNormalizedNPX should be used. See examples below.

The argument preferred_names is a named character vector with internal column names as names and column names of the current data set as values. Names of the input vector can be one or more of the following: "sample_id", "sample_type", "assay_type", "olink_id", "uniprot", "assay", "panel", "block", "plate_id", "panel_version", "lod", "quant", "ext_npx", "count", "qc_warning", "assay_warn", "normalization", and "qc_version"

Value

Dataset, "tibble" or "ArrowObject", with Olink data in long format.

Author(s)

Klev Diamanti Kathleen Nevola Pascal Pucholt Christoffer Cambronero Boxi Zhang Olof Mansson Marianne Sandin

Examples


file <- system.file("extdata",
                    "npx_data_ext.parquet",
                    package = "OlinkAnalyze")

# use NPX by default as quantification
OlinkAnalyze::read_npx(filename = file)

# use PCNormalizedNPX as quantification
OlinkAnalyze::read_npx(
  filename = file,
  preferred_names = c("quant" = "PCNormalizedNPX")
)



OlinkAnalyze documentation built on Sept. 18, 2026, 5:06 p.m.