
Untitled
By: a guest on
May 4th, 2012 | syntax:
None | size: 0.93 KB | hits: 15 | expires: Never
(ns yeastract-ws-example
(:require [clojure.contrib.http.agent :as h]
[clojure.contrib.json :as j]))
(defn fetch-regulation-data
[]
(let [data (:quads (j/read-json (h/string (h/http-agent "http://yeastract.com/beta/services/regulations/documented?tf=Ime1p&format=json"))))
genes (for [item data
:when (some (fn [obj] (= (:value obj) "http://yeastract.com/beta/owl/yontology.owl#Gene")) item)]
(some (fn [obj] (when (and (map? obj) (not (= (:value obj) "http://yeastract.com/beta/owl/yontology.owl#Gene")))
(last (re-find #"orfname=(.+)" (:value obj)))))
item))]
genes))
(defn fetch-gene-expression-data
[genes]
(map (fn [gene] (j/read-json (h/string (h/http-agent (str "http://www.ebi.ac.uk/gxa/api?geneIs=" gene "&format=json&indent"))))) genes))
(defn main
[]
(fetch-gene-expression-data (fetch-regulation-data)))