Skip to contents

Filtering the experiment to keep only significant variables is a common task. This function provides a convenient way to do this. It supports results from all glystats DEA functions including gly_anova(), gly_kruskal(), gly_ttest(), gly_wilcox(), and gly_limma().

Usage

filter_sig_vars(
  exp,
  res,
  p_adj_cutoff = 0.05,
  p_val_cutoff = NULL,
  fc_cutoff = NULL,
  ...
)

# S3 method for class 'glystats_anova_res'
filter_sig_vars(
  exp,
  res,
  p_adj_cutoff = 0.05,
  p_val_cutoff = NULL,
  fc_cutoff = NULL,
  on = "main_test",
  comparison = NULL,
  ...
)

# S3 method for class 'glystats_kruskal_res'
filter_sig_vars(
  exp,
  res,
  p_adj_cutoff = 0.05,
  p_val_cutoff = NULL,
  fc_cutoff = NULL,
  on = "main_test",
  comparison = NULL,
  ...
)

# S3 method for class 'glystats_ttest_res'
filter_sig_vars(
  exp,
  res,
  p_adj_cutoff = 0.05,
  p_val_cutoff = NULL,
  fc_cutoff = NULL,
  ...
)

# S3 method for class 'glystats_wilcox_res'
filter_sig_vars(
  exp,
  res,
  p_adj_cutoff = 0.05,
  p_val_cutoff = NULL,
  fc_cutoff = NULL,
  ...
)

# S3 method for class 'glystats_limma_res'
filter_sig_vars(
  exp,
  res,
  p_adj_cutoff = 0.05,
  p_val_cutoff = NULL,
  fc_cutoff = NULL,
  comparison = NULL,
  ...
)

Arguments

exp

An glyexp::experiment().

res

A glystats result object from a glystats DEA function.

p_adj_cutoff

The threshold for p-adjusted values. Default is 0.05.

p_val_cutoff

The threshold for p-values. We don't recommend using this. Default is NULL. If you insist to use it, please set p_adj_cutoff to NULL.

fc_cutoff

The threshold for fold changes. Default is NULL. Only positive value is needed. For example, 2 means fold change > 2 or < 1/2.

...

Additional arguments passed to methods. See the method-specific documentation for details.

on

(For gly_anova() and gly_kruskal() results only) "main_test" or "post_hoc_test". Should the filter be applied on the main test results or the post-hoc test results? Default is "main_test". If "post_hoc_test", please set a comparison value.

comparison

(For gly_anova(), gly_kruskal(), and gly_limma() results only) Specifies which comparison to filter on. A string with the format "group1_vs_group2". For gly_anova() and gly_kruskal() results, comparison is only used when on is "post_hoc_test".

Value

An new glyexp::experiment() object.

Examples

library(glyexp)
library(glyclean)
#> 
#> Attaching package: ‘glyclean’
#> The following object is masked from ‘package:stats’:
#> 
#>     aggregate

exp <- auto_clean(real_experiment) |>
  glyexp::slice_head_var(n = 10)
#>  Normalizing data (Median)
#>  Normalizing data (Median) [235ms]
#> 
#>  Removing variables with >50% missing values
#>  Removing variables with >50% missing values [81ms]
#> 
#>  Imputing missing values
#>  Sample size <= 30, using sample minimum imputation
#>  Imputing missing values

#>  Imputing missing values [25ms]
#> 
#>  Aggregating data
#>  Aggregating data [951ms]
#> 
#>  Normalizing data again
#>  Normalizing data again [21ms]
#> 
res <- gly_anova(exp)
#>  Number of groups: 4
#>  Groups: "H", "M", "Y", and "C"
#>  Pairwise comparisons will be performed, with levels coming first as reference groups.
sig_exp <- filter_sig_vars(exp, res)