Skip to content

Commit d19a1b8

Browse files
committed
Corrections and updates related to points 5 and 6 of reviewer Kaija Gahm
1 parent 95e45bc commit d19a1b8

13 files changed

+109
-77
lines changed

NEWS.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212

1313
### Bug Fixes
1414

15-
- corrected bug in cyto_clean_styles()
16-
- corrected error in wuchwerte(). It is not using the anos1 dataset from dplR anymore
17-
- corrected error in cyto_create_gn_style and cyto_create_cpm_style
15+
- corrected bug in `cyto_clean_styles()`
16+
- corrected error in `wuchwerte()`. It is not using the `anos1` dataset from dplR anymore
17+
- corrected error in `cyto_create_gn_style` and `cyto_create_cpm_style`
18+
- updated `cyto_create_cpm_style` because it was not working properly.
1819

1920
### Deprecated and defunct
2021

21-
- dev-folder removed, since this was not needed (created by biocthis)
22+
- dev-folder removed, since this was not needed (created by `biocthis`)
2223

2324
### Documentation fixes
2425

@@ -29,7 +30,7 @@
2930
- added Vignette on Cytoscape use
3031
- moved information for using big datasett to seperate vignette
3132
- updated README: added more installion instructions
32-
- corrected examples in cyto_create_gn_style and cyto_create_cpm_style
33+
- corrected examples in `cyto_create_gn_style` and `cyto_create_cpm_style`
3334

3435
### Continous integration
3536

@@ -40,9 +41,9 @@
4041
### Minor improvements
4142

4243
- replaced igraph::graph.data.frame() with igraph::graph_from_data_frame(), since the former is deprecated in igraph 2.0.0
43-
- replaced igraph::is.simple with igraph::is_simple
44-
- replaced igraph::decompose.graph with igraph::decompose
45-
- correction to calls to functions grDevices::colorRampPalette and stats::pnorm
44+
- replaced `igraph::is.simple` with `igraph::is_simple`
45+
- replaced `igraph::decompose.graph` with `igraph::decompose`
46+
- correction to calls to functions `grDevices::colorRampPalette` and `stats::pnorm`
4647

4748
### Bug Fixes
4849

R/cyto_create_cpm_style.R

