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

    Function charToScore

    • Convert a single quality character to numeric score with type-safe branded types

      Parameters

      • char: string

        ASCII quality character from a FASTQ quality string

      • encoding: QualityEncoding

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

      Returns QualityScore | SolexaScore

      Type-safe branded quality score:

      • QualityScore (0-93) for phred33/phred64
      • SolexaScore (-5 to 62) for solexa encoding

      When character is outside valid ASCII range for encoding

      When resulting score is outside valid range for encoding

      // Phred+33 (modern Illumina)
      const score1 = charToScore('I', 'phred33'); // Returns QualityScore 40
      const score2 = charToScore('!', 'phred33'); // Returns QualityScore 0
      const score3 = charToScore('~', 'phred33'); // Returns QualityScore 93

      // Phred+64 (legacy Illumina)
      const score4 = charToScore('h', 'phred64'); // Returns QualityScore 40
      const score5 = charToScore('@', 'phred64'); // Returns QualityScore 0

      // Solexa (historic, with negative scores)
      const score6 = charToScore(';', 'solexa'); // Returns SolexaScore -5
      const score7 = charToScore('h', 'solexa'); // Returns SolexaScore 40

      O(1) - Single character lookup with constant time validation

      v0.1.0