Skip to content

Commit

Permalink
Merge pull request #208 from Knowledge-Graph-Hub/mondo_column_fix
Browse files Browse the repository at this point in the history
fix mondo columns numbers
  • Loading branch information
hrshdhgd authored Aug 8, 2024
2 parents 0da341f + a777e52 commit 1ff1721
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kg_microbe/transform_utils/ontology/ontology_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def _replace_special_prefixes(line):

def _replace_quotation_marks(line, description_index):
"""Replace single and double quotation marks."""
parts = line.strip().split("\t")
parts = line.split("\t")
parts = [i.strip() for i in parts]
parts[description_index] = parts[description_index].replace('"', "").replace("'", "")
new_line = "\t".join(parts)
return new_line
Expand Down Expand Up @@ -247,14 +248,14 @@ def _replace_quotation_marks(line, description_index):
# get the index for the term 'category'
category_index = line.strip().split("\t").index(CATEGORY_COLUMN)
description_index = line.strip().split("\t").index(DESCRIPTION_COLUMN)
new_nf_lines.append(line)
else:
line = _replace_special_prefixes(line)
line = replace_category_ontology(line, id_index, category_index)
line = _replace_quotation_marks(line, description_index)
new_nf_lines.append(line + "\n")
# Rewrite nodes file
with open(nodes_file, "w") as new_nf:
new_nf.write("\t".join(self.node_header) + "\n")
for line in new_nf_lines:
new_nf.write(line)

Expand Down

0 comments on commit 1ff1721

Please sign in to comment.