(in-package :cl-user) (defun write-go-associations-to-owl () (let ((swiss (make-hash-table :test 'equal)) (hinv (make-hash-table :test 'equal)) (refseq (make-hash-table :test 'equal)) (ensembl (make-hash-table :test 'equal)) (vega (make-hash-table :test 'equal))) (unless (eq (config :goa-xref) :ignore) (with-open-file (f (config :goa-xref)) (loop for line = (read-line f nil :eof) until (eq line :eof) for (db id nil nil nil nil nil nil nil nil nil lls) = (split-at-char line #\tab) unless (char= (char line 0) #\#) do (if (equal lls "") (setq lls :none) (setq lls (mapcar (lambda(ll) (car (split-at-char ll #\,))) (split-at-char lls #\;)))) (cond ((or (equal db "SP") (equal db "TR")) (setf (gethash id swiss) lls)) ((equal db "ENSEMBL") (setf (gethash id ensembl) lls)) ((equal db "VEGA") (setf (gethash id vega) lls)) ((or (equal db "HINV") (equal db "H-invDB")) (setf (gethash id hinv) lls)) ((and (>= (length db) 6) (equal (subseq db 0 6) "REFSEQ")) (setf (gethash id refseq) lls)))) (with-open-file (f (config :goa-human)) (loop for line = (read-line f nil :eof) until (eq line :eof) for (db id nil qualifier goid source evidence) = (split-at-char line #\tab) do (let ((lls (cond ((or (equal db "HINV") (equal db "H-invDB")) (gethash id hinv)) ((equal db "ENSEMBL") (gethash id ensembl)) ((equal db "VEGA") (gethash id vega)) ((equal db "RefSeq") (gethash id refseq)) ((equal db "UniProt") (gethash id swiss)) ((equal db "") ; bug :none) (t (error "Found and db I didn't know about: '~a' on line '~a'" db line))))) (assert lls () "Couldn't look up ~a:~a~%" db id) (when (eq lls :none) (setq lls nil)) '(unless (equal qualifier "NOT") (loop for ll in lls with record = (get-record g goid) do (pushnew (cons ll evidence) (direct-associations record) :test 'equal))) (print-db goid lls evidence source) ) repeat 10 )) ))))