@@ -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 */
74217427Version . 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 } ;
0 commit comments