BioLink Model
A nodejs library for manipulating BioLink Model.
💾 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.
await biolink.load();
biolink.loadSync();
🔎 Load the BioLink-model yaml file from a valid url
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';
await biolink.load(path.resolve(__dirname, './biolink.yaml');
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")