---
title: "Overview of pathway network databases"
author: "Kim Philipp Jablonski, Martin Pirkl"
date: "`r Sys.Date()`"
graphics: yes
output: BiocStyle::html_document
bibliography: bibliography.bib
vignette: >
    %\VignetteIndexEntry{Overview of pathway network databases}
    %\VignetteEngine{knitr::rmarkdown}
    %\VignetteEncoding{UTF-8}
---

# Introduction

## Load required packages

Load the package with the library function.

```{r}
library(tidyverse)
library(ggplot2)

library(dce)

set.seed(42)
```

```{r}
dce::df_pathway_statistics %>%
  sample_n(10) %>%
  arrange(desc(node_num)) %>%
  knitr::kable()
```

# Pathway database overview

We provide access to the following topological pathway databases using
graphite [@sales2012graphite]:

```{r}
dce::df_pathway_statistics %>%
  count(database, sort = TRUE, name = "pathway_number") %>%
  knitr::kable()
```

```{r}
dce::df_pathway_statistics %>%
  ggplot(aes(x = node_num)) +
    geom_histogram(bins = 30) +
    facet_wrap(~ database, scales = "free") +
    theme_minimal()
```

# Plotting pathways

It is easily possible to plot pathways:
```{r}
pathways <- get_pathways(
  pathway_list = list(
    kegg = c("Citrate cycle (TCA cycle)")
  )
)

lapply(pathways, function(x) {
  plot_network(as(x$graph, "matrix"), visualize_edge_weights = FALSE) +
    ggtitle(x$pathway_name)
})
```

# Session information

```{r}
sessionInfo()
```

# References
