From 00252234c0a5e3bc3bc66917671d246d17883282 Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Thu, 10 Jan 2019 13:24:31 -0500 Subject: [PATCH 01/14] ENH: upgrade numpy --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 15d19b1..2407d37 100644 --- a/setup.py +++ b/setup.py @@ -74,17 +74,17 @@ def finalize_options(self): maintainer="gneiss development team", maintainer_email="jamietmorton@gmail.com", packages=find_packages(), - setup_requires=['numpy >= 1.9.2'], + setup_requires=['numpy >= 1.15.3'], ext_modules=extensions, cmdclass={'build_ext': build_ext}, install_requires=[ 'IPython >= 3.2.0', 'matplotlib >= 1.4.3', - 'numpy >= 1.9.2', + 'numpy >= 1.15.3', 'pandas >= 0.18.0', 'scipy >= 0.15.1', 'nose >= 1.3.7', - 'scikit-bio==0.5.1', + 'scikit-bio >= 0.5.5', 'statsmodels>=0.8.0', 'biom-format', 'seaborn' From 40b83b55a28f47997ad8a0bef4bbdca0080ec73a Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Thu, 10 Jan 2019 16:48:15 -0500 Subject: [PATCH 02/14] DOC: updating numpy docstring --- gneiss/balances.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gneiss/balances.py b/gneiss/balances.py index 7c03e91..01bc98b 100644 --- a/gneiss/balances.py +++ b/gneiss/balances.py @@ -95,8 +95,8 @@ def balance_basis(tree_node): >>> t = TreeNode.read([tree]) >>> basis, nodes = balance_basis(t) >>> basis - array([[ 0.18507216, 0.18507216, 0.62985567], - [ 0.14002925, 0.57597535, 0.28399541]]) + array([[0.18507216, 0.18507216, 0.62985567], + [0.14002925, 0.57597535, 0.28399541]]) Notes ----- From 3f1ac650ca237a1044d88d410c0e7415af1963b8 Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 09:43:35 -0400 Subject: [PATCH 03/14] ENH: upgrading version number --- gneiss/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gneiss/__init__.py b/gneiss/__init__.py index c88b2aa..9153c18 100644 --- a/gneiss/__init__.py +++ b/gneiss/__init__.py @@ -6,4 +6,4 @@ # The full license is in the file COPYING.txt, distributed with this software. # ---------------------------------------------------------------------------- -__version__ = "0.4.4" +__version__ = "0.4.5" From 5ba5966b0466b17872ab9e682d67639faf9a138a Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 09:47:16 -0400 Subject: [PATCH 04/14] BLD: setting matplotlib backend to agg --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d82f68..5767054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ language: python env: - PYVERSION=3.5 USE_CYTHON=TRUE MAKE_DOC=TRUE before_install: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" + - export MPLBACKEND='Agg' - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - chmod +x miniconda.sh - ./miniconda.sh -b From 9b703ab2d8fa5b2560a78321f65a8f7336e5d48e Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 09:52:23 -0400 Subject: [PATCH 05/14] trimming down ci requirements --- ci/conda_requirements.txt | 9 --------- ci/pip_requirements.txt | 2 -- 2 files changed, 11 deletions(-) diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 11b5936..7278b56 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -1,10 +1 @@ -pip -nose -pycodestyle -flake8 -IPython>4.0.0 -notebook -scikit-bio=0.5.1 -pyqt=4.11.4 -bokeh biom-format diff --git a/ci/pip_requirements.txt b/ci/pip_requirements.txt index fbb75a6..40c2536 100644 --- a/ci/pip_requirements.txt +++ b/ci/pip_requirements.txt @@ -1,4 +1,2 @@ coveralls -ete3 -statsmodels sphinx From c502e2afa0dbb56b07b5143debbb9c5ffc7bb74c Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 09:59:08 -0400 Subject: [PATCH 06/14] adding back in flake8 and pep8 --- ci/pip_requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/pip_requirements.txt b/ci/pip_requirements.txt index 40c2536..c8f9be4 100644 --- a/ci/pip_requirements.txt +++ b/ci/pip_requirements.txt @@ -1,2 +1,4 @@ coveralls sphinx +pycodestyle +flake8 From 2c60c3d7e781f95dfeb8e8b1ca3a38e826d521df Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 09:59:42 -0400 Subject: [PATCH 07/14] adding pip back in --- ci/conda_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 7278b56..40e063a 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -1 +1,2 @@ +pip biom-format From a3f34478e990a7db81fc62763249065866a77c08 Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 10:08:25 -0400 Subject: [PATCH 08/14] DOC: raw strings --- gneiss/sort.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gneiss/sort.py b/gneiss/sort.py index 581b350..cc14d38 100644 --- a/gneiss/sort.py +++ b/gneiss/sort.py @@ -148,7 +148,7 @@ def _cache_ntips(tree): def ladderize(tree, ascending=True): - """ + r""" Sorts tree according to the size of the subtrees. Parameters @@ -200,7 +200,7 @@ def ladderize(tree, ascending=True): def gradient_sort(tree, gradient, ascending=True): - """ + r""" Sorts tree according to ordering in gradient. Parameters From 8832d2ad65b5e9107c13404ed018c20228028df8 Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 10:16:14 -0400 Subject: [PATCH 09/14] flake8 --- gneiss/composition/_variance.py | 2 +- gneiss/util.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gneiss/composition/_variance.py b/gneiss/composition/_variance.py index d86c5e8..a2f38c9 100644 --- a/gneiss/composition/_variance.py +++ b/gneiss/composition/_variance.py @@ -11,7 +11,7 @@ def variation_matrix(X): - """ Calculate Aitchison variation matrix. + r""" Calculate Aitchison variation matrix. This calculates the Aitchison variation matrix. Given a compositional matrix :math:`X`, and columns :math:`i` and :math:`j`, the :math:`ij` entry diff --git a/gneiss/util.py b/gneiss/util.py index c31523b..020f5f8 100644 --- a/gneiss/util.py +++ b/gneiss/util.py @@ -369,7 +369,8 @@ def _type_cast_to_float(df): def block_diagonal(ncols, nrows, nblocks): - """ Generate block diagonal with uniformly distributed values within blocks. + """ Generate block diagonal with uniformly distributed values within + blocks. Parameters ---------- From 032bd9f1e26bb2e84b8e8b5c2697a76e3f37c919 Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 11:26:45 -0400 Subject: [PATCH 10/14] looks like bokeh flipped the ordering. weird --- ci/conda_requirements.txt | 1 + gneiss/plot/tests/test_dendrogram.py | 2 ++ gneiss/plot/tests/test_heatmap.py | 14 +++++++------- gneiss/plot/tests/test_radial.py | 21 ++++++++++++++------- gneiss/regression/tests/test_ols.py | 11 ++++++----- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 40e063a..0fa7fdb 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -1,2 +1,3 @@ pip biom-format +bokeh=1.1.0 diff --git a/gneiss/plot/tests/test_dendrogram.py b/gneiss/plot/tests/test_dendrogram.py index a586b2a..b6d9e32 100644 --- a/gneiss/plot/tests/test_dendrogram.py +++ b/gneiss/plot/tests/test_dendrogram.py @@ -87,6 +87,7 @@ def test_coords(self): index=['x', 'y', 'child0', 'child1', 'is_tip']).T res = t.coords(500, 500) + exp = exp.loc[res.index] pdt.assert_frame_equal(exp, res) def test_rescale(self): @@ -148,6 +149,7 @@ def test_coords(self): index=['x', 'y', 'child0', 'child1', 'is_tip']).T res = t.coords(width=20, height=self.table.shape[0]) + exp = exp.loc[res.index] pdt.assert_frame_equal(exp, res) def test_rescale(self): diff --git a/gneiss/plot/tests/test_heatmap.py b/gneiss/plot/tests/test_heatmap.py index bbf6179..2549935 100644 --- a/gneiss/plot/tests/test_heatmap.py +++ b/gneiss/plot/tests/test_heatmap.py @@ -98,13 +98,13 @@ def test_basic(self): # Make sure that the metadata labels are set properly res = str(fig.get_axes()[1].get_xticklabels(minor=True)[0]) - self.assertEqual(res, "Text(0,0,'a')") + self.assertEqual(res, "Text(0, 0, 'a')") res = str(fig.get_axes()[1].get_xticklabels(minor=True)[1]) - self.assertEqual(res, "Text(0,0,'b')") + self.assertEqual(res, "Text(0, 0, 'b')") res = str(fig.get_axes()[1].get_xlabel()) - self.assertEqual(res, "None") + self.assertEqual(res, "") def test_basic_line_width(self): fig = heatmap(self.table, self.t, self.md, @@ -182,17 +182,17 @@ def test_highlights(self): # Make sure that the metadata labels are set properly res = str(fig.get_axes()[2].get_xticklabels(minor=True)[0]) - self.assertEqual(res, "Text(0,0,'a')") + self.assertEqual(res, "Text(0, 0, 'a')") res = str(fig.get_axes()[2].get_xticklabels(minor=True)[1]) - self.assertEqual(res, "Text(0,0,'b')") + self.assertEqual(res, "Text(0, 0, 'b')") # Make sure that the highlight labels are set properly res = str(fig.get_axes()[1].get_xticklabels()[0]) - self.assertEqual(res, "Text(0,0,'y7')") + self.assertEqual(res, "Text(0, 0, 'y7')") res = str(fig.get_axes()[1].get_xticklabels()[1]) - self.assertEqual(res, "Text(0,0,'y8')") + self.assertEqual(res, "Text(0, 0, 'y8')") # Test to see if the highlights are ok res = fig.get_axes()[2].get_position()._points diff --git a/gneiss/plot/tests/test_radial.py b/gneiss/plot/tests/test_radial.py index 1825a95..bae69e3 100644 --- a/gneiss/plot/tests/test_radial.py +++ b/gneiss/plot/tests/test_radial.py @@ -49,13 +49,13 @@ def test_basic_plot(self): 'hover_var': [None, None, None, None, None], 'is_tip': [True, True, True, False, False], 'node_size': [10, 10, 10, 10, 10], - 'x': [487.5, - 12.499999999999972, + 'x': [12.499999999999972, + 487.5, 324.89684138234867, 338.26125938385832, 193.16888625577729], - 'y': [347.7691620070637, - 483.28006102610289, + 'y': [483.28006102610289, + 347.7691620070637, 16.719938973897143, 271.72822561264161, 365.95231443706376]} @@ -82,10 +82,17 @@ def test_basic_plot(self): p = radialplot(t, node_color='color', edge_color='edge_color', node_size='node_size', edge_width='edge_width') + for e in exp_edges.keys(): - self.assertListEqual( - list(p.renderers[0].data_source.data[e]), - exp_edges[e]) + if isinstance(exp_edges[e], float): + npt.assert_allclose( + p.renderers[0].data_source.data[e], + np.array(exp_edges[e]) + ) + else: + self.assertListEqual( + list(p.renderers[0].data_source.data[e]), + exp_edges[e]) for e in exp_nodes.keys(): self.assertListEqual( diff --git a/gneiss/regression/tests/test_ols.py b/gneiss/regression/tests/test_ols.py index b363cd0..c691038 100644 --- a/gneiss/regression/tests/test_ols.py +++ b/gneiss/regression/tests/test_ols.py @@ -16,7 +16,8 @@ from skbio.util import get_data_path from gneiss.regression import ols from gneiss.balances import balance_basis -import statsmodels.formula.api as smf +from statsmodels.regression.linear_model import OLS + class TestOLS(unittest.TestCase): @@ -45,8 +46,8 @@ def setUp(self): self.Y = Y self.B = B self.X = X - self.r1_ = smf.OLS(endog=y1, exog=X).fit() - self.r2_ = smf.OLS(endog=y2, exog=X).fit() + self.r1_ = OLS(endog=y1, exog=X).fit() + self.r2_ = OLS(endog=y2, exog=X).fit() self.tree = TreeNode.read(['(c, (b,a)y2)y1;']) self.results = "results" @@ -257,8 +258,8 @@ def setUp(self): self.Y = Y self.B = B self.X = X - self.r1_ = smf.OLS(endog=y1, exog=X).fit() - self.r2_ = smf.OLS(endog=y2, exog=X).fit() + self.r1_ = OLS(endog=y1, exog=X).fit() + self.r2_ = OLS(endog=y2, exog=X).fit() self.tree = TreeNode.read(['(c, (b,a)y2)y1;']) def test_loo(self): From 550ac522789b56d1370a8a19e1bb732a0d5fba72 Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 11:39:16 -0400 Subject: [PATCH 11/14] matplotlib tick labels swapped --- gneiss/plot/tests/test_heatmap.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gneiss/plot/tests/test_heatmap.py b/gneiss/plot/tests/test_heatmap.py index 2549935..4f183c7 100644 --- a/gneiss/plot/tests/test_heatmap.py +++ b/gneiss/plot/tests/test_heatmap.py @@ -187,12 +187,13 @@ def test_highlights(self): res = str(fig.get_axes()[2].get_xticklabels(minor=True)[1]) self.assertEqual(res, "Text(0, 0, 'b')") + print([str(i) for i in fig.get_axes()[1].get_xticklabels()]) # Make sure that the highlight labels are set properly res = str(fig.get_axes()[1].get_xticklabels()[0]) - self.assertEqual(res, "Text(0, 0, 'y7')") + self.assertEqual(res, "Text(0, 0, 'y8')") res = str(fig.get_axes()[1].get_xticklabels()[1]) - self.assertEqual(res, "Text(0, 0, 'y8')") + self.assertEqual(res, "Text(0, 0, 'y7')") # Test to see if the highlights are ok res = fig.get_axes()[2].get_position()._points From 4245e94517d9e8a6340d038d03ced27f88097d3d Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 11:53:31 -0400 Subject: [PATCH 12/14] py36 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5767054..f7c03ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false language: python env: - - PYVERSION=3.5 USE_CYTHON=TRUE MAKE_DOC=TRUE + - PYVERSION=3.6 USE_CYTHON=TRUE MAKE_DOC=TRUE before_install: - export MPLBACKEND='Agg' - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh From 23c41367e910739ee1f0723a26ae37777983594c Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 12:03:38 -0400 Subject: [PATCH 13/14] flake8 --- gneiss/plot/tests/test_radial.py | 1 - gneiss/regression/tests/test_ols.py | 1 - 2 files changed, 2 deletions(-) diff --git a/gneiss/plot/tests/test_radial.py b/gneiss/plot/tests/test_radial.py index bae69e3..a9b6752 100644 --- a/gneiss/plot/tests/test_radial.py +++ b/gneiss/plot/tests/test_radial.py @@ -82,7 +82,6 @@ def test_basic_plot(self): p = radialplot(t, node_color='color', edge_color='edge_color', node_size='node_size', edge_width='edge_width') - for e in exp_edges.keys(): if isinstance(exp_edges[e], float): npt.assert_allclose( diff --git a/gneiss/regression/tests/test_ols.py b/gneiss/regression/tests/test_ols.py index c691038..e2da220 100644 --- a/gneiss/regression/tests/test_ols.py +++ b/gneiss/regression/tests/test_ols.py @@ -19,7 +19,6 @@ from statsmodels.regression.linear_model import OLS - class TestOLS(unittest.TestCase): """ Tests OLS regression with refactored matrix multiplication. """ def setUp(self): From 187f536ced608e93965ba1c7215006a000b889cd Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Fri, 28 Jun 2019 12:36:48 -0400 Subject: [PATCH 14/14] forgot import --- gneiss/plot/tests/test_radial.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gneiss/plot/tests/test_radial.py b/gneiss/plot/tests/test_radial.py index a9b6752..27705e7 100644 --- a/gneiss/plot/tests/test_radial.py +++ b/gneiss/plot/tests/test_radial.py @@ -6,6 +6,7 @@ from skbio import TreeNode, DistanceMatrix from gneiss.plot._radial import radialplot from gneiss.plot._dendrogram import UnrootedDendrogram +import numpy.testing as npt class TestRadial(unittest.TestCase):