diff --git a/src/app/components/analysis-panel/analysis-panel.component.ts b/src/app/components/analysis-panel/analysis-panel.component.ts index 27dfb2e4f3a1a108b053f2a9403bdc9e3b6df036..0ea1547e21a404250ca802e242d69c04ee015586 100644 --- a/src/app/components/analysis-panel/analysis-panel.component.ts +++ b/src/app/components/analysis-panel/analysis-panel.component.ts @@ -204,8 +204,6 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit this.tableDrugs.forEach((r) => { r.rawScore = r.score; }); - console.log(this.tableDrugs) - this.tableProteins = nodes.filter(e => e.drugstoneId && e.drugstoneType === 'protein'); this.tableSelectedProteins = []; this.tableProteins.forEach((r) => { @@ -441,7 +439,6 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // or was found during analysis // FIXME connectorNodes are not visualized correctly nodeDetails.group = result.targetNodes && result.targetNodes.indexOf(nodeId) !== -1 ? 'foundNode' : (nodeDetails.group ? nodeDetails.group : 'connectorNode'); - console.log(nodeDetails) nodeDetails.label = nodeDetails.label ? nodeDetails.label : nodeDetails[identifier]; nodeDetails.id = nodeDetails[identifier][0] ? nodeDetails[identifier][0] : nodeDetails.id; this.proteins.push(nodeDetails); @@ -478,6 +475,18 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit }; } + getResultNodes(){ + if(this.nodeData && this.nodeData['nodes']) + return this.nodeData['nodes'].get() + return [] + } + + getResultEdges(){ + if(this.nodeData && this.nodeData['edges']) + return this.nodeData['edges'].get().filter(e=> !e.id || !e.groupName || (typeof e.from === 'string' && typeof e.to === 'string')) + return [] + } + public tableProteinSelection = (e): void => { const oldSelection = [...this.tableSelectedProteins]; this.tableSelectedProteins = e; diff --git a/src/app/components/network/network.component.ts b/src/app/components/network/network.component.ts index 477c20e551890c696c5e8f93bd9fa1049086c3d9..05156fcab725ebee3c8ee6059e9a98a4750df637 100644 --- a/src/app/components/network/network.component.ts +++ b/src/app/components/network/network.component.ts @@ -447,7 +447,6 @@ export class NetworkComponent implements OnInit { this.legendContext = 'drugTarget'; } } - console.log(this.legendContext) } /** diff --git a/src/app/pages/explorer-page/explorer-page.component.html b/src/app/pages/explorer-page/explorer-page.component.html index 1922c4504bdcb398bd56721123ba776484bc9314..e0e2e204defaffe09ce3d48ffeca5011a89f7a17 100644 --- a/src/app/pages/explorer-page/explorer-page.component.html +++ b/src/app/pages/explorer-page/explorer-page.component.html @@ -4,7 +4,7 @@ [(show)]="showAnalysisDialog" [target]="analysisDialogTarget" [config]="drugstoneConfig.config" - [inputNetwork]="{ nodes: proteins, edges: edges }" + [inputNetwork]="{ nodes: getNodes(), edges: getEdges()}" (taskEvent)="emitTaskEvent($event)" > </app-launch-analysis> @@ -721,7 +721,7 @@ <div class="drugstone network column" id="main-column"> <!-- analysis panel with analysis network --> <div class="analysis-view" *ngIf="selectedAnalysisToken"> - <app-analysis-panel + <app-analysis-panel #analysisPanel [(token)]="selectedAnalysisToken" (showDetailsChange)=" networkHandler.activeNetwork.selectedWrapper = $event diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts index 2b52f4c172132a02ffe325a85235ebf0e61742c3..9deff4650aa4abb83194db57bae3da9a4319a9b2 100644 --- a/src/app/pages/explorer-page/explorer-page.component.ts +++ b/src/app/pages/explorer-page/explorer-page.component.ts @@ -538,6 +538,20 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { 'background='; } + @ViewChild('analysisPanel') analysisPanel; + + getNodes() :any { + if (this.selectedAnalysisToken && this.analysisPanel) + return this.analysisPanel.getResultNodes() + return this.proteins + } + + getEdges() :any { + if(this.selectedAnalysisToken && this.analysisPanel) + return this.analysisPanel.getResultEdges() + return this.edges + } + emitTaskEvent(eventObject: object) { this.taskEvent.emit(eventObject); diff --git a/src/app/services/analysis/analysis.service.ts b/src/app/services/analysis/analysis.service.ts index b0d5d3c307fdb0bb2d7e452a87a8a7e7ae8d2ba2..516a1195f7b123ee5745bd466dadcc66bc8305a5 100644 --- a/src/app/services/analysis/analysis.service.ts +++ b/src/app/services/analysis/analysis.service.ts @@ -103,6 +103,8 @@ export class AnalysisService { } async getTasks() { + if (!this.finishedTokens) + this.finishedTokens = [] return await this.netex.getTasks(this.finishedTokens.length > 0 && this.tasks.length === 0 ? this.tokens : this.tokens.filter(t => this.finishedTokens.indexOf(t) === -1)).catch((e) => { clearInterval(this.intervalId); }); @@ -256,6 +258,7 @@ export class AnalysisService { } async startAnalysis(algorithm, target: 'drug' | 'drug-target', parameters) { + console.log(parameters) if (!this.canLaunchTask()) { toast({ message: `You can only run ${MAX_TASKS} tasks at once. Please wait for one of them to finish or delete it from the task list.`, @@ -312,7 +315,9 @@ export class AnalysisService { startWatching() { const watch = async () => { - const finished = JSON.parse(localStorage.getItem(this.tokensFinishedCookieKey)); + let finished = JSON.parse(localStorage.getItem(this.tokensFinishedCookieKey)); + if(!finished) + finished = [] const unfinished = this.tokens.filter(t => finished.indexOf(t) === -1); if (unfinished.length > 0 || ! this.initialTasksLoaded) { this.initialTasksLoaded = true;