Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Updated services prior to merge
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaFumis committed Aug 29, 2017
1 parent 2a25d26 commit 51761e9
Show file tree
Hide file tree
Showing 39 changed files with 174 additions and 703 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module('facets')

.factory('dataDistributionFacetParser', ['otConsts', 'otFiltersService', function (otConsts, otFiltersService) {
.factory('dataDistributionFacetParser', ['otConsts', 'otFacetsFilters', function (otConsts, otFacetsFilters) {
'use strict';


Expand All @@ -27,7 +27,7 @@ angular.module('facets')
// TODO:
// this is not gonna work now!
// NEED TO CHANGE all facets to return a config object rathen than just the list of filters...
var search = otFiltersService.parseURL();
var search = otFacetsFilters.parseURL();
search.score_min = search.score_min || [otConsts.defaults.SCORE_MIN.toFixed(2)];
search.score_max = search.score_max || [otConsts.defaults.SCORE_MAX.toFixed(2)];
search.score_str = search.score_str || [otConsts.defaults.STRINGENCY];
Expand Down
4 changes: 2 additions & 2 deletions app/plugins/disease-classification-directive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('plugins')
.directive('diseaseClassification', ['otAPIservice', '$timeout', 'otUtils', function (otAPIservice, $timeout, otUtils) {
.directive('diseaseClassification', ['otApi', '$timeout', 'otUtils', function (otApi, $timeout, otUtils) {
'use strict';

return {
Expand All @@ -18,7 +18,7 @@ angular.module('plugins')
.width(scope.width - 40) // 40 for margins
.height(700)
.data(scope.disease)
.cttvApi(otAPIservice.getSelf());
.cttvApi(otApi.getSelf());

efoGraph(container);

Expand Down
4 changes: 2 additions & 2 deletions app/plugins/genome-browser-directive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('plugins')
.directive('genomeBrowser', ['otAPIservice', 'otUtils', function (otAPIservice, otUtils) {
.directive('genomeBrowser', ['otApi', 'otUtils', function (otApi, otUtils) {
'use strict';

// Decorate the svg for exporting
Expand Down Expand Up @@ -108,7 +108,7 @@ angular.module('plugins')
gB.rest().prefix('/proxy/rest.ensembl.org').protocol('').domain('');
var theme = targetGenomeBrowser()
.efo(efo)
.cttvRestApi(otAPIservice.getSelf());
.cttvRestApi(otApi.getSelf());
theme(gB, newDiv);

if (otUtils.browser.name !== 'IE') {
Expand Down
4 changes: 2 additions & 2 deletions app/plugins/interactions-viewer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('plugins')
.directive('interactionsViewer', ['$log', '$timeout', '$http', '$q', 'otAPIservice', 'otOmnipathdbSources', function ($log, $timeout, $http, $q, otAPIservice, otOmnipathdbSources) {
.directive('interactionsViewer', ['$log', '$timeout', '$http', '$q', 'otApi', 'otOmnipathdbSources', function ($log, $timeout, $http, $q, otApi, otOmnipathdbSources) {
function getNames (bestHits) {
var mapNames = {};
for (var i = 0; i < bestHits.length; i++) {
Expand Down Expand Up @@ -75,7 +75,7 @@ angular.module('plugins')
trackCall: false
};

promises.push(otAPIservice.getBestHitSearch(queryObject));
promises.push(otApi.getBestHitSearch(queryObject));

// Both promises run in parallel
$q.all(promises)
Expand Down
8 changes: 4 additions & 4 deletions app/plugins/related-diseases-directive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('plugins')
.directive('relatedDiseases', ['otUtils', 'otConsts', 'otDictionary', 'otAPIservice', '$timeout', function (otUtils, otConsts, otDictionary, otAPIservice, $timeout) {
.directive('relatedDiseases', ['otUtils', 'otConsts', 'otDictionary', 'otApi', '$timeout', function (otUtils, otConsts, otDictionary, otApi, $timeout) {
'use strict';

// Details table --
Expand Down Expand Up @@ -148,8 +148,8 @@ angular.module('plugins')
paramsObj.size = 200;
paramsObj.direct = true;
paramsObj.facets = false;
// TODO: Include POST in otAPIservice
var cttvApi = otAPIservice.getSelf(); // No POST in the service yet
// TODO: Include POST in otApi
var cttvApi = otApi.getSelf(); // No POST in the service yet
var url = cttvApi.url.associations();

cttvApi.call(url, paramsObj)
Expand Down Expand Up @@ -244,7 +244,7 @@ angular.module('plugins')
.skip(1)
.size(600)
.score('jackard_weighted')
.cttvApi(otAPIservice.getSelf());
.cttvApi(otApi.getSelf());

// v.on("load", function (d) {
// $log.log("LOADED------------------------------------");
Expand Down
6 changes: 3 additions & 3 deletions app/plugins/related-targets-directive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('plugins')
.directive('relatedTargets', ['$log', 'otAPIservice', function ($log, otAPIservice) {
.directive('relatedTargets', ['$log', 'otApi', function ($log, otApi) {
'use strict';

return {
Expand All @@ -9,7 +9,7 @@ angular.module('plugins')
target: '='
},
link: function (scope, element, attrs) {
otAPIservice.getTargetRelation({
otApi.getTargetRelation({
id: scope.target.id
})
.then(
Expand All @@ -21,7 +21,7 @@ angular.module('plugins')
},

// error handler
otAPIservice.defaultErrorHandler
otApi.defaultErrorHandler
);
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
angular.module('otDirectives')


.directive('otTargetListMapping', ['otAPIservice', 'otUtils', 'otLoadedLists', 'otConfig', function (otAPIservice, otUtils, otLoadedLists, otConfig) {
.directive('otTargetListMapping', ['otApi', 'otUtils', 'otLoadedLists', 'otConfig', function (otApi, otUtils, otLoadedLists, otConfig) {
'use strict';

return {
Expand All @@ -27,7 +27,7 @@ angular.module('otDirectives')
}
};

return otAPIservice.getSearch(queryObject);
return otApi.getSearch(queryObject);
}

// scope.setNewItem = function (oldQuery, res) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('otDirectives')
.directive('otTargetListUpload', ['otAPIservice', 'otLoadedLists', 'otConfig', function (otAPIservice, otLoadedLists, otConfig) {
.directive('otTargetListUpload', ['otApi', 'otLoadedLists', 'otConfig', function (otApi, otLoadedLists, otConfig) {
'use strict';

return {
Expand Down Expand Up @@ -76,7 +76,7 @@ angular.module('otDirectives')
params: opts
};

return otAPIservice.getBestHitSearch(queryObject)
return otApi.getBestHitSearch(queryObject)
.then(function (resp) {
var listName = otLoadedLists.parseBestHitSearch(name, resp.body);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ angular.module('otDirectives')
* In this example, "loading" is the name of the var in the parent scope, pointing to $scope.loading.
* This is useful in conjunction with a spinner where you can have ng-show="loading"
*/
.directive('otDiseaseAssociations', ['otUtils', 'otDictionary', 'otConsts', 'otAPIservice', '$q', function (otUtils, otDictionary, otConsts, otAPIservice, $q) {
.directive('otDiseaseAssociations', ['otUtils', 'otDictionary', 'otConsts', 'otApi', '$q', function (otUtils, otDictionary, otConsts, otApi, $q) {
'use strict';

var draw = 1;
Expand Down Expand Up @@ -196,13 +196,13 @@ angular.module('otDirectives')
opts.target = target;
}

opts = otAPIservice.addFacetsOptions(filters, opts);
opts = otApi.addFacetsOptions(filters, opts);
var queryObject = {
method: 'POST',
params: opts
};

otAPIservice.getAssociations(queryObject)
otApi.getAssociations(queryObject)
.then(function (resp) {
var dtData = parseServerResponse(resp.body.data);
var o = {
Expand Down Expand Up @@ -376,13 +376,13 @@ angular.module('otDirectives')
if (scope.targets && scope.targets.length) {
optsPreFlight.target = scope.targets;
}
optsPreFlight = otAPIservice.addFacetsOptions(scope.filters, optsPreFlight);
optsPreFlight = otApi.addFacetsOptions(scope.filters, optsPreFlight);

var queryObject = {
method: 'POST',
params: optsPreFlight
};
otAPIservice.getAssociations(queryObject)
otApi.getAssociations(queryObject)
.then(function (resp) {
var total = resp.body.total;

Expand Down Expand Up @@ -416,14 +416,14 @@ angular.module('otDirectives')
opts.target = scope.targets;
}

opts = otAPIservice.addFacetsOptions(scope.filters, opts);
opts = otApi.addFacetsOptions(scope.filters, opts);

var queryObject = {
method: 'POST',
params: opts
};

return otAPIservice.getAssociations(queryObject)
return otApi.getAssociations(queryObject)
.then(function (resp) {
var moreText = resp.body;

Expand Down Expand Up @@ -466,7 +466,7 @@ angular.module('otDirectives')
// hiddenElement.download = scope.filename + ".csv";
// hiddenElement.click();
});
}, otAPIservice.defaultErrorHandler);
}, otApi.defaultErrorHandler);
};


Expand Down
4 changes: 2 additions & 2 deletions app/src/components/efo-graph/efo-graph-directive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('otDirectives')
.directive('otEfoGraph', ['otAPIservice', function (otAPIservice) {
.directive('otEfoGraph', ['otApi', function (otApi) {
'use strict';
return {
restrict: 'E',
Expand All @@ -11,7 +11,7 @@ angular.module('otDirectives')
var efoGraph = diseaseGraph()
.width(w)
.height(700)
.cttvApi(otAPIservice.getSelf());
.cttvApi(otApi.getSelf());

scope.$watch(function () { return attrs.efo; }, function (efo_str) {
if (!efo_str) {
Expand Down
12 changes: 6 additions & 6 deletions app/src/components/facets/facets.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ angular.module('facets', [])
* Top level container for all the facets.
* This contains accordion etc
*/
.directive('cttvFacets', ['otFiltersService', function (otFiltersService) {
.directive('cttvFacets', ['otFacetsFilters', function (otFacetsFilters) {
'use strict';

return {
Expand All @@ -49,13 +49,13 @@ angular.module('facets', [])

link: function (scope) {
// scope.dataDistribution =
scope.filters = otFiltersService.getFilters();
scope.selectedFilters = otFiltersService.getSelectedFilters();
scope.deselectAll = otFiltersService.deselectAll;
scope.filters = otFacetsFilters.getFilters();
scope.selectedFilters = otFacetsFilters.getSelectedFilters();
scope.deselectAll = otFacetsFilters.deselectAll;

// scope.respStatus = 1; //otFiltersService.status(); // TODO: handle response status
// scope.respStatus = 1; //otFacetsFilters.status(); // TODO: handle response status
// scope.updateFilter = function(id){
// otFiltersService.getFilter(id).toggle();
// otFacetsFilters.getFilter(id).toggle();
// }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ angular.module('otDirectives')
* <ot-filter-by-file-targets> </ot-filter-by-file-targets>
*
*/
.directive('otFilterByFileTargets', ['$log', 'otAPIservice', '$q', '$analytics', 'otLoadedLists', '$location', 'otUtils', function ($log, otAPIservice, $q, $analytics, otLoadedLists, $location, otUtils) {
.directive('otFilterByFileTargets', ['$log', 'otApi', '$q', '$analytics', 'otLoadedLists', '$location', 'otUtils', function ($log, otApi, $q, $analytics, otLoadedLists, $location, otUtils) {
'use strict';

return {
Expand Down Expand Up @@ -177,7 +177,7 @@ angular.module('otDirectives')
params: opts
};

return otAPIservice.getBestHitSearch(queryObject)
return otApi.getBestHitSearch(queryObject)
.then(function (resp) {
if (resp.body.data.length) {
var listName = otLoadedLists.parseBestHitSearch(scope.fileName, resp.body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ angular.module('otDirectives')
* In this example, "loading" is the name of the var in the parent scope, pointing to $scope.loading.
* This is useful in conjunction with a spinner where you can have ng-show="loading"
*/
.directive('cttvHpaTissueExpression', ['otAPIservice', 'otUtils', function (otAPIservice, otUtils) {
.directive('cttvHpaTissueExpression', ['otApi', 'otUtils', function (otApi, otUtils) {
'use strict';

var colorScale = otUtils.colorScales.BLUE_1_3; // blue orig
Expand Down Expand Up @@ -77,11 +77,11 @@ angular.module('otDirectives')
scope.$watch(
'target',
function () {
// move otAPIservice.getExpression ({ in here
// move otApi.getExpression ({ in here
// ......

if (scope.target) {
otAPIservice.getExpression({
otApi.getExpression({
'method': 'GET',
'params': {
gene: scope.target // TODO: should be TARGET in API!!!
Expand Down Expand Up @@ -146,7 +146,7 @@ angular.module('otDirectives')
},

// error
otAPIservice.defaultErrorHandler
otApi.defaultErrorHandler
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
angular.module('otDirectives')

/* Directive to display the known drug evidence table */
.directive('otKnownDrugTable', ['otAPIservice', 'otConsts', 'otUtils', 'otConfig', '$location', 'otDictionary', function (otAPIservice, otConsts, otUtils, otConfig, $location, otDictionary) {
.directive('otKnownDrugTable', ['otApi', 'otConsts', 'otUtils', 'otConfig', '$location', 'otDictionary', function (otApi, otConsts, otUtils, otConfig, $location, otDictionary) {
'use strict';
// var dbs = otConsts.dbs;
var searchObj = otUtils.search.translateKeys($location.search());
Expand Down Expand Up @@ -92,7 +92,7 @@ angular.module('otDirectives')
method: 'GET',
params: opts
};
return otAPIservice.getFilterBy(queryObject)
return otApi.getFilterBy(queryObject)
.then(
function (resp) {
if (resp.body.data) {
Expand All @@ -102,7 +102,7 @@ angular.module('otDirectives')
// $log.warn("Empty response : drug data");
}
},
otAPIservice.defaultErrorHandler
otApi.defaultErrorHandler
)
.finally(function () {
scope.loadFlag = false;
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/log-session/log-session-directive.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
angular.module('otDirectives')


.directive('logSession', ['otAPIservice', function (otAPIservice) {
.directive('logSession', ['otApi', function (otApi) {
'use strict';

return {
restrict: 'E',
link: function () {
otAPIservice.logSession();
otApi.logSession();
}
};
}]);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module('otDirectives')

.directive('multipleTargetsDrugsSummary', ['otAPIservice', 'otConfig', 'otUtils', function (otAPIservice, otConfig, otUtils) {
.directive('multipleTargetsDrugsSummary', ['otApi', 'otConfig', 'otUtils', function (otApi, otConfig, otUtils) {
'use strict';

function formatDrugDataToArray (drugs) {
Expand Down Expand Up @@ -57,7 +57,7 @@ angular.module('otDirectives')
]
}
};
otAPIservice.getFilterBy(queryObject)
otApi.getFilterBy(queryObject)
.then(function (resp) {
var drugs = {};
for (var i = 0; i < resp.body.data.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module('otDirectives')

.directive('multipleTargetsTissuesSummary', ['$log', '$http', '$q', 'otUtils', 'otAPIservice', function ($log, $http, $q, otUtils, otAPIservice) {
.directive('multipleTargetsTissuesSummary', ['$log', '$http', '$q', 'otUtils', 'otApi', function ($log, $http, $q, otUtils, otApi) {
'use strict';

var tissuesOrdered = [
Expand Down Expand Up @@ -147,7 +147,7 @@ angular.module('otDirectives')
var baseGtexUrlSufix = '?boxplot=true';
for (var i = 0; i < scope.targets.length; i++) {
var target = scope.targets[i];
var targetPromise = otAPIservice.getTarget({
var targetPromise = otApi.getTarget({
method: 'GET',
trackCall: true,
params: {
Expand Down
Loading

0 comments on commit 51761e9

Please sign in to comment.