## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(
    collapse = TRUE,
    comment = "#>"
)

## ----load, message=FALSE------------------------------------------------------
library(dorothea)
library(ggplot2)
library(dplyr)

## ----model--------------------------------------------------------------------
net <- dorothea::dorothea_hs
head(net)

## ----n_genes------------------------------------------------------------------
n_genes <- net %>%
  group_by(tf) %>%
  summarize(n = n())

ggplot(data=n_genes, aes(x=n)) +
  geom_density() +
  theme(text = element_text(size=12)) +
  xlab('Number of target genes') +
  ylab('densities') +
  theme_bw() +
  theme(legend.position = "none")


## ----n_edges------------------------------------------------------------------
n_edges <- net %>%
  group_by(confidence) %>%
  summarize(n = n())

ggplot(data=n_edges, aes(x=confidence, y=log10(n), color=confidence, fill=confidence)) +
  geom_bar(stat="identity") +
  theme(text = element_text(size=12)) +
  xlab('log10(Number of edges)') +
  ylab('densities') +
  theme_bw() +
  theme(legend.position = "none")


## ----prop---------------------------------------------------------------------
prop <- net %>%
  group_by(tf, mor) %>%
  summarize(n = n()) %>%
  mutate(freq = n / sum(n)) %>%
  filter(mor == 1)

ggplot(data=prop, aes(x=freq)) +
  geom_density() +
  theme(text = element_text(size=12)) +
  xlab('% of positive edges') +
  ylab('densities') +
  theme_bw() +
  theme(legend.position = "none")