本文整理匯總了Python中ete3.TreeStyle.complete_branch_lines_when_necessary方法的典型用法代碼示例。如果您正苦於以下問題:Python TreeStyle.complete_branch_lines_when_necessary方法的具體用法?Python TreeStyle.complete_branch_lines_when_necessary怎麽用?Python TreeStyle.complete_branch_lines_when_necessary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ete3.TreeStyle
的用法示例。
在下文中一共展示了TreeStyle.complete_branch_lines_when_necessary方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: in
# 需要導入模塊: from ete3 import TreeStyle [as 別名]
# 或者: from ete3.TreeStyle import complete_branch_lines_when_necessary [as 別名]
import matplotlib.colors as colors
# only decorate a tree that has already PHYDLOG ids
for asrRun in ('1','2','3'):
inputGLF = os.path.join(basePath, 'analysis', 'tables', 'gainLossNormBrLen' + str(asrRun) + '.dat')
outP = os.path.join(basePath, 'analysis', 'figures', 'spTree' + str(asrRun))
if asrRun == '3':
analysisNumber = '3b'
else:
analysisNumber = asrRun
spTreeF = os.path.join(basePath, 'analysis', 'iesdb', 'speciesTree' + analysisNumber + '.nhx')
gl = pd.read_csv(inputGLF, sep = "\t")
t = Tree(spTreeF)
t.sort_descendants(attr='O')
ts = TreeStyle()
ts.complete_branch_lines_when_necessary = False
# calculate branch colors
gainL = [] # list with all rates of gain
lossL = [] # list with all rates of loss
gm = gl.rgain.min()
gM = gl.rgain.max()
lm = gl.rloss.min()
lM = gl.rloss.max()
#bcrg = scaleCol(gl.pgain.tolist()) # Branch Colors for Rates of Gain
#bcrl = scaleCol(gl.ploss.tolist()) # Branch Colors for Rates of Loss
# make a "gain" and a "loss" copy of the tree
tg = t.copy()
tl = t.copy()
gcm = cm.ScalarMappable(norm = colors.Normalize(vmin = gm, vmax = gM), cmap = "coolwarm")
lcm = cm.ScalarMappable(norm = colors.Normalize(vmin = lm, vmax = lM), cmap = "coolwarm")
for node in tg.iter_descendants(): # do not include root