[med-svn] [Git][med-team/q2-types][master] 6 commits: Generate debian/control automatically to refresh version number

Andreas Tille (@tille) gitlab at salsa.debian.org
Mon Jan 29 17:53:44 GMT 2024



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


Commits:
ca571ea3 by Andreas Tille at 2024-01-29T18:43:48+01:00
Generate debian/control automatically to refresh version number

- - - - -
598bdd65 by Andreas Tille at 2024-01-29T18:44:05+01:00
New upstream version 2023.9.0
- - - - -
d4b301df by Andreas Tille at 2024-01-29T18:44:05+01:00
routine-update: New upstream version

- - - - -
2d05d4bc by Andreas Tille at 2024-01-29T18:44:06+01:00
Update upstream source from tag 'upstream/2023.9.0'

Update to upstream version '2023.9.0'
with Debian dir 7ba61c4e815be2ebe8c9a25953a8e68df5d39491
- - - - -
e9d9edf8 by Andreas Tille at 2024-01-29T18:44:09+01:00
routine-update: Build-Depends: s/dh-python/dh-sequence-python3/

- - - - -
664d5c0e by Andreas Tille at 2024-01-29T18:53:08+01:00
Regenerate debian/control from debian/control.in

- - - - -


19 changed files:

- debian/changelog
- debian/control
- + debian/control.in
- debian/rules
- q2_types/__init__.py
- q2_types/_version.py
- + q2_types/feature_map/__init__.py
- + q2_types/feature_map/_format.py
- + q2_types/feature_map/_transformer.py
- + q2_types/feature_map/_type.py
- + q2_types/feature_map/tests/__init__.py
- + q2_types/feature_map/tests/data/mag-to-contigs-empty-list.json
- + q2_types/feature_map/tests/data/mag-to-contigs-invalid-ids.json
- + q2_types/feature_map/tests/data/mag-to-contigs-invalid-values.json
- + q2_types/feature_map/tests/data/mag-to-contigs-valid.json
- + q2_types/feature_map/tests/test_format.py
- + q2_types/feature_map/tests/test_transformer.py
- + q2_types/feature_map/tests/test_type.py
- setup.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+q2-types (2023.9.0-1) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Generate debian/control automatically to refresh version number
+  * Build-Depends: s/dh-python/dh-sequence-python3/ (routine-update)
+
+ -- Andreas Tille <tille at debian.org>  Mon, 29 Jan 2024 18:42:22 +0100
+
 q2-types (2023.7.0-1) unstable; urgency=medium
 
   * New upstream version 2023.7.0


=====================================
debian/control
=====================================
@@ -1,3 +1,4 @@
+# This file is autogenerated from control.in to update versioned dependencies
 Source: q2-types
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
 Uploaders: Liubov Chuprikova <chuprikovalv at gmail.com>,
@@ -6,7 +7,7 @@ Uploaders: Liubov Chuprikova <chuprikovalv at gmail.com>,
 Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
-               dh-python,
+               dh-sequence-python3,
                python3,
                python3-setuptools,
                python3-pytest-cov,
@@ -14,7 +15,7 @@ Build-Depends: debhelper-compat (= 13),
                python3-skbio,
                python3-ijson,
                python3-h5py,
-               qiime (>= 2022.11.1)
+               qiime (>= 2023.9)
 Standards-Version: 4.6.2
 Vcs-Browser: https://salsa.debian.org/med-team/q2-types
 Vcs-Git: https://salsa.debian.org/med-team/q2-types.git
@@ -34,7 +35,7 @@ Depends: ${shlibs:Depends},
          python3-ijson,
          python3-h5py,
          libopenblas0,
-         qiime (>= 2022.11.1)
+         qiime (>= 2023.9)
 Description: QIIME 2 plugin defining types for microbiome analysis
  QIIME 2 is a powerful, extensible, and decentralized microbiome analysis
  package with a focus on data and analysis transparency. QIIME 2 enables


