[med-svn] [Git][med-team/q2-taxa][master] 6 commits: New upstream version 2021.8.0+dfsg

Andreas Tille (@tille) gitlab at salsa.debian.org
Wed Sep 29 13:46:30 BST 2021



Andreas Tille pushed to branch master at Debian Med / q2-taxa


Commits:
e8554fbd by Andreas Tille at 2021-09-29T14:15:31+02:00
New upstream version 2021.8.0+dfsg
- - - - -
ca130aec by Andreas Tille at 2021-09-29T14:15:31+02:00
routine-update: New upstream version

- - - - -
3fcb499f by Andreas Tille at 2021-09-29T14:15:31+02:00
Update upstream source from tag 'upstream/2021.8.0+dfsg'

Update to upstream version '2021.8.0+dfsg'
with Debian dir a48523944e829ac2d406e106c8ee3b41fc8f844f
- - - - -
80dca528 by Andreas Tille at 2021-09-29T14:15:32+02:00
routine-update: Standards-Version: 4.6.0

- - - - -
150c7f1c by Andreas Tille at 2021-09-29T14:21:05+02:00
Versioned (Build-)Depends from qiime and its modules (>= 2021.8.0-1)

- - - - -
83cddb66 by Andreas Tille at 2021-09-29T14:45:53+02:00
Fix Versions and upload to unstable

- - - - -


21 changed files:

- + .github/workflows/ci.yml
- − .travis.yml
- LICENSE
- README.md
- − ci/recipe/conda_build_config.yaml
- ci/recipe/meta.yaml
- debian/changelog
- debian/control
- q2_taxa/__init__.py
- q2_taxa/_method.py
- q2_taxa/_util.py
- q2_taxa/_version.py
- q2_taxa/_visualizer.py
- q2_taxa/assets/barplot/index.html
- q2_taxa/assets/barplot/src/render.js
- q2_taxa/plugin_setup.py
- q2_taxa/tests/__init__.py
- q2_taxa/tests/test_methods.py
- q2_taxa/tests/test_plugin_setup.py
- q2_taxa/tests/test_visualizer.py
- setup.py


Changes:

=====================================
.github/workflows/ci.yml
=====================================
@@ -0,0 +1,55 @@
+# This file is automatically generated by busywork.qiime2.org and
+# template-repos - any manual edits made to this file will be erased when
+# busywork performs maintenance updates.
+
+name: ci
+
+on:
+  pull_request:
+  push:
+    branches:
+      - master
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+    - name: checkout source
+      uses: actions/checkout at v2
+
+    - name: set up python 3.8
+      uses: actions/setup-python at v1
+      with:
+        python-version: 3.8
+
+    - name: install dependencies
+      run: python -m pip install --upgrade pip
+
+    - name: lint
+      run: |
+        pip install -q https://github.com/qiime2/q2lint/archive/master.zip
+        q2lint
+        pip install -q flake8
+        flake8
+
+  build-and-test:
+    needs: lint
+    strategy:
+      matrix:
+        os: [ubuntu-latest, macos-latest]
+    runs-on: ${{ matrix.os }}
+    steps:
+    - name: checkout source
+      uses: actions/checkout at v2
+      with:
+        fetch-depth: 0
+
+    - name: set up git repo for versioneer
+      run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
+
+    - uses: qiime2/action-library-packaging at alpha1
+      with:
+        package-name: q2-taxa
+        build-target: dev
+        additional-tests: py.test --pyargs q2_taxa
+        library-token: ${{ secrets.LIBRARY_TOKEN }}


=====================================
.travis.yml deleted
=====================================
@@ -1,25 +0,0 @@
-dist: trusty
-sudo: false
-language: python
-before_install:
-  - export MPLBACKEND='Agg'
-  - wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
-  - export MINICONDA_PREFIX="$HOME/miniconda"
-  - bash miniconda.sh -b -p $MINICONDA_PREFIX
-  - export PATH="$MINICONDA_PREFIX/bin:$PATH"
-  - conda config --set always_yes yes
-  - conda update -q conda
-  - conda info -a
-install:
-  - wget -q https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/qiime2-latest-py36-linux-conda.yml
-  - conda env create -q -n test-env --file qiime2-latest-py36-linux-conda.yml
-  - source activate test-env
-  - conda install -q pytest-cov
-  - pip install -q flake8 coveralls
-  - pip install -q https://github.com/qiime2/q2lint/archive/master.zip
-  - make install
-script:
-  - make lint
-  - make test-cov
-after_success:
-  - coveralls


