Skip to content
Snippets Groups Projects
Commit 9957f40f authored by Hartung, Michael's avatar Hartung, Michael
Browse files

selection of algorithms available to user

parent 770d9281
Branches
No related tags found
No related merge requests found
import { AlgorithmTarget, AlgorithmType, QuickAlgorithmType } from "./interfaces";
// https://visjs.github.io/vis-network/docs/network/nodes.html // https://visjs.github.io/vis-network/docs/network/nodes.html
export interface NodeGroup { export interface NodeGroup {
groupName?: string; groupName?: string;
...@@ -79,6 +81,7 @@ export interface IConfig { ...@@ -79,6 +81,7 @@ export interface IConfig {
nodeShadow?: boolean; nodeShadow?: boolean;
edgeShadow?: boolean; edgeShadow?: boolean;
useNedrexLicensed?: boolean; useNedrexLicensed?: boolean;
algorithms: { [key in AlgorithmTarget]: Array<AlgorithmType | QuickAlgorithmType> }
} }
/** /**
...@@ -126,6 +129,10 @@ export const defaultConfig: IConfig = { ...@@ -126,6 +129,10 @@ export const defaultConfig: IConfig = {
physicsOn: false, physicsOn: false,
useNedrexLicensed: true, useNedrexLicensed: true,
selfReferences: false, selfReferences: false,
algorithms: {
'drug': ['trustrank', 'closeness', 'degree', 'proximity'],
'drug-target': ['trustrank', 'multisteiner', 'keypathwayminer', 'degree', 'closeness', 'betweenness']
},
nodeGroups: { nodeGroups: {
// all NodeGroups but the default group must be set, if not provided by the user, they will be taken from here // all NodeGroups but the default group must be set, if not provided by the user, they will be taken from here
// IMPORTANT: node color must be hexacode! // IMPORTANT: node color must be hexacode!
......
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { import {
Algorithm,
AlgorithmType,
AnalysisService, BETWEENNESS_CENTRALITY, CLOSENESS_CENTRALITY, AnalysisService, BETWEENNESS_CENTRALITY, CLOSENESS_CENTRALITY,
DEGREE_CENTRALITY, DEGREE_CENTRALITY,
KEYPATHWAYMINER, MAX_TASKS, KEYPATHWAYMINER, MAX_TASKS,
MULTISTEINER, NETWORK_PROXIMITY, MULTISTEINER, NETWORK_PROXIMITY,
QuickAlgorithmType,
TRUSTRANK TRUSTRANK
} from '../../services/analysis/analysis.service'; } from '../../services/analysis/analysis.service';
import { IConfig } from 'src/app/config'; import { Algorithm, AlgorithmType, QuickAlgorithmType } from 'src/app/interfaces';
import { DrugstoneConfigService } from 'src/app/services/drugstone-config/drugstone-config.service';
@Component({ @Component({
selector: 'app-launch-analysis', selector: 'app-launch-analysis',
...@@ -24,8 +22,6 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -24,8 +22,6 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
public target: 'drug' | 'drug-target'; public target: 'drug' | 'drug-target';
@Input() @Input()
public inputNetwork: { nodes: any, edges: any }; public inputNetwork: { nodes: any, edges: any };
@Input()
public config: IConfig;
@Output() @Output()
public showChange = new EventEmitter<boolean>(); public showChange = new EventEmitter<boolean>();
@Output() @Output()
...@@ -82,7 +78,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -82,7 +78,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
public maxTasks = MAX_TASKS; public maxTasks = MAX_TASKS;
constructor(public analysis: AnalysisService) { constructor(public analysis: AnalysisService, public drugstoneConfig: DrugstoneConfigService) {
} }
ngOnInit(): void { ngOnInit(): void {
...@@ -91,10 +87,18 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -91,10 +87,18 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (this.target === 'drug-target') { if (this.target === 'drug-target') {
this.algorithms = [MULTISTEINER, KEYPATHWAYMINER, TRUSTRANK, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, BETWEENNESS_CENTRALITY]; this.algorithms = [MULTISTEINER, KEYPATHWAYMINER, TRUSTRANK, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, BETWEENNESS_CENTRALITY];
this.algorithm = MULTISTEINER.slug;
} else if (this.target === 'drug') { } else if (this.target === 'drug') {
this.algorithms = [TRUSTRANK, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, NETWORK_PROXIMITY]; this.algorithms = [TRUSTRANK, CLOSENESS_CENTRALITY, DEGREE_CENTRALITY, NETWORK_PROXIMITY];
this.algorithm = TRUSTRANK.slug; } else {
// return because this.target === undefined
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
if (!this.algorithms.length) {
this.algorithms = [TRUSTRANK];
} else {
this.algorithm = this.algorithms[0].slug;
} }
} }
...@@ -111,12 +115,12 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -111,12 +115,12 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
}); });
const parameters: any = { const parameters: any = {
seeds: seedsFiltered, seeds: seedsFiltered,
config: this.config, config: this.drugstoneConfig.config,
input_network: this.inputNetwork input_network: this.inputNetwork
}; };
parameters.ppi_dataset = this.config.interactionProteinProtein; parameters.ppi_dataset = this.drugstoneConfig.config.interactionProteinProtein;
parameters.pdi_dataset = this.config.interactionDrugProtein; parameters.pdi_dataset = this.drugstoneConfig.config.interactionDrugProtein;
parameters.target = this.target === 'drug' ? 'drug' : 'drug-target'; parameters.target = this.target === 'drug' ? 'drug' : 'drug-target';
// pass network data to reconstruct network in analysis result to connect non-proteins to results // pass network data to reconstruct network in analysis result to connect non-proteins to results
// 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
......
import {AlgorithmType, QuickAlgorithmType} from './services/analysis/analysis.service';
export interface Node { export interface Node {
ctxRenderer?: any; ctxRenderer?: any;
label: string; label: string;
...@@ -67,10 +65,12 @@ export interface NetworkEdge { ...@@ -67,10 +65,12 @@ export interface NetworkEdge {
label: string; label: string;
} }
export type AlgorithmTarget = 'drug' | 'drug-target'
export interface Task { export interface Task {
token: string; token: string;
info: { info: {
target: 'drug' | 'drug-target', target: AlgorithmTarget,
algorithm: AlgorithmType | QuickAlgorithmType; algorithm: AlgorithmType | QuickAlgorithmType;
parameters?: { [key: string]: any }; parameters?: { [key: string]: any };
...@@ -231,3 +231,18 @@ export interface Dataset { ...@@ -231,3 +231,18 @@ export interface Dataset {
id: string; id: string;
data: Array<[string, string]>; data: Array<[string, string]>;
} }
export type AlgorithmType =
'trustrank'
| 'keypathwayminer'
| 'multisteiner'
| 'closeness'
| 'degree'
| 'proximity'
| 'betweenness';
export type QuickAlgorithmType = 'quick' | 'super';
export interface Algorithm {
slug: AlgorithmType | QuickAlgorithmType;
name: string;
}
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<app-launch-analysis <app-launch-analysis
[(show)]="showAnalysisDialog" [(show)]="showAnalysisDialog"
[target]="analysisDialogTarget" [target]="analysisDialogTarget"
[config]="drugstoneConfig.config"
[inputNetwork]="{ nodes: proteins, edges: edges }" [inputNetwork]="{ nodes: proteins, edges: edges }"
(taskEvent)="emitTaskEvent($event)" (taskEvent)="emitTaskEvent($event)"
> >
......
import {Wrapper, Task, getWrapperFromNode, Node, Dataset, Tissue} from '../../interfaces'; import {Wrapper, Task, getWrapperFromNode, Node, Dataset, Tissue, Algorithm} from '../../interfaces';
import {Subject} from 'rxjs'; import {Subject} from 'rxjs';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import {environment} from '../../../environments/environment'; import {environment} from '../../../environments/environment';
...@@ -6,16 +6,6 @@ import {toast} from 'bulma-toast'; ...@@ -6,16 +6,6 @@ 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';
export type AlgorithmType =
'trustrank'
| 'keypathwayminer'
| 'multisteiner'
| 'closeness'
| 'degree'
| 'proximity'
| 'betweenness';
export type QuickAlgorithmType = 'quick' | 'super';
export const algorithmNames = { export const algorithmNames = {
trustrank: 'TrustRank', trustrank: 'TrustRank',
keypathwayminer: 'KeyPathwayMiner', keypathwayminer: 'KeyPathwayMiner',
...@@ -28,11 +18,6 @@ export const algorithmNames = { ...@@ -28,11 +18,6 @@ export const algorithmNames = {
super: 'Quick-Start', super: 'Quick-Start',
}; };
export interface Algorithm {
slug: AlgorithmType | QuickAlgorithmType;
name: string;
}
export const TRUSTRANK: Algorithm = {slug: 'trustrank', name: algorithmNames.trustrank}; export const TRUSTRANK: Algorithm = {slug: 'trustrank', name: algorithmNames.trustrank};
export const CLOSENESS_CENTRALITY: Algorithm = {slug: 'closeness', name: algorithmNames.closeness}; export const CLOSENESS_CENTRALITY: Algorithm = {slug: 'closeness', name: algorithmNames.closeness};
export const DEGREE_CENTRALITY: Algorithm = {slug: 'degree', name: algorithmNames.degree}; export const DEGREE_CENTRALITY: Algorithm = {slug: 'degree', name: algorithmNames.degree};
......
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {environment} from '../../../environments/environment'; import {environment} from '../../../environments/environment';
import {HttpClient, HttpParams} from '@angular/common/http'; import {HttpClient, HttpParams} from '@angular/common/http';
import {AlgorithmType, QuickAlgorithmType} from '../analysis/analysis.service';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
import {Tissue, Node, EdgeType} from 'src/app/interfaces'; import {Tissue, Node, EdgeType, QuickAlgorithmType, AlgorithmType} from 'src/app/interfaces';
import {InteractionDrugProteinDB, InteractionProteinProteinDB} from 'src/app/config'; import {InteractionDrugProteinDB, InteractionProteinProteinDB} from 'src/app/config';
@Injectable({ @Injectable({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment