Guide on how to plot directed graphs from
igraph objects to display activating and repressive states.
1 Directed graph plots
Here we demonstrate the plotting functions that come built-in with
graphsim, an alternative to the
plot.igraph provided by the
igraph package. Here we provide additional functionality for plotting directed graphs. This draws upon many functions provided by
igraph, including layout settings (Csardi and Nepusz 2006).
In particular, graph and network representations in biology often require displaying edge properties (Barabási and Oltvai 2004). Here we have the “state” parameter which can be used to differentiate these, and allow us to represent activating and inhibiting or repressing relationships differently. We use different arrowheads as per convention in molecular biology.
2 Toy example
Here we demonstrate the plot functions on a small toy graph.
2.1 Set up simulated graph
First we generate a graph object using the
We next demonstrate the plotting function for directed graph objects.
plot_directed with default settings uses the
layout.fruchterman.reingold as does built-in plotting function
igraph::plot.igraph. This function provides additional functionality to displaying directed graphs in particular.
Here you can see that the plotting function displays a graph in a similar layout to
plot.igraph with different aesthetic parameters. We suggest that you choose the function that suits your needs and datasets. We demonstrate the features available for
2.2.1 Custom aesthetics
We support various aesthetic parameters to control the colour and relative size of nodes and edges.
plot_directed supports customised layouts:
In addition, custom colouts are supported:
188.8.131.52 Vectorisation of aesthetics
Colours may also be entered as a vector for each node in
##  "A" "C" "B" "D" "E" "F" "G" "I" "H"
This functionality allows highlighting of particular groups based on known properties of the graph. For examples
V(graph)$type for bipartite graphs or partitions from Louvain (
igraph::cluster_louvain) or Leiden (
leiden::leiden) clustering algorithms.
2.2.2 Arrow customisation
state parameter controls whether the links are “activating” or “inhibiting”. These can denote activation and repression: foe example, positive and negative regulation of genes or kinase and phosphatase activity of proteins. These may be specified globally as either a character string or numeric:
Activating links are displated with any of the following:
Note that activating states can also be specified as follows:
Inhibiting links are displated with any of the following:
Note that inhibiting states can also be specified as follows:
184.108.40.206 Vectorisation of edge properties
The state parameter may also be applied as a vector to each edge in
## + 8/8 edges from 6213726 (vertex names): ##  A->C B->C C->D D->E D->F F->G F->I H->I
Note that by default, inhibiting relationships are highlighted with a different
col.arrow value, which can be controlled by the input parameter.
3 Empirical examples
Here we demonstrate using the plotting package to display real biological pathways from the “Reactome” database (Croft et al. 2014). We can import these from the
data directory included with this package. These graphs are given for examples and convenience. Any empirical data that consists of a list of directed edges can be imported as an igraph object and handled similarly. Below are some demonstrations.
3.1 RAF/MAP kinase cascade
Here we plot the RAF/MAP kinase cascade pathway.
3.2 Pi3K cascade
Here we plot the phosphoinositide-3-kinase (Pi3K) cascade pathway.
3.3 TGFβ-Smad pathway
Here we plot the TGFβ-Smad pathway with inhibitions known. States are imported as edge attributes from the imported graph.
4 Session info
Here is the output of
sessionInfo() on the system on which this document was compiled running pandoc 2.1:
## R version 4.0.2 (2020-06-22) ## Platform: x86_64-apple-darwin17.0 (64-bit) ## Running under: macOS Catalina 10.15.5 ## ## Matrix products: default ## BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib ## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib ## ## locale: ##  en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 ## ## attached base packages: ##  stats graphics grDevices utils datasets methods ##  base ## ## other attached packages: ##  graphsim_1.0.1 scales_1.1.1 igraph_1.2.5 ## ## loaded via a namespace (and not attached): ##  knitr_1.29 magrittr_1.5 munsell_0.5.0 ##  colorspace_1.4-1 lattice_0.20-41 R6_2.4.1 ##  rlang_0.4.6 stringr_1.4.0 matrixcalc_1.0-3 ##  caTools_1.18.0 tools_4.0.2 grid_4.0.2 ##  xfun_0.15 KernSmooth_2.23-17 htmltools_0.5.0 ##  gtools_3.8.2 yaml_2.2.1 digest_0.6.25 ##  lifecycle_0.2.0 Matrix_1.2-18 farver_2.0.3 ##  bitops_1.0-6 prettydoc_0.3.1 evaluate_0.14 ##  rmarkdown_2.3 gdata_2.18.0 stringi_1.4.6 ##  compiler_4.0.2 gplots_3.0.4 mvtnorm_1.1-1 ##  pkgconfig_2.0.3
Barabási, A. L., and Oltvai, Z. N. 2004. “Network Biology: Understanding the Cell’s Functional Organization.” Nat Rev Genet 5 (2): 101–13.
Croft, D., Mundo, A.F., Haw, R., Milacic, M., Weiser, J., Wu, G., Caudy, M., et al. 2014. “The Reactome pathway knowledgebase.” Journal Article. Nucleic Acids Res 42 (database issue): D472–D477. https://doi.org/10.1093/nar/gkt1102.
Csardi, G., and Nepusz, T. 2006. “The Igraph Software Package for Complex Network Research.” InterJournal Complex Systems: 1695. http://igraph.org.