Genotype API Documentation - v0.1.0
    Preparing search index...

    Function scoreToChar

    • Convert a numeric quality score to ASCII character with type safety

      Parameters

      • score: number | QualityScore | SolexaScore

        Numeric quality score (accepts branded QualityScore/SolexaScore or validated number)

      • encoding: QualityEncoding

        Quality encoding scheme ('phred33', 'phred64', or 'solexa')

      Returns string

      ASCII quality character for the encoding

      When score is not a valid integer

      When score is outside QualityScore range (0-93) for non-Solexa

      When score is outside encoding-specific valid range

      // Phred+33 (modern standard)
      scoreToChar(40, 'phred33'); // Returns 'I' (ASCII 73)
      scoreToChar(0, 'phred33'); // Returns '!' (ASCII 33)
      scoreToChar(93, 'phred33'); // Returns '~' (ASCII 126)

      // Phred+64 (legacy)
      scoreToChar(40, 'phred64'); // Returns 'h' (ASCII 104)
      scoreToChar(0, 'phred64'); // Returns '@' (ASCII 64)

      // Type-safe with branded types
      const validated = 40 as QualityScore;
      scoreToChar(validated, 'phred33'); // Type-safe, no runtime validation needed

      O(1) - Direct calculation with constant time validation

      v0.1.0