Next Generation Sequencing techniques have brought new insights into -omics data analysis, mostly thanks to their reliability in detecting biological variants. This reliability is usually measured using a quality score named Phred (or Q score).

The Phred score of a base is an integer value that represents the estimated probability of an error in base calling. Mathematically, a Q score is logarithmically related to the base-calling error probabilities P, and can be calculated using the following formula:

Q = -10 log10 P

In the real world, a quality score of 20 means that there is a possibility in 100 that the base in incorrect; a quality score of 40 means the chances that the base is called incorrectly is 1 in 10000. The Phred score is also inversely related to the base call accuracy, thus a higher Q score means a more reliable base call. Here is a useful table which shows this simple relationship:

Phred quality score Incorrect base call prob Base call accuracy
10 1 in 10 90%
20 1 in 100 99%
30 1 in 1000 99.9%
40 1 in 10000 99.99%

In fastq files, Phred quality scores are usually represented using ASCII characters, such that the quality score of each base can be specified using a single character. While older Illumina data used to apply the ASCII_BASE 64, nowadays the ASCII_BASE 33 table has been universally adopted for NGS data:

Q score ASCII char
0 !
1
2 #
3 $
4 %
5 &
6
7 (
8 )
9 *
10 +
Q score ASCII char
11 ,
12
13 .
14 /
15 0
16 1
17 2
18 3
19 4
20 5
21 6
Q score ASCII char
22 7
23 8
24 9
25 :
26 ;
27 <
28 =
29 ?
30 ?
31 @
Q score ASCII char
32 A
33 B
34 C
35 D
36 E
37 F
38 G
39 H
40 I
41 J

 

 

 

 

 

 

 

 

 

 

 

 

 

Even though there are lots of Python, Biopython and stand-alone softwares for dealing with Phred quality scores, a simple command to convert an ASCII character to its correspondent quality score is the following (from the terminal):

python -c 'print ord("<ASCII>")-33'

Or, from inside Python:

print ord("<ASCII>")-33

Just replace <ASCII> with the actual ASCII character and that will do the trick.

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *