|
| 1 | +--- |
| 2 | +title: "Non-targeted metabolomics feature prioritization" |
| 3 | +author: "Anton Klåvus, Vilhelm Suksi" |
| 4 | +date: "`r Sys.Date()`" |
| 5 | +output: |
| 6 | + BiocStyle::html_document: |
| 7 | + toc: true |
| 8 | + toc_depth: 2 |
| 9 | +vignette: > |
| 10 | + %\VignetteIndexEntry{Non-targeted metabolomics feature prioritization} |
| 11 | + %\VignetteEngine{knitr::rmarkdown} |
| 12 | + %\VignetteEncoding{UTF-8} |
| 13 | +bibliography: references.bib |
| 14 | +biblio-style: apalike |
| 15 | +--- |
| 16 | + |
| 17 | +The statistics functionality in `notameStats` aims to identify interesting |
| 18 | +features across study groups. See the project example vignette in the notame |
| 19 | +package and [notame website reference index](https://hanhineva-lab.github.io/ |
| 20 | +notame/reference/index.html) for listing of functions. Similar functionality is |
| 21 | +available in several packages. |
| 22 | + |
| 23 | +Unless otherwise stated, all functions return separate data frames or other |
| 24 | +objects with the results. These can be then added to the object feature data |
| 25 | +using ```join_rowData(object, results)```. The reason for not adding these to |
| 26 | +the objects automatically is that most of the functions return excess |
| 27 | +information that is not always worth saving. We encourage you to choose which |
| 28 | +information is important to you. |
| 29 | + |
| 30 | +```{r setup, include = FALSE} |
| 31 | +knitr::opts_chunk$set( |
| 32 | + comment = "##", |
| 33 | + message = FALSE |
| 34 | +) |
| 35 | +``` |
| 36 | + |
| 37 | +# Installation |
| 38 | + |
| 39 | +To install `notameStats`, install `BiocManager` first, if it is not installed. |
| 40 | +Afterwards use the `install` function from `BiocManager` and load `notameStats`. |
| 41 | + |
| 42 | +```{r install, eval=FALSE} |
| 43 | +if (!requireNamespace("BiocManager", quietly = TRUE)) |
| 44 | + install.packages("BiocManager") |
| 45 | +BiocManager::install("notameStats") |
| 46 | +``` |
| 47 | + |
| 48 | +```{r, message = FALSE} |
| 49 | +library(notame) |
| 50 | +library(notameViz) |
| 51 | +library(notameStats) |
| 52 | +
|
| 53 | +ppath <- tempdir() |
| 54 | +init_log(log_file = file.path(ppath, "log.txt")) |
| 55 | +
|
| 56 | +data(hilic_neg_sample, package = "notame") |
| 57 | +data(toy_notame_set, package = "notame") |
| 58 | +``` |
| 59 | + |
| 60 | +# Univariate functions |
| 61 | + |
| 62 | +## Summary statistics and effect sizes |
| 63 | + |
| 64 | +It is straightforward to provide summary statistics and effect sizes for all |
| 65 | +features: |
| 66 | + |
| 67 | +```{r} |
| 68 | +toy_notame_set <- mark_nas(toy_notame_set, value = 0) |
| 69 | +
|
| 70 | +# Impute missing values, required especially for multivariate methods |
| 71 | +toy_notame_set <- notame::impute_rf(toy_notame_set) |
| 72 | +
|
| 73 | +sum_stats <- summary_statistics(toy_notame_set, grouping_cols = "Group") |
| 74 | +toy_notame_set <- notame::join_rowData(toy_notame_set, sum_stats) |
| 75 | +
|
| 76 | +d_results <- cohens_d(toy_notame_set, group = "Group") |
| 77 | +toy_notame_set <- notame::join_rowData(toy_notame_set, d_results) |
| 78 | +
|
| 79 | +fc <- fold_change(toy_notame_set, group = "Group") |
| 80 | +toy_notame_set <- notame::join_rowData(toy_notame_set, fc) |
| 81 | +
|
| 82 | +colnames(rowData(toy_notame_set)) |
| 83 | +``` |
0 commit comments