Package Bio :: Package codonalign :: Module codonalignment
[hide private]
[frames] | no frames]

Module codonalignment

source code

Code for dealing with Codon Alignment.

CodonAlignment class is inherited from MultipleSeqAlignment class. This is the core class to deal with codon alignment in biopython.

Classes [hide private]
  CodonAlignment
Codon Alignment class that inherits from MultipleSeqAlignment.
Functions [hide private]
 
mktest(codon_alns, codon_table=default_codon_table, alpha=0.05)
McDonald-Kreitman test for neutrality.
source code
 
_get_codon2codon_matrix(codon_table=default_codon_table)
Get codon codon substitution matrix (PRIVATE).
source code
 
_dijkstra(graph, start, end)
Dijkstra's algorithm Python implementation (PRIVATE).
source code
 
_count_replacement(codon_set, G)
Count replacement needed for a given codon_set (PRIVATE).
source code
 
_prim(G)
Prim's algorithm to find minimum spanning tree (PRIVATE).
source code
 
_get_subgraph(codons, G)
Get the subgraph that contains all codons in list (PRIVATE).
source code
 
_G_test(site_counts)
G test for 2x2 contingency table (PRIVATE).
source code
Variables [hide private]
  __package__ = 'Bio.codonalign'
Function Details [hide private]

mktest(codon_alns, codon_table=default_codon_table, alpha=0.05)

source code 

McDonald-Kreitman test for neutrality.

Implement the McDonald-Kreitman test for neutrality (PMID: 1904993) This method counts changes rather than sites (http://mkt.uab.es/mkt/help_mkt.asp).

Arguments:
  • codon_alns - list of CodonAlignment to compare (each CodonAlignment object corresponds to gene sampled from a species)

Return the p-value of test result.

_get_codon2codon_matrix(codon_table=default_codon_table)

source code 

Get codon codon substitution matrix (PRIVATE).

Elements in the matrix are number of synonymous and nonsynonymous substitutions required for the substitution.

_dijkstra(graph, start, end)

source code 

Dijkstra's algorithm Python implementation (PRIVATE).

Algorithm adapted from http://thomas.pelletier.im/2010/02/dijkstras-algorithm-python-implementation/. However, an obvious bug in:

if D[child_node] >(<) D[node] + child_value:

is fixed. This function will return the distance between start and end.

Arguments:
  • graph: Dictionary of dictionary (keys are vertices).
  • start: Start vertex.
  • end: End vertex.
Output:
List of vertices from the beginning to the end.

_prim(G)

source code 

Prim's algorithm to find minimum spanning tree (PRIVATE).

Code is adapted from http://programmingpraxis.com/2010/04/09/minimum-spanning-tree-prims-algorithm/

_G_test(site_counts)

source code 

G test for 2x2 contingency table (PRIVATE).

Arguments:
  • site_counts - [syn_fix, nonsyn_fix, syn_poly, nonsyn_poly]
>>> print("%0.6f" % _G_test([17, 7, 42, 2]))
0.004924