Java Char to Int CHAR2QUAL(char qual)

Here you can find the source of CHAR2QUAL(char qual)

Description

This method assumes the input ASCII quality character is Sanger encoded (+33).

License

Open Source License

Parameter

Parameter Description
qual The Sanger encoded ASCII quality character.

Return

the PHRED value.

Declaration

public static int CHAR2QUAL(char qual) 

Method Source Code

//package com.java2s;
/*//from   w w  w .  j a va  2  s  .co  m
 * LICENSE to be determined
 */

public class Main {
    /**
     * This method assumes the input ASCII quality character is Sanger encoded (+33).
     * @param qual The Sanger encoded ASCII quality character.
     * @return the PHRED value.
     */
    public static int CHAR2QUAL(char qual) {
        int q = (((int) qual) - 33);
        if (q < 0) {
            return 1;
        } else if (255 < q) {
            return 255;
        } else {
            return q;
        }
    }
}

Related

  1. char2int(char c)
  2. charToIndex(char c)
  3. charToIndex(Character c)
  4. charToInt(char c)
  5. charToInt(char c)