當前位置: 首頁>>代碼示例>>Python>>正文


Python Tree.dist方法代碼示例

本文整理匯總了Python中ete_dev.Tree.dist方法的典型用法代碼示例。如果您正苦於以下問題:Python Tree.dist方法的具體用法?Python Tree.dist怎麽用?Python Tree.dist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ete_dev.Tree的用法示例。


在下文中一共展示了Tree.dist方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import dist [as 別名]
    def test(self):
        # Text faces

        I = TreeImage()
        I.mode = "rect"
        I.aligned_header.add_face(self.headerF, 0)
        I.aligned_header.add_face(self.headerF, 1)
        I.aligned_header.add_face(self.headerF, 2)
        I.aligned_header.add_face(self.headerF, 3)

        I.aligned_foot.add_face(self.footF, 0)
        I.aligned_foot.add_face(self.footF, 1)
        I.aligned_foot.add_face(self.footF, 2)
        I.aligned_foot.add_face(self.footF, 3) 
        I.draw_aligned_faces_as_grid = True
        t = Tree()
        t.dist = 0
        t.populate(10)

        style = NodeStyleDict()
        style["fgcolor"] = "#ff0000"
        style["size"] = 20
        style.add_fixed_face(self.fixedF, "branch-right", 0)
        t.img_style = style
        
        t.render("./test.svg", layout=mylayout, tree_style=I)
        t.show(mylayout, tree_style=I)
        t.show(mylayout2, tree_style=I)
開發者ID:xguse,項目名稱:ete,代碼行數:30,代碼來源:test_treeview.py

示例2: Tree

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import dist [as 別名]
# same directory in which it is
ETEPATH = os.path.abspath(os.path.split(os.path.realpath(__file__))[0]+'/../')
sys.path.insert(0, ETEPATH)

from ete_dev import Tree, TreeStyle, NodeStyle, PhyloTree, faces
from ete_dev.treeview.faces import *
from ete_dev.treeview.main import random_color, _NODE_TYPE_CHECKER, FACE_POSITIONS

sys.path.insert(0, os.path.join(ETEPATH, "examples/treeview"))
import face_grid, bubble_map, item_faces, node_style, node_background, face_positions, face_rotation, seq_motif_faces, barchart_and_piechart_faces

sys.path.insert(0, os.path.join(ETEPATH, "examples/phylogenies"))
import phylotree_visualization

main_tree = Tree()
main_tree.dist = 0

t, ts = face_grid.get_example_tree()
t_grid = TreeFace(t, ts)
n = main_tree.add_child()
n.add_face(t_grid, 0, "aligned")

t, ts = bubble_map.get_example_tree()
t_bubble = TreeFace(t, ts)
n = main_tree.add_child()
n.add_face(t_bubble, 0, "aligned")

t, ts = item_faces.get_example_tree()
t_items = TreeFace(t, ts)
n = main_tree.add_child()
n.add_face(t_items, 0, "aligned")
開發者ID:MikeTrizna,項目名稱:ete,代碼行數:33,代碼來源:test_treeview.py

示例3: TreeStyle

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import dist [as 別名]
    #if node.is_leaf():
    #    f = faces.CircleFace(50, "red")
    #    faces.add_face_to_node(f, node, 0, position="aligned")
        

ts = TreeStyle()
ts.mode = "c"
ts.arc_span = 360
ts.layout_fn = layout 
ts.show_leaf_name = False
ts.show_border = True
ts.draw_guiding_lines = False
ts.show_scale = True
#ts.scale = 60
t = Tree()
t.dist = 0

t.size = 0,0
for x in xrange(100):
    n = t.add_child()
    n = n.add_child()
    n = n.add_child()
    n2 = n.add_child()
    n3 = n.add_child()
    n4 = n2.add_child()
    n5 = n3.add_child()
  #  n.size = (10, 10)
  #  n2.size = (10, 70)
  #  n3.size = (40, 40)
  #  n4.size = (10, 10)
    #n2.size = 10
開發者ID:MikeTrizna,項目名稱:ete,代碼行數:33,代碼來源:test_scale.py

示例4: random_color

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import dist [as 別名]
        # faces.add_face_to_node(f, node, 0, position="branch-right")
        f.border.width = 0
    # node.img_style["bgcolor"] = random_color()


# Tree().show()
ts = TreeStyle()
ts.mode = "c"
ts.layout_fn = layout
ts.show_leaf_name = False
ts.arc_span = 340
ts.arc_start = -70
# ts.allow_face_overlap = True
# ts.show_branch_length = True
ts.draw_guiding_lines = False
ts.optimal_scale_level = "mid"
ts.extra_branch_line_color = "red"
ts.root_opening_factor = 0.50
ts.show_border = True
ts.scale = None
t = Tree()
t.populate(200, random_branches=True, branch_range=(0, 0))
t.dist = 0.0
dists = [n.dist for n in t.traverse() if n.dist != 0]
# print max(dists), min(dists)
t.write(outfile="test.nw")
# for s in [5, None]:
#    ts.scale = s
#    t.render("img_scale_%s.png" %s, tree_style = ts, w=600)
t.show(tree_style=ts)
開發者ID:daisieh,項目名稱:ete,代碼行數:32,代碼來源:test_circ_scale.py


注:本文中的ete_dev.Tree.dist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。