Collapse Injections

collapse_injections(
  mzroll_list,
  grouping_vars,
  peak_quant_vars,
  collapse_fxn = "mean"
)

Arguments

mzroll_list

output of process_mzroll or process_mzroll_multi

  • features: one row per unique analyte (defined by a unique groupId),

  • samples: one row per unique sample (defined by a unique sampleId),

  • measurements: one row per peak (samples x peakgroups)

grouping_vars

character vector of sample variables to use for grouping

peak_quant_vars

character vector of quantification variables to average

collapse_fxn

function name to use for collapse

Value

a process_mzroll collapsed across grouping_vars

Examples

collapse_injections( nplug_mzroll_augmented, grouping_vars = "condition", peak_quant_vars = "log2_abundance" )
#> 3 sample variables will be dropped since they #> - vary for the same grouping_vars: #> - samples_tbl_row, sample_name, replicate
#> Warning: `summarise_each_()` was deprecated in dplyr 0.7.0. #> Please use `across()` instead.
#> Warning: `funs_()` was deprecated in dplyr 0.7.0. #> Please use `funs()` instead. #> See vignette('programming') for more help
#> Warning: `funs()` was deprecated in dplyr 0.8.0. #> Please use a list of either functions or lambdas: #> #> # Simple named list: #> list(mean = mean, median = median) #> #> # Auto named with `tibble::lst()`: #> tibble::lst(mean, median) #> #> # Using lambdas #> list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
#> $features #> # A tibble: 106 × 13 #> groupId compoundName smiles adductName tagString mz rt compoundDB #> <fct> <chr> <chr> <chr> <chr> <dbl> <dbl> <chr> #> 1 1 Ribose-P NA NA "" NA NA NA #> 2 2 OMP NA NA "" NA NA NA #> 3 3 1,3-diphopshategl… NA NA "" NA NA NA #> 4 4 3-hydroxy-3-methy… NA NA "" NA NA NA #> 5 5 3-phosphoglycerate NA NA "" NA NA NA #> 6 6 6-phospho-D-gluco… NA NA "" NA NA NA #> 7 7 acetyl-CoA NA NA "" NA NA NA #> 8 8 aconitate NA NA "" NA NA NA #> 9 9 adenosine NA NA "" NA NA NA #> 10 10 ADP NA NA "" NA NA NA #> # … with 96 more rows, and 5 more variables: searchTableName <chr>, #> # label <chr>, peak_label <chr>, method_tag <chr>, pathway <chr> #> #> $samples #> # A tibble: 60 × 10 #> condition filename month DR limitation exp_ref extraction reference #> <int> <chr> <chr> <dbl> <chr> <chr> <chr> <int> #> 1 1 NA Jun 0.055 NH4 exp filter 53 #> 2 2 NA Jun 0.055 NH4 exp pellet 54 #> 3 3 NA Jun 0.173 NH4 exp filter 53 #> 4 4 NA Jun 0.173 NH4 exp pellet 54 #> 5 5 NA Jun 0.21 NH4 exp filter 53 #> 6 6 NA Jun 0.21 NH4 exp pellet 54 #> 7 7 NA Jun 0.29 NH4 exp filter 53 #> 8 8 NA Jun 0.29 NH4 exp pellet 54 #> 9 9 NA Jun 0.056 URA exp filter 53 #> 10 10 NA Jun 0.056 URA exp pellet 54 #> # … with 50 more rows, and 2 more variables: sampleId <fct>, name <chr> #> #> $measurements #> # A tibble: 6,360 × 3 #> groupId sampleId log2_abundance #> <fct> <fct> <dbl> #> 1 1 1 15.0 #> 2 1 2 15.4 #> 3 1 3 15.5 #> 4 1 4 16.0 #> 5 1 5 15.5 #> 6 1 6 15.8 #> 7 1 7 16.1 #> 8 1 8 16.4 #> 9 1 9 13.8 #> 10 1 10 14.5 #> # … with 6,350 more rows #> #> $design #> $design$features #> # A tibble: 13 × 2 #> variable type #> <chr> <chr> #> 1 groupId feature_primary_key #> 2 compoundName character #> 3 smiles character #> 4 adductName character #> 5 tagString character #> 6 mz numeric #> 7 rt numeric #> 8 compoundDB character #> 9 searchTableName character #> 10 label character #> 11 peak_label character #> 12 method_tag character #> 13 pathway character #> #> $design$samples #> # A tibble: 10 × 2 #> variable type #> <chr> <chr> #> 1 sampleId sample_primary_key #> 2 name character #> 3 filename character #> 4 month character #> 5 DR numeric #> 6 limitation character #> 7 exp_ref character #> 8 extraction character #> 9 condition integer #> 10 reference integer #> #> $design$measurements #> # A tibble: 3 × 2 #> variable type #> <chr> <chr> #> 1 groupId feature_primary_key #> 2 sampleId sample_primary_key #> 3 log2_abundance numeric #> #> $design$feature_pk #> [1] "groupId" #> #> $design$sample_pk #> [1] "sampleId" #> #> #> attr(,"class") #> [1] "triple_omic" "tomic" "mzroll"