-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
80 lines (58 loc) · 2.74 KB
/
README.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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# MethCon5
<!-- badges: start -->
[](https://travis-ci.org/EmilHvitfeldt/methcon5)
[](https://codecov.io/gh/EmilHvitfeldt/methcon5?branch=master)
[](https://CRAN.R-project.org/package=methcon5)
[](https://zenodo.org/badge/latestdoi/207922502)
<!-- badges: end -->
The goal of methcon5 is to identify and rank CpG DNA methylation conservation along the human genome. Specifically, it includes bootstrapping methods to provide ranking which should adjust for the differences in length as without it short regions tend to get higher conservation scores.
The following [repository](https://github.com/EmilHvitfeldt/Epigenetic-Conservation-Is-A-Beacon-Of-Function) includes an analysis in which this package was used.
## Installation
Please note that the name of the package is in all lowercase.
You can install the released version of methcon5 from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("methcon5")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("EmilHvitfeldt/methcon5")
```
## Example
First we apply the `meth_aggregate()` function to the included example dataset `fake_methylation`. This will take the columns specified in `value` and apply the `fun` stratified according to `id`. In this case, we want to calculate the mean meth value within each gene.
```{r}
library(methcon5)
sample_ii <- fake_methylation %>%
meth_aggregate(id = gene, value = meth, fun = mean)
sample_ii
```
Next we use the `meth_bootstrap()` function. This will take the summarized data.frame calculated earlier along with the original dataset. The function with return the original data.frame with the new column attached to the end, which makes it ideal for piping to apply different methods to the same data.
```{r}
adjusted <- sample_ii %>%
meth_bootstrap(reps = 100) %>%
meth_bootstrap(reps = 100, method = "perm_v2") %>%
meth_bootstrap(reps = 100, method = "perm_v3")
adjusted
```
```{r}
library(ggplot2)
ggplot(adjusted, aes(meth_perm_v1, meth_perm_v2, color = n)) +
geom_point() +
scale_color_viridis_c() +
theme_minimal()
```
## Funding acknowledgments
We gratefully acknowledge funding from NIH awards 1P01CA196569 and R21 CA226106.