Biology Stack Exchange is a question and answer site for biology researchers, academics, and students. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From this wiki article:

In genetics, the Ka/Ks ratio (or ω, dN/dS), is the ratio of the number of Nonsynonymous substitutions per non-synonymous site (Ka) to the number of synonymous substitutions per synonymous site (Ks), which can be used as an indicator of selective pressure acting on a protein-coding gene.


Are there any modules/packages available in Python for doing Ka/Ks analysis? I wish to carry out whole gene Ka/Ks analysis and then maybe "codon level" Ka/Ks analysis (i.e. within gene via sliding window).

share|improve this question

Do you know about BioPython?

Here, on another website, someone already asked this question and a pretty nice answer was provided by Brad Chapman. He gives already written functions to perform this kind of analysis (I personally haven't tried the codes).

In Perl there is Bio::Align::DNAStatistics. You might adapt it to Python.

This might be useful as well.

I think there are plenty of possibilities that are offered to you. You can go through some others by doing google search with the keywords synonymous, non-synonymous and BioPython.

share|improve this answer
Cheers, i'll give this a go soon! – hello_there_andy Dec 26 '13 at 20:52
I've looked into BioPython, they have an output parser for PAML but that software is not recommended when you only have pairs of protein sequences. I ended up programming my own version which implements the approximate Nei-Gojobori algorithm. – hello_there_andy Mar 11 '14 at 17:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.