Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(visualize): Change name of function visualizeSubnetwork to visualizeNetworks #10

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
```