Skip to content

Commit

Permalink
added a umls type filter in subclasses-looking procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiwenho committed May 29, 2024
1 parent 5a4ad7c commit 4b47719
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion medikanren2/neo/neo-server/neo-server.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

(define DEFAULT_PORT 8384)

(define NEO_SERVER_VERSION "1.42")
(define NEO_SERVER_VERSION "1.43")

;; Maximum number of results to be returned from *each individual* KP,
;; or from mediKanren itself.
Expand Down
18 changes: 13 additions & 5 deletions medikanren2/neo/neo-utils/neo-helpers-multi-db.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"../neo-reasoning/neo-biolink-reasoning.rkt"
racket/set
"neo-helpers-without-db.rkt"
racket/list)
racket/list
racket/string)

(define (curie->synonyms-in-db curie)
(curies-in-db (curie->synonyms curie)))
Expand Down Expand Up @@ -93,21 +94,28 @@
(set->list new-curies)
(list (list 1111) #f (list 1111)))))))))

(define (curie-is-type? curie type)
(let* ((node-prop (curie->properties curie))
(umls-description (assoc "description" node-prop)))
(and umls-description (string-contains? (cadr umls-description) type))))

(define (get-n-descendent-curies*-in-db curies n)
(list->set
(append curies
(let loop ((r '()) (c curies))
(if (or (> (length r) n) (= (length r) n))
r
(let* ((children (map car
(let* ((children (remove-duplicates
(map car
(query:X->Known-scored
#f
(list "biolink:subclass_of")
c
(list (list 1111) #f (list 1111)))))
(new-r (remove-duplicates (append r children))))
(list (list 1111) #f (list 1111))))))
(not-classification-type (filter (lambda (c) (not (curie-is-type? c "STY:T185"))) children))
(new-r (remove-duplicates (append r not-classification-type))))
(if (= (length r) (length new-r))
r
(loop new-r children))))))))
(loop new-r not-classification-type))))))))


0 comments on commit 4b47719

Please sign in to comment.