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

Class CodonAlignment

source code

                object --+    
                         |    
Align.MultipleSeqAlignment --+
                             |
                            CodonAlignment

Codon Alignment class that inherits from MultipleSeqAlignment.

>>> from Bio.Alphabet import generic_dna
>>> from Bio.SeqRecord import SeqRecord
>>> from Bio.Alphabet import IUPAC, Gapped
>>> a = SeqRecord(CodonSeq("AAAACGTCG", alphabet=default_codon_alphabet), id="Alpha")
>>> b = SeqRecord(CodonSeq("AAA---TCG", alphabet=default_codon_alphabet), id="Beta")
>>> c = SeqRecord(CodonSeq("AAAAGGTGG", alphabet=default_codon_alphabet), id="Gamma")
>>> print(CodonAlignment([a, b, c]))
CodonAlphabet(Standard) CodonAlignment with 3 rows and 9 columns (3 codons)
AAAACGTCG Alpha
AAA---TCG Beta
AAAAGGTGG Gamma
Instance Methods [hide private]
 
__init__(self, records='', name=None, alphabet=CodonAlphabet(Standard))
Initialize the class.
source code
 
__str__(self)
Return a multi-line string summary of the alignment.
source code
 
__getitem__(self, index, alphabet=None)
Return a CodonAlignment object for single indexing.
source code
 
get_aln_length(self) source code
 
toMultipleSeqAlignment(self)
Convert the CodonAlignment to a MultipleSeqAlignment.
source code
 
get_dn_ds_matrix(self, method='NG86', codon_table=default_codon_table)
Available methods include NG86, LWL85, YN00 and ML.
source code
 
get_dn_ds_tree(self, dn_ds_method='NG86', tree_method='UPGMA', codon_table=default_codon_table)
Cnstruct dn tree and ds tree.
source code

Inherited from Align.MultipleSeqAlignment: __add__, __format__, __iter__, __len__, __repr__, add_sequence, append, extend, format, get_alignment_length, sort

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
 
from_msa(cls, align, alphabet=CodonAlphabet(Standard))
Convert a MultipleSeqAlignment to CodonAlignment.
source code
Properties [hide private]

Inherited from Align.MultipleSeqAlignment: column_annotations

Inherited from object: __class__

Method Details [hide private]

__init__(self, records='', name=None, alphabet=CodonAlphabet(Standard))
(Constructor)

source code 
Initialize the class.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Return a multi-line string summary of the alignment.

This output is indicated to be readable, but large alignment is shown truncated. A maximum of 20 rows (sequences) and 60 columns (20 codons) are shown, with the record identifiers. This should fit nicely on a single screen. e.g.

Overrides: object.__str__

__getitem__(self, index, alphabet=None)
(Indexing operator)

source code 
Return a CodonAlignment object for single indexing.
Overrides: Align.MultipleSeqAlignment.__getitem__

toMultipleSeqAlignment(self)

source code 

Convert the CodonAlignment to a MultipleSeqAlignment.

Return a MultipleSeqAlignment containing all the SeqRecord in the CodonAlignment using Seq to store sequences

get_dn_ds_matrix(self, method='NG86', codon_table=default_codon_table)

source code 

Available methods include NG86, LWL85, YN00 and ML.

Argument:
  • method - Available methods include NG86, LWL85, YN00 and ML.
  • codon_table - Codon table to use for forward translation.

get_dn_ds_tree(self, dn_ds_method='NG86', tree_method='UPGMA', codon_table=default_codon_table)

source code 

Cnstruct dn tree and ds tree.

Argument:
  • dn_ds_method - Available methods include NG86, LWL85, YN00 and ML.
  • tree_method - Available methods include UPGMA and NJ.

from_msa(cls, align, alphabet=CodonAlphabet(Standard))
Class Method

source code 

Convert a MultipleSeqAlignment to CodonAlignment.

Function to convert a MultipleSeqAlignment to CodonAlignment. It is the user's responsibility to ensure all the requirement needed by CodonAlignment is met.