예제 #1
0
print tree

raw_input(
    "\n   tree and alignment loaded\nHit some key, to start computation of branch site models A and A1 on each branch.\n"
)

print "running model M0, for comparison with branch-site models..."
tree.run_model("M0")

# each node/leaf has two kind of identifiers node_id and paml_id, to mark nodes we have to specify
# the node_id of the nodes we want to mark, and the kind of mark in this way:

for leaf in tree:
    leaf.node_id
    print "\n---------\nNow working with leaf " + leaf.name
    tree.mark_tree([leaf.node_id], marks=["#1"])
    print tree.write()
    # to organize a bit, we name model with the name of the marked node
    # any character after the dot, in model name, is not taken into account
    # for computation. (have a look in /tmp/ete2.../bsA.. directory)
    print "running model bsA and bsA1"
    tree.run_model("bsA." + leaf.name)
    tree.run_model("bsA1." + leaf.name)
    print "p-value of positive selection for sites on this branch is: "
    ps = tree.get_most_likely("bsA." + leaf.name, "bsA1." + leaf.name)
    rx = tree.get_most_likely("bsA1." + leaf.name, "M0")
    print str(ps)
    print "p-value of relaxation for sites on this branch is: "
    print str(rx)
    if ps < 0.05 and float(bsA.wfrg2a) > 1:
        print "we have positive selection on sites on this branch"
예제 #2
0

from ete_dev import EvolTree
from ete_dev import NodeStyle

tree = EvolTree ("data/S_example/measuring_S_tree.nw")
tree.link_to_alignment ('data/S_example/alignment_S_measuring_evol.fasta')

print tree

print 'Tree and alignment loaded.'
raw_input ('Tree will be mark in order to contrast Gorilla and Chimpanzee as foreground \nspecies.')

marks = ['1', 3, '7']

tree.mark_tree (marks, ['#1'] * 3)
print tree.write ()

# display marked branches in orange
for node in tree.traverse ():
    if not hasattr (node, 'mark'):
        continue
    if node.mark == '':
        continue
    node.img_style = NodeStyle()
    node.img_style ['bgcolor'] = '#ffaa00'
tree.show()


print '''now running branch-site models C and D that represents
the addition of one class of sites in on specific branch.
예제 #3
0
print tree

raw_input(
    '\n   tree and alignment loaded\nHit some key, to start computation of branch site models A and A1 on each branch.\n'
)

print 'running model M0, for comparison with branch-site models...'
tree.run_model('M0')

# each node/leaf has two kind of identifiers node_id and paml_id, to mark nodes we have to specify
# the node_id of the nodes we want to mark, and the kind of mark in this way:

for leaf in tree:
    leaf.node_id
    print '\n---------\nNow working with leaf ' + leaf.name
    tree.mark_tree([leaf.node_id], marks=['#1'])
    print tree.write()
    # to organize a bit, we name model with the name of the marked node
    # any character after the dot, in model name, is not taken into account
    # for computation. (have a look in /tmp/ete2.../bsA.. directory)
    print 'running model bsA and bsA1'
    tree.run_model('bsA.' + leaf.name)
    tree.run_model('bsA1.' + leaf.name)
    print 'p-value of positive selection for sites on this branch is: '
    ps = tree.get_most_likely('bsA.' + leaf.name, 'bsA1.' + leaf.name)
    rx = tree.get_most_likely('bsA1.' + leaf.name, 'M0')
    print str(ps)
    print 'p-value of relaxation for sites on this branch is: '
    print str(rx)
    if ps < 0.05 and float(bsA.wfrg2a) > 1:
        print 'we have positive selection on sites on this branch'