# Bio.codonalign package

## Submodules

- Bio.codonalign.codonalignment module
  - `CodonAlignment`
    - `CodonAlignment.__init__()`
    - `CodonAlignment.__str__()`
    - `CodonAlignment.__getitem__()`
    - `CodonAlignment.__add__()`
    - `CodonAlignment.get_aln_length()`
    - `CodonAlignment.toMultipleSeqAlignment()`
    - `CodonAlignment.get_dn_ds_matrix()`
    - `CodonAlignment.get_dn_ds_tree()`
    - `CodonAlignment.from_msa()`
    - `CodonAlignment.__annotations__`
    - `CodonAlignment.__firstlineno__`
    - `CodonAlignment.__static_attributes__`
  - `mktest()`
- Bio.codonalign.codonseq module
  - `CodonSeq`
    - `CodonSeq.__init__()`
    - `CodonSeq.get_codon()`
    - `CodonSeq.get_codon_num()`
    - `CodonSeq.translate()`
    - `CodonSeq.toSeq()`
    - `CodonSeq.get_full_rf_table()`
    - `CodonSeq.full_translate()`
    - `CodonSeq.ungap()`
    - `CodonSeq.from_seq()`
    - `CodonSeq.__abstractmethods__`
    - `CodonSeq.__annotations__`
    - `CodonSeq.__firstlineno__`
    - `CodonSeq.__static_attributes__`
  - `cal_dn_ds()`

## Module contents

Code for dealing with Codon Alignments.

Bio.codonalign.build(pro_align, nucl_seqs, corr_dict=None, gap_char='-', unknown='X', codon_table=None, complete_protein=False, anchor_len=10, max_score=10)

  Build a codon alignment from protein alignment and corresponding nucleotides.

  Arguments:

    - pro_align - a protein MultipleSeqAlignment object

    - nucl_seqs - an object returned by SeqIO.parse or SeqIO.index or a collection of SeqRecord.

    - corr_dict - a dict that maps protein id to nucleotide id

    - complete_protein - whether the sequence begins with a start codon

  Return a CodonAlignment object.

  The example below answers this Biostars question: https://www.biostars.org/p/89741/

      >>> from Bio.Seq import Seq
      >>> from Bio.SeqRecord import SeqRecord
      >>> from Bio.Align import MultipleSeqAlignment
      >>> from Bio.codonalign import build
      >>> seq1 = SeqRecord(Seq('ATGTCTCGT'), id='pro1')
      >>> seq2 = SeqRecord(Seq('ATGCGT'), id='pro2')
      >>> pro1 = SeqRecord(Seq('MSR'), id='pro1')
      >>> pro2 = SeqRecord(Seq('M-R'), id='pro2')
      >>> aln = MultipleSeqAlignment([pro1, pro2])
      >>> codon_aln = build(aln, [seq1, seq2])
      >>> print(codon_aln)
      CodonAlignment with 2 rows and 9 columns (3 codons)
      ATGTCTCGT pro1
      ATG---CGT pro2

Biopython v: 1.85

Versions
  Previous
  Latest
  Develop

Biopython Project
  Homepage
  On GitHub