diff --git a/src/app/components/network/network.component.ts b/src/app/components/network/network.component.ts index ba14317dfc546bc92f581e305f878caf2825794f..1cf6565b9e762194571f9d9fb4300ab651950cf0 100644 --- a/src/app/components/network/network.component.ts +++ b/src/app/components/network/network.component.ts @@ -105,6 +105,18 @@ export class NetworkComponent implements OnInit { return this.nodeData.nodes.length > 100 || this.nodeData.edges.length > 100; } + getResetInputNetwork(): NetworkData { + const nodes = [...this.inputNetwork.nodes]; + nodes.forEach(n => { + if (n._group) { + n.group = n._group; + delete n._group; + } + }); + return {edges: this.inputNetwork.edges, nodes}; + } + + setLoading(bool: boolean): void { this.loading = bool; } @@ -395,9 +407,9 @@ export class NetworkComponent implements OnInit { public toImage() { this.downloadDom(this.networkWithLegendEl.nativeElement).catch(error => { - console.error('Falling back to network only screenshot. Some components seem to be inaccessable, most likely the legend is a custom image with CORS access problems on the host server side.'); + console.error('Falling back to network only screenshot. Some components seem to be inaccessible, most likely the legend is a custom image with CORS access problems on the host server side.'); this.downloadDom(this.networkEl.nativeElement).catch(e => { - console.error('Some network content seems to be inaccessable for saving as a screenshot. This can happen due to custom images used as nodes. Please ensure correct CORS accessability on the images host server.'); + console.error('Some network content seems to be inaccessible for saving as a screenshot. This can happen due to custom images used as nodes. Please ensure correct CORS accessability on the images host server.'); console.error(e); }); }); @@ -426,7 +438,7 @@ export class NetworkComponent implements OnInit { public openEdgeSummary(edgeId: string) { this.selectedWrapper = undefined; - const edgeMap = this.nodeData.edges.get({returnType:'Object'}); + const edgeMap = this.nodeData.edges.get({returnType: 'Object'}); this.activeEdge = edgeMap[edgeId]; } diff --git a/src/app/dialogs/launch-analysis/launch-analysis.component.ts b/src/app/dialogs/launch-analysis/launch-analysis.component.ts index 138fabaddae67a474c0e107493c49ddc4891bf6c..f473d758ae8dd0108f54eebcc3eb9d7b95882ea5 100644 --- a/src/app/dialogs/launch-analysis/launch-analysis.component.ts +++ b/src/app/dialogs/launch-analysis/launch-analysis.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core'; import { AnalysisService, BETWEENNESS_CENTRALITY, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, @@ -6,9 +6,9 @@ import { MULTISTEINER, NETWORK_PROXIMITY, TRUSTRANK } from '../../services/analysis/analysis.service'; -import { Algorithm, AlgorithmType, QuickAlgorithmType } from 'src/app/interfaces'; -import { DrugstoneConfigService } from 'src/app/services/drugstone-config/drugstone-config.service'; -import {NetworkHandlerService} from "../../services/network-handler/network-handler.service"; +import {Algorithm, AlgorithmType, QuickAlgorithmType} from 'src/app/interfaces'; +import {DrugstoneConfigService} from 'src/app/services/drugstone-config/drugstone-config.service'; +import {NetworkHandlerService} from '../../services/network-handler/network-handler.service'; @Component({ selector: 'app-launch-analysis', @@ -91,7 +91,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { this.algorithms = [TRUSTRANK, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, NETWORK_PROXIMITY]; } else { // return because this.target === undefined - return + return; } this.algorithms = this.algorithms.filter(algorithm => this.drugstoneConfig.config.algorithms[this.target].includes(algorithm.slug)); // sanity check to fallback algorithm, trustrank works on all targets @@ -111,11 +111,18 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { // all nodes in selection have drugstoneId, hence exist in the backend const seeds = this.analysis.getSelection().map((item) => item.id); const seedsFiltered = seeds.filter(el => el != null); + this.analysis.resetSelection(); const parameters: any = { seeds: seedsFiltered, config: this.drugstoneConfig.currentConfig(), - input_network: this.networkHandler.activeNetwork.inputNetwork + input_network: this.networkHandler.activeNetwork.getResetInputNetwork() }; + parameters.input_network.nodes.forEach(node => { + if (node._group) { + // @ts-ignore + node.group = node._group; + } + }); parameters.ppi_dataset = this.drugstoneConfig.config.interactionProteinProtein; parameters.pdi_dataset = this.drugstoneConfig.config.interactionDrugProtein; parameters.licenced = this.drugstoneConfig.config.licensedDatasets; @@ -124,7 +131,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { // drop interactions in nodes beforehand to no cause cyclic error, information is contained in edges // @ts-ignore this.networkHandler.activeNetwork.inputNetwork.nodes.forEach(node => { - delete node.interactions + delete node.interactions; }); if (this.algorithm === 'trustrank') { @@ -180,7 +187,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { parameters.custom_edges = this.multisteinerCustomEdges; } const token = await this.analysis.startAnalysis(this.algorithm, this.target, parameters); - const object = { taskId: token, algorithm: this.algorithm, target: this.target, params: parameters }; + const object = {taskId: token, algorithm: this.algorithm, target: this.target, params: parameters}; this.taskEvent.emit(object); } diff --git a/src/app/services/analysis/analysis.service.ts b/src/app/services/analysis/analysis.service.ts index a479a1cc6f68768755b7281d30cdef23eaf63e8c..f3a4f4746330fef0d9de0ff5df2408f3fa9cb3df 100644 --- a/src/app/services/analysis/analysis.service.ts +++ b/src/app/services/analysis/analysis.service.ts @@ -268,11 +268,12 @@ export class AnalysisService { } }); } + this.resetSelection(); const target = ['connect', 'connectSelected'].includes(algorithm) ? 'drug-target' : 'drug'; const parameters: any = { seeds: seeds, config: this.drugstoneConfig.currentConfig(), - input_network: this.networkHandler.activeNetwork.inputNetwork, + input_network: this.networkHandler.activeNetwork.getResetInputNetwork(), ppi_dataset: this.drugstoneConfig.currentConfig().interactionProteinProtein, pdi_dataset: this.drugstoneConfig.currentConfig().interactionDrugProtein, target: target,