This GitHub repo serves as the development repo for the TRAPI API implementation of BioThings Explorer.
BioThings Explorer aims at helping users querying and linking results from a variety of biomedical relevant APIs through one interface. The project is funded by the NCATS Translator project.
TRAPI stands for Translator Reasoner API. It is a standard defined for APIs developed within NCATS Biomedical Translator project to allow easy information exchange among them.
Please visit our TRAPI API landing page here.
Query Examples can be found here.
Currently, the BioThings Explorer TRAPI API implements TRAPI v1.0.0 standard, and can be queried at https://api.bte.ncats.io/v1/query endpoint.
The TRAPI v0.9.2 standard is deprecated. But it can still be tested using https://api.bte.ncats.io/query endpoint.
For development, you will only need Node.js and a node global package, e.g. npm, installed in your environment.
NOTE: Node version must be higher than v12.
-
Just go on official Node.js website and download the installer. Also, be sure to have
git
available in your PATH,npm
might need it (You can find git here). -
You can install nodejs and npm easily with apt install, just run the following commands.
$ sudo apt install nodejs $ sudo apt install npm
-
You can find more information about the installation on the official Node.js website and the official NPM website.
If the installation was successful, you should be able to run the following command.
$ node --version
v12.*.*
$ npm --version
6.1.0
If you need to update npm
, you can make it using npm
! Cool right? After running the following command, just open again the command line and be happy.
$ npm install npm -g
$ git clone https://github.com/biothings/BioThings_Explorer_TRAPI`
$ cd BioThings_Explorer_TRAPI`
$ npm install`
$ npm start
To enable debug mode, which outputs logging statements to the terminal in real time:
$ DEBUG=biothings-explorer-trapi:* npm start
$ DEBUG=biothings-explorer-trapi:*,smartapi-kg:*,call-apis:*,biomedical-id-resolver:* npm start
(also outputs debug statements from dependencies)
$ npm build
A docker file is included in the base directory and can be used to build the customized container
docker build -t bte_reasoner_api .
Container can be built and started using docker-compose
docker-compose up
Public Docker image located at link
http://<HOST>:3000
The TRAPI interface has /test/query
endpoint which uses a SmartAPI spec stored at test folder named smartapi.json
If you would like to use the /test/query
endpoint to test a local SmartAPI spec, you can mount the your local folder containing the SmartAPI spec to the folder /home/node/app/test in the container. [Note: The SmartAPI spec must be named smartapi.json]
You could do so using the following commands:
First pull the biothings/bte_reasoner_api image from Docker Hub:
docker pull biothings/bte_reasoner_api
Then, Run the image and mount your local smartapi spec folder
docker run -p 3000:3000 -v [local_folder_contain_smartapi_spec]:/home/node/app/test -d biothings/bte_reasoner_api
Now, you should be able to test your local smartapi using POST queries at:
http://localhost:3000/test/query