Skip to content

[TEST] #84: TSV output formatter#109

Closed
crashfrog wants to merge 1 commit into
mainfrom
worktree-agent-ae858b23ef6bab9ce
Closed

[TEST] #84: TSV output formatter#109
crashfrog wants to merge 1 commit into
mainfrom
worktree-agent-ae858b23ef6bab9ce

Conversation

@crashfrog
Copy link
Copy Markdown
Member

Summary

Added RED phase acceptance tests for TSV output formatter in phraya-filter crate. Tests define the API surface and acceptance criteria without implementing the feature.

API Surface Assumed by These Tests

// Column enum for TSV output selection
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Column {
    Position,      // 0-indexed reference position
    RefBase,       // Reference base as char
    AltBases,      // Comma-separated alt alleles, sorted, "." if none
    Coverage,      // From local_coverage[0], "0" if empty
    Mapq,          // Mapping quality
    Cigar,         // CIGAR string
    EditDistance,  // Edit distance
    Confidence,    // Confidence score (0.0-1.0)
    Provenance,    // Provenance with escaped special chars
}

// Format with specified columns
pub fn format_tsv(
    observations: impl Iterator<Item = VariantObservation>,
    columns: &[Column],
) -> String;

// Format with default columns: [Position, RefBase, AltBases, Coverage, Mapq]
pub fn format_tsv_with_defaults(
    observations: impl Iterator<Item = VariantObservation>,
) -> String;

Test Coverage

  • Header row: tab-separated column names
  • Data rows: tab-separated values matching column order
  • Column selection: any subset of Column enum
  • Default columns: Position, RefBase, AltBases, Coverage, Mapq
  • Special character escaping: \t → \t, \n → \n in provenance fields
  • Multi-allelic handling: sorted, comma-separated alt alleles
  • Empty cases: zero coverage, no alt alleles (shows "."), empty observations
  • All column types: tested individually and in combination

Filter Command

Run tests with: cargo test --lib tsv

All 15 tests currently fail at RED phase (functions not implemented).

🤖 Generated with Claude Code

RED phase tests for TSV output formatter in phraya-filter. Tests verify:
- Column selection and headers
- Special character escaping (tabs, newlines)
- Multi-allelic site handling (sorted, comma-separated)
- Empty observations and empty coverage
- All column types (Position, RefBase, AltBases, Coverage, Mapq, Cigar, EditDistance, Confidence, Provenance)
- Default column set (Position, RefBase, AltBases, Coverage, Mapq)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@crashfrog
Copy link
Copy Markdown
Member Author

Closing stale test PR - implementation PR #110 has been merged.

@crashfrog crashfrog closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant