-
Notifications
You must be signed in to change notification settings - Fork 7
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
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:
|
R/module-visualize-network-server.R
Outdated
@@ -0,0 +1,176 @@ | |||
networkServer <- function(input, output, session, parent_session, significant) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could you rename this to visualizeNetworkServer? I think networkServer may confuse people thinking it has something to do with computer networks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
R/module-visualize-network-server.R
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code would be easier to follow if you do df$Protein <- as.character(df$Protein)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
R/module-statmodel-server.R
Outdated
@@ -909,6 +908,7 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu | |||
return( | |||
list( | |||
input = input, | |||
significant = SignificantProteins, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
R/module-statmodel-server.R
Outdated
@@ -376,7 +376,6 @@ statmodelServer <- function(input, output, session,parent_session, loadpage_inpu | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for removing this print statement here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added it back
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you add a dependency on MSstatsBioNet for this package? i.e. using the @importFrom tag and adding the dependency in the DESCRIPTION file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
R/module-visualize-network-server.R
Outdated
interaction <- edge_parts[3] | ||
|
||
# Get edges table | ||
edges_table <- renderNetwork()$edges_table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it wont call INDRA again. It happens only when the inputs change
R/module-visualize-network-server.R
Outdated
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
R/server.R
Outdated
@@ -48,6 +49,8 @@ server <- function(input, output, session) { | |||
selected = "Uploaddata") | |||
}) | |||
|
|||
callModule(networkServer, "network", session, significant) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing significant, could you instead pass data_comparison$ComparisonResult
instead here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
PR Type
enhancement
Description
Changes walkthrough 📝
module-visualize-network-server.R
Implement network visualization server logic with Cytoscape.js
R/module-visualize-network-server.R
rendering.
module-visualize-network-ui.R
Develop UI for network visualization with Cytoscape.js
R/module-visualize-network-ui.R
server.R
Integrate network server module into main server
R/server.R
ui.R
Add network interpretation tab to UI
R/ui.R