From 81fd7f8abe7ed706fb92e4d2188118bd9ad1475b Mon Sep 17 00:00:00 2001 From: "Hartung, Michael" <michael.hartung@uni-hamburg.de> Date: Fri, 30 Sep 2022 17:39:58 +0200 Subject: [PATCH] Custom edges in algortihms; proper formatting of arrow messages in task list --- .../analysis-panel.component.html | 13 ++ .../task-list/task-list.component.scss | 2 +- src/app/config.ts | 2 + .../launch-analysis.component.html | 120 +++++++++++++++++- .../launch-analysis.component.ts | 25 ++-- src/app/services/analysis/analysis.service.ts | 1 + src/index.html | 2 +- 7 files changed, 152 insertions(+), 13 deletions(-) diff --git a/src/app/components/analysis-panel/analysis-panel.component.html b/src/app/components/analysis-panel/analysis-panel.component.html index a4a979d9..d19df5f5 100644 --- a/src/app/components/analysis-panel/analysis-panel.component.html +++ b/src/app/components/analysis-panel/analysis-panel.component.html @@ -150,6 +150,19 @@ ></i> </td> </tr> + <tr *ngIf="task.info.parameters.customEdges !== undefined"> + <td>Include all displayed edges</td> + <td> + <i + *ngIf="task.info.parameters.customEdges" + class="fa fa-check" + ></i> + <i + *ngIf="!task.info.parameters.customEdges" + class="fa fa-times color-danger" + ></i> + </td> + </tr> </tbody> </table> </div> diff --git a/src/app/components/task-list/task-list.component.scss b/src/app/components/task-list/task-list.component.scss index ec5bceef..15694445 100644 --- a/src/app/components/task-list/task-list.component.scss +++ b/src/app/components/task-list/task-list.component.scss @@ -20,7 +20,7 @@ font-size: 10px; max-width: 215px; max-height: 30px; - overflow: scroll; + overflow-y: scroll; border: 1px solid var(--drgstn-border); display: inline-block; } diff --git a/src/app/config.ts b/src/app/config.ts index abee66b7..a0726e73 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -72,6 +72,7 @@ export interface IConfig { nodeGroups: { [key: string]: NodeGroup }; edgeGroups: { [key: string]: EdgeGroup }; selfReferences: boolean; + customEdges: {default: boolean, selectable: boolean}; interactionDrugProtein: InteractionDrugProteinDB; interactionProteinProtein: InteractionProteinProteinDB; indicationDrugDisorder: IndicationDrugDisorderDB; @@ -162,6 +163,7 @@ export const defaultConfig: IConfig = { networkMenuButtonAnimationLabel: 'Animation', identifier: 'symbol', selfReferences: false, + customEdges: {default: true, selectable: false}, interactionDrugProtein: 'NeDRex', interactionProteinProtein: 'NeDRex', indicationDrugDisorder: 'NeDRex', diff --git a/src/app/dialogs/launch-analysis/launch-analysis.component.html b/src/app/dialogs/launch-analysis/launch-analysis.component.html index e7e3a040..e683e9bd 100644 --- a/src/app/dialogs/launch-analysis/launch-analysis.component.html +++ b/src/app/dialogs/launch-analysis/launch-analysis.component.html @@ -162,6 +162,25 @@ </div> <p class="has-text-info is-size-7">Penalty parameter for hubs.</p> </div> + + <div + class="field" + *ngIf="drugstoneConfig.config.customEdges.selectable" + > + <label class="label">Include all displayed edges</label> + <app-toggle + textOn="Include" + textOff="Ignore" + tooltipOn="Use all edges from the visualized network and the Drugst.One database." + tooltipOff="Use only Drugst.One edges." + [(value)]="trustrankCustomEdges" + > + </app-toggle> + <p class="has-text-info is-size-7"> + Include PPI edges from displayed network in the algorithms or + use only edges from the Drugst.One database. + </p> + </div> </div> <div *ngIf="algorithm === 'closeness'"> @@ -261,6 +280,25 @@ </div> <p class="has-text-info is-size-7">Penalty parameter for hubs.</p> </div> + + <div + class="field" + *ngIf="drugstoneConfig.config.customEdges.selectable" + > + <label class="label">Include all displayed edges</label> + <app-toggle + textOn="Include" + textOff="Ignore" + tooltipOn="Use all edges from the visualized network and the Drugst.One database." + tooltipOff="Use only Drugst.One edges." + [(value)]="closenessCustomEdges" + > + </app-toggle> + <p class="has-text-info is-size-7"> + Include PPI edges from displayed network in the algorithms or + use only edges from the Drugst.One database. + </p> + </div> </div> <div *ngIf="algorithm === 'degree'"> @@ -327,6 +365,25 @@ Disabled if equal to 0. </p> </div> + + <div + class="field" + *ngIf="drugstoneConfig.config.customEdges.selectable" + > + <label class="label">Include all displayed edges</label> + <app-toggle + textOn="Include" + textOff="Ignore" + tooltipOn="Use all edges from the visualized network and the Drugst.One database." + tooltipOff="Use only Drugst.One edges." + [(value)]="degreeCustomEdges" + > + </app-toggle> + <p class="has-text-info is-size-7"> + Include PPI edges from displayed network in the algorithms or + use only edges from the Drugst.One database. + </p> + </div> </div> <div *ngIf="algorithm === 'proximity'"> @@ -407,6 +464,25 @@ </div> <p class="has-text-info is-size-7">Penalty parameter for hubs.</p> </div> + + <div + class="field" + *ngIf="drugstoneConfig.config.customEdges.selectable" + > + <label class="label">Include all displayed edges</label> + <app-toggle + textOn="Include" + textOff="Ignore" + tooltipOn="Use all edges from the visualized network and the Drugst.One database." + tooltipOff="Use only Drugst.One edges." + [(value)]="proximityCustomEdges" + > + </app-toggle> + <p class="has-text-info is-size-7"> + Include PPI edges from displayed network in the algorithms or + use only edges from the Drugst.One database. + </p> + </div> </div> <div *ngIf="algorithm === 'betweenness'"> @@ -477,6 +553,25 @@ </div> <p class="has-text-info is-size-7">Penalty parameter for hubs.</p> </div> + + <div + class="field" + *ngIf="drugstoneConfig.config.customEdges.selectable" + > + <label class="label">Include all displayed edges</label> + <app-toggle + textOn="Include" + textOff="Ignore" + tooltipOn="Use all edges from the visualized network and the Drugst.One database." + tooltipOff="Use only Drugst.One edges." + [(value)]="betweennessCustomEdges" + > + </app-toggle> + <p class="has-text-info is-size-7"> + Include PPI edges from displayed network in the algorithms or + use only edges from the Drugst.One database. + </p> + </div> </div> <div *ngIf="algorithm === 'keypathwayminer'"> @@ -537,8 +632,9 @@ <p> The Multi-level Steiner Tree algorithm can be used to approximate a minimum spanning subnetwork between seed - nodes, which happen to be central interaction partners between the seed nodes, and thus represent - favorable drug-targets (Ahmed et al. 2019). + nodes, which happen to be central interaction partners + between the seed nodes, and thus represent favorable + drug-targets (Ahmed et al. 2019). </p> </div> </div> @@ -627,8 +723,26 @@ </div> <p class="has-text-info is-size-7">Penalty parameter for hubs.</p> </div> - </div> + <div + class="field" + *ngIf="drugstoneConfig.config.customEdges.selectable" + > + <label class="label">Include all displayed edges</label> + <app-toggle + textOn="Include" + textOff="Ignore" + tooltipOn="Use all edges from the visualized network and the Drugst.One database." + tooltipOff="Use only Drugst.One edges." + [(value)]="multisteinerCustomEdges" + > + </app-toggle> + <p class="has-text-info is-size-7"> + Include PPI edges from displayed network in the algorithms or + use only edges from the Drugst.One database. + </p> + </div> + </div> </div> </div> </section> diff --git a/src/app/dialogs/launch-analysis/launch-analysis.component.ts b/src/app/dialogs/launch-analysis/launch-analysis.component.ts index 273822d5..fbec89c9 100644 --- a/src/app/dialogs/launch-analysis/launch-analysis.component.ts +++ b/src/app/dialogs/launch-analysis/launch-analysis.component.ts @@ -9,6 +9,7 @@ import { 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 { connectableObservableDescriptor } from 'rxjs/internal/observable/ConnectableObservable'; @Component({ selector: 'app-launch-analysis', @@ -17,6 +18,9 @@ import {NetworkHandlerService} from "../../services/network-handler/network-hand }) export class LaunchAnalysisComponent implements OnInit, OnChanges { + constructor(public analysis: AnalysisService, public drugstoneConfig: DrugstoneConfigService, public networkHandler: NetworkHandlerService) { + } + @Input() public show = false; @Input() @@ -33,37 +37,38 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { // Trustrank Parameters public trustrankIncludeIndirectDrugs = false; public trustrankIncludeNonApprovedDrugs = false; - public trustrankIncludeViralNonSeeds = true; public trustrankDampingFactor = 0.85; public trustrankMaxDeg = 0; public trustrankHubPenalty = 0.0; public trustrankResultSize = 20; + public trustrankCustomEdges = this.drugstoneConfig.config.customEdges.default; // Closeness Parameters public closenessIncludeIndirectDrugs = false; public closenessIncludeNonApprovedDrugs = false; - public closenessIncludeViralNonSeeds = true; public closenessMaxDeg = 0; public closenessHubPenalty = 0.0; public closenessResultSize = 20; + public closenessCustomEdges = this.drugstoneConfig.config.customEdges.default; // Degree Parameters public degreeIncludeNonApprovedDrugs = false; - public degreeIncludeViralNonSeeds = true; public degreeMaxDeg = 0; public degreeResultSize = 20; + public degreeCustomEdges = this.drugstoneConfig.config.customEdges.default; // Network proximity public proximityIncludeNonApprovedDrugs = false; public proximityMaxDeg = 0; public proximityHubPenalty = 0.0; public proximityResultSize = 20; + public proximityCustomEdges = this.drugstoneConfig.config.customEdges.default; // Betweenness Parameters - public betweennessIncludeViralNonSeeds = true; public betweennessMaxDeg = 0; public betweennessHubPenalty = 0.0; public betweennessResultSize = 20; + public betweennessCustomEdges = this.drugstoneConfig.config.customEdges.default; // Keypathwayminer Parameters public keypathwayminerK = 5; @@ -71,15 +76,12 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { // Multisteiner Parameters public multisteinerNumTrees = 5; public multisteinerTolerance = 10; - public multisteinerIncludeViralNonSeeds = true; public multisteinerMaxDeg = 0; public multisteinerHubPenalty = 0.0; + public multisteinerCustomEdges = this.drugstoneConfig.config.customEdges.default; public maxTasks = MAX_TASKS; - constructor(public analysis: AnalysisService, public drugstoneConfig: DrugstoneConfigService, public networkHandler: NetworkHandlerService) { - } - ngOnInit(): void { } @@ -115,6 +117,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { config: this.drugstoneConfig.config, input_network: this.networkHandler.activeNetwork.inputNetwork }; + console.log(parameters) parameters.ppi_dataset = this.drugstoneConfig.config.interactionProteinProtein; parameters.pdi_dataset = this.drugstoneConfig.config.interactionDrugProtein; parameters.licenced = this.drugstoneConfig.config.licensedDatasets; @@ -137,6 +140,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { } parameters.hub_penalty = this.trustrankHubPenalty; parameters.result_size = this.trustrankResultSize; + parameters.custom_edges = this.trustrankCustomEdges; } else if (this.algorithm === 'closeness') { parameters.include_indirect_drugs = this.closenessIncludeIndirectDrugs; parameters.include_non_approved_drugs = this.closenessIncludeNonApprovedDrugs; @@ -145,12 +149,14 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { } parameters.hub_penalty = this.closenessHubPenalty; parameters.result_size = this.closenessResultSize; + parameters.custom_edges = this.closenessCustomEdges; } else if (this.algorithm === 'degree') { parameters.include_non_approved_drugs = this.degreeIncludeNonApprovedDrugs; if (this.degreeMaxDeg && this.degreeMaxDeg > 0) { parameters.max_deg = this.degreeMaxDeg; } parameters.result_size = this.degreeResultSize; + parameters.custom_edges = this.degreeCustomEdges; } else if (this.algorithm === 'proximity') { parameters.include_non_approved_drugs = this.proximityIncludeNonApprovedDrugs; if (this.proximityMaxDeg && this.proximityMaxDeg > 0) { @@ -158,12 +164,14 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { } parameters.hub_penalty = this.proximityHubPenalty; parameters.result_size = this.proximityResultSize; + parameters.custom_edges = this.proximityCustomEdges; } else if (this.algorithm === 'betweenness') { if (this.betweennessMaxDeg && this.betweennessMaxDeg > 0) { parameters.max_deg = this.betweennessMaxDeg; } parameters.hub_penalty = this.betweennessHubPenalty; parameters.result_size = this.betweennessResultSize; + parameters.custom_edges = this.betweennessCustomEdges; } else if (this.algorithm === 'keypathwayminer') { parameters.k = this.keypathwayminerK; } else if (this.algorithm === 'multisteiner') { @@ -173,6 +181,7 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { parameters.max_deg = this.multisteinerMaxDeg; } parameters.hub_penalty = this.multisteinerHubPenalty; + 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 }; diff --git a/src/app/services/analysis/analysis.service.ts b/src/app/services/analysis/analysis.service.ts index b8c37351..f39a5613 100644 --- a/src/app/services/analysis/analysis.service.ts +++ b/src/app/services/analysis/analysis.service.ts @@ -249,6 +249,7 @@ export class AnalysisService { target: target, num_trees: 5, tolerance: 10, + custom_edges: this.drugstoneConfig.config.customEdges.default, }; diff --git a/src/index.html b/src/index.html index 77d89d18..63df1e94 100644 --- a/src/index.html +++ b/src/index.html @@ -94,7 +94,7 @@ pluginId="2" groups='{"nodeGroups":{"patient":{"type":"patient","color":"#000000","font":{"color":"#000000"},"groupName":"Patient","shape":"image","image":"https://static.thenounproject.com/png/22780-200.png"},"condition":{"type":"condition","color":"#000000","font":{"color":"#000000"},"groupName":"Condition","shape":"text"},"important":{"type":"gene","color":"#ff881f","font":{"color":"#000000"},"groupName":"Important Gene","shape":"star"},"gene":{"type":"gene","color":"#4da300","font":{"color":"#f0f0f0"},"groupName":"Gene","shape":"circle"},"foundDrug":{"type":"drug","color":"#F12590","font":{"color":"#000000"},"groupName":"Drug","shape":"diamond"}},"edgeGroups":{"genotype":{"color":"#000000","groupName":"Relevant Gene"},"has-condition":{"color":"#000000","groupName":"Has Condition","dashes":[2,2]},"default":{"color":"#000000","groupName":"default edge"},"ggi":{"color":"#000000","groupName":"Interaction","dashes":[3,2]}}}' config='{"expandNetworkMenu": false, "showSimpleAnalysis": true, "licensedDatasets": false, "physicsOn":false,"identifier":"symbol","title":"Breast cancer example network","nodeShadow":true,"edgeShadow":false,"autofillEdges":true,"showLegend":true}' - network='{"nodes":[{"id": "FOXP3"},{"id":"patient-1","group":"patient","x":592,"y":446},{"id":"patient-2","group":"patient","x":235,"y":87},{"id":"patient-3","group":"patient","x":105,"y":369},{"id":"ATM","label":"ATM","group":"gene","x":289,"y":242},{"id":"BARD1","label":"BARD1","group":"gene","x":44,"y":250},{"id":"BRCA1","label":"BRCA1","group":"gene","x":466,"y":576},{"id":"BRCA2","label":"BRCA2","group":"gene","x":507,"y":285},{"id":"BRIP1","label":"BRIP1","group":"gene","x":54,"y":474},{"id":"CHEK2","label":"CHEK2","group":"gene","x":216,"y":590},{"id":"CDH1","label":"CDH1","group":"gene","x":320,"y":-57},{"id":"NF1","label":"NF1","group":"gene","x":481,"y":111},{"id":"NBN","label":"NBN","group":"gene","x":-57,"y":314},{"id":"PALB2","label":"PALB2","group":"gene","x":450,"y":190},{"id":"PTEN","label":"PTEN","group":"important","x":305,"y":494},{"id":"RAD51C","label":"RAD51C","group":"gene","x":182,"y":-90},{"id":"RAD51D","label":"RAD51D","group":"gene","x":368,"y":73},{"id":"STK11","label":"STK11","group":"gene","x":686,"y":330},{"id":"TP53","label":"TP53","group":"important","x":333,"y":316},{"id":"subtype-1","label":"Subtype 1","group":"condition","x":556,"y":171},{"id":"subtype-2","label":"Subtype 2","group":"condition","x":-87,"y":221}],"edges":[{"from":"BRCA1","to":"BRCA2","group":"ggi"},{"from":"ATM","to":"BARD1","group":"ggi"},{"from":"BRCA1","to":"CHEK2","group":"ggi"},{"from":"RAD51C","to":"RAD51D","group":"ggi"},{"from":"STK11","to":"TP53","group":"ggi"},{"from":"TP53","to":"PALB2","group":"ggi"},{"from":"TP53","to":"RAD51D","group":"ggi"},{"from":"TP53","to":"NF1","group":"ggi"},{"from":"TP53","to":"BRCA1","group":"ggi"},{"from":"TP53","to":"BRCA2","group":"ggi"},{"from":"PTEN","to":"BRCA1","group":"ggi"},{"from":"PTEN","to":"BRCA2","group":"ggi"},{"from":"TP53","to":"PTEN","group":"ggi"},{"from":"ATM","to":"PTEN","group":"ggi"},{"from":"CDH1","to":"RAD51D","group":"ggi"},{"from":"CDH1","to":"PALB2","group":"ggi"},{"from":"NBN","to":"BRIP1","group":"ggi"},{"from":"BRIP1","to":"PTEN","group":"ggi"},{"from":"patient-1","to":"BRCA1","group":"genotype"},{"from":"patient-1","to":"TP53","group":"genotype"},{"from":"patient-1","to":"BRCA2","group":"genotype"},{"from":"patient-1","to":"PTEN","group":"genotype"},{"from":"patient-2","to":"TP53","group":"genotype"},{"from":"patient-2","to":"NF1","group":"genotype"},{"from":"patient-2","to":"BARD1","group":"genotype"},{"from":"patient-3","to":"TP53","group":"genotype"},{"from":"patient-3","to":"PTEN","group":"genotype"},{"from":"patient-3","to":"NBN","group":"genotype"},{"from":"patient-1","to":"subtype-1","group":"has-condition"},{"from":"patient-2","to":"subtype-1","group":"has-condition"},{"from":"patient-3","to":"subtype-2","group":"has-condition"}]}' + network='{"nodes":[{"id": "FOXP3"},{"id":"patient-1","group":"patient","x":592,"y":446},{"id":"patient-2","group":"patient","x":235,"y":87},{"id":"patient-3","group":"patient","x":105,"y":369},{"id":"ATM","label":"ATM","group":"gene","x":289,"y":242},{"id":"BARD1","label":"BARD1","group":"gene","x":44,"y":250},{"id":"BRCA1","label":"BRCA1","group":"gene","x":466,"y":576},{"id":"BRCA2","label":"BRCA2","group":"gene","x":507,"y":285},{"id":"BRIP1","label":"BRIP1","group":"gene","x":54,"y":474},{"id":"CHEK2","label":"CHEK2","group":"gene","x":216,"y":590},{"id":"CDH1","label":"CDH1","group":"gene","x":320,"y":-57},{"id":"NF1","label":"NF1","group":"gene","x":481,"y":111},{"id":"NBN","label":"NBN","group":"gene","x":-57,"y":314},{"id":"PALB2","label":"PALB2","group":"gene","x":450,"y":190},{"id":"PTEN","label":"PTEN","group":"important","x":305,"y":494},{"id":"RAD51C","label":"RAD51C","group":"gene","x":182,"y":-90},{"id":"RAD51D","label":"RAD51D","group":"gene","x":368,"y":73},{"id":"STK11","label":"STK11","group":"gene","x":686,"y":330},{"id":"TP53","label":"TP53","group":"important","x":333,"y":316},{"id":"subtype-1","label":"Subtype 1","group":"condition","x":556,"y":171},{"id":"subtype-2","label":"Subtype 2","group":"condition","x":-87,"y":221}],"edges":[{"from":"PTEN","to":"NBN","group":"ggi"}, {"from":"patient-3","to":"subtype-2","group":"has-condition"}]}' > </drugst-one> -- GitLab