[med-svn] [Git][med-team/q2-taxa][upstream] New upstream version 2023.7.0+dfsg
Étienne Mollier (@emollier)
gitlab at salsa.debian.org
Sun Aug 20 16:41:19 BST 2023
Étienne Mollier pushed to branch upstream at Debian Med / q2-taxa
Commits:
4c7c7bab by Étienne Mollier at 2023-08-20T17:21:23+02:00
New upstream version 2023.7.0+dfsg
- - - - -
18 changed files:
- + .github/workflows/ci-dev.yaml
- − .github/workflows/ci.yml
- + .github/workflows/join-release.yaml
- + .github/workflows/tag-release.yaml
- LICENSE
- ci/recipe/meta.yaml
- q2_taxa/__init__.py
- q2_taxa/_examples.py
- q2_taxa/_method.py
- q2_taxa/_util.py
- q2_taxa/_version.py
- q2_taxa/_visualizer.py
- 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-dev.yaml
=====================================
@@ -0,0 +1,12 @@
+# Example of workflow trigger for calling workflow (the client).
+name: ci-dev
+on:
+ pull_request:
+ branches: ["dev"]
+ push:
+ branches: ["dev"]
+jobs:
+ ci:
+ uses: qiime2/distributions/.github/workflows/lib-ci-dev.yaml at dev
+ with:
+ distro: core
\ No newline at end of file
=====================================
.github/workflows/ci.yml deleted
=====================================
@@ -1,55 +0,0 @@
-# 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 }}
=====================================
.github/workflows/join-release.yaml
=====================================
@@ -0,0 +1,6 @@
+name: join-release
+on:
+ workflow_dispatch: {}
+jobs:
+ release:
+ uses: qiime2/distributions/.github/workflows/lib-join-release.yaml at dev
\ No newline at end of file
=====================================
.github/workflows/tag-release.yaml
=====================================
@@ -0,0 +1,7 @@
+name: tag-release
+on:
+ push:
+ branches: ["Release-*"]
+jobs:
+ tag:
+ uses: qiime2/distributions/.github/workflows/lib-tag-release.yaml at dev
\ No newline at end of file
=====================================
LICENSE
=====================================
@@ -1,6 +1,6 @@
BSD 3-Clause License
-Copyright (c) 2016-2022, QIIME 2 development team.
+Copyright (c) 2016-2023, QIIME 2 development team.
All rights reserved.
Redistribution and use in source and binary forms, with or without
=====================================
ci/recipe/meta.yaml
=====================================
@@ -30,6 +30,9 @@ requirements:
- q2-types {{ qiime2_epoch }}.*
test:
+ commands:
+ - py.test --pyargs q2_taxa
+
requires:
- qiime2 >={{ qiime2 }}
- q2templates >={{ q2templates }}
=====================================
q2_taxa/__init__.py
=====================================
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
=====================================
q2_taxa/_examples.py
=====================================
@@ -1,20 +1,18 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
-import qiime2
-
table_url = ('https://data.qiime2.org/usage-examples/'
'moving-pictures/gut-table.qza')
taxonomy_url = ('https://data.qiime2.org/usage-examples/'
'moving-pictures/taxonomy.qza')
-metadata_url = (f'https://data.qiime2.org/{qiime2.__release__}/tutorials/'
- 'moving-pictures/sample_metadata.tsv')
+metadata_url = ('https://data.qiime2.org/usage-examples/'
+ 'moving-pictures/sample-metadata.tsv')
def collapse_example(use):
=====================================
q2_taxa/_method.py
=====================================
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
=====================================
q2_taxa/_util.py
=====================================
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
@@ -40,7 +40,11 @@ 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)
- as_df = collapsed_table.transpose().to_dataframe(dense=True)
+ as_df = _biom_to_df(collapsed_table)
collapsed_tables.append(as_df)
return collapsed_tables
+
+
+def _biom_to_df(table):
+ return table.transpose().to_dataframe(dense=True)
=====================================
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 = " (HEAD -> master, tag: 2022.11.1)"
- git_full = "d3288c4e0882df166b7f40205a83d3cc50318609"
- git_date = "2022-12-21 21:39:27 +0000"
+ git_refnames = " (tag: 2023.7.0, Release-2023.7)"
+ git_full = "85122a0f9596c79b371fb1dab359363fd59b1a5d"
+ git_date = "2023-08-17 18:50:58 +0000"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
=====================================
q2_taxa/_visualizer.py
=====================================
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
@@ -17,14 +17,14 @@ import q2templates
from qiime2 import Metadata
-from ._util import _extract_to_level
+from ._util import _extract_to_level, _biom_to_df
TEMPLATES = pkg_resources.resource_filename('q2_taxa', 'assets')
-def barplot(output_dir: str, table: biom.Table, taxonomy: pd.Series,
- metadata: Metadata = None) -> None:
+def barplot(output_dir: str, table: biom.Table, taxonomy: pd.Series = None,
+ metadata: Metadata = None, level_delimiter: str = None) -> None:
if metadata is None:
metadata = Metadata(
@@ -35,10 +35,22 @@ def barplot(output_dir: str, table: biom.Table, taxonomy: pd.Series,
raise ValueError('Sample IDs found in the table are missing in the '
f'metadata: {ids_not_in_metadata!r}.')
+ collapse = True
+ if taxonomy is None:
+ if level_delimiter is None:
+ collapse = False
+ else:
+ _ids = table.ids('observation')
+ ranks = [r.replace(level_delimiter, ';') for r in _ids]
+ taxonomy = pd.Series(ranks, index=_ids)
+
num_metadata_cols = metadata.column_count
metadata = metadata.to_dataframe()
jsonp_files, csv_files = [], []
- collapsed_tables = _extract_to_level(taxonomy, table)
+ if collapse:
+ collapsed_tables = _extract_to_level(taxonomy, table)
+ else:
+ collapsed_tables = [_biom_to_df(table)]
for level, df in enumerate(collapsed_tables, 1):
# Stash column labels before manipulating dataframe
=====================================
q2_taxa/plugin_setup.py
=====================================
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
@@ -11,8 +11,7 @@ import qiime2.plugin
import q2_taxa
from q2_types.feature_data import FeatureData, Taxonomy, Sequence
-from q2_types.feature_table import FeatureTable, Frequency
-
+from q2_types.feature_table import FeatureTable, Frequency, PresenceAbsence
from . import barplot, collapse, filter_table, filter_seqs
import q2_taxa._examples as ex
@@ -180,17 +179,25 @@ plugin.visualizers.register_function(
function=barplot,
inputs={
'taxonomy': FeatureData[Taxonomy],
- 'table': FeatureTable[Frequency]
+ 'table': FeatureTable[Frequency | PresenceAbsence]
},
- parameters={'metadata': qiime2.plugin.Metadata},
+ parameters={'metadata': qiime2.plugin.Metadata,
+ 'level_delimiter': qiime2.plugin.Str},
input_descriptions={
'taxonomy': ('Taxonomic annotations for features in the provided '
'feature table. All features in the feature table must '
'have a corresponding taxonomic annotation. Taxonomic '
'annotations that are not present in the feature table '
- 'will be ignored.'),
+ 'will be ignored. If no taxonomy is provided, the '
+ 'feature IDs will be used as labels.'),
'table': 'Feature table to visualize at various taxonomic levels.'},
- parameter_descriptions={'metadata': 'The sample metadata.'},
+ parameter_descriptions={
+ 'metadata': 'The sample metadata.',
+ 'level_delimiter': 'Attempt to parse hierarchical taxonomic '
+ 'information from feature IDs by separating '
+ 'levels with this character. This parameter '
+ 'is ignored if a taxonomy is provided as input.'
+ },
name='Visualize taxonomy with an interactive bar plot',
description='This visualizer produces an interactive barplot visualization'
' of taxonomies. Interactive features include multi-level '
=====================================
q2_taxa/tests/__init__.py
=====================================
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, 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-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
=====================================
q2_taxa/tests/test_plugin_setup.py
=====================================
@@ -1,5 +1,5 @@
# ----------------------------------------------------------------------------
-# Copyright (c) 2016-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, 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-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
@@ -15,7 +15,7 @@ import numpy as np
import pandas as pd
import qiime2
-from q2_taxa import barplot
+from q2_taxa import barplot, collapse
class BarplotTests(unittest.TestCase):
@@ -27,14 +27,14 @@ class BarplotTests(unittest.TestCase):
['feat1', 'feat2']).transpose()
self.taxonomy = pd.Series(['a; b; c', 'a; b; d'],
index=['feat1', 'feat2'])
-
- def test_barplot(self):
- metadata = qiime2.Metadata(
+ self.metadata = qiime2.Metadata(
pd.DataFrame({'val1': ['1.0', '2.0', '3.0', '4.0']},
index=pd.Index(['A', 'B', 'C', 'D'], name='id')))
+ def test_barplot(self):
+
with tempfile.TemporaryDirectory() as output_dir:
- barplot(output_dir, self.table, self.taxonomy, metadata)
+ barplot(output_dir, self.table, self.taxonomy, self.metadata)
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
@@ -76,3 +76,24 @@ class BarplotTests(unittest.TestCase):
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())
+
+ def test_barplot_no_taxonomy(self):
+ with tempfile.TemporaryDirectory() as output_dir:
+ barplot(output_dir, self.table, metadata=self.metadata)
+ 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_lvl1_fp = os.path.join(output_dir, 'level-1.csv')
+ self.assertTrue(os.path.exists(csv_lvl1_fp))
+ self.assertTrue('val1' in open(csv_lvl1_fp).read())
+
+ def test_barplot_collapsed_table(self):
+ with tempfile.TemporaryDirectory() as output_dir:
+ collapsed_table = collapse(self.table, self.taxonomy, 3)
+ barplot(output_dir, collapsed_table, level_delimiter=';')
+ # if level three tables exist, the taxonomy was parsed
+ # correctly from the collapsed table.
+ 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-2022, QIIME 2 development team.
+# Copyright (c) 2016-2023, 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/-/commit/4c7c7bab36e0c7e242b543f6776770f6949181a9
--
View it on GitLab: https://salsa.debian.org/med-team/q2-taxa/-/commit/4c7c7bab36e0c7e242b543f6776770f6949181a9
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/20230820/02168e13/attachment-0001.htm>
More information about the debian-med-commit
mailing list