From b6c6c90cb1906163f9f4a1176ed4bec2ebf43d48 Mon Sep 17 00:00:00 2001 From: Michael Hartung <michi@Michaels-MacBook-Pro.local> Date: Thu, 29 Jul 2021 15:16:13 +0200 Subject: [PATCH] create analysis tables directly from analysis results without additional server requests --- .../analysis-panel.component.ts | 41 +++++++++---------- .../explorer-page/explorer-page.component.ts | 1 - 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/app/components/analysis-panel/analysis-panel.component.ts b/src/app/components/analysis-panel/analysis-panel.component.ts index 73d7e1d0..23ed1cd4 100644 --- a/src/app/components/analysis-panel/analysis-panel.component.ts +++ b/src/app/components/analysis-panel/analysis-panel.component.ts @@ -187,28 +187,22 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { this.network = new vis.Network(container, this.nodeData, options); - const promises: Promise<any>[] = []; - promises.push(this.http.get<any>(`${environment.backend}task_result/?token=${this.token}&view=drugs`).toPromise() - .then((table) => { - this.tableDrugs = table; - this.tableDrugs.forEach((r) => { - r.rawScore = r.score; - }); - })); - promises.push(this.http.get<any>(`${environment.backend}task_result/?token=${this.token}&view=proteins`).toPromise() - .then((table) => { - this.tableProteins = table; - this.tableSelectedProteins = []; - this.tableProteins.forEach((r) => { - r.rawScore = r.score; - r.isSeed = this.seedMap[r.id]; - const wrapper = getWrapperFromNode(r); - if (this.analysis.inSelection(wrapper)) { - this.tableSelectedProteins.push(r); - } - }); - })); - await Promise.all(promises); + this.tableDrugs = nodes.filter( e => e.netexId && e.netexId.startsWith('d'));; + this.tableDrugs.forEach((r) => { + r.rawScore = r.score; + }); + + this.tableProteins = nodes.filter( e => e.netexId && e.netexId.startsWith('p')); + this.tableSelectedProteins = []; + this.tableProteins.forEach((r) => { + r.rawScore = r.score; + r.isSeed = this.seedMap[r.id]; + const wrapper = getWrapperFromNode(r); + if (this.analysis.inSelection(wrapper)) { + this.tableSelectedProteins.push(r); + } + }); + this.tableHasScores = ['trustrank', 'closeness', 'degree', 'proximity', 'betweenness', 'quick', 'super'] .indexOf(this.task.info.algorithm) !== -1; @@ -496,6 +490,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { nodeDetails.group = nodeDetails.group ? nodeDetails.group : 'default'; nodeDetails.label = nodeDetails.label ? nodeDetails.label : nodeDetails[identifier] } + console.log(nodeDetails) // IMPORTANT we set seeds to "selected" and not to seeds. The user should be inspired to run // further analysis and the button function can be used to highlight seeds // option to use scores[node] as gradient, but sccores are very small @@ -626,6 +621,8 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { this.tableSelectedProteins = e; const addItems = []; const removeItems = []; + console.log(e) + for (const i of this.tableSelectedProteins) { const wrapper = getWrapperFromNode(i); if (oldSelection.indexOf(i) === -1) { diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts index ad427a9b..5a1deefb 100644 --- a/src/app/pages/explorer-page/explorer-page.component.ts +++ b/src/app/pages/explorer-page/explorer-page.component.ts @@ -365,7 +365,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { this.proteinData.linkNodes(); const {nodes, edges} = this.proteinData.mapDataToNetworkInput(this.myConfig); - console.log('first item nodes', nodes[0]) this.nodeData.nodes = new vis.DataSet(nodes); this.nodeData.edges = new vis.DataSet(edges); -- GitLab