Table of Contents
1 PubSeq REST API
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.
1.1 Introduction
We built a REST API for COVID-19 PubSeq. The API source code can be found in api.py. To see if the service is up try
curl http://covid19.genenetwork.org/api/version
{ "service": "PubSeq", "version": 0.1 }
The Python3 version is
import requests response = requests.get("http://covid19.genenetwork.org/api/version") response_body = response.json() assert response_body["service"] == "PubSeq", "PubSeq API not found" response_body
service | : | PubSeq | version | : | 0.1 |
1.2 Fetch EBI XML
PubSeq provides an API that is used to export formats that are suitable for uploading data to EBI/ENA from our EXPORT menu. This is documented here.
requests.get("http://covid19.genenetwork.org/api/ebi/sample-MT32690.1.xml").text
<?xml version="1.0" encoding="UTF-8"?> <SAMPLE_SET> <SAMPLE alias="MT32690.1" center_name="COVID-19 PubSeq"> <TITLE>COVID-19 PubSeq Sample</TITLE> <SAMPLE_NAME> <TAXON_ID>2697049</TAXON_ID> <SCIENTIFIC_NAME>Severe acute respiratory syndrome coronavirus 2</SCIENTIFIC_NAME> <COMMON_NAME>SARS-CoV-2</COMMON_NAME> </SAMPLE_NAME> <SAMPLE_ATTRIBUTES> <SAMPLE_ATTRIBUTE> <TAG>investigation type</TAG> <VALUE></VALUE> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>sequencing method</TAG> <VALUE></VALUE> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>collection date</TAG> <VALUE></VALUE> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>geographic location (latitude)</TAG> <VALUE></VALUE> <UNITS>DD</UNITS> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>geographic location (longitude)</TAG> <VALUE></VALUE> <UNITS>DD</UNITS> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>geographic location (country and/or sea)</TAG> <VALUE></VALUE> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>geographic location (region and locality)</TAG> <VALUE></VALUE> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>environment (material)</TAG> <VALUE></VALUE> </SAMPLE_ATTRIBUTE> <SAMPLE_ATTRIBUTE> <TAG>ENA-CHECKLIST</TAG> <VALUE>ERC000011</VALUE> </SAMPLE_ATTRIBUTE> </SAMPLE_ATTRIBUTES> </SAMPLE> </SAMPLE_SET>
2 Configure emacs to run tests
Execute a code block with C-c C-c. You may need to set
(org-babel-do-load-languages 'org-babel-load-languages '((python . t))) (setq org-babel-python-command "python3")
To skip confirmations you may also want to set
(setq org-confirm-babel-evaluate nil)