Network Visualization core logic#99
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
| @@ -0,0 +1,176 @@ | |||
| networkServer <- function(input, output, session, parent_session, significant) { | |||
There was a problem hiding this comment.
nit: Could you rename this to visualizeNetworkServer? I think networkServer may confuse people thinking it has something to do with computer networks.
| if (is.null(input$dataUpload) && !is.null(significant())) { | ||
| df <- significant() | ||
| if (!is.null(df) && "Protein" %in% names(df)) { | ||
| df$Protein <- as.character(significant()$Protein) |
There was a problem hiding this comment.
Code would be easier to follow if you do df$Protein <- as.character(df$Protein)
| return( | ||
| list( | ||
| input = input, | ||
| significant = SignificantProteins, |
There was a problem hiding this comment.
I think this is where we had talked about using the proteins being already filtered before coming to step 5 network viz.
I think adding a significant parameter to the returned object may not be necessary since you can use the dataComparison$ComparisonResult table as the list of proteins with their p-values
| data_comp = data_comparison() | ||
| significant = data_comp$ComparisonResult[ | ||
| which(data_comp$ComparisonResult$adj.pvalue < input$signif), ] | ||
| print(significant) |
There was a problem hiding this comment.
Any reason for removing this print statement here?
| renderNetwork <- reactive({ | ||
| # Annotate protein info and filter the subnetwork based on p-value | ||
| annotated_df <- tryCatch({ | ||
| annotateProteinInfoFromIndra(df(), proteinIdType()) |
There was a problem hiding this comment.
Did you add a dependency on MSstatsBioNet for this package? i.e. using the @importFrom tag and adding the dependency in the DESCRIPTION file.
| interaction <- edge_parts[3] | ||
|
|
||
| # Get edges table | ||
| edges_table <- renderNetwork()$edges_table |
There was a problem hiding this comment.
Will this call INDRA again? If so, could we use the original edges table that we had already.
There was a problem hiding this comment.
No, it wont call INDRA again. It happens only when the inputs change
| # Observe the event when an edge is clicked | ||
| observeEvent(input$edgeClicked, { | ||
| edge_id <- input$edgeClicked$id | ||
| edge_parts <- strsplit(edge_id, "-")[[1]] |
There was a problem hiding this comment.
rather than a string split, I believe we already have source, target, and interaction data stored in the edge as well. Would it be simpler to pass and retrieve that information instead of the ID itself?
| selected = "Uploaddata") | ||
| }) | ||
|
|
||
| callModule(networkServer, "network", session, significant) |
There was a problem hiding this comment.
Instead of passing significant, could you instead pass data_comparison$ComparisonResult instead here?
* adding network visualization core logic * linking step 5 to the pipeline and adding nodes table to output in step 5 * highlighting the selected edge from the network in edges table * error handling for indra method calls * swapping the positions of edges and nodes table in ui * PR suggestions * PR suggestions
PR Type
enhancement
Description
Changes walkthrough 📝
module-visualize-network-server.R
Implement network visualization server logic with Cytoscape.jsR/module-visualize-network-server.R
rendering.
module-visualize-network-ui.R
Develop UI for network visualization with Cytoscape.jsR/module-visualize-network-ui.R
server.R
Integrate network server module into main serverR/server.R
ui.R
Add network interpretation tab to UIR/ui.R