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

fix flake8

parent 2c1e3d6b
No related branches found
No related tags found
1 merge request!3Integrate taxonomy to database
Pipeline #13212 passed
...@@ -29,7 +29,7 @@ class KEGGLineParser(object): ...@@ -29,7 +29,7 @@ class KEGGLineParser(object):
'long_name': names[1].lstrip(), 'long_name': names[1].lstrip(),
'ec_number': ec_number 'ec_number': ec_number
} }
except: except Exception:
_LOGGER.error(f"Could not parse: {line.rstrip()}. Are you sure it comes from KEGG KO list?") _LOGGER.error(f"Could not parse: {line.rstrip()}. Are you sure it comes from KEGG KO list?")
raise raise
...@@ -61,23 +61,24 @@ class NCBITaxonomyLineParser(object): ...@@ -61,23 +61,24 @@ class NCBITaxonomyLineParser(object):
comments -- free-text comments and citations comments -- free-text comments and citations
""" """
elements = line.rstrip().split('|') elements = line.rstrip().split('|')
elements = [element.strip() for element in elements]
try: try:
return { return {
"tax_id": elements[0].strip(), "tax_id": elements[0],
"parent_tax_id": elements[1].strip(), "parent_tax_id": elements[1],
"rank": elements[2].strip(), "rank": elements[2].replace(' ', '_'),
"embl_code": elements[3].strip(), "embl_code": elements[3],
"division_id": elements[4].strip(), "division_id": elements[4],
"inherited_div_flag": elements[5].strip(), "inherited_div_flag": elements[5],
"genetic_code_id": elements[6].strip(), "genetic_code_id": elements[6],
"inherited_GC_flag": elements[7].strip(), "inherited_GC_flag": elements[7],
"mitochondrial_genetic_code_id": elements[8].strip(), "mitochondrial_genetic_code_id": elements[8],
"inherited_MGC_flag": elements[9].strip(), "inherited_MGC_flag": elements[9],
"GenBank_hidden_flag": elements[10].strip(), "GenBank_hidden_flag": elements[10],
"hidden_subtree_root_flag": elements[11].strip(), "hidden_subtree_root_flag": elements[11],
"comments": elements[12].strip() "comments": elements[12]
} }
except: except Exception:
_LOGGER.error(f"Could not parse: {line.rstrip()}. Are you sure it comes from nodes.dmp file?") _LOGGER.error(f"Could not parse: {line.rstrip()}. Are you sure it comes from nodes.dmp file?")
raise raise
...@@ -102,6 +103,6 @@ class NCBITaxonomyLineParser(object): ...@@ -102,6 +103,6 @@ class NCBITaxonomyLineParser(object):
"unique_name": elements[2].strip(), "unique_name": elements[2].strip(),
"name_class": elements[3].strip(), "name_class": elements[3].strip(),
} }
except: except Exception:
_LOGGER.error(f"Could not parse: {line.rstrip()}. Are you sure it comes from nodes.dmp file?") _LOGGER.error(f"Could not parse: {line.rstrip()}. Are you sure it comes from nodes.dmp file?")
raise raise
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