Git Product home page Git Product logo

biolink-model.js's Introduction

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")

biolink-model.js's People

Contributors

kevinxin90 avatar newgene avatar ariutta avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.