Commit e7c74843 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

parse functional category as a list instead of unique value

parent 4f5b73fc
Pipeline #19695 passed with stages
in 2 minutes and 22 seconds
......@@ -13,7 +13,7 @@ class EggNogAnnotationLineParser(object):
try:
elements = line.split('\t')
return {
'functional_category': elements[2],
'functional_category': list(elements[2]),
'function_id': elements[1],
'name': elements[3].rstrip().split('.')[0],
}
......
......@@ -10,7 +10,7 @@ class TestEggNogAnnotationLineParser(TestCase):
expected_dict = {
'function_id': "28H54",
'name': "translational termination",
'functional_category': "K"
'functional_category': ["K"]
}
test_dict = EggNogAnnotationLineParser.get_dict(ko_line)
self.assertDictEqual(test_dict, expected_dict)
......@@ -20,7 +20,7 @@ class TestEggNogAnnotationLineParser(TestCase):
expected_dict = {
'function_id': "28H50",
'name': "",
'functional_category': "S"
'functional_category': ["S"]
}
test_dict = EggNogAnnotationLineParser.get_dict(ko_line)
self.assertDictEqual(test_dict, expected_dict)
......@@ -30,7 +30,17 @@ class TestEggNogAnnotationLineParser(TestCase):
expected_dict = {
'function_id': "28H50",
'name': "Glucose-responsive transcription factor that regulates expression of several glucose transporter (HXT) genes in response to glucose", # noqa
'functional_category': "S"
'functional_category': ["S"]
}
test_dict = EggNogAnnotationLineParser.get_dict(ko_line)
self.assertDictEqual(test_dict, expected_dict)
def test_get_dict_multi_categories(self):
ko_line = "1\t28H54\tKS\ttranslational termination\n"
expected_dict = {
'function_id': "28H54",
'name': "translational termination",
'functional_category': ["K", "S"]
}
test_dict = EggNogAnnotationLineParser.get_dict(ko_line)
self.assertDictEqual(test_dict, expected_dict)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment