From 5fd8dc289c85503d2949a69cd17f904ab36bdfa3 Mon Sep 17 00:00:00 2001 From: azneto Date: Tue, 1 Jun 2021 15:08:54 -0300 Subject: [PATCH 01/10] exception handling --- machado/loaders/common.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/machado/loaders/common.py b/machado/loaders/common.py index 3899aaf2..3ef786a2 100644 --- a/machado/loaders/common.py +++ b/machado/loaders/common.py @@ -176,8 +176,11 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: pass # featuredbxref.dbxref.accession - return FeatureDbxref.objects.get( - dbxref__accession=accession, - feature__type__cv__name="sequence", - feature__type__name=soterm, - ).feature_id + try: + return FeatureDbxref.objects.get( + dbxref__accession=accession, + feature__type__cv__name="sequence", + feature__type__name=soterm, + ).feature_id + except ObjectDoesNotExist: + raise ImportingError("{} {} does not exist".format(soterm, accession)) From 15cc10bb67d909fd77f9ce61efb32a8249a85d84 Mon Sep 17 00:00:00 2001 From: azneto Date: Tue, 1 Jun 2021 16:13:48 -0300 Subject: [PATCH 02/10] updates retrieve_feature_id to ignore case --- machado/loaders/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/machado/loaders/common.py b/machado/loaders/common.py index 3ef786a2..d76e9654 100644 --- a/machado/loaders/common.py +++ b/machado/loaders/common.py @@ -162,7 +162,7 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: # feature.name try: return Feature.objects.get( - name=accession, type__cv__name="sequence", type__name=soterm + name__iexact=accession, type__cv__name="sequence", type__name=soterm ).feature_id except (MultipleObjectsReturned, ObjectDoesNotExist): pass @@ -170,7 +170,7 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: # feature.dbxref.accession try: return Feature.objects.get( - dbxref__accession=accession, type__cv__name="sequence", type__name=soterm + dbxref__accession__iexact=accession, type__cv__name="sequence", type__name=soterm ).feature_id except (MultipleObjectsReturned, ObjectDoesNotExist): pass @@ -178,7 +178,7 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: # featuredbxref.dbxref.accession try: return FeatureDbxref.objects.get( - dbxref__accession=accession, + dbxref__accession__iexact=accession, feature__type__cv__name="sequence", feature__type__name=soterm, ).feature_id From 5fbc6ac30c85510004b6230214f22864c2e614f3 Mon Sep 17 00:00:00 2001 From: azneto Date: Tue, 1 Jun 2021 16:48:39 -0300 Subject: [PATCH 03/10] exception handling --- machado/loaders/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/machado/loaders/common.py b/machado/loaders/common.py index d76e9654..4c4bc851 100644 --- a/machado/loaders/common.py +++ b/machado/loaders/common.py @@ -184,3 +184,5 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: ).feature_id except ObjectDoesNotExist: raise ImportingError("{} {} does not exist".format(soterm, accession)) + except MultipleObjectsReturned: + raise ImportingError("{} {} matches multiple features".format(soterm, accession)) From c61084a349fd4c42cae8b0ef1ac06f2fe26de46f Mon Sep 17 00:00:00 2001 From: adhemar Date: Tue, 8 Jun 2021 09:23:26 -0300 Subject: [PATCH 04/10] fix exception type --- machado/loaders/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/machado/loaders/common.py b/machado/loaders/common.py index 4c4bc851..d3644897 100644 --- a/machado/loaders/common.py +++ b/machado/loaders/common.py @@ -183,6 +183,6 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: feature__type__name=soterm, ).feature_id except ObjectDoesNotExist: - raise ImportingError("{} {} does not exist".format(soterm, accession)) + raise ObjectDoesNotExist("{} {} does not exist".format(soterm, accession)) except MultipleObjectsReturned: - raise ImportingError("{} {} matches multiple features".format(soterm, accession)) + raise MultipleObjectsReturned("{} {} matches multiple features".format(soterm, accession)) From ccb2136cdcb60cd4efdf8beb0b2929ac9a17be5d Mon Sep 17 00:00:00 2001 From: adhemar Date: Tue, 8 Jun 2021 09:40:20 -0300 Subject: [PATCH 05/10] updates dependencies versions --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1990670a..3f8dcb1d 100644 --- a/setup.py +++ b/setup.py @@ -32,8 +32,8 @@ install_requires=[ "django==3.1.8", "psycopg2-binary==2.8.6", + "obonet==0.3.0", "biopython==1.78", - "obonet==0.2.6", "tqdm==4.47.0", "typing==3.7.4.3", "bibtexparser==1.2.0", From d462698a65fecfd6685b2addb9d4fc7573314f9e Mon Sep 17 00:00:00 2001 From: adhemar Date: Tue, 8 Jun 2021 09:42:16 -0300 Subject: [PATCH 06/10] updates dependencies versions --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3f8dcb1d..4b58111b 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ ], scripts=["bin/fixChadoModel.py"], install_requires=[ - "django==3.1.8", + "django==3.1.12", "psycopg2-binary==2.8.6", "obonet==0.3.0", "biopython==1.78", From 2161c70c86f9fb90023bd1adc9591038bc2e3c0a Mon Sep 17 00:00:00 2001 From: adhemar Date: Tue, 8 Jun 2021 11:29:41 -0300 Subject: [PATCH 07/10] updates dependencies versions --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4b58111b..a52fb364 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ "django==3.1.12", "psycopg2-binary==2.8.6", "obonet==0.3.0", - "biopython==1.78", + "biopython==1.79", "tqdm==4.47.0", "typing==3.7.4.3", "bibtexparser==1.2.0", From cca93319f3aabbb9275d8eeb3b18a91ec8c1fc37 Mon Sep 17 00:00:00 2001 From: adhemar Date: Tue, 8 Jun 2021 11:39:09 -0300 Subject: [PATCH 08/10] updates dependencies versions --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index a52fb364..32fe1136 100644 --- a/setup.py +++ b/setup.py @@ -30,6 +30,7 @@ ], scripts=["bin/fixChadoModel.py"], install_requires=[ + "numpy>=1.19", "django==3.1.12", "psycopg2-binary==2.8.6", "obonet==0.3.0", From 15024e42862fa77fad7afdecd9caf735f1834672 Mon Sep 17 00:00:00 2001 From: adhemar Date: Tue, 8 Jun 2021 11:43:35 -0300 Subject: [PATCH 09/10] black --- machado/loaders/common.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/machado/loaders/common.py b/machado/loaders/common.py index d3644897..555654db 100644 --- a/machado/loaders/common.py +++ b/machado/loaders/common.py @@ -170,7 +170,9 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: # feature.dbxref.accession try: return Feature.objects.get( - dbxref__accession__iexact=accession, type__cv__name="sequence", type__name=soterm + dbxref__accession__iexact=accession, + type__cv__name="sequence", + type__name=soterm, ).feature_id except (MultipleObjectsReturned, ObjectDoesNotExist): pass @@ -185,4 +187,6 @@ def retrieve_feature_id(accession: str, soterm: str) -> int: except ObjectDoesNotExist: raise ObjectDoesNotExist("{} {} does not exist".format(soterm, accession)) except MultipleObjectsReturned: - raise MultipleObjectsReturned("{} {} matches multiple features".format(soterm, accession)) + raise MultipleObjectsReturned( + "{} {} matches multiple features".format(soterm, accession) + ) From 55b508410659a768b4e4b999d6a58cae64e23d97 Mon Sep 17 00:00:00 2001 From: adhemar Date: Tue, 8 Jun 2021 13:42:06 -0300 Subject: [PATCH 10/10] updates travis-ci --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 500bede7..1132696b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,18 +4,18 @@ os: linux jobs: include: - - dist: bionic - python: "3.6" - dist: bionic python: "3.7" - dist: bionic python: "3.8" - - dist: xenial - python: "3.6" + - dist: bionic + python: "3.9" - dist: xenial python: "3.7" - dist: xenial python: "3.8" + - dist: xenial + python: "3.9" services: - postgresql