+9-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ cyto_create_cpm_style <- function(graph_input, k = 3, com_k = NULL, style_name =
3333
if (!igraph::is.igraph(graph_input)) {
3434
stop(paste0("Please use an igraph object as input. The current object is an ", class(graph_input), "."))
3535
}
36+
if (is.null(com_k)) {
37+
stop("Please present a data frame with the communities for the given clique size")
38+
}
3639
if (is.numeric(k)) {
3740
if (style_name == "auto") {
3841
style_name <- paste0(substitute(graph_input), "_CPM(k=", k, ")")
@@ -43,17 +46,21 @@ cyto_create_cpm_style <- function(graph_input, k = 3, com_k = NULL, style_name =
4346
RCy3::copyVisualStyle("WhiteNodesLabel", style_name)
4447
# com_k <- clique_community_names(graph_input, k)
4548
com_count <- length(unique(com_k$com_name))
49+
com_k_spread <- com_k %>%
50+
dplyr::count(node, com_name) %>%
51+
tidyr::spread(com_name, n)
52+
RCy3::loadTableData(com_k_spread, data.key.column = "node")
4653
if (com_count == 1) {
4754
# RCy3::setNodeCustomPieChart does not work with a single column and therefore the nodes are coloured based on the single community
4855
RCy3::setNodeColorMapping(unique(com_k$com_name),
4956
table.column.values = 1,
5057
colors = RColorBrewer::brewer.pal(12, "Paired")[1],
58+
mapping.type = "d",
5159
style.name = style_name
5260
)
5361
} else {
54-
getPalette <- grDevices::colorRampPalette(RColorBrewer::brewer.pal(12, "Paired"))
5562
RCy3::setNodeCustomPieChart(unique(com_k$com_name),
56-
colors = getPalette(com_count),
63+
colors = RColorBrewer::brewer.pal(com_count, "Paired"),
5764
style.name = style_name
5865
)
5966
}

R/sim_table.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#' min_overlap=50,
99
#' last_digit_radius=FALSE)
1010
#'
11-
#' @param trs1 Rwl object with first tree-ring series to be compared with trs2
12-
#' @param trs2 Optional second rwl object with second tree-ring series to be compared with trs1. Use this is you have to datasets that you want to compare.
11+
#' @param trs1 Rwl object with first tree-ring series to be compared with trs2. A rwl object is a data.frame with series or tree-ring widths as columns and years as rows. This object is created or read by using the dplR-package
12+
#' @param trs2 Optional second rwl object with second tree-ring series to be compared with trs1. Use this is you have two different datasets that you want to compare. Otherwise all series in trs1 are pair wise compared.
1313
#' @param min_overlap If the overlap of the compared series is longer or equal than this minimal value, the similarities will be calculated for the comparison
1414
#' @param last_digit_radius Set this to TRUE if the last digit of a series name is the radius of the tree-ring series
1515
#' @returns The resulting list includes the names of the compared series, overlap, correlation (both with and without Hollstein-transformation), t-value based on these correlations, SGC, SSGC and the related probability of exceedence.

README.Rmd

+4-24
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ knitr::opts_chunk$set(
2020
)
2121
```
2222

23-
dendroNetwork is a package to create dendrochronological networks for gaining insight into provenance or other patterns based on the statistical relations between tree ring curves. The code and the functions are based on several published papers [@visser2021a; @visser2021b; @visser2022]
23+
dendroNetwork is a package to create dendrochronological networks for gaining insight into provenance or other patterns based on the statistical relations between tree ring curves. The code and the functions are based on several published papers [@visser2021a; @visser2021b; @visser2022].
24+
25+
The package is written for dendrochronologists and have a general knowledge on the discipline and used jargon. There is an excellent website for the introduction of using R in dendrochronology: <https://opendendro.org/r/>. The basics of dendrochronology can be found in handbooks [@speer2010; @cook1990] or on <https://www.dendrohub.com/>.
2426

2527
## Installation
2628

@@ -102,29 +104,7 @@ After creating the network in R, it is possible to visualize the network using C
102104

103105
## Usage for large datasets
104106

105-
When using larger datasets calculating the table with similarities can take a lot of time, but finding communities even more. It is therefore recommended to use of parallel computing for Clique Percolation: `clique_community_names_par(network, k=3, n_core = 6)`. This reduces the amount of time significantly.
106-
107-
The workflow is similar as above, but with minor changes:
108-
109-
1. load network
110-
111-
2. compute similarities
112-
113-
3. find the maximum clique size: `igraph::clique_num(network)`
114-
115-
4. detect communities for each clique size separately:
116-
117-
- `com_cpm_k3 <- clique_community_names_par(network, k=3, n_core = 6)`.
118-
119-
- `com_cpm_k4 <- clique_community_names_par(network, k=4, n_core = 6)`.
120-
121-
- and so on until the maximum clique size
122-
123-
5. merge these into a single `data frame` by `com_cpm_all <- rbind(com_cpm_k3,com_cpm_k4, com_cpm_k5,... )`
124-
125-
6. create table for use in cytoscape with all communities: `com_cpm_all <- com_cpm_all %>% dplyr::count(node, com_name) %>% tidyr::spread(com_name, n)`
126-
127-
7. Continue with the visualisation in Cytoscape, see the previous [section on visualization in Cytoscape](#visualization_cytoscape)
107+
When using larger datasets of tree-ring series, calculating the table with similarities can take a lot of time, but finding communities even more. It is therefore recommended to use of parallel computing for Clique Percolation: `clique_community_names_par(network, k=3, n_core = 4)`. This reduces the amount of time significantly. For most datasets `clique_community_names()` is sufficiently fast and for smaller datasets `clique_community_names_par()` can even be slower due to the parallelisation. Therefore, the funtion `clique_community_names()` should be used initially and if this is very slow, start using `clique_community_names_par()`. See the separate [vignette](https://ronaldvisser.github.io/dendroNetwork/articles/large_datasets_communities.html)for that.
128108

129109
## Citation
130110

README.md

+36-31
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ dendroNetwork is a package to create dendrochronological networks for
2020
gaining insight into provenance or other patterns based on the
2121
statistical relations between tree ring curves. The code and the
2222
functions are based on several published papers (Visser 2021b, 2021a;
23-
Visser and Vorst 2022)
23+
Visser and Vorst 2022).
24+
25+
The package is written for dendrochronologists and have a general
26+
knowledge on the discipline and used jargon. There is an excellent
27+
website for the introduction of using R in dendrochronology:
28+
<https://opendendro.org/r/>. The basics of dendrochronology can be found
29+
in handbooks (Cook and Kariukstis 1990; Speer 2010) or on
30+
<https://www.dendrohub.com/>.
2431

2532
## Installation
2633

@@ -120,36 +127,19 @@ with the Girvan-Newman communities visualized.</figcaption>
120127

121128
## Usage for large datasets
122129

123-
When using larger datasets calculating the table with similarities can
124-
take a lot of time, but finding communities even more. It is therefore
125-
recommended to use of parallel computing for Clique Percolation:
126-
`clique_community_names_par(network, k=3, n_core = 6)`. This reduces the
127-
amount of time significantly.
128-
129-
The workflow is similar as above, but with minor changes:
130-
131-
1. load network
132-
133-
2. compute similarities
134-
135-
3. find the maximum clique size: `igraph::clique_num(network)`
136-
137-
4. detect communities for each clique size separately:
138-
139-
- `com_cpm_k3 <- clique_community_names_par(network, k=3, n_core = 6)`.
140-
141-
- `com_cpm_k4 <- clique_community_names_par(network, k=4, n_core = 6)`.
142-
143-
- and so on until the maximum clique size
144-
145-
5. merge these into a single `data frame` by
146-
`com_cpm_all <- rbind(com_cpm_k3,com_cpm_k4, com_cpm_k5,... )`
147-
148-
6. create table for use in cytoscape with all communities:
149-
`com_cpm_all <- com_cpm_all %>% dplyr::count(node, com_name) %>% tidyr::spread(com_name, n)`
150-
151-
7. Continue with the visualisation in Cytoscape, see the previous
152-
[section on visualization in Cytoscape](#visualization_cytoscape)
130+
When using larger datasets of tree-ring series, calculating the table
131+
with similarities can take a lot of time, but finding communities even
132+
more. It is therefore recommended to use of parallel computing for
133+
Clique Percolation:
134+
`clique_community_names_par(network, k=3, n_core = 4)`. This reduces the
135+
amount of time significantly. For most datasets
136+
`clique_community_names()` is sufficiently fast and for smaller datasets
137+
`clique_community_names_par()` can even be slower due to the
138+
parallelisation. Therefore, the funtion `clique_community_names()`
139+
should be used initially and if this is very slow, start using
140+
`clique_community_names_par()`. See the separate
141+
[vignette](https://ronaldvisser.github.io/dendroNetwork/articles/large_datasets_communities.html)for
142+
that.
153143

154144
## Citation
155145

@@ -196,6 +186,14 @@ optimized and also outputs the number of overlapping rings. Source code:
196186
<div id="refs" class="references csl-bib-body hanging-indent"
197187
line-spacing="2">
198188

189+
<div id="ref-cook1990" class="csl-entry">
190+
191+
Cook, ER and Kariukstis, LA. 1990. *Methods of dendrochronology.
192+
Applications in the environmental sciences*. Dordrecht: Kluwer Academic
193+
Publishers.
194+
195+
</div>
196+
199197
<div id="ref-girvan2002" class="csl-entry">
200198

201199
Girvan, M and Newman, MEJ. 2002 Community structure in social and
@@ -233,6 +231,13 @@ https://doi.org/[10.1101/gr.1239303](https://doi.org/10.1101/gr.1239303).
233231

234232
</div>
235233

234+
<div id="ref-speer2010" class="csl-entry">
235+
236+
Speer, JH. 2010. *Fundamentals of tree ring research*. Tucson:
237+
University of Arizona Press.
238+
239+
</div>
240+
236241
<div id="ref-visser2021b" class="csl-entry">
237242

238243
Visser, RM. 2021a Dendrochronological Provenance Patterns. Network

man/dendroNetwork-package.Rd

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-5 Bytes
Loading
180 Bytes
Loading

man/sim_table.Rd

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

references.bib

+19
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,22 @@ @article{shannon2003
9999
doi = {10.1101/gr.1239303},
100100
url = {http://genome.cshlp.org/content/13/11/2498.abstract}
101101
}
102+
103+
@book{speer2010,
104+
title = {Fundamentals of Tree Ring Research},
105+
author = {Speer, James H.},
106+
year = {2010},
107+
month = {05},
108+
date = {2010-05-01},
109+
publisher = {University of Arizona Press},
110+
address = {Tucson}
111+
}
112+
113+
@book{cook1990,
114+
title = {Methods of Dendrochronology. Applications in the Environmental Sciences},
115+
author = {Cook, E. R. and Kariukstis, L. A.},
116+
year = {1990},
117+
date = {1990},
118+
publisher = {Kluwer Academic Publishers},
119+
address = {Dordrecht}
120+
}

vignettes/dendroNetwork.Rmd

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ output: rmarkdown::html_vignette
44
bibliography: references.bib
55
csl: journal-of-computer-applications-in-archaeology.csl
66
vignette: >
7-
%\VignetteIndexEntry{dendroNetwork_use}
7+
%\VignetteIndexEntry{dendroNetwork}
88
%\VignetteEngine{knitr::rmarkdown}
99
%\VignetteEncoding{UTF-8}
1010
---
1111

12-
dendroNetwork is a package to create dendrochronological networks for gaining insight into provenance or other patterns based on the statistical relations between tree ring curves. The code and the functions are based on several published papers [@visser2022; @visser2021; @visser2021]
12+
dendroNetwork is a package to create dendrochronological networks for gaining insight into provenance or other patterns based on the statistical relations between tree ring curves. The code and the functions are based on several published papers [@visser2022; @visser2021; @visser2021].
13+
14+
The package is written for dendrochronologists and have a general knowledge on the discipline and used jargon. There is an excellent website for the introduction of using R in dendrochronology: <https://opendendro.org/r/>. The basics of dendrochronology can be found in handbooks [@speer2010; @cook1990] or on <https://www.dendrohub.com/>.
1315

1416
## Usage {#usage}
1517

@@ -75,8 +77,6 @@ After creating the network in R, it is possible to visualize the network using C
7577

7678
A more complete description of using Cytoscape with this package can be found here: `vignette("large_datasets_communities")`
7779

78-
79-
8080
## Citation
8181

8282
If you use this software, please cite this using:

vignettes/large_datasets_communities.Rmd

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ knitr::opts_chunk$set(
1818
library(dendroNetwork)
1919
```
2020

21-
## Community detection in large datasets
21+
## Community detection in very large datasets
2222

23-
When using larger datasets of tree-ring series, calculating the table with similarities can take a lot of time, but finding communities even more. It is therefore recommended to use of parallel computing for Clique Percolation: `clique_community_names_par(network, k=3, n_core = 6)`. This reduces the amount of time significantly.
23+
When using larger datasets of tree-ring series, calculating the table with similarities can take a lot of time, but finding communities even more. It is therefore recommended to use of parallel computing for Clique Percolation: `clique_community_names_par(network, k=3, n_core = 4)`. This reduces the amount of time significantly. For most datasets `clique_community_names()` is sufficiently fast and for smaller datasets `clique_community_names_par()` can even be slower due to the parallelisation. Therefore, the funtion `clique_community_names()` should be used initially and if this is very slow, start using `clique_community_names_par()`.
2424

25-
The workflow is similar as described in the `vignette("dendronetwork")`, but with minor changes:
25+
The workflow is similar as described in the `vignette("dendroNetwork")`, but with minor changes:
2626

2727
1. load network
2828

@@ -42,4 +42,4 @@ The workflow is similar as described in the `vignette("dendronetwork")`, but wit
4242

4343
6. create table for use in cytoscape with all communities: `com_cpm_all <- com_cpm_all %>% dplyr::count(node, com_name) %>% tidyr::spread(com_name, n)`
4444

45-
7. Continue with the visualisation in Cytoscape, see the relevant section in the `vignette("dendronetwork")`
45+
7. Continue with the visualisation in Cytoscape, see the relevant section in the `vignette("dendroNetwork")`

vignettes/references.bib

+19
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,22 @@ @article{palla2005
9999
doi = {10.1038/nature03607},
100100
url = {http://dx.doi.org/10.1038/nature03607}
101101
}
102+
103+
@book{speer2010,
104+
title = {Fundamentals of Tree Ring Research},
105+
author = {Speer, James H.},
106+
year = {2010},
107+
month = {05},
108+
date = {2010-05-01},
109+
publisher = {University of Arizona Press},
110+
address = {Tucson}
111+
}
112+
113+
@book{cook1990,
114+
title = {Methods of Dendrochronology. Applications in the Environmental Sciences},
115+
author = {Cook, E. R. and Kariukstis, L. A.},
116+
year = {1990},
117+
date = {1990},
118+
publisher = {Kluwer Academic Publishers},
119+
address = {Dordrecht}
120+
}

0 commit comments

Comments
 (0)