Skip to content

Commit

Permalink
added vignette Cytoscape
Browse files Browse the repository at this point in the history
corrected cyto_clean_styles()
  • Loading branch information
RonaldVisser committed Feb 20, 2024
1 parent 041dc85 commit 7f5324f
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ dendroNetwork 0.5.2 (development)
### NEW FEATURES
### MINOR IMPROVEMENTS
### BUG FIXES
* corrected bug in cyto_clean_styles()
### DEPRECATED AND DEFUNCT
* dev-folder removed, since this was not needed (created by biocthis)
### DOCUMENTATION FIXES
* update acknowledgements in readme and paper
* corrected text of documentation in cor_mat_overlap()
* added pkgdown site: https://ronaldvisser.github.io/dendroNetwork/
* moved some images to man/figures
* added Vignette on Cytoscape use
### CONTINUOUS INTEGRATION

dendroNetwork 0.5.1 (2024-02-10)
Expand Down
2 changes: 1 addition & 1 deletion R/cyto_clean_styles.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cyto_clean_styles <- function() { # nocov start

# import style with grey nodes
if ("GreyNodesLabel" %in% RCy3::getVisualStyleNames() == FALSE) {
RCy3::importVisualStyles(filename = system.file("extdata", "NetworkStyles.xml", package = "DendroNetwork"))
RCy3::importVisualStyles(filename = system.file("extdata", "NetworkStyles.xml", package = "dendroNetwork"))
}
message("All default styles are removed and some new ones are added")
} # nocov end
2 changes: 1 addition & 1 deletion paper/paper.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Dendrochronological analyses are often based on the comparison of tree-ring seri

# Statement of need

There are several packages available in R for dendrochronological research [@guiterman2020; @jevsenak2018; @campelo2012; @bunn2008; @shi2019; @vandermaaten-theunissen2015; @reynolds2021; @altman2014; @rademacher; @campelo2019; @alday2018]. An overview with links to these packages can be found online (<https://github.com/RonaldVisser/Dendro_R>). These R-packages in dendrochronology all fill different needs, but the nice thing is that these are all interconnected in some way in depending on each other, or that they build further into different avenues. Apart from depending on dendrochronological packages, various packages from the Tidyverse [@wickham2019] are often also needed. The various relations can easily be visualised using a network, with the edges based on the dependency of two packages on each other, and and arrow indicating the direction of the dependency.
There are several packages available in R for dendrochronological research [@guiterman2020; @jevsenak2018; @campelo2012; @bunn2008; @shi2019; @vandermaaten-theunissen2015; @reynolds2021; @altman2014; @rademacher; @campelo2019; @alday2018]. An overview with links to these packages can be found online (<https://ronaldvisser.github.io/Dendro_R/>). Some packages are specifically creates to obtain measurements [@campelo2019; @shi2019], while others are written for crossdating [@reynolds2021]. There are also various for analysing tree-ring data [@alday2018; @alday2018; @altman2014; @bunn2008; @campelo2012; @guiterman2020]. These R-packages in dendrochronology all fill different needs, but the nice thing is that these are all interconnected in some way in depending on each other, or that they build further into different avenues. Apart from depending on dendrochronological packages, various packages from the Tidyverse [@wickham2019] are often also needed. The various relations can easily be visualised using a network, with the edges based on the dependency of two packages on each other, and and arrow indicating the direction of the dependency.

```{r, out.width="50%", fig.cap = "The interdependent relations between existing R-packages related to dendrochronology", echo=FALSE}
g_dendro_packages <- igraph::graph( c("dplR", "dfoliatR", "tidyverse", "dfoliatR",
Expand Down
Binary file modified paper/paper_files/figure-html/unnamed-chunk-1-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper/paper_files/figure-html/unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper/paper_files/figure-html/unnamed-chunk-2-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper/paper_files/figure-html/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions vignettes/cytoscape.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: "Cytoscape visualization"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{cytoscape}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```

```{r setup}
library(dendroNetwork)
```

# Required Software

dendroNetwork uses RCy3 (<https://www.bioconductor.org/packages/release/bioc/html/RCy3.html>) to connect with Cytoscape and visualize networks. You will need to install and launch Cytoscape:

- Download the latest Cytoscape from <http://www.cytoscape.org/download.php>

- Complete installation wizard

- Launch Cytoscape

To check if Cytoscape if completely loaded please run:

```
cytoscapePing()
```

# Creation of networks

The creation of dendrochronological networks is done in R using the dendroNetwork package (see readme or the vignette [dendroNetwork: how to use it](dendroNetwork_use.html).

```{r}
library(dendroNetwork)
data(hol_rom) # 1
sim_table_hol <- sim_table(hol_rom) # 2
g_hol <- dendro_network(sim_table_hol) # 3
g_hol_gn <- gn_names(g_hol) # 4
hol_com_cpm_all <- find_all_cpm_com(g_hol) # 5
```

After the networks are created, the next step would be to visualize these in Cytoscape.

# Networks in Cytoscape

To visualise a dendrochronological network in Cytoscape:

``` r
cyto_create_graph(g_hol, CPM_table = hol_com_cpm_all, GN_table = g_hol_gn)
```

This results in Cytoscape as the following:

![Network g_hol in Cytoscape.](images/cytoscape_g_hol.png){width="800"}

The next step would be to add styles for visualisation. However, Cytoscape comes with a lot of default styles that can be confusing. Therefore it is recommended to use once in each session:

``` r
cyto_clean_styles()
```

It is not possible to visualize the styles for example for the Girvan Newman Algorithm:

``` r
cyto_create_gn_style(g_hol)
```

This results in Cytoscape as the following:

![The network g_hol with the Girvan Newman communities visualized in Cytoscape](images/cytoscape_g_hol_GN.png){width="800"}

Visualizing the Clique Percolation communities in Cytoscape for the network could be done using

``` r
cyto_create_cpm_style(g_hol, k=3, com_k = hol_com_cpm_all)
```

However, this would make not much sense in this example, since there is only one full clique with k=3 .
Binary file added vignettes/images/cytoscape_g_hol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vignettes/images/cytoscape_g_hol_GN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7f5324f

Please sign in to comment.