本文整理汇总了Python中ete3.TreeStyle.draw_guiding_lines方法的典型用法代码示例。如果您正苦于以下问题:Python TreeStyle.draw_guiding_lines方法的具体用法?Python TreeStyle.draw_guiding_lines怎么用?Python TreeStyle.draw_guiding_lines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ete3.TreeStyle
的用法示例。
在下文中一共展示了TreeStyle.draw_guiding_lines方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tree_style
# 需要导入模块: from ete3 import TreeStyle [as 别名]
# 或者: from ete3.TreeStyle import draw_guiding_lines [as 别名]
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 = 1
self._treestyle = ts
return ts
示例2: run_action_change_style
# 需要导入模块: from ete3 import TreeStyle [as 别名]
# 或者: from ete3.TreeStyle import draw_guiding_lines [as 别名]
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
示例3: draw_tree
# 需要导入模块: from ete3 import TreeStyle [as 别名]
# 或者: from ete3.TreeStyle import draw_guiding_lines [as 别名]
#.........这里部分代码省略.........
pass
def ly_block_alg(node):
if node.is_leaf():
if 'sequence' in node.features:
seqFace = SeqMotifFace(node.sequence, [])
# [10, 100, "[]", None, 10, "black", "rgradient:blue", "arial|8|white|domain Name"],
motifs = []
last_lt = None
for c, lt in enumerate(node.sequence):
if lt != '-':
if last_lt is None:
last_lt = c
if c+1 == len(node.sequence):
start, end = last_lt, c
motifs.append([start, end, "()", 0, 12, "slategrey", "slategrey", None])
last_lt = None
elif lt == '-':
if last_lt is not None:
start, end = last_lt, c-1
motifs.append([start, end, "()", 0, 12, "grey", "slategrey", None])
last_lt = None
seqFace = SeqMotifFace(node.sequence, motifs,
intermotif_format="line",
seqtail_format="line", scale_factor=ALG_SCALE)
add_face_to_node(seqFace, node, ALG_START_COL, aligned=True)
TRACKED_CLADES = ["Eukaryota", "Viridiplantae", "Fungi",
"Alveolata", "Metazoa", "Stramenopiles", "Rhodophyta",
"Amoebozoa", "Crypthophyta", "Bacteria",
"Alphaproteobacteria", "Betaproteobacteria", "Cyanobacteria",
"Gammaproteobacteria",]
# ["Opisthokonta", "Apicomplexa"]
colors = random_color(num=len(TRACKED_CLADES), s=0.45)
lin2color = dict([(ln, colors[i]) for i, ln in enumerate(TRACKED_CLADES)])
NAME_FACE = AttrFace('name', fsize=10, fgcolor='#444444')
LABEL_START_COL = 10
ALG_START_COL = 40
ts = TreeStyle()
ts.draw_aligned_faces_as_table = False
ts.draw_guiding_lines = False
ts.show_leaf_name = False
ts.show_branch_support = False
ts.scale = 160
ts.layout_fn = [ly_basic, ly_leaf_names, ly_supports, ly_tax_labels]
MIXED_RES = set()
MAX_SEQ_LEN = 0
NPR_TREES = []
for n in tree.traverse():
if hasattr(n, "tree_seqtype"):
MIXED_RES.add(n.tree_seqtype)
if hasattr(n, "tree_type"):
NPR_TREES.append(n.tree_type)
seq = getattr(n, "sequence", "")
MAX_SEQ_LEN = max(len(seq), MAX_SEQ_LEN)
if MAX_SEQ_LEN:
ALG_SCALE = min(1, 1000./MAX_SEQ_LEN)
ts.layout_fn.append(ly_block_alg)
if len(NPR_TREES) > 1:
rF = RectFace(4, 4, "steelblue", "steelblue")
rF.margin_right = 10
rF.margin_left = 10
ts.legend.add_face(rF, 0)
ts.legend.add_face(TextFace(" NPR node"), 1)
ts.legend_position = 3
if len(MIXED_RES) > 1:
rF = RectFace(20, 20, "#CFE6CA", "#CFE6CA")
rF.margin_right = 10
rF.margin_left = 10
ts.legend.add_face(rF, 0)
ts.legend.add_face(TextFace(" Nucleotide based alignment"), 1)
ts.legend_position = 3
try:
tree.set_species_naming_function(spname)
annotate_tree_with_ncbi(tree)
a = tree.search_nodes(species='Dictyostelium discoideum')[0]
b = tree.search_nodes(species='Chondrus crispus')[0]
#out = tree.get_common_ancestor([a, b])
#out = tree.search_nodes(species='Haemophilus parahaemolyticus')[0].up
tree.set_outgroup(out)
tree.swap_children()
except Exception:
pass
tree.render(outfile, tree_style=ts, w=170, units='mm', dpi=150)
tree.render(outfile+'.svg', tree_style=ts, w=170, units='mm', dpi=150)
tree.render(outfile+'.pdf', tree_style=ts, w=170, units='mm', dpi=150)
示例4: TreeStyle
# 需要导入模块: from ete3 import TreeStyle [as 别名]
# 或者: from ete3.TreeStyle import draw_guiding_lines [as 别名]
else:
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)