def get_tree_style(self): ts = TreeStyle() ts.layout_fn = self.custom_layout ts.show_leaf_name = False ts.draw_guiding_lines = True ts.guiding_lines_type = 0 ts.guiding_lines_color = "#000000" self._treestyle = ts return ts
def run_action_change_style(self, tree, a_data): #print "action change style called.." if tree.tree_style == self._treestyle: ts2 = TreeStyle() ts2.layout_fn = self.custom_layout ts2.show_leaf_name = False ts2.draw_guiding_lines = True ts2.guiding_lines_type = 0 #solid line ts2.guiding_lines_color = a_data tree.tree_style = ts2 self._treestyle = ts2 else: tree.tree_style = self._treestyle
default="pies.svg") args = parser.parse_args() plot_tree, subtrees_dict, subtrees_topids = get_phyparts_nodes( args.species_tree, args.phyparts_root) concord_dict, conflict_dict = get_concord_and_conflict(args.phyparts_root, subtrees_dict, subtrees_topids) phyparts_dist, phyparts_pies = get_pie_chart_data(args.phyparts_root, args.num_genes, concord_dict, conflict_dict) #Plot Pie Chart ts = TreeStyle() ts.show_leaf_name = False ts.layout_fn = phyparts_pie_layout nstyle = NodeStyle() nstyle["size"] = 0 for n in plot_tree.traverse(): n.set_style(nstyle) n.img_style["vt_line_width"] = 0 ts.draw_guiding_lines = True ts.guiding_lines_color = "black" ts.guiding_lines_type = 0 ts.scale = 30 ts.branch_vertical_margin = 10 plot_tree.convert_to_ultrametric() my_svg = plot_tree.render(args.svg_name, tree_style=ts, w=595)
from ete3 import TreeStyle from ete3 import EvolTree from ete3 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/ete3-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.')
F = faces.TextFace(mynode.name,fsize=20) faces.add_face_to_node(F,mynode,0,position="aligned") #Plot Pie Chart ts = TreeStyle() ts.show_leaf_name = False ts.layout_fn = phyparts_pie_layout nstyle = NodeStyle() nstyle["size"] = 0 for n in plot_tree.traverse(): n.set_style(nstyle) n.img_style["vt_line_width"] = 0 ts.draw_guiding_lines = True ts.guiding_lines_color = "black" ts.guiding_lines_type = 0 ts.scale = 30 ts.branch_vertical_margin = 10 plot_tree.convert_to_ultrametric() plot_tree.ladderize(direction=1) my_svg = plot_tree.render(args.svg_name,tree_style=ts,w=595,dpi=300) if args.show_nodes: node_style = TreeStyle() node_style.show_leaf_name=False node_style.layout_fn = node_text_layout plot_tree.show(tree_style=node_style)
#выбор стиля circular_style = TreeStyle() circular_style.show_leaf_name = False circular_style.show_branch_length = True circular_style.show_branch_support = True circular_style.scale = 75 circular_style.tree_width = 50 #circular_style.rotation = 90 #circular_style.extra_branch_line_type=(0) #circular_style.guiding_lines_type= (0) #circular_style.title.add_face(TextFace(File, fsize=25), column=0) circular_style.layout_fn = layout t.render(adres+"/out/"+File[:-4]+".png", tree_style=circular_style) circular_style.mode = "r" # draw tree in circular mode circular_style.extra_branch_line_type=(2) circular_style.guiding_lines_type= (2) circular_style.guiding_lines_color =("red") for n in t.traverse(): nstyle = NodeStyle() nstyle["fgcolor"] = "red" nstyle["size"] = 15 n.set_style(nstyle) #N = AttrFace("name", fsize=30) #faces.add_face_to_node(N, node, 0, position="aligned") circular_style.legend.add_face =(TextFace("0.5 support"), column=1) circular_style.legend.add_face =(CircleFace(10, "red"), column=0) circular_style.layout_fn = layout circular_style.legend.add_face(TextFace("0.5 support"), column=1) circular_style.title.add_face(TextFace(File, fsize=40), column=0) TextFace_=TextFace(text, ftype='Verdana', fsize=10, fgcolor='black', penwidth=0, fstyle='normal', tight_text=False, bold=False) t.render(adres+"/out/"+File[:-4]+"_c.png", tree_style=circular_style)
from ete3 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/ete3-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.'