husk detects unwanted variation in the sample and removes it from the population.

husk(
  population,
  variables,
  sample,
  remove_outliers = TRUE,
  epsilon = 1e-06,
  remove_signal = TRUE,
  flatten_noise = TRUE
)

Arguments

population

tbl with grouping (metadata) and observation variables.

variables

character vector specifying observation variables.

sample

tbl containing sample that is used by the method to estimate husking parameters. sample has same structure as population. Typically, sample corresponds to controls in the experiment.

remove_outliers

optional boolean specifying whether to remove outliers. Default is TRUE.

epsilon

optional parameter used in husking to offset eigenvalues to avoid division by zero. Default is 1.

remove_signal

optional boolean specifying whether to husk the signal instead of only scaling it down. Default is TRUE.

flatten_noise

optional boolean specifying whether to flatten the noise instead of scaling it up. Default is TRUE. The parameter is ignored if remove_signal is FALSE.

Value

transformed data of the same class as population.

Examples

population <- tibble::tibble( Metadata_pert_name = c(NA, NA, NA, NA), Metadata_Well = c("A01", "A02", "B01", "B02"), Intensity_DNA = c(10, 20, 12, 32), Granularity_DNA = c(22, 20, NA, 32), Texture_DNA = c(5, 2, 43, 13) ) variables <- c("Intensity_DNA", "Texture_DNA") husk(population, variables, population, epsilon = 1, remove_signal = TRUE)
#> # A tibble: 4 x 5 #> Metadata_pert_name Metadata_Well Granularity_DNA V1 V2 #> <lgl> <chr> <dbl> <dbl> <dbl> #> 1 NA A01 22 -0.0797 -0.411 #> 2 NA A02 20 0.576 0.160 #> 3 NA B01 NA -0.497 0.251 #> 4 NA B02 32 1.16 1.05
husk(population, variables, population, epsilon = 1e-5, remove_signal = TRUE)
#> # A tibble: 4 x 5 #> Metadata_pert_name Metadata_Well Granularity_DNA V1 V2 #> <lgl> <chr> <dbl> <dbl> <dbl> #> 1 NA A01 22 -0.147 -0.760 #> 2 NA A02 20 1.07 0.295 #> 3 NA B01 NA -0.918 0.465 #> 4 NA B02 32 2.14 1.94
husk(population, variables, population, epsilon = 1, remove_signal = FALSE)
#> # A tibble: 4 x 5 #> Metadata_pert_name Metadata_Well Granularity_DNA V1 V2 #> <lgl> <chr> <dbl> <dbl> <dbl> #> 1 NA A01 22 -0.0797 -0.503 #> 2 NA A02 20 0.576 0.195 #> 3 NA B01 NA -0.497 0.307 #> 4 NA B02 32 1.16 1.29
husk(population, variables, population, epsilon = 1e-5, remove_signal = FALSE)
#> # A tibble: 4 x 5 #> Metadata_pert_name Metadata_Well Granularity_DNA V1 V2 #> <lgl> <chr> <dbl> <dbl> <dbl> #> 1 NA A01 22 -0.147 -1.15 #> 2 NA A02 20 1.07 0.445 #> 3 NA B01 NA -0.918 0.700 #> 4 NA B02 32 2.14 2.93