cxmate

0.1.0 • Public • Published

cxmate-js


cxmate-js provides a Javascript SDK for interacting with cxMate, an adapter that allows Cytoscape to talk to network services. It can also convert Cytoscape's network interchange format to and from the Cytoscape.js data model. This SDK enables quick and painless development of a cxMate service, follow the Getting Started guide to learn more about the process.


cxMate is an official Cytoscape project written by the Cytoscape team.

Installation

Install the cxMate SDK via npm.

npm install --save cxmate

Getting Started

Import the cxmate package:

let cxmate = require('cxmate');

Create a subclass of the cxMate.Service class from the package:

class MyService extends cxmate.Service

Implement a single method in the class called process. It takes two arguments, a dictionary of parameters, and an element stream:

class MyService extends cxmate.Service {
 
  process(params, elementStream) {
    cxmate.Adapter.toCyJS(elementStream, (model) => {
      cxmate.Adapter.fromCyJS(model, (element) => {
        elementStream.write(element);
      });
      elementStream.end();
    });
  }
 
}

Whenever your service is called, cxMate will call your process method for you. you must extract networks from the element stream to create your input networks. cxMate comes with an adapter class to make conversion to popular network formats simple. To send networks back to cxMate, you must write network elements back to the stream. cxMate's adapter class can handle this also for various popular network formats.

Finally, setup your service to run when envoked. the cxmate.Service superclass implements a run method for you that takes an optional 'address:port' string.

let service = new MyService();
service.run();

Contributors

We welcome all contributions via Github pull requests. We also encourage the filing of bugs and features requests via the Github issue tracker. For general questions please send us an email.

License

cxmate-js is MIT licensed and a product of the Cytoscape Consortium.

Please see the License file for details.

Package Sidebar

Install

npm i cxmate

Weekly Downloads

6

Version

0.1.0

License

MIT

Last publish

Collaborators

  • ericsage