... | ... |
@@ -201,7 +201,7 @@ setMethod("show", |
201 | 201 |
# Community identification (no, yes and how many and how many nodes each) |
202 | 202 |
cat(" Communities (TF-gene):\n") |
203 | 203 |
df = igraph::vertex.attributes(GRN@graph[["TF_gene"]]$graph) |
204 |
- if (!is.null(df)) { |
|
204 |
+ if (!is.null(df) & "community" %in% names(df)) { |
|
205 | 205 |
communities = df %>% as.data.frame() %>% dplyr::count(community) %>% dplyr::arrange(desc(n)) |
206 | 206 |
cat(" Communities, sorted by size (n = Number of nodes): ", paste0(communities$community, " (n=", communities$n, collapse = "), "), ")\n", sep = "") |
207 | 207 |
} else { |
... | ... |
@@ -2876,11 +2876,11 @@ filterGRNAndConnectGenes <- function(GRN, |
2876 | 2876 |
|
2877 | 2877 |
checkmate::assertClass(GRN, "GRN") |
2878 | 2878 |
checkmate::assertCharacter(TF_peak.connectionTypes, min.len = 1, any.missing = FALSE) |
2879 |
- checkmate::assert(checkmate::checkNull(peak_gene.p_raw.threshold), checkmate::checkNumeric(peak_gene.p_raw.threshold, lower = 0, upper = 1, min.len = 1)) |
|
2879 |
+ checkmate::assert(checkmate::checkNull(peak_gene.p_raw.threshold), checkmate::checkNumber(peak_gene.p_raw.threshold, lower = 0, upper = 1)) |
|
2880 | 2880 |
checkmate::assertNumeric(peak_gene.r_range, lower = -1, upper = 1, len = 2) |
2881 | 2881 |
checkmate::assertCharacter(gene.types, min.len = 1) |
2882 | 2882 |
checkmate::assertNumber(TF_peak.fdr.threshold, lower = 0, upper = 1) |
2883 |
- checkmate::assertNumber(peak_gene.fdr.threshold, lower = 0, upper = 1) |
|
2883 |
+ checkmate::assert(checkmate::checkNull(peak_gene.fdr.threshold), checkmate::checkNumber(peak_gene.fdr.threshold, lower = 0, upper = 1)) |
|
2884 | 2884 |
|
2885 | 2885 |
checkmate::assertSubset(peak_gene.fdr.method, c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none", "IHW")) |
2886 | 2886 |
checkmate::assert(checkmate::checkNull(peak_gene.IHW.covariate), checkmate::checkCharacter(peak_gene.IHW.covariate, min.chars = 1, len = 1)) |
... | ... |
@@ -2895,6 +2895,11 @@ filterGRNAndConnectGenes <- function(GRN, |
2895 | 2895 |
.checkAndLogWarningsAndErrors(NULL, message, isWarning = FALSE) |
2896 | 2896 |
} |
2897 | 2897 |
|
2898 |
+ if (!is.null(peak_gene.p_raw.threshold) & !is.null(peak_gene.fdr.threshold)) { |
|
2899 |
+ message = "Both parameters peak_gene.p_raw.threshold and peak_gene.fdr.threshold have been specified, choose only either of them." |
|
2900 |
+ .checkAndLogWarningsAndErrors(NULL, message, isWarning = FALSE) |
|
2901 |
+ } |
|
2902 |
+ |
|
2898 | 2903 |
start = Sys.time() |
2899 | 2904 |
if (silent) { |
2900 | 2905 |
futile.logger::flog.threshold(futile.logger::WARN) |
... | ... |
@@ -424,6 +424,19 @@ GRN_connections.all |
424 | 424 |
The table contains many columns, and the prefix of each column name indicates the part of the *eGRN* network that the column refers to (e.g., TFs, TF-enhancers, enhancers, enhancer-genes or genes, or TF-gene if the function `add_TF_gene_correlation()` has been run before). Data are stored in a format that minimizes the memory footprint (e.g., each character column is stored as a factor). This table can now be used for any downstream analysis, as it is just a normal data frame. |
425 | 425 |
|
426 | 426 |
|
427 |
+## Construct the eGRN graph |
|
428 |
+ |
|
429 |
+For all network-related and visualization-related functions, we need to build a graph out of the filtered connections. For this, we provide a helper function that stores the graph-structure in the object, and it can be invoked as follows: |
|
430 |
+ |
|
431 |
+```{r buildGraph, echo=TRUE, include=TRUE, eval = FALSE, class.output="scroll-200"} |
|
432 |
+ |
|
433 |
+GRN = build_eGRN_graph(GRN, forceRerun = TRUE) |
|
434 |
+ |
|
435 |
+``` |
|
436 |
+ |
|
437 |
+We don't include the output here, but this function runs actually very quickly. |
|
438 |
+ |
|
439 |
+ |
|
427 | 440 |
## Visualize the filtered *eGRN* |
428 | 441 |
|
429 | 442 |
The `GRaNIE` package also offers a function to visualize a filtered *eGRN* network! It is very easy to invoke, but provides many options to customize the output and the way the graph is drawn. We recommend to explore the options in the R help (`?getGRNConnections`), and here just run the default visualization. |
... | ... |
@@ -494,15 +507,6 @@ As this functions needs a few minutes, for the purpose of the vignette, we do no |
494 | 507 |
|
495 | 508 |
First, we have to create a network representation out of the filtered connections, and there are a few options for how the network structure should look like. We here keep the default options and refer to the R help for details (`?build_eGRN_graph`). |
496 | 509 |
|
497 |
-### Construct the eGRN graph |
|
498 |
- |
|
499 |
-```{r buildGraph, echo=TRUE, include=TRUE, eval = FALSE, class.output="scroll-200"} |
|
500 |
- |
|
501 |
-GRN = build_eGRN_graph(GRN, forceRerun = TRUE) |
|
502 |
- |
|
503 |
-``` |
|
504 |
- |
|
505 |
-We don't include the output here, but this function runs actually very quickly. |
|
506 | 510 |
|
507 | 511 |
### General network statistics |
508 | 512 |
|