-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.Rmd
84 lines (56 loc) · 3.38 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
output: github_document
---
<!-- index.md is generated from index.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
eval = FALSE,
comment = "#>",
fig.path = "man/figures/index-",
out.width = "100%")
```
# batchtma R package: Methods to address batch effects
<!-- badges: start -->
<!-- badges: end -->
The goal of the batchtma package is to provide functions for batch effect-adjusting biomarker data. It implements different methods that address batch effects while retaining differences between batches that may be due to "true" underlying differences in factors that drive biomarker values.
## Installation
batchtma can be installed from [CRAN](https://cran.r-project.org/) using:
```{r}
install.packages("batchtma")
```
To install a potentially newer version from [GitHub](https://github.com/), use:
```{r}
# install.packages("remotes") # The "remotes" package needs to be installed
remotes::install_github("stopsack/batchtma")
```
## Usage
Load the package:
```{r eval=TRUE}
library(batchtma)
```
Define example data with batch effects:
```{r eval=TRUE}
df <- data.frame(tma = rep(1:2, times = 30),
biomarker = rep(1:2, times = 30) + runif(max = 3, n = 60))
```
Run the `adjust_batch()` function to adjust for batch effects:
```{r example, eval=TRUE, fig.show="hold", out.width='40%'}
df_adjust <- adjust_batch(data = df, markers = biomarker, batch = tma, method = simple)
plot_batch(data = df, marker = biomarker, batch = tma, title = "Raw data")
plot_batch(data = df_adjust, marker = biomarker_adj2, batch = tma, title = "Adjusted data")
```
* The ["Get Started"](articles/batchtma.html) vignette has details on how to use the package.
## Methodology
The package implements five different approaches to obtaining batch effect-adjusted biomarker values. The methods differ depending on what distributional property of batch effects they address and how they handle "true" between-batch differences. Such differences can result from confounding when batches include samples with different characteristics that are expected to lead to differences in biomarker levels. They should ideally be retained when performing batch effect adjustments.
\# | `method =` | Approach | Addressed | Retains "true" between-batch differences
---+---------------+-------------------------------+------------------------+----------------
1 | --- | Unadjusted | --- | Yes
2 | `simple` | Simple means | Means | No
3 | `standardize` | Standardized batch means | Means | Yes
4 | `ipw` | Inverse-probability weighting | Means | Yes
5 | `quantreg` | Quantile regression | Low and high quantiles | Yes
6 | `quantnorm` | Quantile normalization | All ranks | No
* ["Get Started"](articles/batchtma.html) shows general examples on the different methods in absence and presence of confounding.
## Reference
Stopsack KH, Tyekucheva S, Wang M, Gerke TA, Vaselkiv JB, Penney KL, Kantoff PW, Finn SP, Fiorentino M, Loda M, Lotan TL, Parmigiani G\*, Mucci LA\* (\* equal contribution). Extent, impact, and mitigation of batch effects in tumor biomarker studies using tissue microarrays. *eLife* 2021;10:e71265. [doi:10.7554/elife.71265](https://doi.org/10.7554/elife.71265).