Package Bio :: Package CodonAlign :: Module CodonAlignment'
[hide private]
[frames] | no frames]

Module CodonAlignment'

source code

Code for dealing with Codon Alignment.

CodonAlignment class is interited 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]
 
_G_test(site_counts)
G test for 2x2 contingency table (PRIVATE).
source code
 
_count_replacement(codon_set, G)
Count replacement needed for a given codon_set (PRIVATE).
source code
 
_dijkstra(graph, start, end)
Dijkstra's algorithm Python implementation.
source code
 
_get_codon2codon_matrix(codon_table=default_codon_table)
Function to get codon codon subsitution matrix.
source code
 
_get_subgraph(codons, G)
Get the subgraph that contains all codons in list (PRIVATE).
source code
 
_prim(G)
Prim's algorithm to find minimum spanning tree.
source code
 
mktest(codon_alns, codon_table=default_codon_table, alpha=0.05)
McDonald-Kreitman test for neutrality (PMID: 1904993) This method counts changes rather than sites (http://mkt.uab.es/mkt/help_mkt.asp).
source code
Variables [hide private]
  __package__ = 'Bio.CodonAlign'
  default_codon_alphabet = CodonAlphabet(Standard)
  default_codon_table = default_codon_table
Function Details [hide private]

_G_test(site_counts)

source code 

G test for 2x2 contingency table (PRIVATE). Argument:

  • site_counts - [syn_fix, nonsyn_fix, syn_poly, nonsyn_poly]
>>> round(_G_test([17, 7, 42, 2]), 7)
0.004924

_dijkstra(graph, start, end)

source code 

Dijkstra's algorithm Python implementation.
Algorithm adapted from
http://thomas.pelletier.im/2010/02/dijkstras-algorithm-python-implementation/.
However, an abvious bug in
    if D[child_node] >(<) D[node] + child_value:
is fixed.
This function will return the distance between start and end.

Arguments:
    graph: Dictionnary of dictionnary (keys are vertices).
    start: Start vertex.
    end: End vertex.
Output:
    List of vertices from the beggining to the end.

_get_codon2codon_matrix(codon_table=default_codon_table)

source code 

Function to get codon codon subsitution matrix. Elements in the matrix are number of synonymous and nonsynonymous substitutions required for the substitution (PRIVATE).

_prim(G)

source code 
Prim's algorithm to find minimum spanning tree. Code is adapted
from
  http://programmingpraxis.com/2010/04/09/minimum-spanning-tree-prims-algorithm/
(PRIVATE).

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

source code 

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