UCSCXenaShiny icon indicating copy to clipboard operation
UCSCXenaShiny copied to clipboard

Implement custom grouped heatmap feature for expression data visualization

Open Copilot opened this issue 6 months ago • 3 comments

This PR implements a comprehensive custom grouped heatmap feature that addresses the need for "自定义分组热图" (Custom Grouped Heatmap) functionality in UCSCXenaShiny.

Key Features

Custom Sample Grouping

The implementation supports two flexible grouping methods:

  • Manual Definition: Users can define custom sample groups using an intuitive format:
    Group1: TCGA-AA-3502,TCGA-AA-3506,TCGA-AA-3514
    Group2: TCGA-AA-3510,TCGA-AA-3520,TCGA-AA-3524
    
  • Phenotype-based: Automatic grouping using existing phenotype variables from clinical data

Expression Data Visualization

  • Displays expression data with genes as rows and samples as columns (as requested)
  • Multi-gene selection with search functionality
  • Support for both UCSC Xena datasets and custom uploaded data
  • Configurable gene limits (5-500 genes) for performance optimization

Advanced Visualization Options

  • Multiple clustering methods (complete, average, single, ward.D, etc.)
  • Rich color palette selection (viridis, plasma, RdYlBu, Spectral, etc.)
  • Configurable display options (gene names, sample names, clustering toggles)
  • Visual group annotations displayed as colored bars above the heatmap

Technical Implementation

  • Multi-backend Support: Uses ComplexHeatmap as primary backend with pheatmap fallback for broader compatibility
  • Robust Data Handling: Includes error handling, data validation, and missing value management
  • Export Functionality: Download support for PNG/PDF formats with proper handling for different plot types
  • UI Integration: Seamlessly integrated as new "Custom-Heatmap" tab in General Analysis page

Usage Workflow

  1. Navigate to General Analysis → Custom-Heatmap tab
  2. Select dataset or upload custom data
  3. Choose genes/features for visualization
  4. Configure appearance (clustering, colors, labels)
  5. Define sample groups (custom or phenotype-based)
  6. Generate heatmap with group annotations
  7. Download results in preferred format

Files Changed

  • New Module: inst/shinyapp/modules/01_general/modules-ga-custom-heatmap.R
  • UI Integration: inst/shinyapp/ui/general-analysis.R
  • Server Integration: inst/shinyapp/server/general-analysis.R
  • Dependencies: Added ComplexHeatmap, pheatmap, viridis, circlize, grid to DESCRIPTION

This implementation provides the exact functionality requested for custom grouped heatmap visualization and establishes a solid foundation for future enhancements, such as overlaying different molecular data types.

Fixes #218.


💡 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.

Copilot avatar Aug 26 '25 03:08 Copilot

@lishensuo 有空看看ai的代码写的怎么样哈?是不是改改就能合并

ShixiangWang avatar Aug 26 '25 04:08 ShixiangWang

@lishensuo 有空看看ai的代码写的怎么样哈?是不是改改就能合并

收到老师。等周末左右的时候,会一起处理下~

lishensuo avatar Aug 26 '25 05:08 lishensuo

嗯,这个就玩一玩看看,有空搞搞就行,不着急 ---- 回复的原邮件 ---- 发件人 @.> 日期 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: @.***>

ShixiangWang avatar Aug 26 '25 05:08 ShixiangWang