=====================================
debian/control.in
=====================================
@@ -0,0 +1,59 @@
+Source: q2-types
+Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
+Uploaders: Liubov Chuprikova <chuprikovalv at gmail.com>,
+           Étienne Mollier <emollier at debian.org>,
+           Steffen Moeller <moeller at debian.org>
+Section: science
+Priority: optional
+Build-Depends: debhelper-compat (= 13),
+               dh-sequence-python3,
+               python3,
+               python3-setuptools,
+               python3-pytest-cov,
+               python3-biom-format,
+               python3-skbio,
+               python3-ijson,
+               python3-h5py,
+               qiime (>= @DEB_VERSION_UPSTREAM@)
+Standards-Version: 4.6.2
+Vcs-Browser: https://salsa.debian.org/med-team/q2-types
+Vcs-Git: https://salsa.debian.org/med-team/q2-types.git
+Homepage: https://qiime2.org/
+Rules-Requires-Root: no
+
+Package: q2-types
+Architecture: all
+Depends: ${shlibs:Depends},
+         ${misc:Depends},
+         ${python3:Depends},
+         python3-setuptools,
+         python3-skbio,
+         python3-numpy,
+         python3-pandas,
+         python3-biom-format,
+         python3-ijson,
+         python3-h5py,
+         libopenblas0,
+         qiime (>= @DEB_VERSION_UPSTREAM@)
+Description: QIIME 2 plugin defining types for microbiome analysis
+ QIIME 2 is a powerful, extensible, and decentralized microbiome analysis
+ package with a focus on data and analysis transparency. QIIME 2 enables
+ researchers to start an analysis with raw DNA sequence data and finish with
+ publication-quality figures and statistical results.
+ Key features:
+  * Integrated and automatic tracking of data provenance
+  * Semantic type system
+  * Plugin system for extending microbiome analysis functionality
+  * Support for multiple types of user interfaces (e.g. API, command line,
+ graphical)
+ .
+ QIIME 2 is a complete redesign and rewrite of the QIIME 1 microbiome analysis
+ pipeline. QIIME 2 will address many of the limitations of QIIME 1, while
+ retaining the features that makes QIIME 1 a powerful and widely-used analysis
+ pipeline.
+ .
+ QIIME 2 currently supports an initial end-to-end microbiome analysis pipeline.
+ New functionality will regularly become available through QIIME 2 plugins. You
+ can view a list of plugins that are currently available on the QIIME 2 plugin
+ availability page. The future plugins page lists plugins that are being
+ developed.


=====================================
debian/rules
=====================================
@@ -3,6 +3,8 @@
 # DH_VERBOSE := 1
 export LC_ALL=C.UTF-8
 
+include /usr/share/dpkg/default.mk
+VERSION_UPSTREAM=$(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\(20[0-9][0-9]\.[0-9]\+\)\..*/\1/')
 
 # For testing, we need .egg-info so the entry points are available.
 export PYBUILD_BEFORE_TEST=python{version} setup.py develop --install-dir {build_dir}
@@ -11,7 +13,11 @@ export PYBUILD_BEFORE_INSTALL=rm -rvf {build_dir}/q2-types.egg-* {build_dir}/sit
 	{build_dir}/.coverage* {build_dir}/easy-install.pth
 
 %:
-	dh $@ --with python3 --buildsystem=pybuild
+	dh $@ --buildsystem=pybuild
+
+debian/control: debian/control.in debian/changelog
+	echo "# This file is autogenerated from control.in to update versioned dependencies" > $@
+	sed -e"s/@DEB_VERSION_UPSTREAM@/$(VERSION_UPSTREAM)/g" $< >> $@
 
 # FIXME: similarly to the qiime package, the build time testing fails, as the
 #        Qiime plugin system is not fully available at this point of the package


=====================================
q2_types/__init__.py
=====================================
@@ -17,6 +17,7 @@ del get_versions
 # import.
 importlib.import_module('q2_types.multiplexed_sequences')
 importlib.import_module('q2_types.feature_data')
+importlib.import_module('q2_types.feature_map')
 importlib.import_module('q2_types.feature_table')
 importlib.import_module('q2_types.distance_matrix')
 importlib.import_module('q2_types.tree')


=====================================
q2_types/_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: 2023.7.0, Release-2023.7)"
-    git_full = "24e144ed3abe2e2133c3e848a0c8277607eec64b"
-    git_date = "2023-08-17 16:46:27 +0000"
+    git_refnames = " (tag: 2023.9.0, Release-2023.9)"
+    git_full = "e351bb6b89217f1d5b8d384db674ce21193eb221"
+    git_date = "2023-10-03 22:05:44 +0000"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 


