From f44cbe10ee5dc040d090d0350c626d1982fc6f6c Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 5 Nov 2020 11:22:26 +0000 Subject: Updated API doc --- test/rest-api.html | 148 ++++++++++++++++++++++------------------------------- test/rest-api.org | 25 +++++---- 2 files changed, 74 insertions(+), 99 deletions(-) diff --git a/test/rest-api.html b/test/rest-api.html index 6e5bf5a..2059ccb 100644 --- a/test/rest-api.html +++ b/test/rest-api.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +Here we document the public REST API that comes with PubSeq. The tests -run in the amazing emacs org-babel. See the bottom of this document -for running the tests inside emacs. +run in emacs org-babel. See the bottom of this document for running +the tests inside emacs. See bottom of the page how to run tests.
We built a REST API for COVID-19 PubSeq. The API source code can be
@@ -290,8 +266,8 @@ found in
{
- "service": "PubSeq",
- "version": 0.1
+ "service": "PubSeq",
+ "version": 0.1
}
import requests -baseURL="http://localhost:5000" # for development -# baseURL="http://covid19.genenetwork.org" -response = requests.get(baseURL+"/api/version") -response_body = response.json() -assert response_body["service"] == "PubSeq", "PubSeq API not found" +import requests +baseURL="http://localhost:5067" # for development +# baseURL="http://covid19.genenetwork.org" +response = requests.get(baseURL+"/api/version") +response_body = response.json() +assert response_body["service"] == "PubSeq", "PubSeq API not found" response_body
When you use the search box on PubSeq it queries the REST end point @@ -350,7 +326,7 @@ for information on the search items. For example
requests.get(baseURL+"/api/search?s=MT533203.1").json()
+requests.get(baseURL+"/api/search?s=MT533203.1").json()
Using above collection link you can fetch the metadata in JSON as it @@ -423,7 +399,7 @@ because is does a bit more in terms of expansion
requests.get(baseURL+"/api/sample/MT533203.1.json").json()
+requests.get(baseURL+"/api/sample/MT533203.1.json").json()
PubSeq provides an API that is used to export formats that are
@@ -523,11 +499,11 @@ documented
-requests.get(baseURL+"/api/ebi/sample-MT326090.1.xml").text
+
requests.get(baseURL+"/api/ebi/sample-MT326090.1.xml").text
+<?xml version="1.0" encoding="UTF-8"?> <SAMPLE_SET> <SAMPLE alias="MT326090.1" center_name="COVID-19 PubSeq"> @@ -584,20 +560,20 @@ documented -2 Configure emacs to run tests
++2 Configure emacs to run tests
-Execute a code -block with C-c C-c. You may need to set +Execute a code block with C-c C-c. You may need to set
@@ -617,7 +593,7 @@ To see output of the inpreter open then Python buffer.(org-babel-do-load-languages 'org-babel-load-languages '((python . t))) -(setq org-babel-python-command "python3") -(setq org-babel-eval-verbose t) +(setq org-babel-python-command "python3") +(setq org-babel-eval-verbose t) +(setq org-confirm-babel-evaluate nil)-diff --git a/test/rest-api.org b/test/rest-api.org index 4b66147..28d7559 100644 --- a/test/rest-api.org +++ b/test/rest-api.org @@ -13,8 +13,8 @@ * PubSeq REST API Here we document the public REST API that comes with PubSeq. The tests -run in the amazing emacs [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html][org-babel]]. See the bottom of this document -for running the tests inside emacs. +run in emacs [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html][org-babel]]. See the bottom of this document for running +the tests inside emacs. See bottom of the page how to run tests. ** Introduction @@ -36,7 +36,7 @@ The Python3 version is #+begin_src python :session :exports both import requests -baseURL="http://localhost:5000" # for development +baseURL="http://localhost:5067" # for development # baseURL="http://covid19.genenetwork.org" response = requests.get(baseURL+"/api/version") response_body = response.json() @@ -57,7 +57,7 @@ requests.get(baseURL+"/api/search?s=MT533203.1").json() #+end_src #+RESULTS: -| collection | : | http://collections.lugli.arvadosapi.com/c=0015b0d65dfd2e82bb3cee4436bf2893+126 | fasta | : | http://collections.lugli.arvadosapi.com/c=0015b0d65dfd2e82bb3cee4436bf2893+126/sequence.fasta | id | : | MT533203.1 | info | : | http://identifiers.org/insdc/MT533203.1#sequence | +| collection | : | http://collections.lugli.arvadosapi.com/c=b16901333ea1754a1e0409bf3caf7d22+126 | fasta | : | http://collections.lugli.arvadosapi.com/c=b16901333ea1754a1e0409bf3caf7d22+126/sequence.fasta | id | : | MT533203.1 | info | : | http://identifiers.org/insdc/MT533203.1#sequence | where collection is the raw uploaded data. The hash value in ~c=~ is computed on the contents of the Arvados keep [[https://doc.arvados.org/v2.0/user/tutorials/tutorial-keep-mount-gnu-linux.html][collection]] and effectively @@ -77,7 +77,7 @@ requests.get(baseURL+"/api/sample/MT533203.1.json").json() #+end_src #+RESULTS: -| collection | : | http://collections.lugli.arvadosapi.com/c=0015b0d65dfd2e82bb3cee4436bf2893+126 | date | : | 2020-04-27 | fasta | : | http://collections.lugli.arvadosapi.com/c=0015b0d65dfd2e82bb3cee4436bf2893+126/sequence.fasta | id | : | MT533203.1 | info | : | http://identifiers.org/insdc/MT533203.1#sequence | mapper | : | minimap v. 2.17 | sequencer | : | http://www.ebi.ac.uk/efo/EFO_0008632 | specimen | : | http://purl.obolibrary.org/obo/NCIT_C155831 | +| collection | : | http://collections.lugli.arvadosapi.com/c=b16901333ea1754a1e0409bf3caf7d22+126 | date | : | 2020-04-27 | fasta | : | http://collections.lugli.arvadosapi.com/c=b16901333ea1754a1e0409bf3caf7d22+126/sequence.fasta | id | : | MT533203.1 | info | : | http://identifiers.org/insdc/MT533203.1#sequence | mapper | : | minimap v. 2.17 | sequencer | : | http://www.ebi.ac.uk/efo/EFO_0008632 | specimen | : | http://purl.obolibrary.org/obo/NCIT_C155831 | @@ -148,19 +148,18 @@ requests.get(baseURL+"/api/ebi/sample-MT326090.1.xml").text * Configure emacs to run tests -Execute a code -block with C-c C-c. You may need to set +Execute a code block with C-c C-c. You may need to set #+begin_src elisp -(org-babel-do-load-languages - 'org-babel-load-languages - '((python . t))) -(setq org-babel-python-command "python3") -(setq org-babel-eval-verbose t) + (org-babel-do-load-languages + 'org-babel-load-languages + '((python . t))) + (setq org-babel-python-command "python3") + (setq org-babel-eval-verbose t) + (setq org-confirm-babel-evaluate nil) #+end_src #+RESULTS: -: python3 To skip confirmations you may also want to set -- cgit v1.2.3
Created by Pjotr Prins (pjotr.public768 at thebird 'dot' nl) using Emacs org-mode and a healthy dose of Lisp!
Modified 2020-07-21 Tue 05:38. +
Created by Pjotr Prins (pjotr.public768 at thebird 'dot' nl) using Emacs org-mode and a healthy dose of Lisp!
Modified 2020-11-05 Thu 05:21.