File: translate_dna.rst

package info (click to toggle)
python-cogent 1.4.1-1.2
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 13,260 kB
  • ctags: 20,087
  • sloc: python: 116,163; ansic: 732; makefile: 74; sh: 9
file content (25 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Translating DNA into protein
============================

.. sectionauthor:: Gavin Huttley

To translate a DNA alignment, read it in assigning the DNA alphabet. Note setting ``aligned = False`` is critical for loading sequences of unequal length. Different genetic codes are available in ``cogent.core.genetic_code``

.. doctest::

    >>> from cogent import LoadSeqs, DNA
    >>> al = LoadSeqs('data/test2.fasta', moltype=DNA, aligned = False)
    >>> pal = al.getTranslation()
    >>> print pal.toFasta()
    >DogFaced
    ARSQQNRWVETKETCNDRQT
    >HowlerMon
    ARSQHNRWAESEETCNDRQT
    >Human
    ARSQHNRWAGSKETCNDRRT
    >Mouse
    AVSQQSRWAASKGTCNDRQV
    >NineBande
    RQQSRWAESKETCNDRQT

To save this result to a file, use the ``writeToFile`` method.