Skip to content

Commit

Permalink
refactor(visualize): Change name of function visualizeSubnetwork to v…
Browse files Browse the repository at this point in the history
…isualizeNetworks (#10)
  • Loading branch information
tonywu1999 authored Jul 25, 2024
1 parent 929df93 commit 87f13c3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(getSubnetworkFromIndra)
export(visualizeSubnetwork)
export(visualizeNetworks)
importFrom(RCy3,createNetworkFromDataFrames)
importFrom(RCy3,createVisualStyle)
importFrom(RCy3,mapVisualProperty)
Expand Down
6 changes: 3 additions & 3 deletions R/visualizeSubnetwork.R → R/visualizeNetworks.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#' package = "MSstatsBioNet"
#' ))
#' # subnetwork = getSubnetworkFromIndra(input)
#' # visualizeSubnetwork(subnetwork$nodes, subnetwork$edges)
#' # visualizeNetworks(subnetwork$nodes, subnetwork$edges)
#'
#' @return cytoscape visualization of subnetwork
#'
#'
visualizeSubnetwork <- function(nodes, edges,
pvalue_cutoff = 0.05, logfc_cutoff = 0.5) {
visualizeNetworks <- function(nodes, edges,
pvalue_cutoff = 0.05, logfc_cutoff = 0.5) {
# Add additional columns for visualization
nodes$logFC_color <- nodes$logFC
nodes$logFC_color[nodes$pvalue > pvalue_cutoff |
Expand Down
10 changes: 5 additions & 5 deletions man/visualizeSubnetwork.Rd → man/visualizeNetworks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
test_that("visualizeSubnetwork works correctly", {
test_that("visualizeNetworks works correctly", {
input <- readRDS(system.file("processed_data/subnetwork.rds",
package = "MSstatsBioNet"
))

mock_createNetworkFromDataFrames <- mock()
stub(
visualizeSubnetwork, "createNetworkFromDataFrames",
visualizeNetworks, "createNetworkFromDataFrames",
mock_createNetworkFromDataFrames
)
mock_mapVisualProperty <- mock()
stub(
visualizeSubnetwork, "mapVisualProperty",
visualizeNetworks, "mapVisualProperty",
mock_mapVisualProperty
)
mock_createVisualStyle <- mock()
stub(
visualizeSubnetwork, "createVisualStyle",
visualizeNetworks, "createVisualStyle",
mock_createVisualStyle
)
mock_setVisualStyle <- mock()
stub(
visualizeSubnetwork, "setVisualStyle",
visualizeNetworks, "setVisualStyle",
mock_setVisualStyle
)

expect_silent(visualizeSubnetwork(input$nodes, input$edges))
expect_silent(visualizeNetworks(input$nodes, input$edges))
expect_called(mock_createNetworkFromDataFrames, 1)
expect_called(mock_mapVisualProperty, 2)
expect_called(mock_createVisualStyle, 1)
expect_called(mock_setVisualStyle, 1)
})


test_that("visualizeSubnetwork with p-value and logFC constraints works", {
test_that("visualizeNetworks with p-value and logFC constraints works", {
input <- readRDS(system.file("processed_data/subnetwork.rds",
package = "MSstatsBioNet"
))

mock_createNetworkFromDataFrames <- mock()
stub(
visualizeSubnetwork, "createNetworkFromDataFrames",
visualizeNetworks, "createNetworkFromDataFrames",
mock_createNetworkFromDataFrames
)
mock_mapVisualProperty <- mock()
stub(
visualizeSubnetwork, "mapVisualProperty",
visualizeNetworks, "mapVisualProperty",
mock_mapVisualProperty
)
mock_createVisualStyle <- mock()
stub(
visualizeSubnetwork, "createVisualStyle",
visualizeNetworks, "createVisualStyle",
mock_createVisualStyle
)
mock_setVisualStyle <- mock()
stub(
visualizeSubnetwork, "setVisualStyle",
visualizeNetworks, "setVisualStyle",
mock_setVisualStyle
)

expect_silent(visualizeSubnetwork(input$nodes, input$edges,
expect_silent(visualizeNetworks(input$nodes, input$edges,
pvalue_cutoff = 0.01, logfc_cutoff = 2.5
))
expect_called(mock_createNetworkFromDataFrames, 1)
Expand Down
4 changes: 2 additions & 2 deletions vignettes/MSstatsBioNet.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ networks. The package is designed to be used in conjunction with the

The package provides a function `getSubnetworkFromIndra` that retrieves a
subnetwork of proteins from the INDRA database based on differential abundance
analysis results. The function `visualizeSubnetwork` then takes the output
analysis results. The function `visualizeNetworks` then takes the output
of `getSubnetworkFromIndra` and visualizes the subnetwork.

```{r proteinNetworkDiscovery, eval=FALSE}
Expand All @@ -38,5 +38,5 @@ input <- data.table::fread(
)
)
subnetwork <- getSubnetworkFromIndra(input)
visualizeSubnetwork(subnetwork$nodes, subnetwork$edges)
visualizeNetworks(subnetwork$nodes, subnetwork$edges)
```

0 comments on commit 87f13c3

Please sign in to comment.