本文整理汇总了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)
示例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
示例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)
示例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)
示例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()
示例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)
示例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)
示例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)