Skip to content

Commit dd626e1

Browse files
Merge pull request #148 from NAL-i5K/fix/gff3-merge-nonnumeric-root-id
Fix gff3_merge crash on non-numeric root IDs
2 parents 68ec198 + 09843c8 commit dd626e1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

gff3tool/lib/replace_OGS.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,15 @@ def name2id(self, Mgff, user_defined2=None):
479479
unique.add(root['line_raw'])
480480
# roots = [line for line in Mgff.lines if line['line_type'] == 'feature' and 'Parent' not in line['attributes']]
481481
mapName2ID = {}
482-
tmp = re.search(r'(.+?)(\d+)',roots[0]['attributes']['ID'])
483-
idprefix = tmp.groups()[0]
482+
idprefix = ''
484483
maxIDnumber = 0
485484
digitlen = 0
485+
for root in roots:
486+
root_id = root['attributes'].get('ID', '')
487+
tmp = re.search(r'(.+?)(\d+)', root_id)
488+
if tmp:
489+
idprefix = tmp.groups()[0]
490+
break
486491
id2name={}
487492
for root in roots:
488493
rootid = root['attributes']['ID']

0 commit comments

Comments
 (0)