=====================================
LICENSE
=====================================
@@ -1,6 +1,6 @@
 BSD 3-Clause License
 
-Copyright (c) 2016-2020, QIIME 2 development team.
+Copyright (c) 2016-2021, QIIME 2 development team.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without


=====================================
README.md
=====================================
@@ -1,6 +1,5 @@
 # q2-taxa
 
-[![Build Status](https://travis-ci.org/qiime2/q2-taxa.svg?branch=master)](https://travis-ci.org/qiime2/q2-taxa)
-[![Coverage Status](https://coveralls.io/repos/github/qiime2/q2-taxa/badge.svg?branch=master)](https://coveralls.io/github/qiime2/q2-taxa?branch=master)
+![](https://github.com/qiime2/q2-taxa/workflows/ci/badge.svg)
 
-This is a QIIME 2 plugin. For details on QIIME 2, see https://qiime2.org..
+This is a QIIME 2 plugin. For details on QIIME 2, see https://qiime2.org..
\ No newline at end of file


=====================================
ci/recipe/conda_build_config.yaml deleted
=====================================
@@ -1,2 +0,0 @@
-python:
-  - 3.6


=====================================
ci/recipe/meta.yaml
=====================================
@@ -1,6 +1,5 @@
 {% set data = load_setup_py_data() %}
 {% set version = data.get('version') or 'placehold' %}
-{% set release = '.'.join(version.split('.')[:2]) %}
 
 package:
   name: q2-taxa
@@ -21,11 +20,17 @@ requirements:
   run:
     - python {{ python }}
     - pandas
-    - qiime2 {{ release }}.*
-    - q2templates {{ release }}.*
-    - q2-types {{ release }}.*
+    - qiime2 {{ qiime2_epoch }}.*
+    - q2templates {{ qiime2_epoch }}.*
+    - q2-types {{ qiime2_epoch }}.*
 
 test:
+  requires:
+    - qiime2 >={{ qiime2 }}
+    - q2templates >={{ q2templates }}
+    - q2-types >={{ q2_types }}
+    - pytest
+
   imports:
     - q2_taxa
     - qiime2.plugins.taxa


=====================================
debian/changelog
=====================================
@@ -1,4 +1,6 @@
-q2-taxa (2020.11.1+dfsg-3) UNRELEASED; urgency=medium
+q2-taxa (2021.8.0+dfsg-1) unstable; urgency=medium
+
+  * Team upload.
 
   [ Steffen Moeller ]
   * Fixed d/u/watch - now finds new version to download
@@ -6,7 +8,11 @@ q2-taxa (2020.11.1+dfsg-3) UNRELEASED; urgency=medium
   [ Nilesh Patra ]
   * d/salsa-ci.yml: Disable build on i386 due to missing python3-skbio
 
- -- Steffen Moeller <moeller at debian.org>  Mon, 26 Jul 2021 00:43:56 +0530
+  [ Andreas Tille ]
+  * Standards-Version: 4.6.0 (routine-update)
+  * Versioned (Build-)Depends from qiime and its modules (>= 2021.8.0)
+
+ -- Andreas Tille <tille at debian.org>  Wed, 29 Sep 2021 14:21:11 +0200
 
 q2-taxa (2020.11.1+dfsg-2) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -11,9 +11,9 @@ Build-Depends: debhelper-compat (= 13),
                python3-pytest-cov,
                python3-pandas,
                nodejs,
-               qiime (>= 2020.11.0),
-               q2templates,
-               q2-types,
+               qiime (>= 2021.8.0),
+               q2templates (>= 2021.8.0),
+               q2-types (>= 2021.8.0),
                node-webpack,
                node-uglifyjs-webpack-plugin,
                node-babel-loader,
@@ -21,7 +21,7 @@ Build-Depends: debhelper-compat (= 13),
                node-natural-sort,
                node-thenby,
                node-d3
-Standards-Version: 4.5.1
+Standards-Version: 4.6.0
 Vcs-Browser: https://salsa.debian.org/med-team/q2-taxa
 Vcs-Git: https://salsa.debian.org/med-team/q2-taxa.git
 Homepage: https://qiime2.org/
@@ -33,9 +33,9 @@ Depends: ${shlibs:Depends},
          ${misc:Depends},
          ${python3:Depends},
          python3-pandas,
-         qiime,
-         q2templates,
-         q2-types,
+         qiime (>= 2021.8.0),
+         q2templates (>= 2021.8.0),
+         q2-types (>= 2021.8.0),
          node-d3-scale-chromatic,
          node-natural-sort,
          node-thenby


=====================================
q2_taxa/__init__.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_taxa/_method.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -7,13 +7,14 @@
 # ----------------------------------------------------------------------------
 
 import pandas as pd
+import biom
 import qiime2
 
 from ._util import _collapse_table, _get_max_level
 
 
-def collapse(table: pd.DataFrame, taxonomy: pd.Series,
-             level: int) -> pd.DataFrame:
+def collapse(table: biom.Table, taxonomy: pd.Series,
+             level: int) -> biom.Table:
     if level < 1:
         raise ValueError('Requested level of %d is too low. Must be greater '
                          'than or equal to 1.' % level)


=====================================
q2_taxa/_util.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -12,7 +12,7 @@ def _get_max_level(taxonomy):
 
 
 def _collapse_table(table, taxonomy, level, max_observed_level):
-    table_ids = set(table.columns)
+    table_ids = set(table.ids(axis='observation'))
     taxonomy_ids = set(taxonomy.index)
     missing_ids = table_ids.difference(taxonomy_ids)
     if len(missing_ids) > 0:
@@ -21,15 +21,15 @@ def _collapse_table(table, taxonomy, level, max_observed_level):
 
     table = table.copy()
 
-    def _collapse(tax):
+    def _collapse(id_, md):
+        tax = taxonomy.loc[id_]
         tax = [x.strip() for x in tax.split(';')]
         if len(tax) < max_observed_level:
             padding = ['__'] * (max_observed_level - len(tax))
             tax.extend(padding)
         return ';'.join(tax[:level])
 
-    table.columns = taxonomy.apply(_collapse)[table.columns]
-    return table.groupby(table.columns, axis=1).agg(sum)
+    return table.collapse(_collapse, axis='observation', norm=False)
 
 
 def _extract_to_level(taxonomy, table):
@@ -40,6 +40,7 @@ def _extract_to_level(taxonomy, table):
     # Collapse table at specified level
     for level in range(1, max_obs_lvl + 1):
         collapsed_table = _collapse_table(table, taxonomy, level, max_obs_lvl)
-        collapsed_tables.append(collapsed_table)
+        as_df = collapsed_table.transpose().to_dataframe(dense=True)
+        collapsed_tables.append(as_df)
 
     return collapsed_tables


=====================================
q2_taxa/_version.py
=====================================
@@ -23,9 +23,9 @@ def get_keywords():
     # setup.py/versioneer.py will grep for the variable names, so they must
     # each be defined on a line of their own. _version.py will just call
     # get_keywords().
-    git_refnames = " (tag: 2020.11.1)"
-    git_full = "1499d2d7a5f0bd958e19f8b2fffb6205e8fe50ad"
-    git_date = "2020-12-05 20:44:48 +0000"
+    git_refnames = " (tag: 2021.8.0)"
+    git_full = "b148b8ec248a63b43e8986ea74fe727dde0c07bb"
+    git_date = "2021-09-09 18:35:31 +0000"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 


=====================================
q2_taxa/_visualizer.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -11,6 +11,7 @@ import os.path
 import pkg_resources
 import shutil
 
+import biom
 import pandas as pd
 import q2templates
 
@@ -22,13 +23,19 @@ from ._util import _extract_to_level
 TEMPLATES = pkg_resources.resource_filename('q2_taxa', 'assets')
 
 
-def barplot(output_dir: str, table: pd.DataFrame, taxonomy: pd.Series,
-            metadata: Metadata) -> None:
-    ids_not_in_metadata = set(table.index) - set(metadata.ids)
+def barplot(output_dir: str, table: biom.Table, taxonomy: pd.Series,
+            metadata: Metadata = None) -> None:
+
+    if metadata is None:
+        metadata = Metadata(
+            pd.DataFrame({'id': table.ids(axis='sample')}).set_index('id'))
+
+    ids_not_in_metadata = set(table.ids(axis='sample')) - set(metadata.ids)
     if ids_not_in_metadata:
         raise ValueError('Sample IDs found in the table are missing in the '
                          f'metadata: {ids_not_in_metadata!r}.')
 
+    num_metadata_cols = metadata.column_count
     metadata = metadata.to_dataframe()
     jsonp_files, csv_files = [], []
     collapsed_tables = _extract_to_level(taxonomy, table)
@@ -62,7 +69,9 @@ def barplot(output_dir: str, table: pd.DataFrame, taxonomy: pd.Series,
 
     # Now that the tables have been collapsed, write out the index template
     index = os.path.join(TEMPLATES, 'barplot', 'index.html')
-    q2templates.render(index, output_dir, context={'jsonp_files': jsonp_files})
+    q2templates.render(index, output_dir,
+                       context={'jsonp_files': jsonp_files,
+                                'num_metadata_cols': num_metadata_cols})
 
     # Copy assets for rendering figure
     shutil.copytree(os.path.join(TEMPLATES, 'barplot', 'dist'),


=====================================
q2_taxa/assets/barplot/index.html
=====================================
@@ -45,4 +45,5 @@
     <script src='{{ level }}?callback=load_data'></script>
     {% endfor %}
     <script src='dist/bundle.js'></script>
+    <p>Number of sample metadata columns provided: {{ num_metadata_cols }}</p>
 {% endblock %}


=====================================
q2_taxa/assets/barplot/src/render.js
=====================================
@@ -34,7 +34,10 @@ export default function render(svg, colorScheme, xOrdering, dataMeta, barWidth)
     const range = [];
     const domain = [];
     for (let i = 0; i < keys.length; i += 1) {
-      range.push(scheme.scheme[i % scheme.scheme.length]);
+      // Assign colors from the "end" of the color scheme, which causes the
+      // color scheme to consistently give the topmost value in the barplot the
+      // same color (https://github.com/qiime2/q2-taxa/issues/111)
+      range.push(scheme.scheme[(keys.length - 1 - i) % scheme.scheme.length]);
       domain.push(i);
     }
     z = scaleOrdinal(range).domain(domain);


=====================================
q2_taxa/plugin_setup.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_taxa/tests/__init__.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_taxa/tests/test_methods.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -8,8 +8,10 @@
 
 import unittest
 
+import numpy as np
+import biom
 import pandas as pd
-import pandas.util.testing as pdt
+import pandas.testing as pdt
 import qiime2
 
 from q2_taxa import collapse, filter_table, filter_seqs
@@ -31,63 +33,70 @@ class CollapseTests(unittest.TestCase):
                                check_index_type=True,
                                check_column_type=True,
                                check_frame_type=True,
-                               check_less_precise=False,
                                check_names=True,
                                by_blocks=False,
                                check_exact=False)
         self.assert_index_equal(left.index, right.index)
 
     def test_collapse(self):
-        table = pd.DataFrame([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0], [0.0, 4.0]],
-                             index=['A', 'B', 'C', 'D'],
-                             columns=['feat1', 'feat2'])
+        table = biom.Table(np.array([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
+                                     [0.0, 4.0]]),
+                           ['A', 'B', 'C', 'D'],
+                           ['feat1', 'feat2']).transpose()
         taxonomy = pd.Series(['a; b; c', 'a; b; d'],
                              index=['feat1', 'feat2'])
 
         actual = collapse(table, taxonomy, 1)
-        expected = pd.DataFrame([[4.0], [2.0], [17.0], [4.0]],
-                                index=['A', 'B', 'C', 'D'],
-                                columns=['a'])
-        self.assert_data_frame_almost_equal(actual, expected)
+        actual.del_metadata()
+        expected = biom.Table(np.array([[4.0], [2.0], [17.0], [4.0]]),
+                              ['A', 'B', 'C', 'D'],
+                              ['a']).transpose()
+        self.assertEqual(actual, expected)
 
         actual = collapse(table, taxonomy, 2)
-        expected = pd.DataFrame([[4.0], [2.0], [17.0], [4.0]],
-                                index=['A', 'B', 'C', 'D'],
-                                columns=['a;b'])
-        self.assert_data_frame_almost_equal(actual, expected)
+        actual.del_metadata()
+        expected = biom.Table(np.array([[4.0], [2.0], [17.0], [4.0]]),
+                              ['A', 'B', 'C', 'D'],
+                              ['a;b']).transpose()
+        self.assertEqual(actual, expected)
 
         actual = collapse(table, taxonomy, 3)
-        expected = pd.DataFrame([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
-                                 [0.0, 4.0]],
-                                index=['A', 'B', 'C', 'D'],
-                                columns=['a;b;c', 'a;b;d'])
-        self.assert_data_frame_almost_equal(actual, expected)
+        actual.del_metadata()
+        expected = biom.Table(np.array([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
+                                        [0.0, 4.0]]),
+                              ['A', 'B', 'C', 'D'],
+                              ['a;b;c', 'a;b;d']).transpose()
+        self.assertEqual(actual, expected)
 
     def test_collapse_missing_level(self):
-        table = pd.DataFrame([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0], [0.0, 4.0]],
-                             index=['A', 'B', 'C', 'D'],
-                             columns=['feat1', 'feat2'])
+        table = biom.Table(np.array([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
+                                     [0.0, 4.0]]),
+                           ['A', 'B', 'C', 'D'],
+                           ['feat1', 'feat2']).transpose()
         taxonomy = pd.Series(['a; b', 'a; b; d'],
                              index=['feat1', 'feat2'])
 
         actual = collapse(table, taxonomy, 1)
-        expected = pd.DataFrame([[4.0], [2.0], [17.0], [4.0]],
-                                index=['A', 'B', 'C', 'D'],
-                                columns=['a'])
-        self.assert_data_frame_almost_equal(actual, expected)
+        actual.del_metadata()
+        expected = biom.Table(np.array([[4.0], [2.0], [17.0], [4.0]]),
+                              ['A', 'B', 'C', 'D'],
+                              ['a']).transpose()
+        self.assertEqual(actual, expected)
 
         actual = collapse(table, taxonomy, 2)
-        expected = pd.DataFrame([[4.0], [2.0], [17.0], [4.0]],
-                                index=['A', 'B', 'C', 'D'],
-                                columns=['a;b'])
-        self.assert_data_frame_almost_equal(actual, expected)
+        actual.del_metadata()
+        expected = biom.Table(np.array([[4.0], [2.0], [17.0], [4.0]]),
+                              ['A', 'B', 'C', 'D'],
+                              ['a;b']).transpose()
+        self.assertEqual(actual, expected)
 
         actual = collapse(table, taxonomy, 3)
-        expected = pd.DataFrame([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
-                                 [0.0, 4.0]],
-                                index=['A', 'B', 'C', 'D'],
-                                columns=['a;b;__', 'a;b;d'])
-        self.assert_data_frame_almost_equal(actual, expected)
+        actual.del_metadata()
+        expected = biom.Table(np.array([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
+                                        [0.0, 4.0]]),
+                              ['A', 'B', 'C', 'D'],
+                              ['a;b;__', 'a;b;d']).transpose()
+        self.assertEqual(actual, expected)
 
     def test_collapse_bad_level(self):
         table = pd.DataFrame([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0], [0.0, 4.0]],
@@ -102,12 +111,12 @@ class CollapseTests(unittest.TestCase):
             collapse(table, taxonomy, 0)
 
     def test_collapse_missing_table_ids_in_taxonomy(self):
-        table = pd.DataFrame([[2.0, 2.0],
-                              [1.0, 1.0],
-                              [9.0, 8.0],
-                              [0.0, 4.0]],
-                             index=['A', 'B', 'C', 'D'],
-                             columns=['feat1', 'feat2'])
+        table = biom.Table(np.array([[2.0, 2.0],
+                                     [1.0, 1.0],
+                                     [9.0, 8.0],
+                                     [0.0, 4.0]]),
+                           ['A', 'B', 'C', 'D'],
+                           ['feat1', 'feat2']).transpose()
         taxonomy = pd.Series(['a; b; c', 'a; b; d'],
                              index=['feat1', 'feat3'])
         with self.assertRaisesRegex(ValueError, 'missing.*feat2'):


=====================================
q2_taxa/tests/test_plugin_setup.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_taxa/tests/test_visualizer.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -10,6 +10,8 @@ import os
 import tempfile
 import unittest
 
+import biom
+import numpy as np
 import pandas as pd
 import qiime2
 
@@ -19,10 +21,10 @@ from q2_taxa import barplot
 class BarplotTests(unittest.TestCase):
 
     def setUp(self):
-        self.table = pd.DataFrame([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
-                                  [0.0, 4.0]],
-                                  index=['A', 'B', 'C', 'D'],
-                                  columns=['feat1', 'feat2'])
+        self.table = biom.Table(np.array([[2.0, 2.0], [1.0, 1.0], [9.0, 8.0],
+                                          [0.0, 4.0]]),
+                                ['A', 'B', 'C', 'D'],
+                                ['feat1', 'feat2']).transpose()
         self.taxonomy = pd.Series(['a; b; c', 'a; b; d'],
                                   index=['feat1', 'feat2'])
 
@@ -39,6 +41,7 @@ class BarplotTests(unittest.TestCase):
                             open(index_fp).read())
             csv_lvl3_fp = os.path.join(output_dir, 'level-3.csv')
             self.assertTrue(os.path.exists(csv_lvl3_fp))
+            self.assertTrue('val1' in open(csv_lvl3_fp).read())
 
     def test_barplot_metadata_extra_id(self):
         metadata = qiime2.Metadata(
@@ -62,3 +65,14 @@ class BarplotTests(unittest.TestCase):
         with tempfile.TemporaryDirectory() as output_dir:
             with self.assertRaisesRegex(ValueError, 'missing.*D'):
                 barplot(output_dir, self.table, self.taxonomy, metadata)
+
+    def test_barplot_no_metadata(self):
+        with tempfile.TemporaryDirectory() as output_dir:
+            barplot(output_dir, self.table, self.taxonomy)
+            index_fp = os.path.join(output_dir, 'index.html')
+            self.assertTrue(os.path.exists(index_fp))
+            self.assertTrue("src='level-1.jsonp?callback=load_data'" in
+                            open(index_fp).read())
+            csv_lvl3_fp = os.path.join(output_dir, 'level-3.csv')
+            self.assertTrue(os.path.exists(csv_lvl3_fp))
+            self.assertTrue('val1' not in open(csv_lvl3_fp).read())


=====================================
setup.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2016-2020, QIIME 2 development team.
+# Copyright (c) 2016-2021, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #



View it on GitLab: https://salsa.debian.org/med-team/q2-taxa/-/compare/a8e78df1d12563fec666639d4a2dde550244de37...83cddb66837d5ca1621f88d32235e913babb86a6

-- 
View it on GitLab: https://salsa.debian.org/med-team/q2-taxa/-/compare/a8e78df1d12563fec666639d4a2dde550244de37...83cddb66837d5ca1621f88d32235e913babb86a6
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210929/f305852b/attachment-0001.htm>


More information about the debian-med-commit mailing list