=====================================
q2_types/feature_map/__init__.py
=====================================
@@ -0,0 +1,19 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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 importlib
+
+from ._format import MAGtoContigsFormat, MAGtoContigsDirFmt
+
+from ._type import FeatureMap, MAGtoContigs
+
+__all__ = [
+    "FeatureMap", "MAGtoContigs", "MAGtoContigsFormat", "MAGtoContigsDirFmt"
+]
+
+importlib.import_module("q2_types.feature_map._transformer")


=====================================
q2_types/feature_map/_format.py
=====================================
@@ -0,0 +1,54 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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 json
+from uuid import UUID
+
+from qiime2.core.exceptions import ValidationError
+from qiime2.plugin import model
+
+from ..plugin_setup import plugin
+
+
+class MAGtoContigsFormat(model.TextFileFormat):
+    def _validate_(self, level):
+        with self.path.open("r") as fh:
+            data = json.load(fh)
+
+            level_map = {"min": 1, "max": len(data)}
+            max_entries = level_map[level]
+
+            # assert keys are proper UUIDs and dict values are lists
+            # with at least one contig
+            for _id, contigs in list(data.items())[:max_entries]:
+                try:
+                    UUID(_id, version=4)
+                except ValueError:
+                    raise ValidationError(
+                        "MAG IDs must be valid UUID version 4 sequences. "
+                        f'Found "{_id}", which is invalid.'
+                    )
+
+                if not isinstance(contigs, list):
+                    raise ValidationError(
+                        "Values corresponding to MAG IDs must be lists of "
+                        f'contigs. Found "{type(contigs)}" for MAG "{_id}".'
+                    )
+
+                if len(contigs) == 0:
+                    raise ValidationError(
+                        "Only non-empty MAGs are allowed. The list of "
+                        f'contigs for MAG "{_id}" is empty.'
+                    )
+
+
+MAGtoContigsDirFmt = model.SingleFileDirectoryFormat(
+    "MAGtoContigsDirFmt", "mag-to-contigs.json", MAGtoContigsFormat
+)
+
+plugin.register_formats(MAGtoContigsFormat, MAGtoContigsDirFmt)


=====================================
q2_types/feature_map/_transformer.py
=====================================
@@ -0,0 +1,28 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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 json
+
+from . import MAGtoContigsFormat
+
+from ..plugin_setup import plugin
+
+
+ at plugin.register_transformer
+def _1(fp: MAGtoContigsFormat) -> dict:
+    with fp.open() as fh:
+        data = json.load(fh)
+    return data
+
+
+ at plugin.register_transformer
+def _2(data: dict) -> MAGtoContigsFormat:
+    fp = MAGtoContigsFormat()
+    with fp.open() as fh:
+        json.dump(data, fh)
+    return fp


=====================================
q2_types/feature_map/_type.py
=====================================
@@ -0,0 +1,22 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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.
+# ----------------------------------------------------------------------------
+
+from qiime2.core.type import SemanticType
+
+from ._format import MAGtoContigsDirFmt
+from ..plugin_setup import plugin
+
+FeatureMap = SemanticType("FeatureMap", field_names="type")
+MAGtoContigs = SemanticType(
+    "MAGtoContigs", variant_of=FeatureMap.field["type"]
+)
+
+plugin.register_semantic_types(FeatureMap, MAGtoContigs)
+plugin.register_semantic_type_to_format(
+    FeatureMap[MAGtoContigs], artifact_format=MAGtoContigsDirFmt
+)


=====================================
q2_types/feature_map/tests/__init__.py
=====================================
@@ -0,0 +1,7 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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.
+# ----------------------------------------------------------------------------


