Skip to content

Commit

Permalink
query view refactoring + disconnected node removal #717 #719
Browse files Browse the repository at this point in the history
  • Loading branch information
umut-er committed Jul 1, 2024
1 parent 30db8c9 commit 34da6cb
Show file tree
Hide file tree
Showing 4 changed files with 471 additions and 735 deletions.
7 changes: 7 additions & 0 deletions app/css/chise.css
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,13 @@ hr.inspector-divider {
margin: 1px;
}

.caption-style-text {
padding-top: 8px;
padding-bottom: 8px;
color: #777;
text-align: left;
}

.chise-tab a {
color: #555;
padding-left: 5px !important;
Expand Down
35 changes: 35 additions & 0 deletions app/js/app-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -3791,4 +3791,39 @@ appUtilities.selectAllElementsOfSameType = function(ele) {
cy.elements('[class="' + sbgnclass + '"]').select();
};

appUtilities.removeDisconnectedNodesAfterQuery = function( querySeedGenes ){
var isAggregateNode = function (node) {
return node.data("class") == "compartment" || node.data("class") == "submap"
|| node.data("class") == "complex";
}

var lowerCaseQuerySeedGenes = querySeedGenes.map( (gene) => {
return gene.toLowerCase();
});

var cy = appUtilities.getActiveCy();
var nodesToDelete = cy.collection();
cy.nodes().forEach( (node, idx) => {
if(isAggregateNode(node) && node.children().connectedEdges().length != 0){
node.children().forEach( (node, idx) => {
if(node.connectedEdges().length == 0 && !isAggregateNode(node)){
var querySeedNode = false;
if(node.data("label")){
var lowerCaseNodeLabel = node.data("label").toLowerCase();
lowerCaseQuerySeedGenes.forEach( (gene) => {
if(lowerCaseNodeLabel.indexOf(gene) >= 0){
querySeedNode = true;
}
});
}
if(!querySeedNode)
nodesToDelete.merge(node);
}
})
}
});
cy.remove(nodesToDelete);
// cy.viewUtilities("get").highlight(nodesToDelete);
}

module.exports = appUtilities;
Loading

0 comments on commit 34da6cb

Please sign in to comment.