1//data from /json 2 3angular 4 .module('resources') 5 .factory('allOrgs', function ($resource) { 6 var url = '/static/wiki/json/orgsList.json'; 7 return $resource(url, {}, { 8 getAllOrgs: { 9 method: "GET", 10 params: {}, 11 isArray: true, 12 cache: true 13 } 14 }); 15 }); 16 17angular 18 .module('resources') 19 .factory('evidenceCodes', function ($resource) { 20 var url = '/static/wiki/json/evidence_codes.json'; 21 return $resource(url, {}, { 22 getevidenceCodes: { 23 method: "GET", 24 params: {}, 25 isArray: true, 26 cache: true 27 } 28 }); 29 }); 30 31angular 32 .module('resources') 33 .factory('mutantData', function ($resource) { 34 var url = '/static/wiki/json/kokes.json'; 35 return $resource(url, {}, { 36 getKokesMutants: { 37 method: "GET", 38 params: {}, 39 isArray: true, 40 cache: true 41 } 42 }); 43 }); 44 45angular 46 .module('resources') 47 .factory('orthoData', function ($resource) { 48 var url = '/static/wiki/json/orthologs.json'; 49 return $resource(url, {}, { 50 getOrthologs: { 51 method: "GET", 52 params: {}, 53 isArray: true, 54 cache: true 55 } 56 }); 57 }); 58 59//server communication 60angular 61 .module('resources') 62 .factory('sendToView', function ($http) { 63 var sendToView = function (url_suffix, data) { 64 console.log(data); 65 var url = url_suffix; 66 return $http.post(url, data) 67 .success(function (data) { 68 return data 69 }) 70 .error(function (data, status) { 71 return status 72 }); 73 }; 74 return { 75 sendToView: sendToView 76 } 77 78 }); 79 80angular 81 .module('resources') 82 .factory('uploadFile', function ($http) { 83 var uploadFile = function (url_suffix, data) { 84 var url = url_suffix; 85 //var config = { 86 // 'Content-Type': data.type 87 //}; 88 return $http.post(url, data) 89 .success(function (data) { 90 return data 91 }) 92 .error(function (data, status) { 93 return status 94 }); 95 }; 96 return { 97 uploadFile: uploadFile 98 } 99 100 }); 101 102 103//currently loaded organism 104angular 105 .module('resources') 106 .factory('currentOrgFetch', function ($http) { 107 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 108 var getCurrentOrg = function (taxid) { 109 var url = endpoint + encodeURIComponent("SELECT ?taxid ?taxon ?taxonLabel" + 110 " WHERE{ ?taxon wdt:P685 '" + taxid + "'. " + 111 "SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . } }"); 112 return $http.get(url).then(function (response) { 113 var results = response.data.results.bindings; 114 return { 115 taxid: taxid, 116 taxon: results[0].taxon.value, 117 taxonLabel: results[0].taxonLabel.value 118 } 119 }); 120 }; 121 122 return { 123 getCurrentOrg: getCurrentOrg 124 } 125 126 127 }); 128 129//genes for current organism 130 131angular 132 .module('resources') 133 .factory('allOrgGenes', function ($http) { 134 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 135 var getAllOrgGenes = function (taxid) { 136 var url = endpoint + encodeURIComponent("SELECT ?gene ?geneLabel ?proteinLabel ?protein ?entrez ?refseqProt " + 137 "?locusTag ?uniprot ?chromosome ?chromosomeLabel ?refSeqChromosome ?refSeqChromosomeLabel ?genStart ?genEnd ?strand " + 138 "(group_concat(?aliases;separator=', ') as ?alias) " + 139 "WHERE{ ?taxon wdt:P685 '" + taxid + "'. " + 140 "?gene wdt:P703 ?taxon; " + 141 "wdt:P279 wd:Q7187; " + 142 "wdt:P2393 ?locusTag; " + 143 "wdt:P351 ?entrez; " + 144 "wdt:P644 ?genStart; " + 145 "wdt:P645 ?genEnd; " + 146 "wdt:P2548 ?strand; " + 147 "skos:altLabel ?aliases. " + 148 "OPTIONAL {?gene wdt:P688 ?protein; wdt:P352 ?uniprot; wdt:P637 ?refseqProt. }" + 149 "?gene p:P644 ?chr. ?chr pq:P1057 ?chromosome. " + 150 "?chromosome wdt:P2249 ?refSeqChromosome." + 151 "SERVICE wikibase:label { " + 152 "bd:serviceParam wikibase:language 'en' ." + 153 "}" + 154 "} " + 155 "GROUP BY ?gene ?geneLabel ?protein ?proteinLabel ?entrez ?refseqProt " + 156 "?locusTag ?uniprot ?chromosome ?chromosomeLabel ?genStart ?genEnd ?strand " + 157 "?refSeqChromosome ?refSeqChromosomeLabel " 158 ); 159 return $http.get(url) 160 .success(function (response) { 161 return response 162 }) 163 .error(function (response) { 164 return response 165 }) 166 }; 167 return { 168 getAllOrgGenes: getAllOrgGenes 169 } 170 }); 171 172angular 173 .module('resources') 174 .factory('allOrgGenes2', function ($http) { 175 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 176 var getAllOrgGenes = function (taxid) { 177 var query = "SELECT ?gene ?geneLabel ?entrez ?locusTag ?aliases " + 178 "WHERE { " + 179 "?taxon wdt:P685 '{taxid}'. " + 180 "?gene wdt:P279 wd:Q7187;" + 181 "wdt:P703 ?taxon;" + 182 "wdt:P351 ?entrez;" + 183 "wdt:P2393 ?locusTag;" + 184 "wdt:P688 ?protein;" + 185 "skos:altLabel ?aliases." + 186 "SERVICE wikibase:label {bd:serviceParam wikibase:language 'en' .}}".replace('{taxid}', taxid); 187 var url = endpoint + encodeURIComponent(query); 188 return $http.get(url) 189 .success(function (response) { 190 return response 191 }) 192 .error(function (response) { 193 return response 194 }) 195 }; 196 return { 197 getAllOrgGenes: getAllOrgGenes 198 } 199 }); 200 201 202angular 203 .module('resources') 204 .factory('allOrgOperons', function ($http) { 205 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 206 var getAllOrgOperons = function (taxid) { 207 var url = endpoint + encodeURIComponent( 208 "SELECT ?operon ?operonLabel " + 209 "WHERE{ ?taxon wdt:P685 '" + taxid + "'. " + 210 "?operon wdt:P703 ?taxon; " + 211 "wdt:P279 wd:Q139677. " + 212 "SERVICE wikibase:label { " + 213 "bd:serviceParam wikibase:language 'en' ." + 214 "}" + 215 "} " 216 ); 217 return $http.get(url) 218 .success(function (response) { 219 return response 220 }) 221 .error(function (response) { 222 return response 223 }) 224 }; 225 return { 226 getAllOrgOperons: getAllOrgOperons 227 } 228 }); 229 230 231//annotations data 232angular 233 .module('resources') 234 .factory('GOTerms', function ($http) { 235 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 236 var getGoTerms = function (uniprot) { 237 var url = endpoint + encodeURIComponent( 238 "SELECT distinct ?gotermValueLabel ?goID ?gotermValue ?goclass ?determinationLabel ?reference_stated_inLabel ?reference_retrievedLabel ?ecnumber WHERE { ?protein wdt:P352 " + 239 "'" + uniprot + "'. " + 240 "{?protein p:P680 ?goterm} UNION {?protein p:P681 ?goterm} UNION {?protein p:P682 ?goterm}. " + 241 "?goterm pq:P459 ?determination . ?goterm prov:wasDerivedFrom/pr:P248 ?reference_stated_in . " + 242 "?goterm prov:wasDerivedFrom/pr:P813 ?reference_retrieved . " + 243 "OPTIONAL {?goterm prov:wasDerivedFrom/pr:P698 ?pmid .}" + 244 "{?goterm ps:P680 ?gotermValue} UNION {?goterm ps:P681 ?gotermValue} UNION {?goterm ps:P682 ?gotermValue}. " + 245 "?gotermValue wdt:P279* ?goclass; wdt:P686 ?goID. FILTER ( ?goclass = wd:Q2996394 || ?goclass = wd:Q5058355 || ?goclass = wd:Q14860489) " + 246 "OPTIONAL {?gotermValue wdt:P591 ?ecnumber.}" + 247 "SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\" .}}" 248 ); 249 return $http.get(url) 250 .success(function (response) { 251 return response.data 252 253 }) 254 .error(function (response) { 255 return response 256 }); 257 258 // .then(function (response) { 259 // 260 // return response.data.results.bindings; 261 // 262 //}); 263 }; 264 return { 265 getGoTerms: getGoTerms 266 } 267 268 269 }); 270 271angular 272 .module('resources') 273 .factory('InterPro', function ($http) { 274 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 275 var getInterPro = function (uniprot) { 276 var url = endpoint + encodeURIComponent( 277 "SELECT distinct ?protein ?interPro_item ?interPro_label ?ipID ?reference_stated_inLabel ?refURL WHERE {" + 278 "?proteinLabel wdt:P352" + 279 "'" + uniprot + "';" + 280 "p:P527 ?interPro." + 281 "?interPro ps:P527 ?interPro_item." + 282 "?interPro prov:wasDerivedFrom/pr:P248 ?reference_stated_in ;" + //#where stated 283 "prov:wasDerivedFrom/pr:P854 ?refURL ." + //#reference URL 284 "?interPro_item wdt:P2926 ?ipID;" + 285 "rdfs:label ?interPro_label. " + 286 "SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\" .}" + 287 "filter (lang(?interPro_label) = \"en\") .}" 288 ); 289 return $http.get(url).then(function (response) { 290 return response.data.results.bindings; 291 292 }); 293 }; 294 return { 295 getInterPro: getInterPro 296 } 297 298 299 }); 300 301angular 302 .module('resources') 303 .factory('OperonData', function ($http) { 304 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 305 var getOperonData = function (entrez) { 306 var url = endpoint + encodeURIComponent( 307 "SELECT ?gene ?locusTag ?entrez ?operon ?operonLabel ?operonItem ?operonItemLabel ?genStart ?genEnd ?strand " + 308 "?strandLabel ?op_genes ?reference_stated_in ?reference_stated_inLabel ?op_genesLabel " + 309 "?reference_pmid " + 310 "WHERE { " + 311 "?gene wdt:P351 '" + entrez + "'; " + 312 "p:P361 ?operon. " + 313 "?operon ps:P361 ?operonItem. " + 314 "?operonItem wdt:P279 wd:Q139677; " + 315 "wdt:P527 ?op_genes. " + 316 "?op_genes wdt:P2393 ?locusTag; " + 317 "wdt:P351 ?entrez; " + 318 "wdt:P644 ?genStart; " + 319 "wdt:P645 ?genEnd; " + 320 "wdt:P2548 ?strand." + 321 "OPTIONAL { " + 322 "?operon prov:wasDerivedFrom/pr:P248 ?reference_stated_in. " + 323 "?reference_stated_in wdt:P698 ?reference_pmid. } " + 324 "SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . }}" 325 ); 326 return $http.get(url) 327 .success(function (response) { 328 return response.data 329 330 }) 331 .error(function (response) { 332 return response 333 }); 334 }; 335 return { 336 getOperonData: getOperonData 337 } 338 }); 339 340angular 341 .module('resources') 342 .factory('expasyData', function ($http) { 343 var expasy_endpoint = 'http://enzyme.expasy.org/EC/{ecnumber}.txt'; 344 345 var getReactionData = function (ecNumber) { 346 var url = expasy_endpoint.replace('{ecnumber}', ecNumber); 347 return $http.get(url).then( 348 function successCallback(response) { 349 var reactionData = { 350 reaction: [] 351 }; 352 var responseData = response.data.split("\n"); 353 angular.forEach(responseData, function (value, key) { 354 355 if (value.match("^ID")) {
356 reactionData['ecnumber'] = value.slice(5); 357 } 358 if (value.match("^CA ")) { 359 var trimmedReaction = value.replace(/^(CA)/, ""); 360 reactionData['reaction'].push(trimmedReaction); 361 } 362 363 }); 364 return reactionData; 365 366 }, 367 function errorCallbackResponse(response) { 368 return response; 369 } 370 ); 371 }; 372 return { 373 getReactionData: getReactionData 374 } 375 376 377 }); 378 379angular 380 .module('resources') 381 .factory('pubMedData', function ($http) { 382 var getPMID = function (val) { 383 var endpoint = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&retmode=json&id='; 384 var url = endpoint + val; 385 return $http.get(url) 386 .success(function (response) { 387 return response.result[val]; 388 }) 389 .error(function (response) { 390 return response 391 }); 392 }; 393 return { 394 getPMID: getPMID 395 } 396 }); 397var url = 'https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=CT681&resulttype=core&format=json' 398 399angular 400 .module('resources') 401 .factory('linkedPubs', function ($http) { 402 var getLinkedPubs = function (locus_tag, organism_name) { 403 var endpoint = 'https://www.ebi.ac.uk/europepmc/webservices/rest/search?query={organism}%20{locusTag}&format=json'; 404 var url1 = endpoint.replace('{locusTag}', locus_tag); 405 var url = url1.replace('{organism}', organism_name); 406 console.log(url); 407 return $http.get(url) 408 .success(function (response) { 409 return response; 410 }) 411 .error(function (response) { 412 return response 413 }); 414 }; 415 return { 416 getLinkedPubs: getLinkedPubs 417 } 418 }); 419 420 421angular 422 .module('resources') 423 .factory('euroPubData', function ($http) { 424 var getEuroPubData = function (val) { 425 var endpoint = 'https://www.ebi.ac.uk/europepmc/webservices/rest/search?query={pubmedID}&resulttype=core&format=json'; 426 var url = endpoint.replace('{pubmedID}', val); 427 return $http.get(url) 428 .success(function (response) { 429 return response; 430 }) 431 .error(function (response) { 432 return response 433 }); 434 }; 435 return { 436 getEuroPubData: getEuroPubData 437 } 438 }); 439 440angular 441 .module('resources') 442 .factory('pubLinks', function ($http, $filter) { 443 var getPubLinks = function (entrez) { 444 var endpoint = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=gene&db=pubmed&id={entrez}&retmode=json&linkname=gene_pubmed_pmc_nucleotide'; 445 446 var url = endpoint.replace('{entrez}', entrez); 447 return $http.get(url) 448 .success(function (response) { 449 return response 450 }) 451 .error(function (response) { 452 return response 453 }); 454 }; 455 return { 456 getPubLinks: getPubLinks 457 } 458 }); 459 460angular 461 .module('resources') 462 .factory('recentChlamPubLinks', function ($http) { 463 var getRecentChlamPubLinks = function (entrez) { 464 var url = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=chlamydia trachomatis&reldate=10&datetype=edat&retmax=100&usehistory=y&retmode=json'; 465 return $http.get(url) 466 .success(function (response) { 467 return response 468 }) 469 .error(function (response) { 470 return response 471 }); 472 }; 473 return { 474 getRecentChlamPubLinks: getRecentChlamPubLinks 475 } 476 }); 477 478angular 479 .module('resources') 480 .factory('allGoTerms', function ($http) { 481 var getGoTermsAll = function (val, goClass) { 482 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 483 var url = endpoint + encodeURIComponent("SELECT DISTINCT ?goterm ?goID ?goterm_label " + 484 "WHERE { ?goterm wdt:P279* wd:" + goClass + "; " + 485 "rdfs:label ?goterm_label; wdt:P686 ?goID. " + 486 "FILTER(lang(?goterm_label) = 'en') " + 487 "FILTER(CONTAINS(LCASE(?goterm_label), '" + 488 val.toLowerCase() + "' ))}" 489 ); 490 return $http.get(url) 491 .success(function (response) { 492 return response.data; 493 }) 494 .error(function (response) { 495 return response 496 }); 497 }; 498 return { 499 getGoTermsAll: getGoTermsAll 500 } 501 502 }); 503 504angular 505 .module('resources') 506 .factory('allChlamydiaGenes', function ($http) { 507 var getAllChlamGenes = function () { 508 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 509 var url = endpoint + encodeURIComponent( 510 "SELECT ?taxon ?taxid ?taxonLabel ?gene ?geneLabel ?entrez ?uniprot ?protein ?proteinLabel ?locusTag " + 511 "?geneDescription ?refseq_prot ?aliases " + 512 "WHERE { " + 513 "?taxon wdt:P171* wd:Q846309. " + 514 "?gene wdt:P279 wd:Q7187; " + 515 "wdt:P703 ?taxon; " + 516 "wdt:P351 ?entrez; " + 517 "wdt:P2393 ?locusTag; " + 518 "wdt:P688 ?protein; " + 519 "skos:altLabel ?aliases." + 520 "?protein wdt:P352 ?uniprot; " + 521 "wdt:P637 ?refseq_prot. " + 522 "?taxon wdt:P685 ?taxid." + 523 "SERVICE wikibase:label {bd:serviceParam wikibase:language 'en'.}}"); 524 return $http.get(url) 525 .success(function (response) { 526 return response.data; 527 }) 528 .error(function (response) { 529 return response 530 }); 531 }; 532 return { 533 getAllChlamGenes: getAllChlamGenes 534 } 535 }); 536 537angular 538 .module('resources') 539 .factory('wdGetEntities', function () { 540 var wdGetEntities = function (qid) { 541 return $.ajax({ 542 url: "https://www.wikidata.org/w/api.php", 543 jsonp: "callback", 544 dataType: 'jsonp', 545 data: { 546 action: "wbgetentities", 547 ids: qid, 548 format: "json" 549 }, 550 xhrFields: {withCredentials: true}, 551 success: function (response) { 552 return response 553 }, 554 error: function (response) { 555 return response 556 } 557 }); 558 }; 559 return { 560 wdGetEntities: wdGetEntities 561 562 } 563 }); 564 565angular 566 .module('resources') 567 .factory('entrez2QID', function ($http, $filter) { 568 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 569 var getEntrez2QID = function (entrez) { 570 var query = "SELECT distinct ?gene ?protein WHERE{" + 571 "?gene wdt:P351 '{entrez}'; " + 572 "wdt:P688 ?protein.}"; 573 var url = endpoint + encodeURIComponent(query.replace('{entrez}', entrez)); 574 return $http.get(url) 575 .success(function (response) { 576 return response; 577 }) 578 .error(function (response) { 579 return response 580 }); 581 582 }; 583 return { 584 getEntrez2QID: getEntrez2QID 585 } 586 587 588 }); 589 590angular 591 .module('resources') 592 .factory('locusTag2QID', function ($http, $filter) { 593 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 594 var getLocusTag2QID = function (locusTag, taxid) { 595 var query = "SELECT distinct ?gene ?protein WHERE{" + 596 "?strain wdt:P685 '{taxid}'. " + 597 "?gene wdt:P2393 '{locusTag}'; " + 598 "wdt:P703 ?strain; " + 599 "wdt:P688 ?protein.}"; 600 var url1 = query.replace('{taxid}', taxid); 601 var url = endpoint + encodeURIComponent(url1.replace('{locusTag}', locusTag)); 602 603 return $http.get(url) 604 .success(function (response) { 605 606 return response; 607 608 }) 609 .error(function (response) { 610 611 return response 612 }); 613 614 }; 615 return { 616 getLocusTag2QID: getLocusTag2QID 617 } 618 619 620 }); 621 622 623angular 624 .module('resources') 625 .factory('abstractSPARQL', function ($http) { 626 var endpoint = 'https://query.wikidata.org/sparql?format=json&query='; 627 var getAbstractSPARQL = function (pqid, pred, idprop) { 628 var preq = "PREFIX wd: <http://www.wikidata.org/entity/> " + 629 "PREFIX prov: <http://www.w3.org/ns/prov#> " + 630 "PREFIX pr: <http://www.wikidata.org/prop/reference/> " + 631 "PREFIX p: <http://www.wikidata.org/prop/> " + 632 "PREFIX ps: <http://www.wikidata.org/prop/statement/> " +
633 "SELECT (wd:prot_qid as ?sub) " + 634 "?obj ?objLabel ?objDescription ?obj_id " + 635 "?stated_in ?stated_inLabel " + 636 "?retrieved " + 637 "?reference_url " + 638 "?language ?languageLabel " + 639 "?curator ?curatorLabel " + 640 "?determination ?determinationLabel " + 641 "WHERE { " + 642 " wd:prot_qid p:an_prop ?claim . " + 643 " ?claim ps:an_prop ?obj. " + 644 " ?obj wdt:id_prop ?obj_id. " + 645 " optional {?claim prov:wasDerivedFrom/pr:P248 ?stated_in. } " + 646 " optional {?claim prov:wasDerivedFrom/pr:P813 ?retrieved. } " + 647 " optional {?claim prov:wasDerivedFrom/pr:P854 ?reference_url. } " + 648 " optional {?claim prov:wasDerivedFrom/pr:P407 ?language. } " + 649 " optional {?claim prov:wasDerivedFrom/pr:P1640 ?curator. } " + 650 " optional {?claim pq:P459 ?determination. } " + 651 " SERVICE wikibase:label { " + 652 " bd:serviceParam wikibase:language 'en' ." + 653 " } " + 654 "}"; 655 656 var url1 = preq.replace(/prot_qid/g, pqid).replace(/an_prop/g, pred).replace(/id_prop/g, idprop); 657 var url = endpoint + encodeURIComponent(url1); 658 console.log(url1); 659 return $http.get(url) 660 .success(function (response) { 661 return response; 662 }) 663 .error(function (response) { 664 665 return response 666 }); 667 }; 668 return { 669 getAbstractSPARQL: getAbstractSPARQL 670 } 671 672 673 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.