
Main function for normalizing quantitative data in a tidyproteomics data-object
Source:R/control_normalization.R
normalize.Rdnormalize() Main function for normalizing quantitative data from a tidyproteomics
data-object. This is a passthrough function as it returns the original
tidyproteomics data-object with an additional quantitative column labeled with the
normalization method(s) used.
This function can accommodate multiple normalization methods in a single pass, and it is useful for examining normalization effects on data. Often it is adventitious to select a optimal normalization method based on performance.
Usage
normalize(
data,
...,
.method = c("scaled", "median", "linear", "limma", "loess", "svm", "randomforest"),
.cores = 1
)Arguments
- data
tidyproteomics data object
- ...
use a subset of the data for normalization see
subset(). This is useful when normalizing against a spike-in set of proteins- .method
character vector of normalization to use
- .cores
number of CPU cores to use for multi-threading
Examples
library(dplyr, warn.conflicts = FALSE)
library(tidyproteomics)
# subset for fast execution
hela_proteins <- hela_proteins %>% subset(description %like% "Ribosome")
#>
#> ℹ Subsetting data: description %like% Ribosome
#> ✔ Subsetting data: description %like% Ribosome ... done
#>
hela_proteins %>%
normalize(.method = c("scaled", "median")) %>%
summary("sample")
#> ℹ Normalizing quantitative data
#> ℹ ... using scaled shift
#> ✔ ... using scaled shift [15ms]
#>
#> ℹ ... using median shift
#> ✔ ... using median shift [14ms]
#>
#> ℹ Selecting best normalization method
#> ✔ Selecting best normalization method ... done
#>
#> ℹ ... selected scaled
#>
#> ── Summary: sample ──
#>
#> sample proteins peptides peptides_unique quantifiable CV PC1 PC2
#> control 17 224 224 0.976 0.057 0.60 0.40
#> knockdown 17 224 224 0.996 0.087 0.59 0.41
#>
# normalize between samples according to a subset, then apply to all values
# this would be recommended with a pull-down experiment wherein a conserved
# protein complex acts as the majority content and individual inter-actors
# are of quantitative differentiation
hela_proteins %>%
normalize(!description %like% "mitochondrial", .method = c("scaled", "median")) %>%
summary("sample")
#> ! normalization based on 14 of 17 identifiers
#> ! WARNING: filter narrowed range, NAs may result
#> ! WARNING: omitting `limma` and `randomforest` - cannot accommodate subsetting
#> ℹ Normalizing quantitative data
#> ℹ ... using scaled shift
#> ✔ ... using scaled shift [15ms]
#>
#> ℹ ... using median shift
#> ✔ ... using median shift [14ms]
#>
#> ℹ Selecting best normalization method
#> ✔ Selecting best normalization method ... done
#>
#> ℹ ... selected scaled
#>
#> ── Summary: sample ──
#>
#> sample proteins peptides peptides_unique quantifiable CV PC1 PC2
#> control 17 224 224 0.976 0.061 0.61 0.39
#> knockdown 17 224 224 0.996 0.084 0.59 0.41
#>