Node.js SDK for WeGene
$ npm install node-wegene
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>';
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));
});
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));
});
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));
});
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));
});
Use wegene.Skin.getSkin(profileId, reportId, callback)
to get skin info
var skin = wegene.Skin;
skin.getSkin(profile_id, 1522, function(error, result){
if(error){ return console.log(error) }
console.log('Skin Data:\n', JSON.stringify(result));
});
Use wegene.Psychology.getPsychology(profileId, reportId, callback)
to get psychology info
var psychology = wegene.Psychology;
psychology.getPsychology(profile_id, 1557, function(error, result){
if(error){ return console.log(error) }
console.log('Psychology Data:\n', JSON.stringify(result));
});
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));
});
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));
});
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));
});
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));
});
Use wegene.Demographics.getDemographics(profile_id, callback)
to get demographics result
var demographics = wegene.Demographics;
demographics.getDemographics(profile_id, function(error, result){
if(error){ return console.log(error) }
console.log('Demographics Result:\n', JSON.stringify(result));
});
const wegene = require('../../lib/node-wegene').promise;
then, all the methods above will return a promise, and you need not pass a callback.
- 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!!
(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.