Skip to content

Commit

Permalink
Refactoring template generation (#156)
Browse files Browse the repository at this point in the history
* refactoring relationship verification

* refactoring template generation

* fix entity check and update og2dot call

* fix og2dot call

* refact connected_to check

* refact indirect query and fix non valid log

* move 'get graphs' to UberonGraph class

Co-authored-by: Anita Caron <anitacaron@users.noreply.github.com>
  • Loading branch information
Anita Caron and anitacaron authored Aug 25, 2022
1 parent 4f1be9a commit a8322c3
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 281 deletions.
21 changes: 20 additions & 1 deletion src/ccf_tools.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pandas as pd
import rdflib
import re
import logging
import sys
import json
from datetime import datetime

class DuplicateFilter(logging.Filter):
def filter(self, record):
Expand Down Expand Up @@ -209,3 +209,22 @@ def split_terms(list):
terms_o.append(o[:-1])

return terms_s, terms_o

def add_rows(records, valid_as, valid_ct, pairs, relation, inverse=False):
for s, o in pairs:
rec = dict()
if inverse:
rec['ID'] = o
rec[relation] = s
else:
rec['ID'] = s
rec[relation] = o
rec['OBO_Validated_' + relation] = True
rec['validation_date_' + relation] = datetime.now().isoformat()
records.append(rec)

if 'UBERON' in s and 'UBERON' in o:
valid_as.add((s,o))
elif 'CL' in s and 'CL' in o:
valid_ct.add((s,o))
return records, valid_as, valid_ct
Loading

0 comments on commit a8322c3

Please sign in to comment.