Skip to content

Commit

Permalink
Merge in changes to SciBite-CORD19 data from master
Browse files Browse the repository at this point in the history
  • Loading branch information
justaddcoffee committed Jul 9, 2020
2 parents 7367358 + 69060a4 commit 0a5fc26
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions kg_covid_19/transform_utils/scibite_cord/scibite_cord.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ def run(self, data_file: Optional[str] = None) -> None:
else:
data_files.extend(data_files)

self.node_header = ['id', 'name', 'category', 'description', 'provided_by']
self.edge_header = ['subject', 'edge_label', 'object', 'relation', 'provided_by']
self.node_header = ['id', 'name', 'category', 'description']
self.edge_header = ['subject', 'edge_label', 'object', 'relation', 'provided_by',
'publications']

node_handle = open(self.output_node_file, 'w')
edge_handle = open(self.output_edge_file, 'w')
node_handle.write("\t".join(self.node_header) + "\n")
Expand Down Expand Up @@ -191,7 +193,8 @@ def parse_annotation_doc(self, node_handle, edge_handle, doc: Dict, subset: str
f"biolink:related_to",
f"CORD:{paper_id}",
"SIO:000255",
provided_by
provided_by,
f"CORD:{paper_id}"
]
)

Expand Down Expand Up @@ -282,6 +285,7 @@ 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

if (curie, paper_curie) not in self.seen:
write_node_edge_item(
fh=edge_handle,
Expand All @@ -296,6 +300,19 @@ def parse_cooccurrence_record(self, node_handle: Any, edge_handle: Any, record:
)
self.seen.add((curie, paper_curie))

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",
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 0a5fc26

Please sign in to comment.