A nodejs library for manipulating BioLink Model.
pnpm i biolink-model
const bl = require("biolink-model")
const biolink = new bl.BioLink();
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.
This can be done in sync or async mode.
// load in async mode
await biolink.load();
// in sync mode
biolink.loadSync();
// 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");
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');
const tree = biolink.classTree;
const tree = biolink.classTree;
const ancestors = tree.getAncestors("Gene")
const tree = biolink.classTree;
const descendants = tree.getDescendants("MolecularEntity")
const tree = biolink.slotTree;
const tree = biolink.slotTree;
const ancestors = tree.getAncestors("regulates")
const tree = biolink.slotTree;
const descendants = tree.getDescendants("regulates")