Skip to content

Add QC Comparison Table to Samples Panel #113

@lkwhite

Description

@lkwhite

Overview

Add a multi-sample QC comparison table to the top of the Samples panel, providing at-a-glance quality metrics for loaded samples.

Implementation Scope (MVP - Zero New Computation)

Location: Add to existing Samples panel (top section, above sample cards)

Data Source: Use only data already extracted during POD5/BAM load:

  • From _squiggy_session.bam_info
  • From _squiggy_session.pod5_path / read_ids
  • No new Python computation required

UI Design: Comparison table showing side-by-side metrics

Metrics to Display

Metric Source Format
Basecaller Model extract_model_provenance() "dna_r10.4.1"
Basecaller Version extract_model_provenance() "guppy 5.0.0"
POD5 Reads len(read_ids) "14,234"
BAM Mapped bam_info['num_reads'] "13,890"
Alignment Rate Calculated "97.6%"
References len(bam_info['references']) "12"
Modifications bam_info['modification_types'] "5mC, 6mA" (formatted)
Has Events bam_info['has_event_alignment'] ✅/❌

Visual Design

╔════════════════════════════════════════════════════════════════╗
║ Samples                                                        ║
╠════════════════════════════════════════════════════════════════╣
║ QC COMPARISON (3 samples)                                      ║
║ ─────────────────────────────────────────────────────────────  ║
║ Metric              │ Sample A    │ Sample B    │ Sample C    ║
║ ────────────────────┼─────────────┼─────────────┼────────────  ║
║ Basecaller Model    │ dna_r10.4.1 │ dna_r10.4.1 │ rna004_70bps║
║ Basecaller Version  │ guppy 5.0.0 │ dorado 7.2  │ dorado 7.2  ║
║ POD5 Reads          │ 14,234      │ 14,234      │ 8,902       ║
║ BAM Mapped          │ 13,890      │ 14,102      │ 8,654       ║
║ Alignment Rate      │ 97.6%       │ 99.1% ✨    │ 97.2%       ║
║ References          │ 12          │ 12          │ 4           ║
║ Modifications       │ 5mC, 5hmC   │ 5mC, 6mA    │ Ψ, m7G      ║
║ Has Events          │ ✅          │ ✅          │ ✅          ║
║ ════════════════════════════════════════════════════════════   ║
║ MANAGE SAMPLES                                                 ║
║ Sample A                                        [👁️][▼]       ║
║   └─ [existing expandable card details]                       ║
║ Sample B                                        [👁️][▼]       ║
╚════════════════════════════════════════════════════════════════╝

Implementation Details

Backend (Python)

  1. Add extract_model_provenance() call during BAM load if not already done
  2. Store in bam_info['model_provenance'] = {name, version, basecaller}

Frontend (TypeScript/React)

  1. Update squiggy-samples-core.tsx to add QC table section at top
  2. Reuse existing modCodeToName mapping for modification display (from squiggy-modifications-core.tsx)
  3. Calculate alignment rate: (bamReads / pod5Reads) * 100
  4. Responsive table layout (collapses on narrow screens)

Message Passing

  • QC data sent via existing updateSamples message
  • No new message types needed

Behavior

Single Sample Mode:

  • Show table with 1 column (still useful to see all metrics at once)

Multi-Sample Mode:

  • Show comparison table with all samples side-by-side
  • Highlight best values (e.g., highest alignment rate with ✨)

Collapsible:

  • Add collapse/expand button to QC section
  • Default: expanded (users want to see QC immediately)

Benefits

Immediate value: Compare basecallers/models at a glance
Zero cost: Uses only existing data
No UI clutter: Fits in existing Samples panel
Actionable: Quickly spot quality issues (low alignment, missing mods)

Future Enhancements (Out of Scope for MVP)

  • Read length distribution (requires scanning all reads)
  • Quality score distribution (requires BAM scan)
  • Signal statistics (requires loading POD5 data)
  • Interactive sorting/filtering of comparison table

Acceptance Criteria

  • QC comparison table displays at top of Samples panel
  • All 8 metrics shown correctly for each sample
  • Modification types formatted with human-readable names
  • Alignment rate calculated correctly
  • Table responsive (works with 1-6+ samples)
  • Collapsible section (default expanded)
  • No performance impact on sample loading

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions