Skip to content

Commit

Permalink
Fix bug with repeating edges when parsing co-occurrence data from Sci…
Browse files Browse the repository at this point in the history
…Bite
  • Loading branch information
deepakunni3 committed Jun 8, 2020
1 parent 43a1f2d commit 4ac72b2
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions kg_covid_19/transform_utils/scibite_cord/scibite_cord.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run(self, data_file: Optional[str] = None) -> None:
edge_handle = open(self.output_edge_file, 'w')
node_handle.write("\t".join(self.node_header) + "\n")
edge_handle.write("\t".join(self.edge_header) + "\n")
self.parse_annotations(node_handle, edge_handle, data_files[0])
#self.parse_annotations(node_handle, edge_handle, data_files[0])

node_handle = open(os.path.join(self.output_dir, "entity_cooccurrence_nodes.tsv"), 'w')
edge_handle = open(os.path.join(self.output_dir, "entity_cooccurrence_edges.tsv"), 'w')
Expand Down Expand Up @@ -270,17 +270,19 @@ def parse_cooccurrence_record(self, node_handle: Any, edge_handle: Any, record:
# simplified generation of edges between OntologyClass and the publication where
# OntologyClass -> correlated_with -> Publication
# with the edge having relation RO:0002610
write_node_edge_item(
fh=edge_handle,
header=self.edge_header,
data=[
f"{curie}",
"biolink:correlated_with",
f"{paper_curie}",
f"RO:0002610", # 'correlated with'
f"{self.source_name} co-occurrences"
]
)
if (curie, paper_curie) not in self.seen:
write_node_edge_item(
fh=edge_handle,
header=self.edge_header,
data=[
f"{curie}",
"biolink:correlated_with",
f"{paper_curie}",
f"RO:0002610", # 'correlated with'
f"{self.source_name} co-occurrences"
]
)
self.seen.add((curie, paper_curie))

# This is an earlier style of modeling that involves an InformationContentEntity for every instance of
# co-occurrence between a Publication and a set of OntologyClass
Expand Down

0 comments on commit 4ac72b2

Please sign in to comment.