Extract heatmap core logic into testable R package functions#375
Closed
Extract heatmap core logic into testable R package functions#375
Conversation
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] 自定义分组热图
Implement custom grouped heatmap feature for expression data visualization
Aug 26, 2025
Member
|
@lishensuo 有空看看ai的代码写的怎么样哈?是不是改改就能合并 |
Collaborator
收到老师。等周末左右的时候,会一起处理下~ |
Member
|
嗯,这个就玩一玩看看,有空搞搞就行,不着急
---- 回复的原邮件 ----
发件人 ***@***.***> 日期 2025年08月26日 13:04 收件人 ***@***.***> 抄送至 Shixiang Wang ***@***.***>***@***.***> 主题 Re: [openbiox/UCSCXenaShiny] Implement custom grouped heatmap feature for expression data visualization (PR #375)
lishensuo left a comment (openbiox/UCSCXenaShiny#375)
@lishensuo 有空看看ai的代码写的怎么样哈?是不是改改就能合并
收到老师。等周末左右的时候,会一起处理下~
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were assigned.Message ID: ***@***.***>
|
Member
|
@copilot 只引入 tidyHeatmap 作为 suggests 依赖实现目标功能,请重新实现和测试。 |
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Contributor
Author
Refactoring complete! The custom heatmap module now uses only tidyHeatmap as a Suggests dependency. Key changes:
Commits:
Ready for testing. All functionality including custom grouping, multiple color palettes, and export features have been preserved. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
- Simplify dataset selection to match other GA modules pattern - Add "NONE" option as default to ensure dropdown renders - Add validation to warn if no dataset selected - Update UI text from "expression data" to "molecular data" - Change "genes" terminology to generic "features" throughout - Improve error messages to be dataset-type agnostic Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
Implement custom grouped heatmap feature for expression data visualization
Fix custom heatmap dataset selection and remove expression data limitation
Feb 8, 2026
- Add get_dataset_features() function to fetch available features from Xena datasets - Update custom heatmap module to automatically load features when dataset is selected - Default select first 10-20 features for better UX - Add helpful UI text explaining automatic feature loading - Add jsonlite dependency for JSON parsing - Improve error handling and user notifications Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
Fix custom heatmap dataset selection and remove expression data limitation
Add dynamic feature loading to custom heatmap with auto-selection
Feb 8, 2026
Remove get_dataset_features() function and API calls. Instead, use all_preload_identifiers which already contains all molecular IDs (Gene, Protein, miRNA). Simply select first 15 items as defaults. This is much simpler, more reliable, and doesn't require API calls that may fail. The preloaded identifiers list is comprehensive and sufficient for most use cases. Changes: - Remove get_dataset_features() from R/query_value.R - Simplify observe() block in custom heatmap module - Use all_preload_identifiers directly - Pre-select first 15 features by default - Remove complex error handling and API call logic - Remove unnecessary help text about feature loading Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
Add dynamic feature loading to custom heatmap with auto-selection
Remove unreliable API-based feature loading, use preloaded identifiers
Feb 8, 2026
Create R/vis_custom_heatmap.R with testable functions: - parse_custom_groups(): Parse group definition strings - prepare_heatmap_data(): Prepare data for visualization - generate_custom_heatmap(): Core heatmap generation - vis_custom_heatmap(): High-level wrapper function Add comprehensive tests in tests/testthat/test-vis_custom_heatmap.R These functions can now be tested independently of Shiny, used programmatically, and are properly documented with roxygen2. Next step: Refactor Shiny module to use these package functions. Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Update modules-ga-custom-heatmap.R to use the new package functions: - Replace custom group parsing logic with parse_custom_groups() - Replace heatmap generation logic with generate_custom_heatmap() - Shiny module now acts as thin UI wrapper - Reduced code complexity: 67 lines removed, 35 lines added - All core logic now testable independently The Shiny module now focuses on: - UI reactivity and user input handling - Calling package functions with appropriate parameters - Displaying results and notifications Benefits: - Cleaner separation of concerns - Core logic can be tested without Shiny - Easier to maintain and debug - Can reuse functions in other contexts Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
Remove unreliable API-based feature loading, use preloaded identifiers
Extract heatmap core logic into testable R package functions
Feb 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Heatmap visualization logic was embedded in Shiny module, making it untestable and unreusable. Extracted into proper package functions with comprehensive test coverage.
Changes
New package functions (
R/vis_custom_heatmap.R):parse_custom_groups()- Parse group definition stringsprepare_heatmap_data()- Transform data to long format with groupinggenerate_custom_heatmap()- Core visualization with tidyHeatmapvis_custom_heatmap()- High-level wrapperTest coverage (
tests/testthat/test-vis_custom_heatmap.R):Shiny module refactoring:
Usage
Functions are now independently usable:
Architecture
Before: Monolithic Shiny module (500 lines, untestable)
After: Package functions (356 lines) + thin Shiny wrapper (450 lines)
All core logic is now testable without Shiny, reusable in scripts/pipelines, and properly documented with roxygen2.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.