=====================================
q2_types/feature_map/tests/data/mag-to-contigs-empty-list.json
=====================================
@@ -0,0 +1,15 @@
+{
+    "23c5b64e-3f3e-4688-9862-e9dae4fa0f5b": [
+      "contig1",
+      "contig2"
+    ],
+    "70c5a728-96a6-4eed-b9f9-9a73153c1385": [
+      "contig3",
+      "contig4"
+    ],
+    "7e2a749a-a19a-4b62-8195-0ee601b5fdfb": [
+      "contig1",
+      "contig3"
+    ],
+    "6232c7e1-8ed7-47c8-9bdb-b94706a26931": []
+  }


=====================================
q2_types/feature_map/tests/data/mag-to-contigs-invalid-ids.json
=====================================
@@ -0,0 +1,18 @@
+{
+    "23c5b64e-3f3e-4688-9862-e9dae4fa0f5b": [
+      "contig1",
+      "contig2"
+    ],
+    "70c5a728-96a6-4eed-b9f9-9a73153c1385": [
+      "contig3",
+      "contig4"
+    ],
+    "7e2a749a-a19a-4b62-8195-0ee601b5fdfb": [
+      "contig1",
+      "contig3"
+    ],
+    "6232c7e1": [
+      "contig2",
+      "contig5"
+    ]
+  }


=====================================
q2_types/feature_map/tests/data/mag-to-contigs-invalid-values.json
=====================================
@@ -0,0 +1,15 @@
+{
+    "23c5b64e-3f3e-4688-9862-e9dae4fa0f5b": [
+      "contig1",
+      "contig2"
+    ],
+    "70c5a728-96a6-4eed-b9f9-9a73153c1385": [
+      "contig3",
+      "contig4"
+    ],
+    "7e2a749a-a19a-4b62-8195-0ee601b5fdfb": [
+      "contig1",
+      "contig3"
+    ],
+    "6232c7e1-8ed7-47c8-9bdb-b94706a26931": "abc"
+  }


=====================================
q2_types/feature_map/tests/data/mag-to-contigs-valid.json
=====================================
@@ -0,0 +1,18 @@
+{
+    "23c5b64e-3f3e-4688-9862-e9dae4fa0f5b": [
+      "contig1",
+      "contig2"
+    ],
+    "70c5a728-96a6-4eed-b9f9-9a73153c1385": [
+      "contig3"
+    ],
+    "7e2a749a-a19a-4b62-8195-0ee601b5fdfb": [
+      "contig1",
+      "contig3",
+      "contig4"
+    ],
+    "6232c7e1-8ed7-47c8-9bdb-b94706a26931": [
+      "contig2",
+      "contig5"
+    ]
+  }


=====================================
q2_types/feature_map/tests/test_format.py
=====================================
@@ -0,0 +1,58 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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 unittest
+
+from qiime2.core.exceptions import ValidationError
+from qiime2.plugin.testing import TestPluginBase
+
+from .._format import MAGtoContigsFormat
+
+
+class TestFormats(TestPluginBase):
+    package = "q2_types.feature_map.tests"
+
+    def test_mag_to_contigs_valid_min(self):
+        fp = self.get_data_path("mag-to-contigs-valid.json")
+        fmt = MAGtoContigsFormat(fp, mode="r")
+        fmt.validate(level="min")
+
+    def test_mag_to_contigs_valid_max(self):
+        fp = self.get_data_path("mag-to-contigs-valid.json")
+        fmt = MAGtoContigsFormat(fp, mode="r")
+        fmt.validate(level="max")
+
+    def test_mag_to_contigs_has_invalid_ids(self):
+        fp = self.get_data_path("mag-to-contigs-invalid-ids.json")
+        fmt = MAGtoContigsFormat(fp, mode="r")
+        with self.assertRaisesRegex(
+            ValidationError, 'Found "6232c7e1", which is invalid.'
+        ):
+            fmt.validate(level="max")
+
+    def test_mag_to_contigs_has_invalid_values(self):
+        fp = self.get_data_path("mag-to-contigs-invalid-values.json")
+        fmt = MAGtoContigsFormat(fp, mode="r")
+        with self.assertRaisesRegex(
+            ValidationError,
+            'Found "<class \'str\'>" for MAG '
+            '"6232c7e1-8ed7-47c8-9bdb-b94706a26931".',
+        ):
+            fmt.validate(level="max")
+
+    def test_mag_to_contigs_has_no_contigs(self):
+        fp = self.get_data_path("mag-to-contigs-empty-list.json")
+        fmt = MAGtoContigsFormat(fp, mode="r")
+        with self.assertRaisesRegex(
+            ValidationError,
+            'MAG "6232c7e1-8ed7-47c8-9bdb-b94706a26931" is empty.',
+        ):
+            fmt.validate(level="max")
+
+
+if __name__ == "__main__":
+    unittest.main()


