I am planning to calculate my own phred quality score.

I need to share some idea how to calculate my own Q Score.

I have a sequences like below,

AAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAA

....

TAAAAAAAAAAAAAAAAAAAAA

So Above case, There is A : 100 and T : 1 on the first base.

So That position has 99% accuracy.

And from 99% accuracy how I can get Q = 20 ?

What if there is A : 151 and 1 T on the first position?

Anyone knows how to calculate that score from the percentage?

Thank you.