0.0.3 • Published 14 days ago

trapi-client v0.0.3

Weekly downloads
Last release
14 days ago

TRAPI Javascript Client

This project is a lightweight Javascript client library for the Translator Reasoner API (TRAPI) web services. TRAPI is a standard web service specification for the Biomedical Data Translator project of the National Center for Advancing Translational Science (NCATS; https://ncats.nih.gov/).


This client is current compatible with TRAPI Release 1.0.


The Translator Reasoner API (TRAPI) is a web services protocol for querying metadata and data in knowledge graphs which represent networks of biomedical concepts and relationships imported by so-called Translator Knowledge Provider ("KP") components from external biomedical knowledge sources (i.e. public bioinformatics databases, literature or data sources) or constructed by machine learning algorithms inferring from said imported knowledge sources by so-called Translator Autonomous Relay Agent ("ARA") components.

TRAPI 1.0 currently consists of two endpoints:

  • /predicates: returns web service metadata consisting of a simple map Biolink Model relationship predicates and concept category values used in knowledge graphs returned by the service (note: future TRAPI releases will significantly elaborate further on the functionality of this endpoint, which will also likely be renamed)

  • /query: executes a knowledge graph templated query on the underlying KP or ARA to return a relevant knowledge graph and a set of 'results' mapping of the seed concepts and edges of the knowledge graph templated query, against that knowledge graph.

Getting Started

This project uses Javascript and uses npm for managing module dependencies and running the system which needs to be installed. Instructions for installing npm are here.

Installing the Client from the Public Module Repository

Assuming that your npm is properly configured, the latest public npm package release of the module may be installed as follows:

$ npm install trapi-client

or using yarn

yarn add trapi-client

Locally Installing and Developing with the Client Project

If you wish to directly modify or add to the client software, the project may be directly installed as follows.

Obtaining the Source Code

The first step is to clone the project source code from the Github project repository, into a suitable location on your computer using a copy of Git installed on your operating system:

git clone https://github.com/STARInformatics/trapi-client-js.git

Installing Javascript Dependencies

After cloning the project, you need to install the project's Javascript module dependencies locally, by typing the following from within your root project directory (i.e. inside /path/to/your/project/trapi-client-js):

$ npm install

Using the Client


The trapi.js script may be run directly by typing:

$ node trapi.js

This script has very simple functionality for quick testing purposes.


The trapi.js script actually calls the underlying TRAPI client.js module to do its work. This client module may be directly invoked within other Javascript execution contexts by importing the module and running its functions directly, as illustrated by the code within the trapi.js script.

var client = require("./src/client.js");

var predicates = client.predicates();

var results = client.query();


Aside from basic Javascript, this project uses the openapitools openapi-generator-cli module.


14 days ago


14 days ago


1 month ago