Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/uk/ac/ebi/vfb/neo4j/KB_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,14 @@ def add_fact(self, s, r, o, edge_annotations = None,
match_on=match_on,
safe_label_edge=safe_label_edge)

def add_xref(self, s, xref, stype=''):
def add_xref(self, s, xref, otype=':Site', stype=''):
"""Add an xref axiom"""
# Add regex test for xref
x = xref.split(':')
self.add_annotation_axiom(s=s,
r='hasDbXref',
o=x[0],
otype=':Site',
otype=otype,
stype=stype,
edge_annotations={'accession': x[1]},
match_on='short_form',
Expand Down Expand Up @@ -874,6 +874,7 @@ def add_anatomy_image_set(self,
anatomy_attributes=None,
dbxrefs=None,
dbxref_strings=None,
dbxref_type=':Site',
image_filename='',
match_on='short_form',
orcid='',
Expand All @@ -894,6 +895,7 @@ def add_anatomy_image_set(self,
template: channel ID of the template to which the image is registered
start: Start of range for generation of new accessions
dbxrefs: dict of DB:accession pairs
dbxref_type: type of node for object of hasDbXref relationship, ':Site' by default.
anatomy_attributes: Dict of property:value for anatomy node

hard_fail: Boolean. If True, throw exception for uknown entitise referenced in args"""
Expand Down Expand Up @@ -941,7 +943,7 @@ def add_anatomy_image_set(self,
for db, acc in dbxrefs.items():
self.ec.roll_dbxref_check(db, acc)
if not self.ec.check(hard_fail=hard_fail):
warnings.warn("Load fail: Cross-referenced enties already exist.")
warnings.warn("Load fail: Cross-referenced entities already exist.")
return False

if not self.ec.check(hard_fail=hard_fail):
Expand Down Expand Up @@ -974,15 +976,11 @@ def add_anatomy_image_set(self,

if dbxrefs:
for db, acc in dbxrefs.items():
self.ew.add_annotation_axiom(s=anat_id['short_form'],
r='hasDbXref',
o=db,
stype=':Individual',
otype=':Individual:Site',
match_on='short_form',
edge_annotations={'accession': acc},
safe_label_edge=True
)
self.ew.add_xref(s=anat_id['short_form'],
xref=':'.join([db, acc]),
stype=':Individual',
otype=':Individual' + dbxref_type,
)
if orcid:
self.ew.add_annotation_axiom(s=anat_id['short_form'],
r='contributor',
Expand Down