本文整理汇总了Python中ete2.TreeStyle.guiding_lines_color方法的典型用法代码示例。如果您正苦于以下问题:Python TreeStyle.guiding_lines_color方法的具体用法?Python TreeStyle.guiding_lines_color怎么用?Python TreeStyle.guiding_lines_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ete2.TreeStyle
的用法示例。
在下文中一共展示了TreeStyle.guiding_lines_color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tree_style
# 需要导入模块: from ete2 import TreeStyle [as 别名]
# 或者: from ete2.TreeStyle import guiding_lines_color [as 别名]
def get_tree_style(tree_file, abund, rownames):
with open("matrix.txt", "w") as temp:
cols = len(abund[0])
header = "#Names"
for i in xrange(cols):
header += "\tOTU%d" % i
temp.write("%s\n" % header)
for i, row in enumerate(abund):
temp.write("%s\t%s\n" % (rownames[i], '\t'.join([str(i) for i in row])))
t = Tree(tree_file)
t.convert_to_ultrametric(10)
assert isinstance(abund, numpy.ndarray)
assert isinstance(rownames, numpy.ndarray)
ts = TreeStyle()
ts.mode = "r"
ts.show_leaf_name = False
ts.show_scale = False
ts.show_branch_length = False
ts.branch_vertical_margin = 20
ts.force_topology = True
ts.optimal_scale_level = "full"
ts.scale = 50
ts.draw_guiding_lines = True
ts.guiding_lines_type = 0
ts.guiding_lines_color = "black"
for n in t.traverse():
if not n.is_leaf():
nstyle = NodeStyle()
n.set_style(nstyle)
nstyle['size'] = 0
nstyle['hz_line_width'] = 3
nstyle['vt_line_width'] = 3
else:
nstyle = NodeStyle()
n.set_style(nstyle)
nstyle['size'] = 0
nstyle['hz_line_width'] = 3
nstyle['vt_line_width'] = 3
nstyle['fgcolor'] = "Black"
nstyle['shape'] = "square"
name_face = AttrFace("name", fsize=14, ftype="Arial", fgcolor="black", penwidth=10, text_prefix=" ", text_suffix=" ")
n.add_face(name_face, column=0, position="aligned")
row_index = rownames.tolist().index(n.name)
col = 1
for i in xrange(10):
col += 1
n.add_face(CircleFace(5, color=get_color(abund, row_index, i)), column=col, position="aligned")
return t, ts
示例2: setTreeStyle
# 需要导入模块: from ete2 import TreeStyle [as 别名]
# 或者: from ete2.TreeStyle import guiding_lines_color [as 别名]
def setTreeStyle(style, layoutfunction):
#consolidate options for showing trees
#pass in string "circle" or "rect" and a layout function
I = TreeStyle()
if style == "circle":
I.tree_width = 1200
I.layout_fn = layoutfunction
I.show_branch_length = False
#I.show_branch_support = True
I.show_leaf_name = False
I.mode = "c"
I.force_topology = True
#I.legend_position = 3
I.extra_branch_line_type = 1
I.guiding_lines_type = 1
I.guiding_lines_color = "#666666"
I.extra_branch_line_color = "#666666"
I.optimal_scale_level = "full"
I.root_opening_factor = 0
elif style =="rect":
I = TreeStyle()
I.layout_fn = layoutfunction
I.show_leaf_name = False
I.force_topology = True
I.optimal_scale_level = "semi"
else:
I.layout_fn = layoutfunction
I.show_leaf_name = False
I.force_topology = True
I.optimal_scale_level = "semi"
return I
示例3: EvolTree
# 需要导入模块: from ete2 import TreeStyle [as 别名]
# 或者: from ete2.TreeStyle import guiding_lines_color [as 别名]
from ete2 import EvolTree
from ete2 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."