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


Python Tree.show方法代碼示例

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


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

示例1: test

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [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: get_example_tree

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [as 別名]
def get_example_tree():
    # Create a random tree and add to each leaf a random set of motifs
    # from the original set
    t = Tree()
    t.populate(10)
    # for l in t.iter_leaves():
    #     seq_motifs = [list(m) for m in motifs] #sample(motifs, randint(2, len(motifs))) 

    #     seqFace = SeqMotifFace(seq, seq_motifs, intermotif_format="line",
    #                            seqtail_format="compactseq", scale_factor=1)
    #     seqFace.margin_bottom = 4
    #     f = l.add_face(seqFace, 0, "aligned")

    ts = TreeStyle()
    ts.layout_fn = layout
    t.show(tree_style=ts)
    return t, ts
開發者ID:MikeTrizna,項目名稱:ete,代碼行數:19,代碼來源:seq_motif_faces.py

示例3: layout

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [as 別名]
import sys
from ete_dev import Tree, faces, TreeStyle, COLOR_SCHEMES

sys.path.insert(0, "./")
def layout(node):
    if node.is_leaf():
        F= faces.PieChartFace([10,10,10,10,10,10,10,10,10,4,6], colors=COLOR_SCHEMES["set3"], width=100, height=100)
        F.border.width = None
        F.opacity = 0.8
        faces.add_face_to_node(F,node, 0, position="branch-right")
        F.background.color = "indianred"
        x = faces.TextFace("hola")
        faces.add_face_to_node(x,node, 1, position="branch-right")
        x.background.color = "blue"
    else:
        F= faces.BarChartFace([40,20,70,100,30,40,50,40,70,12], min_value=0, colors=COLOR_SCHEMES["spectral"])
        faces.add_face_to_node(F,node, 0, position="branch-top")
        
t = Tree()
ts = TreeStyle()
ts.layout_fn = layout
ts.mode = "r"
ts.show_leaf_name = False

t.populate(10)
t.show(tree_style=ts)
開發者ID:alxndrsPittis,項目名稱:ete,代碼行數:28,代碼來源:test_newfaces.py

示例4: enumerate

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [as 別名]
        col = 0
        for i, name in enumerate(set(node.get_leaf_names())):
            if i>0 and i%2 == 0:
                col += 1
            # Add the corresponding face to the node
            if name.startswith("Dme"):
                faces.add_face_to_node(flyFace, node, column=col)
            elif name.startswith("Dre"):
                faces.add_face_to_node(fishFace, node, column=col)
            elif name.startswith("Mms"):
                faces.add_face_to_node(mouseFace, node, column=col)
            elif name.startswith("Ptr"):
                faces.add_face_to_node(chimpFace, node, column=col)
            elif name.startswith("Hsa"):
                faces.add_face_to_node(humanFace, node, column=col)
            elif name.startswith("Cfa"):
                faces.add_face_to_node(dogFace, node, column=col)

            # Modifies this node's style
            node.img_style["size"] = 16
            node.img_style["shape"] = "sphere"
            node.img_style["fgcolor"] = "#AA0000"

    # If leaf is "Hsa" (homo sapiens), highlight it using a
    # different background.
    if node.is_leaf() and node.name.startswith("Hsa"):
        node.img_style["bgcolor"] = "#9db0cf"

# And, finally, Visualize the tree using my own layout function
t.show(mylayout)
開發者ID:MikeTrizna,項目名稱:ete,代碼行數:32,代碼來源:custom_tree_visualization.py

示例5: TextFace

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [as 別名]
aligned_c0_r0 = TextFace("aligned_col0_row0")
aligned_c0_r1 = TextFace("aligned_col0_row1")

aligned_c1_r0 = TextFace("aligned_col1_row0")
aligned_c1_r1 = TextFace("aligned_col1_row1")


t.add_face(right_c0_r1, column=1, position="branch-right")
t.add_face(right_c0_r0, column=0, position="branch-right")

t.add_face(right_c1_r2, column=2, position="branch-right")
t.add_face(right_c1_r1, column=1, position="branch-right")
t.add_face(right_c1_r0, column=0, position="branch-right")

t.add_face(top_c0_r1, column=1, position="branch-top")
t.add_face(top_c0_r0, column=0, position="branch-top")

t.add_face(bottom_c0_r0, column=0, position="branch-bottom")
t.add_face(bottom_c1_r0, column=1, position="branch-bottom")

for leaf in t.iter_leaves():
    leaf.add_face(aligned_c0_r1, 0, "aligned")
    leaf.add_face(aligned_c0_r0, 0, "aligned")
    leaf.add_face(aligned_c1_r1, 0, "aligned")
    leaf.add_face(aligned_c1_r0, 0, "aligned")


t.show()

開發者ID:xguse,項目名稱:ete,代碼行數:30,代碼來源:face_grid.py

示例6: len

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [as 別名]
    global CONT
    if CONT >= len(chars):
        CONT = 0
    if node.is_leaf():
        node.img_style["size"] = 0
        F2= AttrFace("name", tight_text=True)
        F= TextFace(chars[CONT], tight_text=True)
        F.inner_border.width = 0
        F2.inner_border.width = 0
        #faces.add_face_to_node(F ,node, 0, position="branch-right")
        faces.add_face_to_node(F2 ,node, 1, position="branch-right")
        CONT += 1
t = Tree()
t.populate(20, random_branches=True)
ts = TreeStyle()
ts.layout_fn = layout
ts.mode = "c"
ts.show_leaf_name = False

temp_tface = TreeFace(t, ts)
n = main_tree.add_child()
n.add_face(temp_tface, 0, "aligned")

# MAIN TREE

ms = TreeStyle()
ms.mode = "r"
ms.show_leaf_name = False
main_tree.show(tree_style=ms)        

開發者ID:MikeTrizna,項目名稱:ete,代碼行數:31,代碼來源:test_treeview.py

示例7: TreeStyle

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [as 別名]
t.add_face(fixed, column=1, position="branch-right")
# Bind the precomputed style to the root node 



# ETE 2.1 has now support for general image properties 
I = TreeStyle()
# You can add faces to the tree image (without any node
# associated). They will be used as headers and foot notes of the
# aligned columns (aligned faces)
I.aligned_header.add_face(t1, column = 0)
I.aligned_header.add_face(t1, 1)
I.aligned_header.add_face(t1, 2)
I.aligned_header.add_face(t1, 3)
t1.hz_align = 1 # 0 left, 1 center, 2 right 
t1.border.width = 1

I.aligned_foot.add_face(t2, column = 0)
I.aligned_foot.add_face(t2, 1)
I.aligned_foot.add_face(t2, 2)
I.aligned_foot.add_face(t2, 3)
t2.hz_align = 1

# Set tree image style. Note that aligned header and foot is only
# visible in "rect" mode.

I.mode =  "r" #(rectangular)
I.tree_width= 50
t.show(mylayout, tree_style=I)

開發者ID:xguse,項目名稱:ete,代碼行數:31,代碼來源:face_positions.py

示例8: random_color

# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import show [as 別名]
I.aligned_foot.add_face( faces.TextFace("FO1"), 2 )
I.aligned_foot.add_face( faces.TextFace("F1"), 3 )
I.aligned_foot.add_face( faces.TextFace("FO1"), 4 )

I.legend.add_face(faces.CircleFace(30, random_color(), "sphere"), 0)
I.legend.add_face(faces.CircleFace(30, random_color(), "sphere"), 0)
I.legend.add_face(faces.TextFace("HOLA"), 1)
I.legend.add_face(faces.TextFace("HOLA"), 1)
 
# Creates a random tree with 10 leaves
t2 = Tree()
t2.populate(10)

# Creates a fixed NodeStyle object containing a TreeFace (A tree image
# as a face within another tree image)
# t.add_face(faces.TreeFace(t2, I), "branch-right", 0)

# Attach the fixed style to the first child of the root node
# t.children[0].img_style = style
I.rotation = 90
I.mode = "c"
t.show(tree_style=I)
#t.render("/home/jhuerta/test.svg", img_properties=I)
#t.render("/home/jhuerta/test.pdf", img_properties=I)
#t.render("/home/jhuerta/test.png", img_properties=I)
#t.render("/home/jhuerta/test.ps", img_properties=I)
#os.system("inkscape /home/jhuerta/test.svg")
#I.mode = "c"
#t.show(img_properties=I)

開發者ID:MikeTrizna,項目名稱:ete,代碼行數:31,代碼來源:random_draw.py


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