biolink-model
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

BioLink Model

A nodejs library for manipulating BioLink Model.

Test Coveralls Coverage Status

💾 Install

npm i biolink-model

📐 Usage

📢 Import and Initialize

const bl = require("biolink-model")

const biolink = new bl.BioLink();

Load BioLink Yaml File

Loading BioLink Yaml file is a required step before you can utilizing this package to traverse the hierarchy tree for BioLink predicates and classes.

The Yaml file can be loaded through a url, a local file stored within the package, or a valid file path provided.

🔎 Load the BioLink-model yaml file stored along with the package

This can be done in sync or async mode.

// load in async mode
await biolink.load();
// in sync mode
biolink.loadSync();

🔎 Load the BioLink-model yaml file from a valid url

// load in async mode
/// the url provided below points to the most recent version of the biolink model.
await biolink.load("https://raw.githubusercontent.com/biolink/biolink-model/master/biolink-model.yaml");

🔎 Load the BioLink-model yaml file from a local file path

This can be done in sync or async mode as well.

import path from 'path';
// load in async mode
// assume your biolink file is stored in the same folder under biolink.yaml
await biolink.load(path.resolve(__dirname, './biolink.yaml');
// in sync mode
biolink.loadSync(path.resolve(__dirname, './biolink.yaml');

❇️ Traverse the BioLink Class Hierarchy

🔎 Get BioLink Class Tree Object

const tree = biolink.classTree;

🔎 Get the ancestors of a biolink class

const tree = biolink.classTree;

const ancestors = tree.getAncestors("Gene")

🔎 Get the descendants of a biolink class

const tree = biolink.classTree;

const descendants = tree.getDescendants("MolecularEntity")

❇️ Traverse the BioLink Slot Hierarchy

🔎 Get BioLink Slot Tree Object

const tree = biolink.slotTree;

🔎 Get the ancestors of a biolink slot

const tree = biolink.slotTree;

const ancestors = tree.getAncestors("regulates")

🔎 Get the descendants of a biolink slot

const tree = biolink.slotTree;

const descendants = tree.getDescendants("regulates")

Package Sidebar

Install

npm i biolink-model

Weekly Downloads

7

Version

0.4.0

License

ISC

Unpacked Size

394 kB

Total Files

79

Last publish

Collaborators

  • kevinxin
  • newgene
  • marcocano