File: simple.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 (39 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
The simplest script
===================

.. sectionauthor:: Gavin Huttley

This is just about the simplest possible Cogent script for evolutionary modelling. We use a canned nucleotide substitution model (the ``HKY85`` model) on just three primate species. As there is only unrooted tree possible, the sequence names are all that's required to make the tree.

.. doctest::

    >>> from cogent.evolve.models import HKY85
    >>> from cogent import LoadSeqs, LoadTree
    >>> model = HKY85()
    >>> aln = LoadSeqs("data/primate_cdx2_promoter.fasta")
    >>> tree = LoadTree(tip_names=aln.Names)
    >>> lf = model.makeLikelihoodFunction(tree)
    >>> lf.setAlignment(aln)
    >>> lf.optimise(show_progress = False)
    >>> print lf
    Likelihood Function Table
    ======
     kappa
    ------
    5.9589
    ------
    ===========================
       edge    parent    length
    ---------------------------
      human      root    0.0040
    macaque      root    0.0384
      chimp      root    0.0061
    ---------------------------
    ===============
    motif    mprobs
    ---------------
        T    0.2552
        C    0.2581
        A    0.2439
        G    0.2428
    ---------------