Skip to content

Commit

Permalink
avoids crashing if OG annotation not in db. fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
jhcepas committed Apr 18, 2017
1 parent 1db6845 commit 237788e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eggnogmapper/annota.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def get_og_annotations(ogname):
cmd = 'SELECT level, nm, description, COG_categories FROM og WHERE og.og = "%s"' % ogname
level, nm, desc, cat = None, None, None, None
if db.execute(cmd):
level, nm, desc, cat = db.fetchone()
cat = re.sub(cog_cat_cleaner, '', cat)
try:
level, nm, desc, cat = db.fetchone()
except TypeError: # avoids crashing ig no annotation for OG viral
desc, cat = '', ''
else:
cat = re.sub(cog_cat_cleaner, '', cat)
return level, nm, desc, cat


Expand Down

0 comments on commit 237788e

Please sign in to comment.