Commit 2a24bfd5 authored by Fintan Mc Gee's avatar Fintan Mc Gee

Added history of enties and the abilitey to laod more than 1 entity to the bio list view

parent c176601d
......@@ -125,6 +125,29 @@
</div>
</div>
<div class="centeredDiv">
<div class="row" ng-repeat="previousInput in model.previousInputs" style="padding: 3px;">
<div class="col-sm-2">
<label>Entity Type:</label>
</div>
<div class=" col-sm-2">
<input type="text" placeholder="Enter Name" type="text"
class="form-control ng-valid ng-dirty ng-valid-parse ng-touched"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="width: 100%;" ng-model="previousInput.inputType" readonly>
</div>
<div class="col-sm-2">
<label>Entity of Interest: </label>
</div>
<div class="col-sm-2">
<input type="text" placeholder="Enter Name" type="text"
class="form-control ng-valid ng-dirty ng-valid-parse ng-touched"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="width: 100%;" ng-model="previousInput.inputName" readonly>
</div>
</div>
</div>
<div class="centeredDiv">
<div class="row" ng-repeat="constraint in model.relationshipConstraints.constraint">
......
......@@ -9,10 +9,11 @@
*******************************/
angular.module('blizaarModule.controllers')
.controller('bioListViewCtrl', ['$scope', 'graphFileAndRenderingService', 'dataService', 'filteringService', 'multiLayerGraphService', 'metaDataService','graphLayeringService','tooltipService','masterDataConstraintsService','$rootScope',
function ($scope, graphFileAndRenderingService, dataService, filteringService,multiLayerGraphService,metaDataService,graphLayeringService,tooltipService, masterDataConstraintsService,$rootScope) {
function ($scope, graphFileAndRenderingService, dataService, filteringService,multiLayerGraphService, metaDataService, graphLayeringService,tooltipService, masterDataConstraintsService,$rootScope) {
// Will store the name of the Entity to used to build layers
$scope.model.inputName = "";
$scope.model.previousInputs = []; // is multiple entites have been added it can be seen here
$scope.model.inputType = "Protein";
$scope.model.availableInputTypes = ["Protein","Gene", "Metabolite", "Experiment"]; // list of entities available to build graph
......@@ -43,8 +44,10 @@ angular.module('blizaarModule.controllers')
$scope.initializeBioListView = function(){
if(dataService.currentGraphName !== "Bio") {
dataService.initGraphData("Bio")
}
}
$scope.resetControlVisibility();
$scope.setControlVisibility({layers:false, listView: true})
metaDataService.getNodeNames( "Bio", $scope.model.inputType).then(function(d){
......@@ -56,6 +59,12 @@ angular.module('blizaarModule.controllers')
// //$scope.model.availableNames.sort(); // data should be sorted on Arrival
// });
$scope.getQueryHistory().forEach(function(globalQueryItem) {
if(globalQueryItem.hasOwnProperty("inputName") && globalQueryItem.hasOwnProperty("inputType")) {
$scope.model.previousInputs.push(globalQueryItem);
}
});
// setup constraints
masterDataConstraintsService.setRelationshipAvailableAttributes( ["none", "STITCH_combined_score","STRING_combined_score"]);
......@@ -90,11 +99,6 @@ angular.module('blizaarModule.controllers')
});
// we want the
// dataService.getAvailableNodeNames([ $scope.model.inputType],[]).then(function(d){
// //$scope.model.availableNames = $scope.model.testlist
// $scope.model.availableNames = [""].concat(d);
// $scope.model.availableNames.sort(); // data should be sorted on Arrival
// });
};
/**************************************
......@@ -172,6 +176,8 @@ angular.module('blizaarModule.controllers')
}
);
$scope.setGlobalSelectedAspectNoRefresh("EntityType");
$scope.refreshAspectList();
$scope.refreshGraph();
};
......@@ -183,6 +189,11 @@ angular.module('blizaarModule.controllers')
* Date: 19/10/2017
*******************************/
$scope.loadEntityData = function() {
var merge = false;
if(multiLayerGraphService.getGraph().nodes.length > 0){
merge = true;
}
//check if a valid name has been selected
// first ensure the constraints user are stored so they can be retireve later
......@@ -233,6 +244,9 @@ angular.module('blizaarModule.controllers')
targetLabels = [["Metabolite"],["DataLine","Spot","Protein", "Gene", "Metabolite"],["Protein", "Gene","Experiment"]];
targetRelationships = [["CATALYSIS","xBOLISM", "MEASURED", "SPOTTED"],["EXPERIMENTED","INTERACTS"]];
}
$scope.model.previousInputs.push({inputName:$scope.model.inputName, inputType:$scope.model.inputType})
$scope.addToQueryHistory({inputName:$scope.model.inputName, inputType:$scope.model.inputType})
// dataService.queryGraph(targetLabels, [], $scope.model.inputName,null, true,attributeConstraints,neighbourhoodSize).then(function(){
var dateString = (new Date()).toISOString();
dateString = dateString.replace(/:/g,"_");
......@@ -240,7 +254,7 @@ angular.module('blizaarModule.controllers')
dateString = dateString.replace(/\./g,"_");
var edgeSetLabel = "tmp_bio_" + ($scope.model.tempTagIndex++) +"_"+dateString;
console.log("Creating temp label " + edgeSetLabel);
dataService.queryGraph(targetLabels, targetRelationships, $scope.model.inputName,null, false,attributeConstraints,neighbourhoodSize,null,edgeSetLabel).then(function(){
dataService.queryGraph(targetLabels, targetRelationships, $scope.model.inputName,null, false,attributeConstraints,neighbourhoodSize,merge,edgeSetLabel).then(function(){
$scope.createDefaultLayers();
angular.element(document).ready(function () {
......
......@@ -163,6 +163,13 @@ angular.module('blizaarModule.services')
}
multiLayerGraphService.getLayerNames();
if(multiLayerGraphService.getGraph().aspects.hasOwnProperty("EntityType")) {
multiLayerGraphService.getGraph().addLayersToAspect("EntityType", ["Proteins", "Genes", "Metabolites", "CATALYSIS","DataItems","Experiments"])
}else {
multiLayerGraphService.getGraph().createAspect("EntityType",["Proteins", "Genes", "Metabolites", "CATALYSIS","DataItems","Experiments"])
}
if(doLayout) {
multiLayerGraphService.getLayers().forEach(function(layer) {
var layerName = layer.name;
......@@ -192,24 +199,29 @@ angular.module('blizaarModule.services')
// that do not have those values
var master = multiLayerGraphService.getGraph();
master.buildAdjacencyList();
master.nodes.forEach(function(n) {
if(master.checkNodeType(n.uid,"DataLine") || master.checkNodeType(n.uid,"Spot") ) {
var neighbours = master.getNeighbours(n);
if(neighbours.length > 2) {
console.log(" Warning found Dataline with more than 1 protein / metabolite neighbour)")
}
neighbours.forEach(function(neighbourNode){
if(master.checkNodeType(neighbourNode.uid,"Protein")){
master.copyDistinctNodeAttributes(n.uid,neighbourNode.uid)
} else if (master.checkNodeType(neighbourNode.uid,"Metabolite")) {
// we want to avoid copying an invalid "Id" field into a metabolite ( as it has none )(
// so set a dummy one and sett it later to undefined.... ( quicker than deleting it)
n.Id= n.Id_single;
master.copyDistinctNodeAttributes(n.uid,neighbourNode.uid);
n.Id= undefined;
if(neighbours) {
if (neighbours.length > 2) {
console.log(" Warning found Dataline with more than 1 protein / metabolite neighbour)")
}
});
neighbours.forEach(function (neighbourNode) {
if (master.checkNodeType(neighbourNode.uid, "Protein")) {
master.copyDistinctNodeAttributes(n.uid, neighbourNode.uid)
} else if (master.checkNodeType(neighbourNode.uid, "Metabolite")) {
// we want to avoid copying an invalid "Id" field into a metabolite ( as it has none )(
// so set a dummy one and sett it later to undefined.... ( quicker than deleting it)
n.Id = n.Id_single;
master.copyDistinctNodeAttributes(n.uid, neighbourNode.uid);
n.Id = undefined;
}
});
}
else {
console.log(" Warning found Dataline with no neightbour / null mapping")
}
}
n.BLZ_label = n.Id_single || n.pr_Descr || n.Id || n.name ;
......
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