WeGene (https://www.wegene.com) SDK for Node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example/query
lib/node-wegene
.gitignore
LICENSE
README.md
package.json

README.md

node-wegene

Node.js SDK for WeGene

Installation

$ npm install node-wegene

Usage

Set Access Token

To query data from WeGene, one need a valid OAuth2 access token authorized by the user. Node.js Express apps can use passport-wegene for implementing the OAuth2 flow.

var wegene = require('node-wegene');
var config = wegene.configuration;
config.oAuthAccessToken = '<A Valid Access Token With Proper Scope>';

Get Basic User Info

Use wegene.User.getUser() to get user data

var user = wegene.User
user.getUser(function(error, result){
  if(error){ return console.log(error) }
  console.log('User Info:\n', JSON.stringify(result));
});

Get Gene Allele Info

Use wegene.Allele.getAllele(profile_id, locations, callback) to get allele data

var allele = wegene.Allele;
allele.getAllele(profile_id, ['rs182549'], function(error, result){
  if(error){ return console.log(error) }
  console.log('Allele Data:\n', JSON.stringify(result));
});

Get Health Risk Data

Use wegene.Risk.getRisk(profileId, reportId, callback) to get health risk info

var risk = wegene.Risk;
risk.getRisk(profile_id, 88, function(error, result){
  if(error){ return console.log(error) }
  console.log('Health Data:\n', JSON.stringify(result));
});

Get Athletigen Data

Use wegene.Athletigen.getAthletigen(profileId, reportId, callback) to get athletigen info

var athletigen = wegene.Athletigen;
athletigen.getAthletigen(profile_id, 1487, function(error, result){
  if(error){ return console.log(error) }
  console.log('Health Data:\n', JSON.stringify(result));
});

Get Health Data

Use wegene.Health.getDrug(profileId, reportId, callback) to get drug response info

Use wegene.Health.getCarrier(profileId, reportId, callback) to get disease carrier info

Use wegene.Health.getTraits(profileId, reportId, callback) to get disease carrier info

Use wegene.Health.getMetabolism(profileId, reportId, callback) to get disease carrier info

var health = wegene.Health;
health.getDrug(profile_id, 158, function(error, result){
  if(error){ return console.log(error) }
  console.log('Health Data:\n', JSON.stringify(result));
});

Get Ancestry Composition Info

Use wegene.Ancestry.getAncestry(profile_id, callback) to get ancestry composition info

var ancestry = wegene.Ancestry;
ancestry.getAncestry(profile_id, function(error, result){
  if(error){ return console.log(error) }
  console.log('Ancestry Composition:\n', JSON.stringify(result));
});

Get Haplogroups

Use wegene.Haplogroups.getHaplogroups(profile_id, callback) to get haplogroups result

var haplogroups = wegene.Haplogroups;
haplogroups.getHaplogroups(profile_id, function(error, result){
  if(error){ return console.log(error) }
  console.log('Haplogroups Result:\n', JSON.stringify(result));
});

Promise API

const wegene = require('../../lib/node-wegene').promise;

then, all the methods above will return a promise, and you need not pass a callback.

Documentation

Credits

Thanks

  • The SDK is modified on top of the code auto-generated using APIMATIC. Huge thanks to the team as this is a real life saver!!

License

(The MIT License)

Copyright (c) 2016 Eddie Wu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge