View source: R/olink_normalization_utils.R
olink_norm_input_check | R Documentation |
olink_normalization
function.This function is a wrapper of multiple help functions which check the inputs
of the olink_normalization
function.
olink_norm_input_check(
df1,
df2,
overlapping_samples_df1,
overlapping_samples_df2,
df1_project_nr,
df2_project_nr,
reference_project,
reference_medians
)
df1 |
First dataset to be used in normalization (required). |
df2 |
Second dataset to be used in normalization. |
overlapping_samples_df1 |
Samples to be used for adjustment factor calculation in df1 (required). |
overlapping_samples_df2 |
Samples to be used for adjustment factor calculation in df2. |
df1_project_nr |
Project name of first dataset (df1). |
df2_project_nr |
Project name of first dataset (df2). |
reference_project |
Project name of reference_project. Should be one of df1_project_nr or df2_project_nr. Indicates the project to which the other project is adjusted to. |
reference_medians |
Dataset with columns "OlinkID" and "Reference_NPX". Used for reference median normalization. |
The following checks are performed:
olink_norm_input_validate
:
Determines the normalization to be performed by intersecting inputs with
internal global variable olink_norm_mode_combos
.
Returns the type of normalization to be performed from
olink_norm_modes
.
Message with the normalization type.
Error message if input is invalid.
olink_norm_input_class
:
Checks if all inputs are of the expected class:
df1
, df2
and reference_medians
: tibble or R6 ArrowObject
overlapping_samples_df1
, overlapping_samples_df2
,
df1_project_nr
, df2_project_nr
and reference_project
: Character
vector
Also checks the validity of names of project and reference project.
Error if invalid input classes are detected.
olink_norm_input_check_df_cols
:
Detects the column names of input datasets df1
and df2
to allow for
alternative names.
Returns named list of column names to use downstream.
Warning if Normalization
column missing from all datasets.
Warning if LOD
is missing or if there are multiple LOD
columns.
Error if required columns are missing.
Error if not all input datasets have or lack Normalization
column.
Error if input datasets have been quantified with different methods.
olink_norm_input_ref_medians
:
Checks validity of dataset containing reference_medians
.
Error if required columns are missing based on
olink_norm_ref_median_cols
.
Error if columns are not of the correct class bases on
olink_norm_ref_median_cols
.
Error if there duplicate assay identifiers.
olink_norm_input_check_samples
:
Check character vectors of reference sample identifiers for:
Being present in df1
and/or df2
.
Duplicate identifiers.
olink_norm_input_clean_assays
:
Returns a named list with the updated df1
, df2
and/or
reference_medians
.
Removes assays that are not of the format OID followed by 5 digits.
Removes assays that are marked with Normalization = EXCLUDED
.
olink_norm_input_assay_overlap
:
Returns a named list with the updated df1
, df2
and/or
reference_medians
.
Remove assays not shared between df1
and df2
, or between df1
and
reference_medians
.
olink_norm_input_norm_method
:
Check if all assays in df1
and df2
have been originally normalized
with the same method "Intensity" or "Plate control".
Warning is thrown if not.
Named list of updated inputs to use for normalization:
df1
: dataset df1.
df2
: NULL
if reference median normalization, or dataset df2.
overlapping_samples_df1
: character vector of reference samples from df1.
overlapping_samples_df2
: NULL
if reference median normalization, or
character vector of reference samples from df1.
df1_project_nr
: name of df1 project.
df2_project_nr
: NULL
if reference median normalization, or name of df2
project.
reference_project
: NULL
if reference median normalization, or name of
reference project.
reference_medians
: NULL
if bridge or subset normalization, or dataset
with reference_medians.
df1_cols
: column names of df1 to use downstream.
df2_cols
: NULL
if reference median normalization, or column names of
df2 to use downstream.
norm_mode
: one of bridge, subset, ref_median, and norm_cross_product
indicating the normalization to be performed.
Klev Diamanti
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.