=====================================
q2_types/feature_map/tests/test_transformer.py
=====================================
@@ -0,0 +1,49 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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 json
+import unittest
+
+from qiime2.plugin.testing import TestPluginBase
+
+from .._format import MAGtoContigsFormat
+
+
+class TestTransformers(TestPluginBase):
+    package = "q2_types.feature_map.tests"
+
+    def setUp(self):
+        super().setUp()
+        self.valid_contig_map = {
+            "23c5b64e-3f3e-4688-9862-e9dae4fa0f5b": ["contig1", "contig2"],
+            "70c5a728-96a6-4eed-b9f9-9a73153c1385": ["contig3"],
+            "7e2a749a-a19a-4b62-8195-0ee601b5fdfb": [
+                "contig1", "contig3", "contig4"
+            ],
+            "6232c7e1-8ed7-47c8-9bdb-b94706a26931": ["contig2", "contig5"],
+        }
+
+    def test_contig_map_to_dict(self):
+        transformer = self.get_transformer(MAGtoContigsFormat, dict)
+        _input = MAGtoContigsFormat(
+            self.get_data_path("mag-to-contigs-valid.json"), "r"
+        )
+
+        obs = transformer(_input)
+        self.assertDictEqual(self.valid_contig_map, obs)
+
+    def test_dict_to_contig_map(self):
+        transformer = self.get_transformer(dict, MAGtoContigsFormat)
+        obs_fp = transformer(self.valid_contig_map)
+
+        with obs_fp.open() as obs_fh:
+            obs = json.load(obs_fh)
+        self.assertDictEqual(self.valid_contig_map, obs)
+
+
+if __name__ == "__main__":
+    unittest.main()


=====================================
q2_types/feature_map/tests/test_type.py
=====================================
@@ -0,0 +1,32 @@
+# ----------------------------------------------------------------------------
+# Copyright (c) 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 unittest
+
+from qiime2.plugin.testing import TestPluginBase
+
+from .._type import (FeatureMap, MAGtoContigs)
+from .._format import MAGtoContigsDirFmt
+
+
+class TestTypes(TestPluginBase):
+    package = "q2_types.feature_map.tests"
+
+    def test_feature_map_semantic_type_registration(self):
+        self.assertRegisteredSemanticType(FeatureMap)
+
+    def test_feature_map_mag_to_contigs_semantic_type_registration(self):
+        self.assertRegisteredSemanticType(MAGtoContigs)
+
+    def test_feature_map_to_dir_fmt_registration(self):
+        self.assertSemanticTypeRegisteredToFormat(
+            FeatureMap[MAGtoContigs], MAGtoContigsDirFmt
+        )
+
+
+if __name__ == "__main__":
+    unittest.main()


=====================================
setup.py
=====================================
@@ -29,6 +29,7 @@ setup(
         'q2_types.tests': ['data/*'],
         'q2_types.distance_matrix.tests': ['data/*'],
         'q2_types.feature_data.tests': ['data/*', 'data/taxonomy/*'],
+        'q2_types.feature_map.tests': ['data/*'],
         'q2_types.feature_table.tests': ['data/*'],
         'q2_types.metadata.tests': ['data/*'],
         'q2_types.multiplexed_sequences.tests': ['data/*'],



View it on GitLab: https://salsa.debian.org/med-team/q2-types/-/compare/33d216791b4c00e41fe156b76f3e3ae5ae3a2fab...664d5c0e47019e6cee93364abbbe2bbab1c5b470

-- 
View it on GitLab: https://salsa.debian.org/med-team/q2-types/-/compare/33d216791b4c00e41fe156b76f3e3ae5ae3a2fab...664d5c0e47019e6cee93364abbbe2bbab1c5b470
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/20240129/e84299b1/attachment-0001.htm>


More information about the debian-med-commit mailing list