Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/intermine/imcljs
https://github.com/intermine/imcljs
clojurescript core-async intermine
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/intermine/imcljs
- Owner: intermine
- Created: 2016-11-08T17:43:43.000Z (about 8 years ago)
- Default Branch: dev
- Last Pushed: 2022-04-07T12:52:32.000Z (over 2 years ago)
- Last Synced: 2024-09-25T09:32:25.236Z (3 months ago)
- Topics: clojurescript, core-async, intermine
- Language: Clojure
- Size: 491 KB
- Stars: 3
- Watchers: 3
- Forks: 6
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# imcljs
[![CircleCI](https://circleci.com/gh/intermine/imcljs.svg?style=svg)](https://circleci.com/gh/intermine/imcljs)
[![Clojars Project](https://img.shields.io/clojars/v/org.intermine/imcljs.svg)](https://clojars.org/org.intermine/imcljs)A Clojure/ClojureScript library for interacting with InterMine's web services.
## Getting Started
Add the necessary dependency to your project:
[![Clojars Project](https://img.shields.io/clojars/v/org.intermine/imcljs.svg)](https://clojars.org/org.intermine/imcljs)
imcljs returns channels so you'll also want to include core.async
```[org.clojure/core.async "0.2.395"]```
## Usage
With the exception of the fetch/registry function, all imcljs functions expect a map as their first parameter containing a mandatory `:root` key and two semi-optional keys, `:token` and `:model`.
```clj
(def flymine {:root "https://www.flymine.org/flymine"
: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 a list of InterMines from the Registry
```cljs
(let [;fetch all mines except the dev/beta mines
prod-mines (fetch/registry false)
;fetch all mines INCLUDING the dev/beta mines
dev-and-prod-mines (fetch/registry true)](go
(let [prod ( (fig-start)
# Figwheel: Starting server at http://0.0.0.0:5003
# Open this URL in your browser.
user=> (cljs-repl)
```You can now use `require` to test parts of imcljs and dependencies. Even better, if you install an nREPL plugin to your editor, you can load any namespace and evaluate arbitrary code all from your editor (`src/cljs/imcljs/core.cljs` has useful code for testing). **Keep an eye on your browser devtool's Network and Console tabs**; it's great for debugging requests and seeing the output when running code.
### Running tests
**Required dependency:** phantomjs, to run the tests in a headless javascript engine. You'll need a recent version of node installed, perhaps via [nvm](https://github.com/creationix/nvm). Once node is installed, run `npm install -g phantomjs` to install phantomjs.
**Local biotestmine:** The tests are run against a local biotestmine instance on port 9999 (can be changed in *test/cljs/imcljs/env.cljs*). If you're not familiar with building InterMine instances, we recommend using [intermine_boot](https://github.com/intermine/intermine_boot).
**To run tests in the browser:**
```bash
lein doo
```**To run tests in the JVM:**
```bash
lein test
```### Releasing new versions (Clojars)
1. Update the version number in [project.clj](https://github.com/intermine/imcljs/blob/dev/project.clj#L1)
2. Don't forget to add the new version with notes to **CHANGELOG.md**.
3. Tag the [release with a matching version number in git and push the tag to GitHub](https://git-scm.com/book/en/v2/Git-Basics-Tagging)
4. To [push the release to Clojars](https://github.com/clojars/clojars-web/wiki/Pushing), type `lein deploy clojars`. **Note** that you'll need to have a clojars account that is a member of the [org.intermine](https://clojars.org/search?q=org.intermine) team.### API Docs
API docs for IMCLJS are available at [intermine.org/imcljs](http://intermine.org/imcljs).
These docs are automatically generated by CircleCI when anything is merged to dev.
If you would like to generate them locally, run `lein codox` and go to your target/docs folder.
### Formatting
Builds will fail unless your file is formatted correctly. Write code with whatever formatting you like - but before you commit and push, run `lein format` to auto-format your file to the required standards. The formatting is managed using the [cljfmt](https://github.com/weavejester/cljfmt) package.