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

fixing quick and super start option

parent d8bdd5e6
No related branches found
No related tags found
No related merge requests found
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
" "
> >
<button <button
(click)="analysis.startQuickAnalysis(true, null)" (click)="analysis.startQuickAnalysis(true, drugstoneConfig.config,{ nodes: proteins, edges: edges })"
[disabled]="analysis.isLaunchingQuick()" [disabled]="analysis.isLaunchingQuick()"
class="button is-white is-rounded has-tooltip quick-start-btn" class="button is-white is-rounded has-tooltip quick-start-btn"
pTooltip="Find drugs for all proteins." pTooltip="Find drugs for all proteins."
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
" "
> >
<button <button
(click)="analysis.startQuickAnalysis(false, null)" (click)="analysis.startQuickAnalysis(false, drugstoneConfig.config,{ nodes: proteins, edges: edges })"
[disabled]=" [disabled]="
analysis.getCount() === 0 || analysis.getCount() === 0 ||
analysis.isLaunchingQuick() analysis.isLaunchingQuick()
......
...@@ -5,6 +5,7 @@ import {environment} from '../../../environments/environment'; ...@@ -5,6 +5,7 @@ import {environment} from '../../../environments/environment';
import {toast} from 'bulma-toast'; import {toast} from 'bulma-toast';
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {NetexControllerService} from '../netex-controller/netex-controller.service'; import {NetexControllerService} from '../netex-controller/netex-controller.service';
import {IConfig} from "../../config";
export type AlgorithmType = export type AlgorithmType =
'trustrank' 'trustrank'
...@@ -207,7 +208,7 @@ export class AnalysisService { ...@@ -207,7 +208,7 @@ export class AnalysisService {
}); });
} }
async startQuickAnalysis(isSuper: boolean, dataset: Dataset) { async startQuickAnalysis(isSuper: boolean, config: IConfig, network: any) {
if (!this.canLaunchTask()) { if (!this.canLaunchTask()) {
toast({ 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.`, 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.`,
...@@ -221,29 +222,20 @@ export class AnalysisService { ...@@ -221,29 +222,20 @@ export class AnalysisService {
return; return;
} }
if (dataset == null) {
toast({
message: `Passed dataset is null. This feature might be still under development.`,
duration: 5000,
dismissible: true,
pauseOnHover: true,
type: 'is-danger',
position: 'top-center',
animate: {in: 'fadeIn', out: 'fadeOut'}
});
return;
}
this.launchingQuick = true; this.launchingQuick = true;
const params = {
ppi_dataset: config.interactionProteinProtein,
pdi_dataset: config.interactionDrugProtein,
config: config,
input_network: network,
seeds: isSuper ? network.nodes.filter(n => n.drugstoneId && n.drugstoneId[0] === 'p').map(n => n.drugstoneId) : this.getSelection().map((i) => i.id),
};
console.log(params)
const resp = await this.http.post<any>(`${environment.backend}task/`, { const resp = await this.http.post<any>(`${environment.backend}task/`, {
algorithm: isSuper ? 'super' : 'quick', algorithm: isSuper ? 'super' : 'quick',
target: 'drug', target: 'drug',
parameters: { parameters: params,
strain_or_drugs: dataset.id,
bait_datasets: dataset.data,
seeds: isSuper ? [] : this.getSelection().map((i) => i.id),
},
}).toPromise(); }).toPromise();
this.tokens.push(resp.token); this.tokens.push(resp.token);
localStorage.setItem(this.tokensCookieKey, JSON.stringify(this.tokens)); localStorage.setItem(this.tokensCookieKey, JSON.stringify(this.tokens));
...@@ -320,7 +312,7 @@ export class AnalysisService { ...@@ -320,7 +312,7 @@ export class AnalysisService {
const watch = async () => { const watch = async () => {
if (this.tokens.length > 0) { if (this.tokens.length > 0) {
const newtasks = await this.getTasks(); const newtasks = await this.getTasks();
if(newtasks.length === 0) if (newtasks.length === 0)
return; return;
const newTaskIds = newtasks.map(t => t.token.toString()); const newTaskIds = newtasks.map(t => t.token.toString());
this.tasks = newtasks.concat(this.tasks.filter(t => newTaskIds.indexOf(t.token) === -1)); this.tasks = newtasks.concat(this.tasks.filter(t => newTaskIds.indexOf(t.token) === -1));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment