Skip to content

Commit bf3c50e

Browse files
committed
Fixed problems resulting from new major igraph version
1 parent 806d987 commit bf3c50e

File tree

12 files changed

+34
-29
lines changed

12 files changed

+34
-29
lines changed

.github/workflows/check-bioc.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
fail-fast: false
5353
matrix:
5454
config:
55-
- { os: ubuntu-latest, r: '4.3', bioc: '3.17', cont: "bioconductor/bioconductor_docker:RELEASE_3_17", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
55+
- { os: ubuntu-latest, r: '4.3', bioc: '3.18', cont: "bioconductor/bioconductor_docker:RELEASE_3_18", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
5656
env:
5757
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
5858
RSPM: ${{ matrix.config.rspm }}
@@ -100,16 +100,16 @@ jobs:
100100
uses: actions/cache@v3
101101
with:
102102
path: ${{ env.R_LIBS_USER }}
103-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_17-r-4.3-${{ hashFiles('.github/depends.Rds') }}
104-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_17-r-4.3-
103+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-${{ hashFiles('.github/depends.Rds') }}
104+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-
105105

106106
- name: Cache R packages on Linux
107107
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
108108
uses: actions/cache@v2
109109
with:
110110
path: /home/runner/work/_temp/Library
111-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_17-r-4.3-${{ hashFiles('.github/depends.Rds') }}
112-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_17-r-4.3-
111+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-${{ hashFiles('.github/depends.Rds') }}
112+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-
113113

114114
# - name: Install Linux system dependencies
115115
# if: runner.os == 'Linux'
@@ -271,15 +271,15 @@ jobs:
271271
if: failure()
272272
uses: actions/upload-artifact@v3
273273
with:
274-
name: ${{ runner.os }}-biocversion-RELEASE_3_13-r-4.1-results
274+
name: ${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-results
275275
path: check
276276

277277
- uses: docker/build-push-action@v1
278278
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && runner.os == 'Linux' "
279279
with:
280280
username: ${{ secrets.DOCKER_USERNAME }}
281281
password: ${{ secrets.DOCKER_PASSWORD }}
282-
repository: almeidasilvaf/bionero
282+
repository: almeidasilvaf/BioNERO
283283
tag_with_ref: true
284284
tag_with_sha: true
285285
tags: latest

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Imports:
6565
minet,
6666
GENIE3,
6767
SummarizedExperiment
68-
RoxygenNote: 7.2.3
68+
RoxygenNote: 7.3.0
6969
Suggests:
7070
knitr,
7171
rmarkdown,

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ importFrom(grDevices,colorRampPalette)
128128
importFrom(igraph,V)
129129
importFrom(igraph,as_adjacency_matrix)
130130
importFrom(igraph,betweenness)
131-
importFrom(igraph,centralization.degree)
131+
importFrom(igraph,centr_degree)
132132
importFrom(igraph,cliques)
133133
importFrom(igraph,closeness)
134134
importFrom(igraph,cluster_edge_betweenness)
@@ -143,7 +143,6 @@ importFrom(igraph,degree)
143143
importFrom(igraph,diameter)
144144
importFrom(igraph,edge_density)
145145
importFrom(igraph,fit_power_law)
146-
importFrom(igraph,graph.data.frame)
147146
importFrom(igraph,graph_from_adjacency_matrix)
148147
importFrom(igraph,graph_from_data_frame)
149148
importFrom(igraph,simplify)

R/grn_inference.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ get_hubs_grn <- function(edgelist, top_percentile = 0.1, top_n = NULL,
368368
#' @rdname get_hubs_grn
369369
#' @importFrom igraph graph_from_data_frame degree
370370
#' @examples
371-
#' ppi_edges <- igraph::get.edgelist(igraph::barabasi.game(n=500, directed=FALSE))
371+
#' ppi_edges <- igraph::sample_pa(n = 500)
372+
#' ppi_edges <- igraph::as_edgelist(ppi_edges)
372373
#' hubs <- get_hubs_ppi(ppi_edges, return_degree = TRUE)
373374
get_hubs_ppi <- function(edgelist, top_percentile = 0.1, top_n = NULL,
374375
return_degree = FALSE) {

R/network_stats.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#' @export
3434
#' @importFrom igraph graph_from_adjacency_matrix cliques diameter
3535
#' betweenness V closeness degree transitivity edge_density
36-
#' centralization.degree
36+
#' centr_degree
3737
#' @importFrom WGCNA fundamentalNetworkConcepts
3838
#' @examples
3939
#' \donttest{
@@ -75,7 +75,7 @@ net_stats <- function(adj_matrix = NULL, net_type = c("gcn", "ppi", "grn"),
7575
degree <- igraph::degree(graph, mode = "all")
7676
clustercoef <- igraph::transitivity(graph, type = "global")
7777
density <- igraph::edge_density(graph)
78-
centralization <- igraph::centralization.degree(graph)$centralization
78+
centralization <- igraph::centr_degree(graph)$centralization
7979
stats <- list(
8080
Connectivity = degree,
8181
ScaledConnectiviy = degree / max(degree),

R/network_visualization.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
#' @rdname detect_communities
2626
#' @author Fabricio Almeida-Silva
2727
#' @export
28-
#' @importFrom igraph graph.data.frame simplify cluster_infomap cluster_edge_betweenness cluster_fast_greedy cluster_walktrap cluster_spinglass cluster_leading_eigen cluster_louvain cluster_label_prop
28+
#' @importFrom igraph graph_from_data_frame simplify cluster_infomap
29+
#' cluster_edge_betweenness cluster_fast_greedy
30+
#' cluster_walktrap cluster_spinglass cluster_leading_eigen
31+
#' cluster_louvain cluster_label_prop
2932
#' @examples
3033
#' data(filt.se)
3134
#' tfs <- sample(rownames(filt.se), size=50, replace=FALSE)
@@ -34,7 +37,7 @@
3437
detect_communities <- function(edgelist,
3538
method = igraph::cluster_infomap,
3639
directed = TRUE) {
37-
graph <- igraph::graph.data.frame(edgelist, directed = directed)
40+
graph <- igraph::graph_from_data_frame(edgelist, directed = directed)
3841
graph <- igraph::simplify(graph)
3942
com <- method(graph, modularity = FALSE)
4043
df_com <- as.data.frame(list(names = com$names, mem = com$membership))
@@ -80,7 +83,8 @@ detect_communities <- function(edgelist,
8083
#' @importFrom ggplot2 ggplot aes guides
8184
#' @import intergraph
8285
#' @examples
83-
#' ppi_edges <- igraph::get.edgelist(igraph::barabasi.game(n=50, directed=FALSE))
86+
#' ppi_edges <- igraph::sample_pa(n = 500)
87+
#' ppi_edges <- igraph::as_edgelist(ppi_edges)
8488
#' p <- plot_ppi(ppi_edges, add_color_legend = FALSE)
8589
plot_ppi <- function(edgelist_int, color_by = "community",
8690
clustering_method = igraph::cluster_infomap,

R/utils.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,14 @@ check_SFT <- function(edgelist, net_type = "gcn") {
387387

388388
# Test for scale-free topology fit
389389
test <- igraph::fit_power_law(degree)
390-
if(test$KS.p < 0.05) {
391-
message("At the 95% confidence level for the Kolmogorov-Smirnov statistic, your graph does not fit the scale-free topology. P-value:", test$KS.p)
390+
if("KS.p" %in% names(test)) {
391+
if(test$KS.p < 0.05) {
392+
message("At the 95% confidence level for the Kolmogorov-Smirnov statistic, your graph does not fit the scale-free topology. P-value:", test$KS.p)
393+
} else {
394+
message("Your graph fits the scale-free topology. P-value:", test$KS.p)
395+
}
392396
} else {
393-
message("Your graph fits the scale-free topology. P-value:", test$KS.p)
397+
message("Could not obtain P-value for the Kolmogorov-Smirnov statistic.")
394398
}
395399

396400
return(test)

man/get_hubs_grn.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot_ppi.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_grn.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ test_that("get_hubs_grn() returns a data frame with hub genes and their out degr
101101
})
102102

103103
test_that("get_hubs_ppi() returns a list or data frame of hubs and degree", {
104-
ppi_edges <- igraph::get.edgelist(igraph::barabasi.game(n=500, directed=FALSE))
104+
ppi_edges <- igraph::as_edgelist(igraph::sample_pa(n=500))
105105
hubs <- get_hubs_ppi(ppi_edges, return_degree = TRUE)
106106
hubs2 <- get_hubs_ppi(ppi_edges, top_n = 1)
107107

tests/testthat/test_utils.R

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ se <- SummarizedExperiment::SummarizedExperiment(
2929
)
3030

3131
## Edge list
32-
edges <- igraph::get.edgelist(igraph::barabasi.game(n = 50, directed = FALSE))
32+
edges <- igraph::as_edgelist(igraph::sample_pa(n = 50))
3333

3434
#----Start tests----------------------------------------------------------------
3535
test_that("metadata2colors() returns a list of metadata and named vectors", {
@@ -113,11 +113,6 @@ test_that("check_SFT() returns a list with SFT stats", {
113113
expect_equal(class(c2), "list")
114114
expect_equal(class(c3), "list")
115115

116-
117-
expect_equal(length(c1), 6)
118-
expect_equal(length(c2), 6)
119-
expect_equal(length(c3), 6)
120-
121116
})
122117

123118

tests/testthat/test_visualization.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tfs <- sample(rownames(filt.se), size=50, replace=FALSE)
55

66
## Infer networks to be used
77
set.seed(123)
8-
ppi_edges <- igraph::get.edgelist(igraph::barabasi.game(n=50, directed=FALSE))
8+
ppi_edges <- igraph::as_edgelist(igraph::sample_pa(n=50))
99
gcn <- exp2gcn(filt.se, SFTpower = 18, cor_method = "pearson")
1010
gcn_edges <- get_edge_list(
1111
gcn, module = "brown", filter = TRUE, method = "min_cor"

0 commit comments

Comments
 (0)