Skip to content
Snippets Groups Projects
Commit e7c74843 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion :recycle:
Browse files

parse functional category as a list instead of unique value

parent 4f5b73fc
No related branches found
No related tags found
2 merge requests!59Prod,!25integration eggnog to catalog
Pipeline #19695 passed
...@@ -13,7 +13,7 @@ class EggNogAnnotationLineParser(object): ...@@ -13,7 +13,7 @@ class EggNogAnnotationLineParser(object):
try: try:
elements = line.split('\t') elements = line.split('\t')
return { return {
'functional_category': elements[2], 'functional_category': list(elements[2]),
'function_id': elements[1], 'function_id': elements[1],
'name': elements[3].rstrip().split('.')[0], 'name': elements[3].rstrip().split('.')[0],
} }
......
...@@ -10,7 +10,7 @@ class TestEggNogAnnotationLineParser(TestCase): ...@@ -10,7 +10,7 @@ class TestEggNogAnnotationLineParser(TestCase):
expected_dict = { expected_dict = {
'function_id': "28H54", 'function_id': "28H54",
'name': "translational termination", 'name': "translational termination",
'functional_category': "K" 'functional_category': ["K"]
} }
test_dict = EggNogAnnotationLineParser.get_dict(ko_line) test_dict = EggNogAnnotationLineParser.get_dict(ko_line)
self.assertDictEqual(test_dict, expected_dict) self.assertDictEqual(test_dict, expected_dict)
...@@ -20,7 +20,7 @@ class TestEggNogAnnotationLineParser(TestCase): ...@@ -20,7 +20,7 @@ class TestEggNogAnnotationLineParser(TestCase):
expected_dict = { expected_dict = {
'function_id': "28H50", 'function_id': "28H50",
'name': "", 'name': "",
'functional_category': "S" 'functional_category': ["S"]
} }
test_dict = EggNogAnnotationLineParser.get_dict(ko_line) test_dict = EggNogAnnotationLineParser.get_dict(ko_line)
self.assertDictEqual(test_dict, expected_dict) self.assertDictEqual(test_dict, expected_dict)
...@@ -30,7 +30,17 @@ class TestEggNogAnnotationLineParser(TestCase): ...@@ -30,7 +30,17 @@ class TestEggNogAnnotationLineParser(TestCase):
expected_dict = { expected_dict = {
'function_id': "28H50", 'function_id': "28H50",
'name': "Glucose-responsive transcription factor that regulates expression of several glucose transporter (HXT) genes in response to glucose", # noqa '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) test_dict = EggNogAnnotationLineParser.get_dict(ko_line)
self.assertDictEqual(test_dict, expected_dict) self.assertDictEqual(test_dict, expected_dict)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment