diff --git a/src/app/components/analysis-panel/analysis-panel.component.ts b/src/app/components/analysis-panel/analysis-panel.component.ts index f4dd30520d497f2e3102012d6177df665d46c2e0..73d7e1d0d67065c4fd771f02b0a2c330d4fd678d 100644 --- a/src/app/components/analysis-panel/analysis-panel.component.ts +++ b/src/app/components/analysis-panel/analysis-panel.component.ts @@ -79,7 +79,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { public myConfig: IConfig = JSON.parse(JSON.stringify(defaultConfig)); - private network: any; + public network: any; private nodeData: { nodes: any, edges: any } = {nodes: null, edges: null}; private drugNodes: any[] = []; private drugEdges: any[] = []; diff --git a/src/app/pages/explorer-page/explorer-page.component.html b/src/app/pages/explorer-page/explorer-page.component.html index 97633a5b5748016324f81803a119790270070397..af08aff3e935d0a4bbf0bc47d34bda7dc0042151 100644 --- a/src/app/pages/explorer-page/explorer-page.component.html +++ b/src/app/pages/explorer-page/explorer-page.component.html @@ -100,7 +100,7 @@ <span class="icon"> <i class="fas fa-search" aria-hidden="true"></i> </span> - Query Protein/Gene + Query Node </p> <a (click)="collapseQuery = !collapseQuery" diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts index 8785ee6f9946bfc573f5f78fc5d31b06fc7895fe..d70e88009c6b25955b04acf59d51cf3a8f1d1558 100644 --- a/src/app/pages/explorer-page/explorer-page.component.ts +++ b/src/app/pages/explorer-page/explorer-page.component.ts @@ -28,6 +28,7 @@ import {defaultConfig, EdgeGroup, IConfig, InteractionDatabase, NodeGroup} from import {NetexControllerService} from 'src/app/services/netex-controller/netex-controller.service'; import {removeDuplicateObjectsFromList} from '../../utils' import * as merge from 'lodash/fp/merge'; +import { AnalysisPanelComponent } from 'src/app/components/analysis-panel/analysis-panel.component'; // import * as 'vis' from 'vis-network'; // import {DataSet} from 'vis-data'; @@ -180,6 +181,9 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { @ViewChild('network', {static: false}) networkEl: ElementRef; @ViewChild('networkWithLegend', {static: false}) networkWithLegendEl: ElementRef; + @ViewChild(AnalysisPanelComponent, { static: false }) + private analysisPanel: AnalysisPanelComponent; + constructor( public omnipath: OmnipathControllerService, public analysis: AnalysisService, @@ -315,8 +319,11 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { } private zoomToNode(id: string) { + // get network object, depending on whether analysis is open or not + const network = this.selectedAnalysisToken ? this.analysisPanel.network : this.networkInternal; + this.nodeData.nodes.getIds(); - const coords = this.networkInternal.getPositions(id)[id]; + const coords = network.getPositions(id)[id]; if (!coords) { return; } @@ -326,7 +333,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { } else { zoomScale = 3.0; } - this.networkInternal.moveTo({ + network.moveTo({ position: {x: coords.x, y: coords.y}, scale: zoomScale, animation: true, @@ -399,18 +406,15 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { this.closeSummary(); }); - // // this might be not necessary, positions get saved right before reloding network - // this.networkInternal.on('stabilizationIterationsDone', () => { - // this.networkPositions = this.networkInternal.getPositions(); - // }); - // this.networkInternal.stabilize(); - if (this.selectedWrapper) { this.zoomToNode(this.selectedWrapper.id); } + this.currentViewNodes = this.nodeData.nodes; + this.currentViewEdges = this.nodeData.edges; + this.queryItems = []; - this.fillQueryItems(this.proteins); + this.fillQueryItems(this.currentViewNodes); if (this.selectedWrapper) { this.networkInternal.selectNodes([this.selectedWrapper.id]); } @@ -422,8 +426,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { this.queryItems.push(getWrapperFromNode(protein)); }); - this.currentViewNodes = this.nodeData.nodes; - this.currentViewEdges = this.nodeData.edges; + this.currentViewProteins = this.proteins; } @@ -587,6 +590,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { this.currentViewProteins = this.proteins; this.currentViewSelectedTissue = this.selectedTissue; } + this.fillQueryItems(this.currentViewNodes); } gProfilerLink(): string {