Skip to content

Commit

Permalink
Merge pull request #313 from azneto/master
Browse files Browse the repository at this point in the history
updates retrieve_feature_id to ignore case
  • Loading branch information
azneto authored Jun 8, 2021
2 parents 5e0ae62 + 55b5084 commit 7a99773
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 16 additions & 7 deletions machado/loaders/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,31 @@ 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

# 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

# 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__iexact=accession,
feature__type__cv__name="sequence",
feature__type__name=soterm,
).feature_id
except ObjectDoesNotExist:
raise ObjectDoesNotExist("{} {} does not exist".format(soterm, accession))
except MultipleObjectsReturned:
raise MultipleObjectsReturned(
"{} {} matches multiple features".format(soterm, accession)
)
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
],
scripts=["bin/fixChadoModel.py"],
install_requires=[
"django==3.1.8",
"numpy>=1.19",
"django==3.1.12",
"psycopg2-binary==2.8.6",
"biopython==1.78",
"obonet==0.2.6",
"obonet==0.3.0",
"biopython==1.79",
"tqdm==4.47.0",
"typing==3.7.4.3",
"bibtexparser==1.2.0",
Expand Down

0 comments on commit 7a99773

Please sign in to comment.