From e4c18217e06ff99904c783c49d29459347b0237a Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Mon, 23 Sep 2024 09:28:26 -0700 Subject: [PATCH 1/4] Add test_i304_regulates.py --- tests/test_i304_regulates.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/test_i304_regulates.py diff --git a/tests/test_i304_regulates.py b/tests/test_i304_regulates.py new file mode 100644 index 0000000..1ea0389 --- /dev/null +++ b/tests/test_i304_regulates.py @@ -0,0 +1,15 @@ +from goatools.gosubdag.gosubdag import GoSubDag +from goatools.obo_parser import GODag + + +def test_i304_regulates(): + godag = GODag("go-basic.obo", optional_attrs=["relationship"]) + optional_relationships = { + "regulates", + "negatively_regulates", + "positively_regulates", + } + anc = GoSubDag( + ["GO:0019222"], godag, optional_relationships, prt=None + ).rcntobj.go2ancestors["GO:0019222"] + assert len(anc) == 4 From dbf3e354dbff48ede31911c5b70d2213b8a09bae Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Fri, 8 Nov 2024 20:55:05 -0800 Subject: [PATCH 2/4] update version --- goatools/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/goatools/__init__.py b/goatools/__init__.py index 1da4e38..2200940 100644 --- a/goatools/__init__.py +++ b/goatools/__init__.py @@ -1,5 +1,5 @@ from datetime import datetime -from pkg_resources import get_distribution, DistributionNotFound +from importlib.metadata import version, PackageNotFoundError __author__ = ("Haibao Tang", "DV Klopfenstein") __copyright__ = "Copyright (C) 2009-{}, Haibao Tang, DV Klopfenstein".format( @@ -10,7 +10,7 @@ __status__ = "Development" try: - VERSION = get_distribution(__name__).version + VERSION = version(__name__) except DistributionNotFound: # pragma: no cover try: from .version import version as VERSION # noqa From 0147fe3f13d197a8dbf51514a8c3cf9ad930978e Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Fri, 8 Nov 2024 20:58:45 -0800 Subject: [PATCH 3/4] minor --- goatools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goatools/__init__.py b/goatools/__init__.py index 2200940..ee7067d 100644 --- a/goatools/__init__.py +++ b/goatools/__init__.py @@ -11,7 +11,7 @@ try: VERSION = version(__name__) -except DistributionNotFound: # pragma: no cover +except PackageNotFoundError: # pragma: no cover try: from .version import version as VERSION # noqa except ImportError: # pragma: no cover From d968357480d3c72d24aea0a7907c0c9478ab99c5 Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Fri, 8 Nov 2024 21:02:34 -0800 Subject: [PATCH 4/4] update __init__.py --- goatools/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/goatools/__init__.py b/goatools/__init__.py index ee7067d..3a332cd 100644 --- a/goatools/__init__.py +++ b/goatools/__init__.py @@ -2,8 +2,8 @@ from importlib.metadata import version, PackageNotFoundError __author__ = ("Haibao Tang", "DV Klopfenstein") -__copyright__ = "Copyright (C) 2009-{}, Haibao Tang, DV Klopfenstein".format( - datetime.now().year +__copyright__ = ( + f"Copyright (C) 2009-{datetime.now().year}, Haibao Tang, DV Klopfenstein" ) __email__ = "tanghaibao@gmail.com" __license__ = "BSD" @@ -14,10 +14,10 @@ except PackageNotFoundError: # pragma: no cover try: from .version import version as VERSION # noqa - except ImportError: # pragma: no cover + except ImportError as exc: # pragma: no cover raise ImportError( "Failed to find (autogenerated) version.py. " "This might be because you are installing from GitHub's tarballs, " "use the PyPI ones." - ) + ) from exc __version__ = VERSION