我正在尝试通过对Ipyrad的D统计检验得出图。我正在遵循Ipyrad教程中的代码。但是,我很固执,但是我是Python的新手,所以希望能为解决此问题提供帮助。这是我当前的代码:
import ipyrad.analysis as ipa
import ipyparallel as ipp
import toytree
import toyplot
ipyclient = ipp.Client()
len(ipyclient)
locifile = "/home/acj1n18/rawdata/loci/des-c90-m10.loci"
newick = "/home/acj1n18/rawdata/raxml-ng/c90-m10/des-c90-m10.raxml.bestTree"
## Draw imported newick tree rooted on Maderian clade
tre = toytree.tree(newick=newick)
tre.root(outgroup=["tan_C6", "dep_C26"])
tre.draw(width=800, height=1000,
use_edge_lengths=False,
node_labels=tre.get_node_values("support"),
node_size=10,
node_style={"stroke": "black"},
node_labels_style={
"baseline-shift": "8px",
"-toyplot-anchor-shift": "-16px",
"font-size": "10px"});
## store rooted tree back into a newick string.
newick = tre.tree.write()
## create a baba object linked to a data file and newick tree
d = ipa.baba(data=locifile, newick=newick)
## All D-statistic tests
d.tests = [
{
"p4": ["dep_C26", "tan_C6"],
"p3": ["mil_125a", "mil_128b"],
"p2": ["bour_GH", "bour_51v", "bour_563"],
"p1": ["gon_GHA", "gon_B162"]
}, ]
# run D-statistics
d.run(ipyclient)
d.results_table
## plot results on the tree
d.plot(height=850, width=700, pct_tree_y=0.2, pct_tree_x=0.5, alpha=4.0);
尝试绘制最后一行代码的结果后,我得到以下错误:
IndexError Traceback (most recent call last)
<ipython-input-32-b103a343bdcc> in <module>()
1 ## plot results on the tree
----> 2 d.plot(height=850, width=700, pct_tree_y=0.2, pct_tree_x=0.5, alpha=4.0);
/scratch/acj1n18/miniconda2/lib/python2.7/site-packages/ipyrad/analysis/baba.pyc in plot(self, show_test_labels, use_edge_lengths, collapse_outgroup, pct_tree_x, pct_tree_y, *args, **kwargs)
185 pct_tree_y=pct_tree_y,
186 *args,
--> 187 **kwargs)
188 return canvas, axes, panel
189
/scratch/acj1n18/miniconda2/lib/python2.7/site-packages/ipyrad/plotting/baba_panel_plot.pyc in baba_panel_plot(ttree, tests, boots, show_tip_labels, show_test_labels, use_edge_lengths, collapse_outgroup, pct_tree_x, pct_tree_y, alpha, *args, **kwargs)
543 ## add panels to axes
544 panel.panel_tree(axes)
--> 545 panel.panel_test(axes)
546 panel.panel_tip_labels(axes)
547 if isinstance(boots, np.ndarray):
/scratch/acj1n18/miniconda2/lib/python2.7/site-packages/ipyrad/plotting/baba_panel_plot.pyc in panel_test(self, axes)
120
121 def panel_test(self, axes):
--> 122 _panel_test(self, axes)
123
124 ## these just squeeze in on their own
/scratch/acj1n18/miniconda2/lib/python2.7/site-packages/ipyrad/plotting/baba_panel_plot.pyc in _panel_test(panel, axes)
326 ## add features
327 add_test_lines(panel, axes)
--> 328 add_test_numbers(panel, axes)
329 add_rectangles(panel, axes)
330
/scratch/acj1n18/miniconda2/lib/python2.7/site-packages/ipyrad/plotting/baba_panel_plot.pyc in add_test_numbers(panel, axes)
401 ## add text
402 axes.text(
--> 403 [panel.xmax_tree + panel.xspacer] * len(panel.tests),
404 panel.ypos[1:-1],
405 labels,
/scratch/acj1n18/miniconda2/lib/python2.7/site-packages/ipyrad/plotting/baba_panel_plot.pyc in xspacer(self)
104 @property
105 def xspacer(self):
--> 106 return abs(self.xpos[1] - self.xpos[0])
107 @property
108 def ypos(self):
IndexError: index 1 is out of bounds for axis 0 with size 1