Skip to content

Commit a816f8c

Browse files
committed
send the correct activity unit param. activity relation filter for target & compound class
1 parent 977c86c commit a816f8c

File tree

5 files changed

+112
-22
lines changed

5 files changed

+112
-22
lines changed

app/assets/javascripts/controllers/compoundsPharmacologyController.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,15 @@ App.CompoundsPharmacologyController = Ember.ObjectController.extend({
370370
var lens = null;
371371
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
372372
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
373-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
373+
var actualUnit = null;
374+
this.get('activityUnits').forEach(function(activityUnit, index) {
375+
if (activityUnit.label === unit) {
376+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
377+
}
378+
});
379+
unit = actualUnit;
380+
381+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
374382
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
375383
var activityRelation = null;
376384
var minActivityValue = null;
@@ -548,7 +556,15 @@ App.CompoundsPharmacologyController = Ember.ObjectController.extend({
548556
var lens = null;
549557
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
550558
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
551-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
559+
var actualUnit = null;
560+
this.get('activityUnits').forEach(function(activityUnit, index) {
561+
if (activityUnit.label === unit) {
562+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
563+
}
564+
});
565+
unit = actualUnit;
566+
567+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
552568
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
553569
var activityRelation = null;
554570
var minActivityValue = null;
@@ -669,6 +685,16 @@ App.CompoundsPharmacologyController = Ember.ObjectController.extend({
669685
var lens = null;
670686
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
671687
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
688+
// In the 1.5 API the activity unit response does not contain the actual term used in the pharma filter so we have
689+
// to do this horror.
690+
// TODO check if this is needed for the next release
691+
var actualUnit = null;
692+
this.get('activityUnits').forEach(function(activityUnit, index) {
693+
if (activityUnit.label === unit) {
694+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
695+
}
696+
});
697+
unit = actualUnit;
672698
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
673699
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
674700
var activityRelation = null;

app/assets/javascripts/controllers/targetsPharmacologyController.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,15 @@ App.TargetsPharmacologyController = Ember.ObjectController.extend({
199199
var lens = null;
200200
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
201201
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
202-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
202+
var actualUnit = null;
203+
this.get('activityUnits').forEach(function(activityUnit, index) {
204+
if (activityUnit.label === unit) {
205+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
206+
}
207+
});
208+
unit = actualUnit;
209+
210+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
203211
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
204212
var activityRelation = null;
205213
var minActivityValue = null;
@@ -327,7 +335,15 @@ App.TargetsPharmacologyController = Ember.ObjectController.extend({
327335
var lens = null;
328336
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
329337
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
330-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
338+
var actualUnit = null;
339+
this.get('activityUnits').forEach(function(activityUnit, index) {
340+
if (activityUnit.label === unit) {
341+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
342+
}
343+
});
344+
unit = actualUnit;
345+
346+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
331347
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
332348
var activityRelation = null;
333349
var minActivityValue = null;
@@ -446,7 +462,15 @@ App.TargetsPharmacologyController = Ember.ObjectController.extend({
446462
var lens = null;
447463
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
448464
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
449-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
465+
var actualUnit = null;
466+
this.get('activityUnits').forEach(function(activityUnit, index) {
467+
if (activityUnit.label === unit) {
468+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
469+
}
470+
});
471+
unit = actualUnit;
472+
473+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
450474
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
451475
var activityRelation = null;
452476
var minActivityValue = null;
@@ -606,7 +630,15 @@ App.TargetsPharmacologyController = Ember.ObjectController.extend({
606630
var lens = null;
607631
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
608632
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
609-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
633+
var actualUnit = null;
634+
this.get('activityUnits').forEach(function(activityUnit, index) {
635+
if (activityUnit.label === unit) {
636+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
637+
}
638+
});
639+
unit = actualUnit;
640+
641+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
610642
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
611643
var activityRelation = null;
612644
var minActivityValue = null;

app/assets/javascripts/controllers/treesPharmacologyController.js

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,15 @@ App.TreesPharmacologyController = Ember.ArrayController.extend({
203203
var lens = null;
204204
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
205205
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
206-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
206+
var actualUnit = null;
207+
this.get('activityUnits').forEach(function(activityUnit, index) {
208+
if (activityUnit.label === unit) {
209+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
210+
}
211+
});
212+
unit = actualUnit;
213+
214+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
207215
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
208216
var activityRelation = null;
209217
var minActivityValue = null;
@@ -333,7 +341,15 @@ App.TreesPharmacologyController = Ember.ArrayController.extend({
333341
var lens = null;
334342
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
335343
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
336-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
344+
var actualUnit = null;
345+
this.get('activityUnits').forEach(function(activityUnit, index) {
346+
if (activityUnit.label === unit) {
347+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
348+
}
349+
});
350+
unit = actualUnit;
351+
352+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
337353
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
338354
var activityRelation = null;
339355
var minActivityValue = null;
@@ -459,7 +475,15 @@ App.TreesPharmacologyController = Ember.ArrayController.extend({
459475
var lens = null;
460476
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
461477
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
462-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
478+
var actualUnit = null;
479+
this.get('activityUnits').forEach(function(activityUnit, index) {
480+
if (activityUnit.label === unit) {
481+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
482+
}
483+
});
484+
unit = actualUnit;
485+
486+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
463487
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
464488
var activityRelation = null;
465489
var minActivityValue = null;
@@ -601,10 +625,10 @@ App.TreesPharmacologyController = Ember.ArrayController.extend({
601625
}
602626
};
603627
if (this.get('treeType') === 'chebi') {
604-
searcher.getCompoundClassPharmacologyCount(me.get('uri'), assayOrganism, targetOrganism, activity, activityValue, minActivityValue, minExActivityValue, maxActivityValue, maxExActivityValue, unit, activityRelation, actualPchemblValue, minPchemblValue, minExPchemblValue, maxPchemblValue, maxExPchemblValue, targetType, lens, countCallback);
628+
searcher.getCompoundClassPharmacologyCount(me.get('uri'), assayOrganism, targetOrganism, activity, activityValue, unit, minActivityValue, minExActivityValue, maxActivityValue, maxExActivityValue, activityRelation, actualPchemblValue, minPchemblValue, minExPchemblValue, maxPchemblValue, maxExPchemblValue, targetType, lens, countCallback);
605629

606630
} else {
607-
searcher.getTargetClassPharmacologyCount(me.get('uri'), assayOrganism, targetOrganism, activity, activityValue, minActivityValue, minExActivityValue, maxActivityValue, maxExActivityValue, unit, activityRelation, actualPchemblValue, minPchemblValue, minExPchemblValue, maxPchemblValue, maxExPchemblValue, targetType, lens, countCallback);
631+
searcher.getTargetClassPharmacologyCount(me.get('uri'), assayOrganism, targetOrganism, activity, activityValue, unit, minActivityValue, minExActivityValue, maxActivityValue, maxExActivityValue, activityRelation, actualPchemblValue, minPchemblValue, minExPchemblValue, maxPchemblValue, maxExPchemblValue, targetType, lens, countCallback);
608632
}
609633
},
610634
resetFilters: function() {
@@ -640,7 +664,15 @@ searcher.getCompoundClassPharmacologyCount(me.get('uri'), assayOrganism, targetO
640664
var lens = null;
641665
var activity = this.get('selectedActivity') != null ? this.get('selectedActivity').label : null;
642666
var unit = this.get('selectedUnit') != null ? this.get('selectedUnit').label : null;
643-
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
667+
var actualUnit = null;
668+
this.get('activityUnits').forEach(function(activityUnit, index) {
669+
if (activityUnit.label === unit) {
670+
actualUnit = activityUnit.uri.split('/').pop().split('#').pop().replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1_$2').toLowerCase();
671+
}
672+
});
673+
unit = actualUnit;
674+
675+
var condition = this.get('selectedCondition') != null ? this.get('selectedCondition') : null;
644676
var currentActivityValue = this.get('activityValue') != null ? this.get('activityValue') : null;
645677
var activityRelation = null;
646678
var minActivityValue = null;

public/combined.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6775,7 +6775,7 @@ TreeSearch.prototype.getTargetClassPharmacologyCount = function(URI, assayOrgani
67756775
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
67766776
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
67776777
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6778-
relation != null ? params['relation'] = relation : '';
6778+
relation != null ? params['activity_relation'] = relation : '';
67796779
pChembl != null ? params['pChembl'] = pChembl : '';
67806780
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
67816781
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -6815,7 +6815,7 @@ TreeSearch.prototype.getTargetClassPharmacologyPaginated = function(URI, assayOr
68156815
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
68166816
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
68176817
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6818-
relation != null ? params['relation'] = relation : '';
6818+
relation != null ? params['activity_relation'] = relation : '';
68196819
pChembl != null ? params['pChembl'] = pChembl : '';
68206820
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
68216821
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -6858,7 +6858,7 @@ TreeSearch.prototype.getCompoundClassPharmacologyCount = function(URI, assayOrga
68586858
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
68596859
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
68606860
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6861-
relation != null ? params['relation'] = relation : '';
6861+
relation != null ? params['activity_relation'] = relation : '';
68626862
pChembl != null ? params['pChembl'] = pChembl : '';
68636863
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
68646864
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -6898,7 +6898,7 @@ TreeSearch.prototype.getCompoundClassPharmacologyPaginated = function(URI, assay
68986898
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
68996899
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
69006900
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6901-
relation != null ? params['relation'] = relation : '';
6901+
relation != null ? params['activity_relation'] = relation : '';
69026902
pChembl != null ? params['pChembl'] = pChembl : '';
69036903
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
69046904
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -7287,7 +7287,7 @@ var target_organism_name = null;
72877287
target_provenance = 'https://www.ebi.ac.uk/chembl/target/inspect/' + target._about.split('/').pop();
72887288
target_organism_name = target.assay_organism != null ? target.assay_organism : null;
72897289
if (target.hasTargetComponent != null) {
7290-
arrayify(target.hasTargetComponent).forEach(function(targetComponent, i) {
7290+
Utils.arrayify(target.hasTargetComponent).forEach(function(targetComponent, i) {
72917291
var tc = {};
72927292
tc.uri = targetComponent._about;
72937293
if (targetComponent.exactMatch != null) {

vendor/assets/javascripts/combined.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6775,7 +6775,7 @@ TreeSearch.prototype.getTargetClassPharmacologyCount = function(URI, assayOrgani
67756775
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
67766776
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
67776777
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6778-
relation != null ? params['relation'] = relation : '';
6778+
relation != null ? params['activity_relation'] = relation : '';
67796779
pChembl != null ? params['pChembl'] = pChembl : '';
67806780
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
67816781
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -6815,7 +6815,7 @@ TreeSearch.prototype.getTargetClassPharmacologyPaginated = function(URI, assayOr
68156815
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
68166816
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
68176817
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6818-
relation != null ? params['relation'] = relation : '';
6818+
relation != null ? params['activity_relation'] = relation : '';
68196819
pChembl != null ? params['pChembl'] = pChembl : '';
68206820
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
68216821
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -6858,7 +6858,7 @@ TreeSearch.prototype.getCompoundClassPharmacologyCount = function(URI, assayOrga
68586858
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
68596859
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
68606860
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6861-
relation != null ? params['relation'] = relation : '';
6861+
relation != null ? params['activity_relation'] = relation : '';
68626862
pChembl != null ? params['pChembl'] = pChembl : '';
68636863
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
68646864
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -6898,7 +6898,7 @@ TreeSearch.prototype.getCompoundClassPharmacologyPaginated = function(URI, assay
68986898
minExActivityValue ? params['minEx-activity_value'] = minExActivityValue : '';
68996899
maxActivityValue ? params['max-activity_value'] = maxActivityValue : '';
69006900
maxExActivityValue ? params['maxEx-activity_value'] = maxExActivityValue : '';
6901-
relation != null ? params['relation'] = relation : '';
6901+
relation != null ? params['activity_relation'] = relation : '';
69026902
pChembl != null ? params['pChembl'] = pChembl : '';
69036903
minpChembl != null ? params['min-pChembl'] = minpChembl : '';
69046904
minExpChembl != null ? params['minEx-pChembl'] = minExpChembl : '';
@@ -7287,7 +7287,7 @@ var target_organism_name = null;
72877287
target_provenance = 'https://www.ebi.ac.uk/chembl/target/inspect/' + target._about.split('/').pop();
72887288
target_organism_name = target.assay_organism != null ? target.assay_organism : null;
72897289
if (target.hasTargetComponent != null) {
7290-
arrayify(target.hasTargetComponent).forEach(function(targetComponent, i) {
7290+
Utils.arrayify(target.hasTargetComponent).forEach(function(targetComponent, i) {
72917291
var tc = {};
72927292
tc.uri = targetComponent._about;
72937293
if (targetComponent.exactMatch != null) {

0 commit comments

Comments
 (0)