Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Radialplot #112

Merged
merged 16 commits into from
Mar 1, 2017
Prev Previous commit
Next Next commit
Merge branch 'master' of https://github.com/biocore/gneiss into radia…
…lplot
  • Loading branch information
mortonjt committed Feb 23, 2017
commit f2145e5ca39d176ac7d5f9c4f4f202e76765effe
30 changes: 4 additions & 26 deletions gneiss/plot/_dendrogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,7 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------------------------------------------------------------

"""Drawing trees.

Draws horizontal trees where the vertical spacing between taxa is
constant. Since dy is fixed dendrograms can be either:
- square: dx = distance
- not square: dx = max(0, sqrt(distance**2 - dy**2))

Also draws basic unrooted trees.

For drawing trees use either:
- UnrootedDendrogram

Note: This is directly ported from pycogent.
"""

# Future:
# - font styles
# - orientation switch
# Layout gets more complicated for rooted tree styles if dy is allowed to vary,
# and constant-y is suitable for placing alongside a sequence alignment anyway.
import abc
from collections import namedtuple
from skbio import TreeNode
import pandas as pd
import numpy
from skbio import TreeNode
Expand Down Expand Up @@ -212,8 +190,7 @@ def rescale(self, width, height):
Notes
-----
"""

angle = 2*numpy.pi / self.leafcount
angle = (2 * numpy.pi) / self._n_tips
# this loop is a horrible brute force hack
# there are better (but complex) ways to find
# the best rotation of the tree to fit the display.
Expand Down Expand Up @@ -287,7 +264,8 @@ def update_coordinates(self, s, x1, y1, a, da):
# This function has a little bit of recursion. This will
# need to be refactored to remove the recursion.
for child in self.children:
ca = child.leafcount * da
# calculate the arc that covers the subtree.
ca = child._n_tips * da
points += child.update_coordinates(s, x2, y2, a+ca/2, da)
a += ca
return points
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.