Skip to content

Commit 3a254e9

Browse files
authored
Merge pull request #21 from mboudet/master
Decode feature_id when searching in cache.
2 parents 9982cb7 + c83db9e commit 3a254e9

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ $ chakin feature load_fasta \
8787
8888
## History
8989
90+
- 2.3.9
91+
- URL decode GFF ids when loading blast/interpro/others
92+
9093
- 2.3.8
9194
- Fix connection closed error when loading big interproscan files
9295

chado/client.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from __future__ import unicode_literals
77

88
import re
9+
from urllib.parse import unquote
910

1011
from chado.exceptions import RecordNotFoundError
1112

@@ -116,15 +117,22 @@ def _match_feature(self, feature_id, re_name, query_type, organism_id, skip_miss
116117
re_res = re.search(re_name, feature_id)
117118
if re_res:
118119
feature_id = re_res.group(1)
120+
else:
121+
re_res = re.search(re_name, unquote(feature_id))
122+
if re_res:
123+
feature_id = re_res.group(1)
119124

120125
cache_id = (feature_id, organism_id, seqterm)
121126

122127
if cache_id not in self._feature_cache:
123-
if skip_missing:
124-
warn('Could not find feature with name "%s", skipping it', feature_id)
125-
return None
126-
else:
127-
raise RecordNotFoundError('Could not find feature with name "%s"' % feature_id)
128+
# Check after decoding
129+
cache_id = (unquote(feature_id), organism_id, seqterm)
130+
if cache_id not in self._feature_cache:
131+
if skip_missing:
132+
warn('Could not find feature with name "%s", skipping it', feature_id)
133+
return None
134+
else:
135+
raise RecordNotFoundError('Could not find feature with name "%s"' % feature_id)
128136

129137
return self._feature_cache[cache_id]['feature_id']
130138

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="chado",
9-
version='2.3.8',
9+
version='2.3.9',
1010
description="Chado library",
1111
author="Anthony Bretaudeau",
1212
author_email="anthony.bretaudeau@inrae.fr",

0 commit comments

Comments
 (0)