-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
93 lines (66 loc) · 2 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
81
82
83
84
85
86
87
88
89
90
91
92
93
---
output: github_document
---
[![R-CMD-check](https://github.com/ctlab/gatom/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ctlab/gatom/actions/workflows/R-CMD-check.yaml)
# gatom
An R-package for finding active metabolic modules in atom transition network.
Full vignette can be found [here](https://rpubs.com/asergushichev/gatom-tutorial).
### Installation
```{r eval=FALSE}
library(devtools)
install_github("ctlab/gatom")
```
### Quick start
```{r message=FALSE}
library(gatom)
library(data.table)
library(igraph)
library(mwcsr)
```
First let's load data with atom mappings (`network` object),
enzyme annotations for mouse (`org.Mm.eg.gatom`)
and metabolite annotations (`met.kegg.db.rda`):
```{r}
data("networkEx")
data("org.Mm.eg.gatom.annoEx")
data("met.kegg.dbEx")
```
Loading input data:
```{r message=F}
data("met.de.rawEx")
data("gene.de.rawEx")
```
Getting atom graph:
```{r}
g <- makeMetabolicGraph(network=networkEx,
topology = "atoms",
org.gatom.anno=org.Mm.eg.gatom.annoEx,
gene.de=gene.de.rawEx,
met.db=met.kegg.dbEx,
met.de=met.de.rawEx)
print(g)
```
Scoring graph, obtaining an instance of SGMWCS (Signal Generalized Maximum Weight Subgraph)
problem instance:
```{r message=FALSE, warning=FALSE}
gs <- scoreGraph(g, k.gene=25, k.met=25)
```
Initialize an SMGWCS solver (a heuristic relax-and-cut solver `rnc_solver` is used for simplicity, check out `mwcsr` package documentation for more options):
```{r}
solver <- rnc_solver()
```
Finding a module:
```{r message=FALSE, warning=FALSE}
res <- solve_mwcsp(solver, gs)
m <- res$graph
```
```{r}
print(m)
head(E(m)$label)
head(V(m)$label)
```
We can save the module to different formats (dot, xgmml, svg, pdf):
```{r results="hide", message=FALSE, warning=FALSE}
saveModuleToPdf(m, file="M0.vs.M1.pdf", name="M0.vs.M1", n_iter=100, force=1e-5)
```
![Module](https://rawgit.com/ctlab/gatom/master/inst/M0.vs.M1.png)