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


Python TreeStyle.draw_guiding_lines方法代碼示例

本文整理匯總了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
開發者ID:phylotastic,項目名稱:phylo_webservices,代碼行數:10,代碼來源:tree_config.py

示例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
開發者ID:phylotastic,項目名稱:phylo_webservices,代碼行數:15,代碼來源:tree_config.py

示例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)
開發者ID:Ward9250,項目名稱:ete,代碼行數:104,代碼來源:visualize.py

示例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)

     
開發者ID:mossmatters,項目名稱:MJPythonNotebooks,代碼行數:31,代碼來源:phypartspiecharts.py


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