root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/bx/phylo/phast_tests.py @ 3

リビジョン 3, 1.9 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1"""
2Tests for `bx.phylo.phast`.
3"""
4
5import unittest
6from StringIO import StringIO
7from bx.phylo.phast import TreeModel
8from numpy import *
9
10test_data = """ALPHABET: A C G T -
11ORDER: 0
12SUBST_MOD: HKY85+Gap
13TRAINING_LNL: -178667772.836697
14BACKGROUND: 0.227006 0.169993 0.169307 0.227262 0.206432
15RATE_MAT:
16  -0.971735    0.122443    0.465361    0.163692    0.220238
17   0.163508   -1.130351    0.121949    0.624656    0.220238
18   0.623952    0.122443   -1.130326    0.163692    0.220238
19   0.163508    0.467247    0.121949   -0.972942    0.220238
20   0.242187    0.181362    0.180630    0.242461   -0.846640
21TREE: ((((((hg16:0.007738,panTro1:0.008356):0.027141,(baboon:0.009853,rheMac1:0.010187):0.035049):0.103138,galago:0.174770):0.019102,((rn3:0.092633,mm6:0.089667):0.273942,rabbit:0.230839):0.021927):0.023762,(canFam1:0.204637,(elephant:0.123777,tenrec:0.278910):0.085977):0.009439):0.306466,monDom1:0.401151)mammals;
22"""
23
24def test_parser():
25    tm = TreeModel.from_file( StringIO( test_data ) )
26    assert tm.alphabet == ( 'A', 'C', 'G', 'T', '-' )
27    assert tm.order == 0
28    assert tm.subst_mod == "HKY85+Gap"
29    assert allclose( tm.background, [ 0.227006, 0.169993, 0.169307, 0.227262, 0.206432 ] )
30    assert allclose( tm.matrix, array(
31        [ [ -0.971735,  0.122443,   0.465361,   0.163692,   0.220238 ],
32          [ 0.163508,  -1.130351,   0.121949,   0.624656,   0.220238 ],
33          [ 0.623952,   0.122443,  -1.130326,   0.163692,   0.220238 ],
34          [ 0.163508,   0.467247,   0.121949,  -0.972942,   0.220238 ],
35          [ 0.242187,   0.181362,   0.180630,   0.242461,  -0.846640 ] ] ) )
36    assert tm.tree == "((((((hg16:0.007738,panTro1:0.008356):0.027141,(baboon:0.009853,rheMac1:0.010187):0.035049):0.103138,galago:0.174770):0.019102,((rn3:0.092633,mm6:0.089667):0.273942,rabbit:0.230839):0.021927):0.023762,(canFam1:0.204637,(elephant:0.123777,tenrec:0.278910):0.085977):0.009439):0.306466,monDom1:0.401151)mammals;"
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。