Skip to content

heralden/imcljs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imcljs

Build Status

A Clojure/ClojureScript library for interacting with Intermine's web services.

Getting Start

Add the necessary dependency to your project:

Clojars Project

imcljs returns channels so you'll also want to include core.async

[org.clojure/core.async "0.2.395"]

Usage

All imcljs funtions expect a map as their first parameter containing a mandtory :root key and two semi-optional keys, :token and :model.

(def flymine {:root  "www.flymine.org/query"
              :token nil ; Optional parameter for authentication
              :model "genomic" ; Required by some functions, such as executing a query
              })

We recommend fetching the model once and storing it in the above map for re-use across your application.

Examples

Fetching assets

; Fetch model (you'll need this for later.)
(go (log (<! (fetch/model flymine)))

; Fetch templates
(go (log (<! (fetch/templates flymine)))

; Fetch lists
(go (log (<! (fetch/lists flymine)))

; Fetch summary fields
(go (log (<! (fetch/summary-fields flymine)))

Fetching query results

Most result-fetching functions require that the :model key be present in their first parameter.

(ns my-app.core
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:require [imcljs.fetch :as fetch]
            [cljs.core.async :refer [<!]]))


(def my-query {:from   "Gene"
              :select ["Gene.secondaryIdentifier Gene.symbol"]
              :where  [{:path  "Gene.symbol"
                        :op    "="
                        :value "a*"}]})

; Rows
(go (log (<! (fetch/rows flymine my-query))))

; Records
(go (log (<! (fetch/records flymine my-query {:size 10}))))

; Row Count
(go (log (<! (fetch/row-count flymine my-query))))

Development

Running tests

To run tests in the browser:

lein doo default

To run tests in the JVM:

lein test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 99.3%
  • HTML 0.7%