-
Notifications
You must be signed in to change notification settings - Fork 10
feature(response-curve): Enable setting up metadata for response curves #133
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
Changes from all commits
4c4f703
3e45d0e
0ccbcab
0dc9021
732e5f4
4ce844f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,8 @@ get_contrast_panel_ui <- function(mode, ns) { | |
| build_all_pairwise_panel(ns) | ||
| } else if (mode == CONSTANTS_STATMODEL$comparison_mode_custom_nonpairwise) { | ||
| build_custom_nonpairwise_panel(ns) | ||
| } else if (mode == CONSTANTS_STATMODEL$comparison_mode_response_curve) { | ||
| build_response_curve_panel(ns) | ||
| } else { | ||
| NULL | ||
| } | ||
|
|
@@ -202,6 +204,13 @@ build_all_pair_contrast = function(input, condition_list, contrast, comp_list, r | |
| return(contrast$matrix) | ||
| } | ||
|
|
||
| #' @importFrom MSstatsResponse convertGroupToNumericDose | ||
| build_response_curve_matrix = function(contrast, condition_list) { | ||
| condition_to_metadata_table = convertGroupToNumericDose(condition_list) | ||
| contrast$matrix = data.frame(GROUP = condition_list, condition_to_metadata_table) | ||
| return(contrast$matrix) | ||
| } | ||
|
Comment on lines
+207
to
+212
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for The call to Consider wrapping in a tryCatch to provide a user-friendly error message: #' @importFrom MSstatsResponse convertGroupToNumericDose
build_response_curve_matrix = function(contrast, condition_list) {
- condition_to_metadata_table = convertGroupToNumericDose(condition_list)
- contrast$matrix = data.frame(GROUP = condition_list, condition_to_metadata_table)
+ tryCatch({
+ condition_to_metadata_table = convertGroupToNumericDose(condition_list)
+ contrast$matrix = data.frame(GROUP = condition_list, condition_to_metadata_table)
+ }, error = function(e) {
+ stop("Failed to extract dose information from condition names. ",
+ "Ensure conditions follow a pattern like 'Drug_100nM'. Error: ",
+ conditionMessage(e))
+ })
return(contrast$matrix)
}🤖 Prompt for AI Agents |
||
|
|
||
| # Todo: Add helper function to build dose response curve mapper matrix | ||
|
|
||
| # ============================================================================ | ||
|
|
@@ -509,6 +518,9 @@ statmodelServer = function(id, parent_session, loadpage_input, qc_input, | |
| } else if (input[[NAMESPACE_STATMODEL$comparison_mode]] == CONSTANTS_STATMODEL$comparison_mode_all_pairwise) { | ||
| contrast$matrix = build_all_pair_contrast( | ||
| input, condition_list(), contrast, comp_list, row(), loadpage_input()) | ||
| } else if (input[[NAMESPACE_STATMODEL$comparison_mode]] == CONSTANTS_STATMODEL$comparison_mode_response_curve) { | ||
| contrast$matrix = build_response_curve_matrix( | ||
| contrast, condition_list()) | ||
|
Comment on lines
+521
to
+523
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for all usages of comparison_mode_response_curve
rg -n "comparison_mode_response_curve" RRepository: Vitek-Lab/MSstatsShiny Length of output: 645 🏁 Script executed: #!/bin/bash
# Get context around line 35
echo "=== Context at line 35 ==="
sed -n '25,50p' R/module-statmodel-server.R
echo ""
echo "=== Context at line 100 ==="
sed -n '90,115p' R/module-statmodel-server.R
echo ""
echo "=== Context at line 542 (reviewed code) ==="
sed -n '535,555p' R/module-statmodel-server.RRepository: Vitek-Lab/MSstatsShiny Length of output: 3519 🏁 Script executed: #!/bin/bash
# Find dataComparison function
echo "=== Searching for dataComparison function ==="
rg -n "dataComparison\s*=" R --type r
echo ""
echo "=== Searching for generate_analysis_code function ==="
rg -n "generate_analysis_code\s*=" R --type r
echo ""
echo "=== Searching for build_response_curve_matrix function ==="
rg -n "build_response_curve_matrix\s*=" R --type r
echo ""
echo "=== Searching for uses of contrast\$matrix ==="
rg -n "contrast\\\$matrix" R --type r | head -30Repository: Vitek-Lab/MSstatsShiny Length of output: 2847 🏁 Script executed: #!/bin/bash
# View build_response_curve_matrix function
echo "=== build_response_curve_matrix function ==="
sed -n '229,280p' R/module-statmodel-server.R
echo ""
echo "=== generate_analysis_code function ==="
sed -n '335,380p' R/module-statmodel-server.RRepository: Vitek-Lab/MSstatsShiny Length of output: 4438 🏁 Script executed: #!/bin/bash
# Find where generate_analysis_code is called
echo "=== Calls to generate_analysis_code ==="
rg -n "generate_analysis_code" R --type r -B 2 -A 2
echo ""
echo "=== data_comparison variable usage ==="
rg -n "data_comparison" R --type r | head -20
echo ""
echo "=== MSstatsResponse usage ==="
rg -n "MSstatsResponse" R --type rRepository: Vitek-Lab/MSstatsShiny Length of output: 2792 🏁 Script executed: #!/bin/bash
# View the data_comparison and related code context
sed -n '550,610p' R/module-statmodel-server.RRepository: Vitek-Lab/MSstatsShiny Length of output: 2147 🏁 Script executed: #!/bin/bash
# Search for dataComparison function definition
echo "=== Search for dataComparison function definition ==="
rg -n "^dataComparison\s*=" R --type r
echo ""
echo "=== Alternative search pattern ==="
rg -n "dataComparison.*function" R --type r
echo ""
echo "=== Look in separate files ==="
find R -name "*.R" -type f | xargs grep -l "dataComparison"Repository: Vitek-Lab/MSstatsShiny Length of output: 375 🏁 Script executed: #!/bin/bash
# View the dataComparison function
echo "=== dataComparison function ==="
sed -n '1212,1300p' R/utils.R
# Get file length to see how much more there is
echo ""
echo "=== File stats ==="
wc -l R/utils.RRepository: Vitek-Lab/MSstatsShiny Length of output: 1805 🏁 Script executed: #!/bin/bash
# Find tmt_model and lf_model functions
echo "=== Search for tmt_model and lf_model ==="
rg -n "tmt_model\s*=" R --type r
echo ""
rg -n "lf_model\s*=" R --type r
echo ""
echo "=== Check if they're in utils.R ==="
grep -n "tmt_model\|lf_model" R/utils.R | head -20Repository: Vitek-Lab/MSstatsShiny Length of output: 855 🏁 Script executed: #!/bin/bash
# View lf_model function
echo "=== lf_model function (starting at line 304) ==="
sed -n '304,350p' R/main_calculations.R
echo ""
echo "=== tmt_model function (starting at line 411) ==="
sed -n '411,460p' R/main_calculations.RRepository: Vitek-Lab/MSstatsShiny Length of output: 3559 🏁 Script executed: #!/bin/bash
# Search for TODO comments related to response curves
echo "=== TODO comments in module-statmodel-server.R ==="
grep -n "Todo\|TODO" R/module-statmodel-server.R
echo ""
echo "=== Response curve related comments ==="
grep -n "response\|dose" R/module-statmodel-server.R | grep -i "todo\|fixme\|hack"
echo ""
echo "=== Check create_group_comparison_plot for response curve handling ==="
sed -n '258,310p' R/module-statmodel-server.RRepository: Vitek-Lab/MSstatsShiny Length of output: 3054 🏁 Script executed: #!/bin/bash
# Check how the matrix is displayed in GUI
echo "=== Matrix display code (around line 578) ==="
sed -n '575,585p' R/module-statmodel-server.R
echo ""
echo "=== Check for any mode checks before calling analysis functions ==="
sed -n '559,572p' R/module-statmodel-server.R
echo ""
echo "=== Check build_response_curve_panel to understand UI flow ==="
rg -n "build_response_curve_panel" R --type r -A 10 | head -30Repository: Vitek-Lab/MSstatsShiny Length of output: 2339 Response curve matrix incompatibility requires conditional handling in downstream analysis pipeline. The response-curve matrix building at lines 542-544 produces a data.frame with columns Currently, this data.frame is passed directly to Additionally:
Add conditional mode checking before passing 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| enable("calculate") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.