Skip to content
Snippets Groups Projects
Commit c190d560 authored by AndiMajore's avatar AndiMajore
Browse files

fixed issue with running tasks while nodes are selected

parent 884e6084
No related branches found
No related tags found
No related merge requests found
...@@ -105,6 +105,18 @@ export class NetworkComponent implements OnInit { ...@@ -105,6 +105,18 @@ export class NetworkComponent implements OnInit {
return this.nodeData.nodes.length > 100 || this.nodeData.edges.length > 100; 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 { setLoading(bool: boolean): void {
this.loading = bool; this.loading = bool;
} }
...@@ -395,9 +407,9 @@ export class NetworkComponent implements OnInit { ...@@ -395,9 +407,9 @@ export class NetworkComponent implements OnInit {
public toImage() { public toImage() {
this.downloadDom(this.networkWithLegendEl.nativeElement).catch(error => { 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 => { 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); console.error(e);
}); });
}); });
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
} from '../../services/analysis/analysis.service'; } from '../../services/analysis/analysis.service';
import {Algorithm, AlgorithmType, QuickAlgorithmType} from 'src/app/interfaces'; import {Algorithm, AlgorithmType, QuickAlgorithmType} from 'src/app/interfaces';
import {DrugstoneConfigService} from 'src/app/services/drugstone-config/drugstone-config.service'; import {DrugstoneConfigService} from 'src/app/services/drugstone-config/drugstone-config.service';
import {NetworkHandlerService} from "../../services/network-handler/network-handler.service"; import {NetworkHandlerService} from '../../services/network-handler/network-handler.service';
@Component({ @Component({
selector: 'app-launch-analysis', selector: 'app-launch-analysis',
...@@ -91,7 +91,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -91,7 +91,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
this.algorithms = [TRUSTRANK, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, NETWORK_PROXIMITY]; this.algorithms = [TRUSTRANK, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, NETWORK_PROXIMITY];
} else { } else {
// return because this.target === undefined // return because this.target === undefined
return return;
} }
this.algorithms = this.algorithms.filter(algorithm => this.drugstoneConfig.config.algorithms[this.target].includes(algorithm.slug)); 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 // sanity check to fallback algorithm, trustrank works on all targets
...@@ -111,11 +111,18 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -111,11 +111,18 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
// all nodes in selection have drugstoneId, hence exist in the backend // all nodes in selection have drugstoneId, hence exist in the backend
const seeds = this.analysis.getSelection().map((item) => item.id); const seeds = this.analysis.getSelection().map((item) => item.id);
const seedsFiltered = seeds.filter(el => el != null); const seedsFiltered = seeds.filter(el => el != null);
this.analysis.resetSelection();
const parameters: any = { const parameters: any = {
seeds: seedsFiltered, seeds: seedsFiltered,
config: this.drugstoneConfig.currentConfig(), 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.ppi_dataset = this.drugstoneConfig.config.interactionProteinProtein;
parameters.pdi_dataset = this.drugstoneConfig.config.interactionDrugProtein; parameters.pdi_dataset = this.drugstoneConfig.config.interactionDrugProtein;
parameters.licenced = this.drugstoneConfig.config.licensedDatasets; parameters.licenced = this.drugstoneConfig.config.licensedDatasets;
...@@ -124,7 +131,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -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 // drop interactions in nodes beforehand to no cause cyclic error, information is contained in edges
// @ts-ignore // @ts-ignore
this.networkHandler.activeNetwork.inputNetwork.nodes.forEach(node => { this.networkHandler.activeNetwork.inputNetwork.nodes.forEach(node => {
delete node.interactions delete node.interactions;
}); });
if (this.algorithm === 'trustrank') { if (this.algorithm === 'trustrank') {
......
...@@ -268,11 +268,12 @@ export class AnalysisService { ...@@ -268,11 +268,12 @@ export class AnalysisService {
} }
}); });
} }
this.resetSelection();
const target = ['connect', 'connectSelected'].includes(algorithm) ? 'drug-target' : 'drug'; const target = ['connect', 'connectSelected'].includes(algorithm) ? 'drug-target' : 'drug';
const parameters: any = { const parameters: any = {
seeds: seeds, seeds: seeds,
config: this.drugstoneConfig.currentConfig(), config: this.drugstoneConfig.currentConfig(),
input_network: this.networkHandler.activeNetwork.inputNetwork, input_network: this.networkHandler.activeNetwork.getResetInputNetwork(),
ppi_dataset: this.drugstoneConfig.currentConfig().interactionProteinProtein, ppi_dataset: this.drugstoneConfig.currentConfig().interactionProteinProtein,
pdi_dataset: this.drugstoneConfig.currentConfig().interactionDrugProtein, pdi_dataset: this.drugstoneConfig.currentConfig().interactionDrugProtein,
target: target, target: target,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment