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

Module CodonSeq'

source code

Code for dealing with Codon Seq.

CodonSeq class is interited from Seq class. This is the core class to deal with sequences in CodonAlignment in biopython.

Classes [hide private]
  CodonSeq
CodonSeq is designed to be within the SeqRecords of a CodonAlignment class.
Functions [hide private]
 
_count_diff_NG86(codon1, codon2, codon_table=default_codon_table)
Count differences between two codons (three-letter string).
source code
 
_count_diff_YN00(codon1, codon2, P, codon_lst, codon_table=default_codon_table)
Count differences between two codons (three-letter string).
source code
 
_count_site_NG86(codon_lst, k=1, codon_table=default_codon_table)
count synonymous and non-synonymous sites of a list of codons (PRIVATE).
source code
 
_count_site_YN00(codon_lst1, codon_lst2, pi, k, codon_table=default_codon_table)
Site counting method from Ina 1995, PMID: 7699723 and modified by Yang, PMID: 10666704.
source code
 
_diff_codon(codon1, codon2, fold_dict)
function to get the differences of two codon and return number of different types substitutions
source code
 
_get_Q(pi, k, w, codon_lst, codon_table)
Q matrix for codon substitution
source code
 
_get_TV(codon_lst1, codon_lst2, codon_table=default_codon_table)
Argument:
source code
 
_get_codon_fold(codon_table)
function to classify different position in a codon into different fold (PRIVATE).
source code
 
_get_codon_list(codonseq)
get a list of codons according to full_rf_table for counting (PRIVATE).
source code
 
_get_kappa_t(pi, TV, t=False)
The following formula and variable names are according to PMID: 10666704
source code
 
_get_pi(seq1, seq2, cmethod, codon_table=default_codon_table)
Obtain codon frequency dict (pi) from two codon list (PRIVATE).
source code
 
_likelihood_func(t, k, w, pi, codon_cnt, codon_lst, codon_table)
likelihood function for ML method
source code
 
_lwl85(seq1, seq2, k, codon_table)
Main function fo LWL85 method (PRIVATE).
source code
 
_ml(seq1, seq2, cmethod, codon_table)
Main function for ML method (PRIVATE).
source code
 
_ng86(seq1, seq2, k, codon_table)
Main function for NG86 method (PRIVATE).
source code
 
_q(i, j, pi, k, w, codon_table=default_codon_table)
Q matrix for codon substitution.
source code
 
_yn00(seq1, seq2, k, codon_table)
Main function for yn00 method (PRIVATE).
source code
 
cal_dn_ds(codon_seq1, codon_seq2, method='NG86', codon_table=default_codon_table, k=1, cfreq=None)
Function to calculate the dN and dS of the given two CodonSeq or SeqRecord that contain CodonSeq objects.
source code
Variables [hide private]
  __package__ = 'Bio.CodonAlign'
  default_codon_alphabet = CodonAlphabet(Standard)
  default_codon_table = default_codon_table
  generic_by_id = {}
  generic_dna = DNAAlphabet()
Function Details [hide private]

_count_diff_NG86(codon1, codon2, codon_table=default_codon_table)

source code 

Count differences between two codons (three-letter string). The function will take multiple pathways from codon1 to codon2 into account (PRIVATE).

_count_diff_YN00(codon1, codon2, P, codon_lst, codon_table=default_codon_table)

source code 

Count differences between two codons (three-letter string). The function will weighted multiple pathways from codon1 to codon2 according to P matrix of codon substitution. The proportion of transition and transvertion (TV) will also be calculated in the function (PRIVATE).

_count_site_NG86(codon_lst, k=1, codon_table=default_codon_table)

source code 

count synonymous and non-synonymous sites of a list of codons (PRIVATE). Argument:

  • codon_lst - A three letter codon list from a CodonSeq object. This can be returned from _get_codon_list method.
  • k - transition/transversion rate ratio

_count_site_YN00(codon_lst1, codon_lst2, pi, k, codon_table=default_codon_table)

source code 

Site counting method from Ina 1995, PMID: 7699723 and modified by Yang, PMID: 10666704. The method will return the total number of synonymous and nonsynonymous sites and base frequencies in each category. The function is equivalent to CountSites() function in yn00.c of PAML.

_diff_codon(codon1, codon2, fold_dict)

source code 

function to get the differences of two codon and return number of different types substitutions

return (P0, P2, P4, Q0, Q2, Q4) Nomenclature is according to PMID (3916709)

_get_TV(codon_lst1, codon_lst2, codon_table=default_codon_table)

source code 

Argument:

  • T - proportions of transitional differences
  • V - proportions of transversional differences

_get_pi(seq1, seq2, cmethod, codon_table=default_codon_table)

source code 

Obtain codon frequency dict (pi) from two codon list (PRIVATE). This function is designed for ML method. Available counting methods (cfreq) are F1x4, F3x4 and F64.

_q(i, j, pi, k, w, codon_table=default_codon_table)

source code 

Q matrix for codon substitution.

Arguments:

  • i, j : three letter codon string
  • pi : expected codon frequency
  • k : transition/transversion ratio
  • w : nonsynonymous/synonymous rate ratio
  • codon_table: Bio.Data.CodonTable object

cal_dn_ds(codon_seq1, codon_seq2, method='NG86', codon_table=default_codon_table, k=1, cfreq=None)

source code 

Function to calculate the dN and dS of the given two CodonSeq or SeqRecord that contain CodonSeq objects.

Available methods:

  • NG86 - PMID: 3444411
  • LWL85 - PMID: 3916709
  • ML - PMID: 7968486
  • YN00 - PMID: 10666704

Arguments:

  • w - transition/transvertion ratio
  • cfreq - Current codon frequency vector can only be specified when you are using ML method. Possible ways of getting cfreq are: F1x4, F3x4 and F61.