Commit 61451efa authored by Severine Duvaud's avatar Severine Duvaud
Browse files

Using the new API

parent 306b0436
......@@ -2,16 +2,18 @@
// dataset identifiers's validity for instance.
var request = require("request");
var url = "http://arraymap.org/api/?db=arraymap&api_out=icdmlist&api_out=icdmlist&api_doctype=json&icdm_m=8,9";
// var url = "http://arraymap.org/api/?db=arraymap&api_out=icdmlist&api_out=icdmlist&api_doctype=json&icdm_m=8010/2";
var url = "http://arraymap.org/qsubsets/?db=arraymap&collection=subsets&subsettype=ICDMORPHOLOGYCODE&querytext=8|9";
module.exports = {
getDatasetsFromArrayMap: function(callback) {
var object;
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
// Incorrect json returned.
// Remove flanking parenthesis
body = body.replace(/^\(/, "");
body = body.replace(/\}\);/, "}");
object = getDatasets(JSON.parse(body));
console.log(object)
callback(object);
}
else {
......@@ -41,14 +43,17 @@ function getDatasets(json) {
infoinfo.email = "SIB-Technology@isb-sib.ch";
var datasets = [];
var array = json.data;
var array = json.subsetdata;
for (var i = 0; i < array.length; i++) {
var element = array[i];
var dataset = {};
dataset.id = element.ICDMORPHOLOGYCODE;
dataset.description = element.ICDMORPHOLOGY;
// "UID":"80003","SUBSETCODE":"8000/3","SAMPLENO":7,"SUBSETTEXT":"8000/3: Neoplasm, malignant"
dataset.id = element.SUBSETCODE;
dataset.description = element.SUBSETTEXT;
dataset.reference = "reference genome";
var size = {};
......
......@@ -22,7 +22,8 @@ arrayMap.factory('BeaconService', ['$http', '$q', function ($http, $q) {
function getDatasets() {
var defer = $q.defer();
var url = "http://arraymap.org/api/?db=arraymap&api_out=icdmlist&api_out=icdmlist&api_doctype=json&icdm_m=8,9";
// var url = "http://arraymap.org/api/?db=arraymap&api_out=icdmlist&api_out=icdmlist&api_doctype=json&icdm_m=8,9";
var url = "http://arraymap.org/qsubsets/?db=arraymap&collection=subsets&subsettype=ICDMORPHOLOGYCODE&querytext=8|9";
var req = {
method: 'GET',
......@@ -100,7 +101,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', 'BeaconService',
BeaconService.getDatasets()
.then(function (datasets) {
$scope.datasets = datasets
$scope.datasets = datasets;
},
function(datasets){
console.log("Error getting datasets");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment