Skip to content

Commit

Permalink
added chemical affects gene query
Browse files Browse the repository at this point in the history
  • Loading branch information
webyrd committed Nov 25, 2023
1 parent 37d181f commit c13a668
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
29 changes: 29 additions & 0 deletions contrib/medikanren2/neo/Will/chemical-affects-gene.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#lang racket/base

(require
"../../../../medikanren2/neo/neo-low-level/query-low-level-multi-db.rkt"
"../../../../medikanren2/neo/neo-utils/neo-helpers-multi-db.rkt"
"../../../../medikanren2/neo/neo-server/neo-server-utils.rkt"
"../utils.rkt"
json
racket/format
racket/list
racket/match
racket/set
racket/pretty
racket/string)

;; finds a list of compounds that affect a provided set of genes
(define (chem-affects-gene gene-list)
(time (remove-duplicates
(query:X->Known
(set->list
(get-non-deprecated/mixin/abstract-ins-and-descendent-classes*-in-db
'("biolink:ChemicalEntity")))
(set->list
(get-non-deprecated/mixin/absreact-ins-and-descendent-predicates*-in-db
'("biolink:affects")))
(set->list (curie-synonyms-and-descendents gene-list))))))

;; test with BRCA2 gene
(define chem-affects-BRCA2 (chem-affects-gene (list "HGNC:1101")))
7 changes: 7 additions & 0 deletions contrib/medikanren2/neo/utils.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

get-props

curie-synonyms-and-descendents

write-answers-to-tsv

get-source
Expand All @@ -24,9 +26,14 @@
racket/match
"../../../medikanren2/neo/neo-server/neo-server-utils.rkt"
"../../../medikanren2/neo/neo-low-level/query-low-level-multi-db.rkt"
"../../../medikanren2/neo/neo-utils/neo-helpers-multi-db.rkt"
"../../../medikanren2/neo/neo-utils/neo-helpers-without-db.rkt"
)

(define (curie-synonyms-and-descendents curie-list)
(get-descendent-curies*-in-db
(curies->synonyms-in-db curie-list)))

(define (concept->name curie)
(let ((id-name-val
(remove-duplicates (filter (lambda (cl)
Expand Down

0 comments on commit c13a668

Please sign in to comment.