-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.clj
35 lines (27 loc) · 904 Bytes
/
core.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(ns ensembl.core
(:use [ensembl.config :only (data-source)])
(:import [uk.ac.roslin.ensembl.dao.database DBRegistry]))
(def ^:dynamic *registry* nil)
(def ^:dynamic *species* nil)
(defmacro with-registry
[registry & body]
`(binding [*registry* ~registry] ~@body))
(defmacro with-species
[species & body]
`(binding [*species* ~species] ~@body))
(defn registry
[ds]
(DBRegistry. (data-source ds)))
(defn list-species
[& {:keys [registry] :or {registry *registry*}}]
(map (memfn getDatabaseStyleName) (.getSpecies registry)))
(defn species
[s & {:keys [registry] :or {registry *registry*}}]
(or (.getSpeciesByEnsemblName registry (name s))
(.getSpeciesByAlias registry (name s))))
(defn list-chromosomes
[s]
(map key (.getChromosomes s)))
(defn chromosome
[n & {:keys [species] :or {species *species*}}]
(.getChromosomeByName (ensembl.core/species species) n))