本文整理汇总了Python中ete_dev.Tree.set_outgroup方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.set_outgroup方法的具体用法?Python Tree.set_outgroup怎么用?Python Tree.set_outgroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ete_dev.Tree
的用法示例。
在下文中一共展示了Tree.set_outgroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from ete_dev import Tree [as 别名]
# 或者: from ete_dev.Tree import set_outgroup [as 别名]
# /-A
# |
# | /-H
#---------|---------|
# | \-F
# |
# | /-B
# \--------|
# | /-E
# \--------|
# \-D
#
# Let's define that the ancestor of E and D as the tree outgroup. Of
# course, the definition of an outgroup will depend on user criteria.
ancestor = t.get_common_ancestor("E","D")
t.set_outgroup(ancestor)
print "Tree rooteda at E and D's ancestor is more basal that the others."
print t
#
# /-B
# /--------|
# | | /-A
# | \--------|
# | | /-H
#---------| \--------|
# | \-F
# |
# | /-E
# \--------|
# \-D
#
示例2: main
# 需要导入模块: from ete_dev import Tree [as 别名]
# 或者: from ete_dev.Tree import set_outgroup [as 别名]
#.........这里部分代码省略.........
" Example: use this expression '[^_]+_(.+)' to extract HUMAN from the string 'P53_HUMAN'."))
opt_args.add_argument("--collateral",
action='store_true',
help=(""))
args = parser.parse_args(argv)
print __DESCRIPTION__
reftree = args.reftree
if args.source_file and args.source_trees:
print >>sys.stderr, 'The use of targets_file and targets at the same time is not supported.'
sys.exit(1)
if args.source_file:
source_trees = tree_iterator(args.source_file)
else:
source_trees = args.source_trees
ref_tree = Tree(reftree)
if args.ref_tree_attr:
for lf in ref_tree.iter_leaves():
lf._origname = lf.name
if args.ref_tree_attr not in lf.features:
print lf
lf.name = getattr(lf, args.ref_tree_attr)
if args.outgroup:
if len(args.outgroup) > 1:
out = ref_tree.get_common_ancestor(args.outgroup)
else:
out = ref_tree.search_nodes(name=args.outgroup[0])[0]
ref_tree.set_outgroup(out)
HEADER = ("source tree", 'ref tree', 'common\ntips', 'normRF', 'RF', 'maxRF', "%reftree", "%genetree", "subtrees", "treeko\ndist")
if args.output:
OUT = open(args.output, "w")
print >>OUT, '# ' + ctime()
print >>OUT, '# ' + ' '.join(sys.argv)
print >>OUT, '#'+'\t'.join(HEADER)
else:
print '# ' + ctime()
print '# ' + ' '.join(sys.argv)
COL_WIDTHS = [20, 20] + [9] * 10
print_table([HEADER], fix_col_width=COL_WIDTHS, wrap_style='wrap')
prev_tree = None
ref_fname = os.path.basename(args.reftree)
for counter, tfile in enumerate(source_trees):
if args.source_file:
seedid, tfile = tfile
else:
seedid = None
if args.extract_species:
if args.sp_regexp:
SPMATCHER = re.compile(args.sp_regexp)
get_sp_name = lambda x: re.search(SPMATCHER, x).groups()[0]
else:
get_sp_name = lambda x: x
tt = PhyloTree(tfile, sp_naming_function = get_sp_name)
示例3:
# 需要导入模块: from ete_dev import Tree [as 别名]
# 或者: from ete_dev.Tree import set_outgroup [as 别名]
# | |
# | | /-waxkv
# | /--------| /--------|
# | | | /--------| \-djeoh
# | | | | |
# | | \--------| \-exmsn
# \--------| |
# | | /-udspq
# | \--------|
# | \-buxpw
# |
# \-rkzwd
# Calculate the midpoint node
R = t.get_midpoint_outgroup()
# and set it as tree outgroup
t.set_outgroup(R)
print t
# /-opben
# |
# /--------| /-xoryn
# | | /--------|
# | | | | /-wdima
# | \--------| \--------|
# /--------| | \-qxovz
# | | |
# | | \-isngq
# | |
# | | /-xyewk
# | \--------|
# | | /-qogjl
# | \--------|