Skip to content

Commit f571de3

Browse files
committed
fix a bug that shredding annotation fails when there is a semicolon at the end of attribute field in GFF, or when attributes have no {}={} format
1 parent ddc1a92 commit f571de3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/agouti_shred.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def get_attributes(attribute):
1313
dAttrs = {}
1414
tmp_attributes = attribute.split(';')
1515
for i in range(len(tmp_attributes)):
16-
tmp_attribute = tmp_attributes[i].split('=')
17-
attributeName = tmp_attribute[0]
18-
attributeValue = tmp_attribute[1]
19-
if attributeName not in dAttrs:
20-
dAttrs[attributeName] = attributeValue
16+
if tmp_attributes[i]:
17+
tmp_attribute = tmp_attributes[i].split('=')
18+
attributeName = tmp_attribute[0]
19+
attributeValue = tmp_attribute[1]
20+
if attributeName not in dAttrs:
21+
dAttrs[attributeName] = attributeValue
2122

2223
return dAttrs
2324

0 commit comments

Comments
 (0)