{"id":20930532,"url":"https://github.com/intermine/imcljs","last_synced_at":"2025-05-13T19:32:11.133Z","repository":{"id":12946948,"uuid":"73211532","full_name":"intermine/imcljs","owner":"intermine","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-07T12:52:32.000Z","size":503,"stargazers_count":3,"open_issues_count":10,"forks_count":6,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2024-09-25T09:32:25.236Z","etag":null,"topics":["clojurescript","core-async","intermine"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intermine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-08T17:43:43.000Z","updated_at":"2022-12-19T17:50:15.000Z","dependencies_parsed_at":"2022-08-07T07:00:53.236Z","dependency_job_id":null,"html_url":"https://github.com/intermine/imcljs","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intermine%2Fimcljs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intermine%2Fimcljs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intermine%2Fimcljs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intermine%2Fimcljs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intermine","download_url":"https://codeload.github.com/intermine/imcljs/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224923594,"owners_count":17392884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojurescript","core-async","intermine"],"created_at":"2024-11-18T21:34:49.641Z","updated_at":"2024-11-18T21:34:50.106Z","avatar_url":"https://github.com/intermine.png","language":"Clojure","readme":"# imcljs\n\n[![CircleCI](https://circleci.com/gh/intermine/imcljs.svg?style=svg)](https://circleci.com/gh/intermine/imcljs)\n[![Clojars Project](https://img.shields.io/clojars/v/org.intermine/imcljs.svg)](https://clojars.org/org.intermine/imcljs)\n\n\nA Clojure/ClojureScript library for interacting with InterMine's web services.\n\n## Getting Started\n\nAdd the necessary dependency to your project:\n\n[![Clojars Project](https://img.shields.io/clojars/v/org.intermine/imcljs.svg)](https://clojars.org/org.intermine/imcljs)\n\nimcljs returns channels so you'll also want to include core.async\n\n```[org.clojure/core.async \"0.2.395\"]```\n\n## Usage\n\nWith 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`.\n\n```clj\n(def flymine {:root  \"https://www.flymine.org/flymine\"\n              :token nil ; Optional parameter for authentication\n              :model \"genomic\" ; Required by some functions, such as executing a query\n              })\n```\n\nWe recommend fetching the `model` once and storing it in the above map for re-use across your application.\n\n## Examples\n\n### Fetching a list of InterMines from the Registry\n\n```cljs\n(let [;fetch all mines except the dev/beta mines\n      prod-mines (fetch/registry false)\n      ;fetch all mines INCLUDING the dev/beta mines\n      dev-and-prod-mines (fetch/registry true)]\n\n      (go\n        (let [prod (\u003c! prod-mines )\n              dev (\u003c! dev-and-prod-mines)]\n          ;; This should print true, so long as the sum of dev+prod mines is \n          ;; greater than the count of prod mines\n          (.log js/console (\u003c (count (:instances (:body prod)))\n              (count (:instances (:body dev)))))\n          )))\n```\n\n### Fetching assets\n\n```cljs\n; Fetch model (you'll need this for later.)\n(go (log (\u003c! (fetch/model flymine)))\n\n; Fetch templates\n(go (log (\u003c! (fetch/templates flymine)))\n\n; Fetch lists\n(go (log (\u003c! (fetch/lists flymine)))\n\n; Fetch summary fields\n(go (log (\u003c! (fetch/summary-fields flymine)))\n```\n\n### Fetching query results\n\nMost result-fetching functions require that the `:model` key be present in their first parameter.\n\n```cljs\n\n(ns my-app.core\n  (:require-macros [cljs.core.async.macros :refer [go]])\n  (:require [imcljs.fetch :as fetch]\n            [cljs.core.async :refer [\u003c!]]))\n\n\n(def my-query {:from   \"Gene\"\n              :select [\"Gene.secondaryIdentifier Gene.symbol\"]\n              :where  [{:path  \"Gene.symbol\"\n                        :op    \"=\"\n                        :value \"a*\"}]})\n\n; Rows\n(go (log (\u003c! (fetch/rows flymine my-query))))\n\n; Records\n(go (log (\u003c! (fetch/records flymine my-query {:size 10}))))\n\n; Row Count\n(go (log (\u003c! (fetch/row-count flymine my-query))))\n\n```\n\n## Development\n\n### REPL\n\nIt's useful to have a live interactive environment to invoke imcljs when developing. You can get this by running:\n\n```\n$ lein repl\nuser=\u003e (fig-start)\n# Figwheel: Starting server at http://0.0.0.0:5003\n# Open this URL in your browser.\nuser=\u003e (cljs-repl)\n```\n\nYou 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.\n\n### Running tests\n\n**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. \n\n**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).\n\n**To run tests in the browser:**\n```bash\nlein doo\n```\n\n**To run tests in the JVM:**\n```bash\nlein test\n```\n\n### Releasing new versions (Clojars)\n\n1. Update the version number in [project.clj](https://github.com/intermine/imcljs/blob/dev/project.clj#L1)\n2. Don't forget to add the new version with notes to **CHANGELOG.md**.\n3. 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)\n4. 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.\n\n### API Docs\n\nAPI docs for IMCLJS are available at [intermine.org/imcljs](http://intermine.org/imcljs). \n\nThese docs are automatically generated by CircleCI when anything is merged to dev.\n\nIf you would like to generate them locally, run `lein codox` and go to your target/docs folder.  \n\n### Formatting\n\nBuilds 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. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintermine%2Fimcljs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintermine%2Fimcljs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintermine%2Fimcljs/lists"}