예제 #1
0
def main():
    """
    main function
    """
    tree = EvolTree(WRKDIR + 'tree.nw')
    tree.workdir = 'data/protamine/PRM1/paml/'

    random_swap(tree)
    tree.link_to_evol_model(WRKDIR + 'paml/fb/fb.out', 'fb')
    check_annotation(tree)
    tree.link_to_evol_model(WRKDIR + 'paml/M1/M1.out', 'M1')
    tree.link_to_evol_model(WRKDIR + 'paml/M2/M2.out', 'M2')
    tree.link_to_evol_model(WRKDIR + 'paml/M7/M7.out', 'M7')
    tree.link_to_evol_model(WRKDIR + 'paml/M8/M8.out', 'M8')
    tree.link_to_alignment(WRKDIR + 'alignments.fasta_ali')
    print 'pv of LRT M2 vs M1: ',
    print tree.get_most_likely('M2', 'M1')
    print 'pv of LRT M8 vs M7: ',
    print tree.get_most_likely('M8', 'M7')

    tree.show(histfaces=['M2'])

    print 'The End.'
예제 #2
0
def main():
    """
    main function
    """
    tree = EvolTree (WRKDIR + 'tree.nw')
    tree.workdir = 'data/protamine/PRM1/paml/'

    random_swap(tree)
    tree.link_to_evol_model (WRKDIR + 'paml/fb/fb.out', 'fb')
    check_annotation (tree)
    tree.link_to_evol_model (WRKDIR + 'paml/M1/M1.out', 'M1')
    tree.link_to_evol_model (WRKDIR + 'paml/M2/M2.out', 'M2')
    tree.link_to_evol_model (WRKDIR + 'paml/M7/M7.out', 'M7')
    tree.link_to_evol_model (WRKDIR + 'paml/M8/M8.out', 'M8')
    tree.link_to_alignment  (WRKDIR + 'alignments.fasta_ali')
    print 'pv of LRT M2 vs M1: ',
    print tree.get_most_likely ('M2','M1')
    print 'pv of LRT M8 vs M7: ',
    print tree.get_most_likely ('M8','M7')

    
    tree.show (histfaces=['M2'])

    print 'The End.'
