Test/coverage improvements#213
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughSDRF column mapping is corrected, Plotly device handling is guarded, and comprehensive Tinytest coverage is added for conversion, plotting, quantification, sample-size, group-comparison edge cases, feature-selection, linear summarization, anomaly-weighting, and validation utility workflows. ChangesMSstats validation and behavior fixes
Estimated code review effort: 3 (Moderate) | ~27 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Failed to generate code suggestions for PR |
Motivation and Context
The current test coverage is very low (below 50%). This PR adds many tests to bring the coverage above 80%
Changes
Testing
Please describe any unit tests you added or modified to verify your changes.
Checklist Before Requesting a Review
Motivation and Context
The change set significantly increases unit test coverage (especially for plotting/export behavior) from under 50% to above 80%, while also addressing bugs uncovered by the added tests—most notably around SDRF fraction column handling and graphics-device handling in Plotly vs non-Plotly plot modes.
Changes
R/SDRFconverter.R:SDRFtoAnnotation(): builds the renamed output columns dynamically so theFractioncolumn is only added/renamed when a fraction input column is requested, preventing column name mismatches.extractSDRF(): fixes column renaming whenfraction = NULLby using the correct source column order sorun_name,condition_name, andbiological_replicateapply to the intended columns.R/groupComparisonPlots.R:.plotHeatmap,.plotVolcano,.plotComparison: only calldev.off()whenaddress != FALSEand the output is not Plotly (!isPlotly), preventing graphics devices from being closed in Plotly/ZIP/HTML output scenarios.Unit Tests
inst/tinytest/test_SDRFconverter.RSDRFtoAnnotation()default naming, optionalFractionhandling, row counts, and error cases for invalid column inputs.extractSDRF()output structure/value mapping with and withoutfraction, and thatmeta_datais merged correctly by run.inst/tinytest/test_dataProcessPlots.R(ggplot2 PDF export warnings/files; Plotly list outputs and ZIP export)inst/tinytest/test_groupComparisonPlots.R(error handling; PDF export; Plotly volcano + ZIP outputs)inst/tinytest/test_modelBasedQCPlots.R(wrapper behavior; PDF outputs for QQ/Residual plots; error handling)inst/tinytest/test_plot_quality_metrics.R(validation errors; ggplot vs Plotly object types; PDF/HTML export; factor preservation forRun)inst/tinytest/test_designSampleSize.R(sample size vs power outputs, monotonicity expectations, Plotly vs non-Plotly plotting)inst/tinytest/test_groupComparison_designs.Randinst/tinytest/test_groupComparison_missing.R(model-fitting branches, repeated/tech replicate detection, incomplete condition edge cases)inst/tinytest/test_quantification.R(sample/group quantification shapes; case-insensitivetype; error handling)inst/tinytest/test_utils_anomaly_weights.R(weighting behavior across NA/outlier/normal cases; normalization behavior)inst/tinytest/test_utils_feature_selection.R(selection modes, expected columns, quality/outlier fields)inst/tinytest/test_utils_plots_common.R(theme helpers, protein selection utilities,savePlot()and internalsaveTable()semantics)inst/tinytest/test_summarization_linear.R(linear summarization path, model fitting helper behavior)inst/tinytest/test_utils_checks_extra.Randinst/tinytest/test_utils_groupcomparison_checks_extra.R(validation/error branches)inst/tinytest/test_utils_output_finalize.Randinst/tinytest/test_utils_summarization_isSummarizable.R(finalization logic and summarizability edge cases)Coding Guidelines Violations