Skip to content

Commit cdfabbc

Browse files
committed
Merge branch 'develop'
Conflicts: README.md citation.txt
2 parents fe30096 + c6c3c66 commit cdfabbc

File tree

8 files changed

+44
-33
lines changed

8 files changed

+44
-33
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ We love receiving patches for bug fixes and new features. Please follow these si
2727
## Citations
2828
To cite OPS.js in publications please see [the zenodo record](https://zenodo.org/record/21396#.VbJPs_lVhBc "OPS.js zenodo record").
2929

30-
>Ian Dunlop et al.. (2015). ops.js: OPS.js 6.0.2 for Open PHACTS 1.5 API. Zenodo. 10.5281/zenodo.21396
30+
>Ian Dunlop et al.. (2015). ops.js: OPS.js 6.1.2 for Open PHACTS 1.5 API. Zenodo. 10.5281/zenodo.21008
3131
3232
For Bibtex use:
3333

@@ -38,8 +38,8 @@ For Bibtex use:
3838
> andrawaag and
3939
> Stian Soiland-Reyes and
4040
> PANDORINO},
41-
> title = {ops.js: OPS.js 6.0.2 for Open PHACTS 1.5 API},
42-
> month = jul,
41+
> title = {ops.js: OPS.js 6.1.2 for Open PHACTS 1.5 API},
42+
> month = aug,
4343
> year = 2015,
4444
> doi = {10.5281/zenodo.21396},
4545
> url = {http://dx.doi.org/10.5281/zenodo.21396}

citation.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ author = {Ian Dunlop and
55
andrawaag and
66
Stian Soiland-Reyes and
77
PANDORINO},
8-
title = {ops.js: OPS.js 6.0.2 for Open PHACTS 1.5 API},
9-
month = jul,
8+
title = {ops.js: OPS.js 6.1.2 for Open PHACTS 1.5 API},
9+
month = aug,
1010
year = 2015,
11-
doi = {10.5281/zenodo.21396},
12-
url = {http://dx.doi.org/10.5281/zenodo.21396}
11+
doi = {10.5281/zenodo.21008},
12+
url = {http://dx.doi.org/10.5281/zenodo.21008}
1313
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ops.js",
3-
"version": "6.0.2",
3+
"version": "6.1.2",
44
"description": "Javascript based library to access the Open PHACTS API and discover bio-chemical and life sciences data",
55
"main": "./src/OPS.js",
66
"directories": {

src/DiseaseSearch.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,19 @@ DiseaseSearch.prototype.parseDiseasesByTargetResponse = function(response) {
515515
URI = item[constants.ABOUT];
516516
gene = {};
517517
gene["URI"] = item.forGene[constants.ABOUT];
518-
gene["encodes"] = item.forGene.encodes[constants.ABOUT];
519-
if (item.forGene.encodes.exactMatch != null) {
520-
gene["encodesProvenance"] = item.forGene.encodes.exactMatch[constants.ABOUT] != null ? item.forGene.encodes.exactMatch[constants.ABOUT] : null;
521-
gene["encodesLabel"] = item.forGene.encodes.exactMatch.prefLabel != null ? item.forGene.encodes.exactMatch.prefLabel : null;
518+
gene["encodes"] = [];
519+
Utils.arrayify(item.forGene.encodes).forEach(function(encode, i) {
520+
var about = encode[constants.ABOUT];
521+
if (encode.exactMatch != null) {
522+
var provenance = encode.exactMatch[constants.ABOUT] != null ? item.forGene.encodes.exactMatch[constants.ABOUT] : null;
523+
var label = encode.exactMatch.prefLabel != null ? item.forGene.encodes.exactMatch.prefLabel : null;
524+
gene["encodes"].push({"uri": about, "provenance": provenance, "label": label});
522525
} else {
523-
gene["encodesProvenance"] = null;
524-
gene["encodesLabel"] = null;
526+
gene["encodes"].push({"uri": about});
527+
gene["provenance"] = null;
528+
gene["label"] = null;
525529
}
530+
});
526531
diseases.push({
527532
"name": name,
528533
"URI": URI,

src/OPS.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ module.exports = Openphacts;
206206
* @typedef {Array.<Object>} DiseasesByTargetResponse
207207
* @property {string} URI - URI
208208
* @property {string} name - name
209-
* @property {Array.<object>} gene - containing URI for the gene, link to the gene it encodes, encodesLabel and encodesProvenance link to where the label came from
209+
* @property {Array.<object>} gene - containing URI for the gene and an array of encoded genes with link to the gene it encodes, label and provenance link to where the label came from
210210
*/
211211
/**
212212
* Contains list of targets for a particular disease fetched with {@link DiseaseSearch#targetsByDisease}

src/Version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Version = function Version() {
1717
*/
1818
Version.prototype.information = function() {
1919
return {
20-
"version": "6.0.2",
20+
"version": "6.1.2",
2121
"author": "Ian Dunlop",
2222
"ORCID": "http://orcid.org/0000-0001-7066-3350",
2323
"title": "OPS.js",
@@ -26,7 +26,7 @@ Version.prototype.information = function() {
2626
"organization": "School of Computer Science",
2727
"address": "University of Manchester, UK",
2828
"year": "2015",
29-
"month": "July",
29+
"month": "August",
3030
"url": "http://github.com/openphacts/ops.js",
3131
"LDA-version": "1.5"
3232
};

src/combined.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,10 +1933,11 @@ function createXHR(options, callback) {
19331933
// IE must die
19341934
}
19351935
xhr.ontimeout = errorFunc
1936-
xhr.open(method, uri, !sync)
1936+
xhr.open(method, uri, !sync, options.username, options.password)
19371937
//has to be after open
1938-
xhr.withCredentials = !!options.withCredentials
1939-
1938+
if(!sync) {
1939+
xhr.withCredentials = !!options.withCredentials
1940+
}
19401941
// Cannot set timeout with sync request
19411942
// not setting timeout on the xhr object, because of old webkits etc. not handling that correctly
19421943
// both npm's request and jquery 1.x use this kind of timeout, so this is being consistent
@@ -4306,14 +4307,19 @@ DiseaseSearch.prototype.parseDiseasesByTargetResponse = function(response) {
43064307
URI = item[constants.ABOUT];
43074308
gene = {};
43084309
gene["URI"] = item.forGene[constants.ABOUT];
4309-
gene["encodes"] = item.forGene.encodes[constants.ABOUT];
4310-
if (item.forGene.encodes.exactMatch != null) {
4311-
gene["encodesProvenance"] = item.forGene.encodes.exactMatch[constants.ABOUT] != null ? item.forGene.encodes.exactMatch[constants.ABOUT] : null;
4312-
gene["encodesLabel"] = item.forGene.encodes.exactMatch.prefLabel != null ? item.forGene.encodes.exactMatch.prefLabel : null;
4310+
gene["encodes"] = [];
4311+
Utils.arrayify(item.forGene.encodes).forEach(function(encode, i) {
4312+
var about = encode[constants.ABOUT];
4313+
if (encode.exactMatch != null) {
4314+
var provenance = encode.exactMatch[constants.ABOUT] != null ? item.forGene.encodes.exactMatch[constants.ABOUT] : null;
4315+
var label = encode.exactMatch.prefLabel != null ? item.forGene.encodes.exactMatch.prefLabel : null;
4316+
gene["encodes"].push({"uri": about, "provenance": provenance, "label": label});
43134317
} else {
4314-
gene["encodesProvenance"] = null;
4315-
gene["encodesLabel"] = null;
4318+
gene["encodes"].push({"uri": about});
4319+
gene["provenance"] = null;
4320+
gene["label"] = null;
43164321
}
4322+
});
43174323
diseases.push({
43184324
"name": name,
43194325
"URI": URI,
@@ -4777,7 +4783,7 @@ module.exports = Openphacts;
47774783
* @typedef {Array.<Object>} DiseasesByTargetResponse
47784784
* @property {string} URI - URI
47794785
* @property {string} name - name
4780-
* @property {Array.<object>} gene - containing URI for the gene, link to the gene it encodes, encodesLabel and encodesProvenance link to where the label came from
4786+
* @property {Array.<object>} gene - containing URI for the gene and an array of encoded genes with link to the gene it encodes, label and provenance link to where the label came from
47814787
*/
47824788
/**
47834789
* Contains list of targets for a particular disease fetched with {@link DiseaseSearch#targetsByDisease}
@@ -7420,7 +7426,7 @@ Version = function Version() {
74207426
*/
74217427
Version.prototype.information = function() {
74227428
return {
7423-
"version": "6.0.0",
7429+
"version": "6.1.2",
74247430
"author": "Ian Dunlop",
74257431
"ORCID": "http://orcid.org/0000-0001-7066-3350",
74267432
"title": "OPS.js",
@@ -7429,7 +7435,7 @@ Version.prototype.information = function() {
74297435
"organization": "School of Computer Science",
74307436
"address": "University of Manchester, UK",
74317437
"year": "2015",
7432-
"month": "July",
7438+
"month": "August",
74337439
"url": "http://github.com/openphacts/ops.js",
74347440
"LDA-version": "1.5"
74357441
};

test/spec/integration/DiseaseIntegrationSpec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,18 @@ expect(this_result.length).toBeGreaterThan(0);
209209
runs(function() {
210210
expect(this_success).toBe(true);
211211
expect(this_status).toBe(200);
212-
213212
// API contract states that these will be present
214213
expect(this_result).toBeDefined();
215214
expect(this_result.length).toBeGreaterThan(0);
216215
expect(this_result[0].name).not.toBeNull();
217216
expect(this_result[0].URI).not.toBeNull();
218217
expect(this_result[0].gene).not.toBeNull();
219-
expect(this_result[0].gene.URI).not.toBeNull();
220218
expect(this_result[0].gene.encodes).not.toBeNull();
219+
expect(this_result[0].gene.encodes[0]).not.toBeNull();
220+
expect(this_result[0].gene.encodes[0].uri).not.toBeNull();
221221
// encodesProvenance & encodesLabel are optional
222-
expect(this_result[0].gene.encodesProvenance).toBeDefined();
223-
expect(this_result[0].gene.encodesLabel).toBeDefined();
222+
expect(this_result[0].gene.encodes[0].label).toBeDefined();
223+
expect(this_result[0].gene.encodes[0].provenance).toBeDefined();
224224
});
225225
searcher.diseasesByTarget('http://purl.uniprot.org/uniprot/Q9Y5Y9', null, null, null, null, callback);
226226
});

0 commit comments

Comments
 (0)