예제 #3
0
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.
These models must be compared to null models M1 and M3.
if branch-site models are detected to be significantly better,
than, one class of site is evolving at different rate in the marked
clade.
'''

# TODO: re-enable model M3

print 'running branch-site C...'
tree.run_model ('bsC.137')
#print 'running branch-site D...'
예제 #4
0
파일: 7_slr.py 프로젝트: MikeTrizna/ete
06 Feb 2011

use slr to compute evolutionary rates
"""

__author__  = "Francois-Jose Serra"
__email__   = "*****@*****.**"
__licence__ = "GPLv3"
__version__ = "0.0"

from ete_dev import EvolTree


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


tree.run_model ('SLR')

slr = tree.get_evol_model ('SLR')

slr.set_histface (up=False, kind='curve',errors=True,
                  hlines = [1.0,0.3], hlines_col=['black','grey'])

tree.show (histfaces=['SLR'])





예제 #5
0
     GAT GCA CGC TGG ATC AAC GAA AAG TTA AGA TGC GTA TCG AGA ACT CTG AAA AAA
     TTG GGA CTG GAC GGC TAC AAG GGA GTA AGT CAA TAC GTT AAA GGT CGT CCG
     """)
     #try:
     #    tree.run_model("fb")
     #    tree.run_model("M2")
     #except:
     #    pass
     tree.dist = 0
     ts = TreeStyle()
     ts.title.add_face(TextFace("Example for EvolTree, interactivity shows codons", fsize=15), column=0)
     ts.layout_fn = test_layout_evol
     #try:
     #    tree.show(tree_style=ts, histfaces=["M2"])
     #except:
     tree.show(tree_style=ts)
 except:
     tree = PhyloTree('(Orangutan,Human,Chimp);')
     tree.link_to_alignment("""
                            >Chimp
                            HARWLNEKLRCELRTLKKLGLDGYKAVSQYVKGRA
                            >Orangutan
                            DARWINEKLRCVSRTLKKLGLDGYKGVSQYVKGRP
                            >Human
                            DARWHNVKLRCELRTLKKLGLVGFKAVSQFVIRRA
                            """)
     nt_sequences = {"Human"    : "GACGCACGGTGGCACAACGTAAAATTAAGATGTGAATTGAGAACTCTGAAAAAATTGGGACTGGTCGGCTTCAAGGCAGTAAGTCAATTCGTAATACGTCGTGCG",
                     "Chimp"    : "CACGCCCGATGGCTCAACGAAAAGTTAAGATGCGAATTGAGAACTCTGAAAAAATTGGGACTGGACGGCTACAAGGCAGTAAGTCAGTACGTTAAAGGTCGTGCG",
                     "Orangutan": "GATGCACGCTGGATCAACGAAAAGTTAAGATGCGTATCGAGAACTCTGAAAAAATTGGGACTGGACGGCTACAAGGGAGTAAGTCAATACGTTAAAGGTCGTCCG"
                 }
     for l in nt_sequences:
예제 #6
0
from ete_dev import EvolTree

tree = EvolTree("data/S_example/measuring_S_tree.nw")

print tree

raw_input('\n   tree loaded, hit some key.\n')

print 'Now, it is necessary to link this tree to an alignment:'

tree.link_to_alignment('data/S_example/alignment_S_measuring_evol.fasta')

raw_input('\n   alignment loaded, hit some key to see.\n')

tree.show()

print '''
we will run free-ratio model that is one of models available through
function run_model:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'''
print tree.run_model.__doc__ + '\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'

tree.run_model('fb.example')

raw_input('free-ratio model runned, all results are store in a Model object.')

fb = tree.get_evol_model('fb.example')

print 'Have a look to the parameters used to run this model on codeml: '
예제 #7
0
from ete_dev import TreeStyle
from ete_dev import EvolTree
from ete_dev import faces

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

print tree

print '\n Running free-ratio model with calculation of ancestral sequences...'

tree.run_model('fb_anc')
#tree.link_to_evol_model('/tmp/ete2-codeml/fb_anc/out', 'fb_anc')

I = TreeStyle()
I.force_topology = False
I.draw_aligned_faces_as_table = True
I.draw_guiding_lines = True
I.guiding_lines_type = 2
I.guiding_lines_color = "#CCCCCC"
for n in sorted(tree.get_descendants() + [tree], key=lambda x: x.node_id):
    if n.is_leaf(): continue
    anc_face = faces.SequenceFace(n.sequence, 'aa', fsize=10, bg_colors={})
    I.aligned_foot.add_face(anc_face, 1)
    I.aligned_foot.add_face(
        faces.TextFace('node_id: #%d ' % (n.node_id), fsize=8), 0)
print 'display result of bs_anc model, with ancestral amino acid sequences.'
tree.show(tree_style=I)

print '\nThe End.'
예제 #8
0
from ete_dev import faces


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

print tree

print '\n Running free-ratio model with calculation of ancestral sequences...'

tree.run_model ('fb_anc')
#tree.link_to_evol_model('/tmp/ete2-codeml/fb_anc/out', 'fb_anc')

I = TreeStyle()
I.force_topology             = False
I.draw_aligned_faces_as_table = True
I.draw_guiding_lines = True
I.guiding_lines_type = 2
I.guiding_lines_color = "#CCCCCC"
for n in sorted (tree.get_descendants()+[tree],
                 key=lambda x: x.node_id):
    if n.is_leaf(): continue
    anc_face = faces.SequenceFace (n.sequence, 'aa', fsize=10, bg_colors={})
    I.aligned_foot.add_face(anc_face, 1)
    I.aligned_foot.add_face(faces.TextFace('node_id: #%d '%(n.node_id),
                                           fsize=8), 0)
print 'display result of bs_anc model, with ancestral amino acid sequences.'
tree.show(tree_style=I)

print '\nThe End.'
예제 #9
0
     """)
     #try:
     #    tree.run_model("fb")
     #    tree.run_model("M2")
     #except:
     #    pass
     tree.dist = 0
     ts = TreeStyle()
     ts.title.add_face(TextFace(
         "Example for EvolTree, interactivity shows codons", fsize=15),
                       column=0)
     ts.layout_fn = test_layout_evol
     #try:
     #    tree.show(tree_style=ts, histfaces=["M2"])
     #except:
     tree.show(tree_style=ts)
 except:
     tree = PhyloTree('(Orangutan,Human,Chimp);')
     tree.link_to_alignment("""
                            >Chimp
                            HARWLNEKLRCELRTLKKLGLDGYKAVSQYVKGRA
                            >Orangutan
                            DARWINEKLRCVSRTLKKLGLDGYKGVSQYVKGRP
                            >Human
                            DARWHNVKLRCELRTLKKLGLVGFKAVSQFVIRRA
                            """)
     nt_sequences = {
         "Human":
         "GACGCACGGTGGCACAACGTAAAATTAAGATGTGAATTGAGAACTCTGAAAAAATTGGGACTGGTCGGCTTCAAGGCAGTAAGTCAATTCGTAATACGTCGTGCG",
         "Chimp":
         "CACGCCCGATGGCTCAACGAAAAGTTAAGATGCGAATTGAGAACTCTGAAAAAATTGGGACTGGACGGCTACAAGGCAGTAAGTCAGTACGTTAAAGGTCGTGCG",
예제 #10
0
print tree

raw_input ('\n   tree and alignment loaded\n Hit some key, to start computation of site models M1 and M2.\n')

print 'running model M1'
tree.run_model ('M1')
print 'running model M2'
tree.run_model ('M2')

print '\n\n comparison of models M1 and M2, p-value: ' + str(tree.get_most_likely ('M2','M1'))

#tree.show()

print 'by default the hist represented is this one:'

tree.show (histfaces=['M2'])

print 'but we can choose between many others...'

model2 = tree.get_evol_model ('M2')

col2 = {'NS' : 'black', 'RX' : 'black',
        'RX+': 'black', 'CN' : 'black',
        'CN+': 'black', 'PS' : 'black', 'PS+': 'black'}


model2.set_histface (up=False, kind='curve', colors=col2, ylim=[0,4], hlines = [2.5, 1.0, 4.0, 0.5], header = 'Many lines, error boxes, background black',
                     hlines_col=['orange', 'yellow', 'red', 'cyan'], errors=True)

tree.show(histfaces=['M2'])
예제 #11
0
파일: 7_slr.py 프로젝트: tarah28/ete
#!/usr/bin/python
"""
06 Feb 2011

use slr to compute evolutionary rates
"""

__author__ = "Francois-Jose Serra"
__email__ = "*****@*****.**"
__licence__ = "GPLv3"
__version__ = "0.0"

from ete_dev import EvolTree

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

tree.run_model('SLR')

slr = tree.get_evol_model('SLR')

slr.set_histface(up=False,
                 kind='curve',
                 errors=True,
                 hlines=[1.0, 0.3],
                 hlines_col=['black', 'grey'])

tree.show(histfaces=['SLR'])
예제 #12
0
from ete_dev import EvolTree

tree = EvolTree ("data/S_example/measuring_S_tree.nw")

print tree

raw_input ('\n   tree loaded, hit some key.\n')

print 'Now, it is necessary to link this tree to an alignment:'

tree.link_to_alignment ('data/S_example/alignment_S_measuring_evol.fasta')

raw_input ('\n   alignment loaded, hit some key to see.\n')

tree.show()

print '''
we will run free-ratio model that is one of models available through
function run_model:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'''
print tree.run_model.__doc__ +'\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'

tree.run_model ('fb.example')

raw_input ('free-ratio model runned, all results are store in a Model object.')

fb = tree.get_evol_model('fb.example')

print 'Have a look to the parameters used to run this model on codeml: '