cbioportal-api-client
Advanced tools
Comparing version 0.2.13 to 0.3.0
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _keys = require('babel-runtime/core-js/object/keys'); | ||
var _keys2 = _interopRequireDefault(_keys); | ||
var _create = require('babel-runtime/core-js/object/create'); | ||
@@ -21,5 +25,5 @@ | ||
var _requestPromise = require('request-promise'); | ||
var _isomorphicFetch = require('isomorphic-fetch'); | ||
var _requestPromise2 = _interopRequireDefault(_requestPromise); | ||
var _isomorphicFetch2 = _interopRequireDefault(_isomorphicFetch); | ||
@@ -80,5 +84,4 @@ var _reduce2 = require('lodash/reduce'); | ||
headers: { | ||
'User-Agent': 'cbioportal-api-client.js/0.0.1' | ||
}, | ||
uri: 'http://www.cbioportal.org/webservice.do' | ||
'User-Agent': 'cbioportal-api-client.js/1.0.0' | ||
} | ||
}) | ||
@@ -122,9 +125,11 @@ }); | ||
var cmd = 'get' + endpoint; | ||
var qsObj = (0, _assign2.default)((0, _utils.formatQuery)(query), { cmd: cmd }); | ||
var qs = (0, _keys2.default)(qsObj).reverse().map(function (key) { | ||
return key + '=' + encodeURIComponent(qsObj[key]); | ||
}).join('&'); | ||
var requestOpts = (0, _assign2.default)({ | ||
qs: (0, _assign2.default)((0, _utils.formatQuery)(query), { cmd: cmd }) | ||
}, this.requestOpts); | ||
return (0, _requestPromise2.default)(requestOpts).then(function (response) { | ||
return (0, _utils.convertResponse)(response, cmd); | ||
return (0, _isomorphicFetch2.default)('http://www.cbioportal.org/webservice.do?' + qs, this.requestOpts).then(function (response) { | ||
return response.text(); | ||
}).then(function (responseText) { | ||
return (0, _utils.convertResponse)(responseText, cmd); | ||
}); | ||
@@ -131,0 +136,0 @@ }, |
@@ -11,2 +11,6 @@ 'use strict'; | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -17,6 +21,2 @@ value: true | ||
var _bluebird = require('bluebird'); | ||
var _bluebird2 = _interopRequireDefault(_bluebird); | ||
var _csvParser = require('csv-parser'); | ||
@@ -34,8 +34,6 @@ | ||
var _ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment'); | ||
var _stream = require('stream'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var Readable = _ExecutionEnvironment.canUseDom ? require('stream-browserify').Readable : require('stream').Readable; | ||
var copyNumberRegexp = /^.*#.*(?:COPY_NUMBER_ALTERATION)\n/mg; | ||
@@ -60,4 +58,4 @@ var mutationRegexp = /^.*#.*(?:MUTATION_EXTENDED)\n/mg; | ||
return new _bluebird2.default(function (resolve) { | ||
var stream = new Readable(); | ||
return new _promise2.default(function (resolve) { | ||
var stream = new _stream.Readable(); | ||
var rows = []; | ||
@@ -64,0 +62,0 @@ stream._read = function () {}; // eslint-disable-line no-underscore-dangle |
'use strict'; | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
@@ -16,6 +20,2 @@ | ||
var _bluebird = require('bluebird'); | ||
var _bluebird2 = _interopRequireDefault(_bluebird); | ||
var _map2 = require('lodash/map'); | ||
@@ -54,2 +54,4 @@ | ||
*/ | ||
/* eslint-disable no-param-reassign */ | ||
function reduceCaseIds(key) { | ||
@@ -71,4 +73,2 @@ return function (cases, n) { | ||
*/ | ||
/* eslint-disable no-param-reassign */ | ||
function summarizer(cases, alterationFilter) { | ||
@@ -193,3 +193,3 @@ var summary = (0, _transform3.default)(cases, function (result, n, key) { | ||
return new _bluebird2.default(function (resolve) { | ||
return new _promise2.default(function (resolve) { | ||
@@ -196,0 +196,0 @@ var rows = (0, _flatten3.default)((0, _map3.default)((0, _flattenDeep3.default)(dataSets), function (set) { |
@@ -8,3 +8,3 @@ /** | ||
import Request from 'request-promise'; | ||
import Fetch from 'isomorphic-fetch'; | ||
import _reduce from 'lodash/reduce'; | ||
@@ -48,5 +48,4 @@ import _defaults from 'lodash/defaults'; | ||
headers: { | ||
'User-Agent': 'cbioportal-api-client.js/0.0.1' | ||
}, | ||
uri: 'http://www.cbioportal.org/webservice.do' | ||
'User-Agent': 'cbioportal-api-client.js/1.0.0' | ||
} | ||
}) | ||
@@ -87,9 +86,10 @@ }); | ||
const cmd = `get${endpoint}`; | ||
const qsObj = Object.assign(formatQuery(query), { cmd }); | ||
const qs = Object.keys(qsObj).reverse().map(key => { | ||
return key + '=' + encodeURIComponent(qsObj[key]); | ||
}).join('&'); | ||
const requestOpts = Object.assign({ | ||
qs: Object.assign(formatQuery(query), { cmd }) | ||
}, this.requestOpts); | ||
return Request(requestOpts) | ||
.then(response => convertResponse(response, cmd)); | ||
return Fetch(`http://www.cbioportal.org/webservice.do?${qs}`, this.requestOpts) | ||
.then(response => response.text()) | ||
.then(responseText => convertResponse(responseText, cmd)); | ||
}, | ||
@@ -96,0 +96,0 @@ |
@@ -1,9 +0,6 @@ | ||
import Promise from 'bluebird'; | ||
import CsvParser from 'csv-parser'; | ||
import _map from 'lodash/map'; | ||
import _transform from 'lodash/transform'; | ||
import { canUseDom } from 'fbjs/lib/ExecutionEnvironment'; | ||
import { Readable } from 'stream'; | ||
const Readable = canUseDom ? require('stream-browserify').Readable : require('stream').Readable; | ||
const copyNumberRegexp = /^.*#.*(?:COPY_NUMBER_ALTERATION)\n/mg; | ||
@@ -10,0 +7,0 @@ const mutationRegexp = /^.*#.*(?:MUTATION_EXTENDED)\n/mg; |
/* eslint-disable no-param-reassign */ | ||
import Promise from 'bluebird'; | ||
import _map from 'lodash/map'; | ||
@@ -5,0 +4,0 @@ import _uniq from 'lodash/uniq'; |
{ | ||
"name": "cbioportal-api-client", | ||
"version": "0.2.13", | ||
"version": "0.3.0", | ||
"description": "cBio Portal API client with promises and response parsing", | ||
@@ -10,3 +10,5 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "npm run clean:dist && babel lib -d dist", | ||
"build": "npm run clean:dist && babel lib -d dist && npm run build:webpack", | ||
"build:webpack": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js", | ||
"build:webpack:stats": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js --profile --json > stats.json", | ||
"build:dev": "nodemon -w lib --exec \"npm run clean:dist && babel lib -d dist\"", | ||
@@ -41,2 +43,3 @@ "clean": "npm run clean:dist && npm run clean:coverage", | ||
"babel-eslint": "^5.0.0-beta6", | ||
"babel-loader": "^6.2.1", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.4.5", | ||
@@ -48,3 +51,5 @@ "babel-plugin-transform-runtime": "^6.4.0", | ||
"blue-tape": "^0.1.11", | ||
"bluebird": "^3.1.5", | ||
"coveralls": "^2.11.6", | ||
"cross-env": "^1.0.7", | ||
"ddata": "github:nathanmarks/ddata#personal-modifications", | ||
@@ -56,2 +61,3 @@ "eslint": "^1.10.3", | ||
"jsdoc-to-markdown": "^1.3.3", | ||
"json-loader": "^0.5.4", | ||
"nock": "^5.2.1", | ||
@@ -61,16 +67,13 @@ "rimraf": "^2.5.0", | ||
"tap-xunit": "^1.3.1", | ||
"tape": "^4.4.0" | ||
"tape": "^4.4.0", | ||
"webpack": "^1.12.12" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^3.1.1", | ||
"cls-bluebird": "^1.0.1", | ||
"commander": "^2.9.0", | ||
"continuation-local-storage": "^3.1.4", | ||
"csv-parser": "^1.9.2", | ||
"fbjs": "^0.7.0", | ||
"in-publish": "^2.0.0", | ||
"isomorphic-fetch": "^2.2.1", | ||
"lodash": "^4.0.0", | ||
"request-promise": "^2.0.0", | ||
"stream-browserify": "^2.0.1" | ||
"readable-stream": "^2.0.5" | ||
} | ||
} |
@@ -6,3 +6,3 @@ # cBio Portal API Client | ||
[cBio Portal API](http://www.cbioportal.org/web_api.jsp) client. Parses tab separated responses into JSON format. Works in node and in the browser via a module loader such as [Webpack](http://webpack.github.io) (**soon:** just finalizing the browser build). | ||
[cBio Portal API](http://www.cbioportal.org/web_api.jsp) client. Parses tab separated responses into JSON format. Works in node and in the browser via a module loader such as [Webpack](http://webpack.github.io). | ||
@@ -9,0 +9,0 @@ This library can be used programatically or via the command line. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
331835
6
58
1698
26
+ Addedisomorphic-fetch@^2.2.1
+ Addedreadable-stream@^2.0.5
- Removedbluebird@^3.1.1
- Removedcls-bluebird@^1.0.1
- Removedcontinuation-local-storage@^3.1.4
- Removedfbjs@^0.7.0
- Removedrequest-promise@^2.0.0
- Removedstream-browserify@^2.0.1
- Removedajv@6.12.6(transitive)
- Removedasap@2.0.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasync-listener@0.6.10(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbluebird@2.11.03.7.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcls-bluebird@1.1.3(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcontinuation-local-storage@3.2.1(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedemitter-listener@1.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfbjs@0.7.2(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-bluebird@1.0.2(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpromise@7.3.1(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedrequest-promise@2.0.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@5.7.2(transitive)
- Removedshimmer@1.2.1(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstream-browserify@2.0.2(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)