diff --git a/src/app/components/analysis-panel/analysis-panel.component.ts b/src/app/components/analysis-panel/analysis-panel.component.ts index a8c9d3f90761ef5f543f191471e74b12af0c2f5a..59584070065046c76adedb4adc89366f98a1c843 100644 --- a/src/app/components/analysis-panel/analysis-panel.component.ts +++ b/src/app/components/analysis-panel/analysis-panel.component.ts @@ -197,12 +197,12 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit this.networkHandler.activeNetwork.networkInternal = new vis.Network(container, this.nodeData, options); - this.tableDrugs = nodes.filter( e => e.netexId && e.netexId.startsWith('d')); + this.tableDrugs = nodes.filter( e => e.drugstoneId && e.drugstoneId.startsWith('d')); this.tableDrugs.forEach((r) => { r.rawScore = r.score; }); - this.tableProteins = nodes.filter( e => e.netexId && e.netexId.startsWith('p')); + this.tableProteins = nodes.filter( e => e.drugstoneId && e.drugstoneId.startsWith('p')); this.tableSelectedProteins = []; this.tableProteins.forEach((r) => { r.rawScore = r.score; @@ -233,7 +233,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit if (nodeIds.length > 0) { const nodeId = nodeIds[0]; const node = this.nodeData.nodes.get(nodeId); - if (node.nodeType === 'drug' || node.netexId === undefined || !node.netexId.startsWith('p')) { + if (node.nodeType === 'drug' || node.drugstoneId === undefined || !node.drugstoneId.startsWith('p')) { return; } const wrapper = getWrapperFromNode(node); @@ -306,7 +306,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit this.nodeData.nodes.forEach((node) => { // let drugType; // let drugInTrial; - // if (node.netexId && node.netexId.startsWith('d')) { + // if (node.drugstoneId && node.drugstoneId.startsWith('d')) { // drugType = node.status; // drugInTrial = node.inTrial; // } @@ -428,7 +428,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // } // for (const disorder of response.disorders) { // disorder.group = 'defaultDisorder'; - // disorder.id = disorder.netexId; + // disorder.id = disorder.drugstoneId; // this.adjacentProteinDisorderList.push(mapCustomNode(disorder, this.myConfig)) // } // this.saveAddNodes(this.adjacentProteinDisorderList); @@ -456,7 +456,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // } // for (const disorder of response.disorders) { // disorder.group = 'defaultDisorder'; - // disorder.id = disorder.netexId; + // disorder.id = disorder.drugstoneId; // this.adjacentDrugDisorderList.push(mapCustomNode(disorder, this.myConfig)); // } // this.saveAddNodes(this.adjacentDrugDisorderList); @@ -495,9 +495,9 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit public inferNodeGroup(wrapper: Wrapper): string { if (wrapper.data.group !== undefined) { return wrapper.data.group; - } else if (wrapper.data.netexId !== undefined && wrapper.data.netexId.startsWith('d')) { + } else if (wrapper.data.drugstoneId !== undefined && wrapper.data.drugstoneId.startsWith('d')) { return 'drug'; - } else if (wrapper.data.netexId !== undefined && wrapper.data.netexId.startsWith('p')) { + } else if (wrapper.data.drugstoneId !== undefined && wrapper.data.drugstoneId.startsWith('p')) { return 'protein'; } } @@ -554,14 +554,14 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // convert id to netex Id if exists const nodeDetails = details[node]; - nodeDetails.id = nodeDetails.id ? nodeDetails.id : nodeDetails.netexId; - if (nodeDetails.netexId && nodeDetails.netexId.startsWith('p')) { + nodeDetails.id = nodeDetails.id ? nodeDetails.id : nodeDetails.drugstoneId; + if (nodeDetails.drugstoneId && nodeDetails.drugstoneId.startsWith('p')) { // node is protein from database, has been mapped on init to backend protein from backend // or was found during analysis nodeDetails.group = nodeDetails.group ? nodeDetails.group : 'foundNode'; nodeDetails.label = nodeDetails.label ? nodeDetails.label : nodeDetails[identifier]; this.proteins.push(nodeDetails); - } else if (nodeDetails.netexId && nodeDetails.netexId.startsWith('d')) { + } else if (nodeDetails.drugstoneId && nodeDetails.drugstoneId.startsWith('d')) { // node is drug, was found during analysis nodeDetails.type = 'Drug'; nodeDetails.group = 'foundDrug'; @@ -586,7 +586,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // hasDrugsLoaded(): boolean { // if (this.nodeData == null || this.nodeData.nodes == null) // return false; - // return this.nodeData.nodes.get().filter((node: Node) => node.drugId && node.netexId.startsWith('dr')).length > 0; + // return this.nodeData.nodes.get().filter((node: Node) => node.drugId && node.drugstoneId.startsWith('dr')).length > 0; // } // public updateAdjacentDrugs(bool: boolean) { @@ -684,7 +684,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // this.selectedTissue = null; // const updatedNodes = []; // for (const item of this.proteins) { - // if (item.netexId === undefined) { + // if (item.drugstoneId === undefined) { // // nodes that are not mapped to backend remain untouched // continue; // } @@ -718,7 +718,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // // filter out non-proteins, e.g. drugs // const proteinNodes = []; // this.nodeData.nodes.forEach(element => { - // if (element.id.startsWith('p') && element.netexId !== undefined) { + // if (element.id.startsWith('p') && element.drugstoneId !== undefined) { // proteinNodes.push(element); // } // }); @@ -728,17 +728,17 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // // mapping from netex IDs to network IDs, TODO check if this step is necessary // const networkIdMappping = {} // this.nodeData.nodes.forEach(element => { - // networkIdMappping[element.netexId] = element.id + // networkIdMappping[element.drugstoneId] = element.id // }); // const maxExpr = Math.max(...Object.values(this.expressionMap)); - // for (const [netexId, expressionlvl] of Object.entries(this.expressionMap)) { - // const networkId = networkIdMappping[netexId] + // for (const [drugstoneId, expressionlvl] of Object.entries(this.expressionMap)) { + // const networkId = networkIdMappping[drugstoneId] // const node = this.nodeData.nodes.get(networkId); // if (node === null) { // continue; // } // const wrapper = getWrapperFromNode(node) - // this.gradientMap[netexId] = expressionlvl !== null ? (Math.pow(expressionlvl / maxExpr, 1 / 3) * (1 - minExp) + minExp) : -1; + // this.gradientMap[drugstoneId] = expressionlvl !== null ? (Math.pow(expressionlvl / maxExpr, 1 / 3) * (1 - minExp) + minExp) : -1; // const pos = this.networkHandler.activeNetwork.networkInternal.getPositions([networkId]); // node.x = pos[networkId].x; // node.y = pos[networkId].y; @@ -749,7 +749,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit // this.myConfig, // isSeed, // this.analysis.inSelection(wrapper), - // this.gradientMap[netexId])); + // this.gradientMap[drugstoneId])); // node.shape = 'custom'; // node.ctxRenderer = pieChartContextRenderer; // updatedNodes.push(node); diff --git a/src/app/components/info-tile/info-tile.component.html b/src/app/components/info-tile/info-tile.component.html index 744580ef4303ca5e218da8271e9b1c894b7d0d49..dc8f22f3986e645db3a150e1550e54ca41cedc59 100644 --- a/src/app/components/info-tile/info-tile.component.html +++ b/src/app/components/info-tile/info-tile.component.html @@ -101,7 +101,7 @@ </div> <app-toggle - *ngIf="wrapper.data.netexId && wrapper.data.netexId.startsWith('p')" + *ngIf="wrapper.data.drugstoneId && wrapper.data.drugstoneId.startsWith('p')" [value]="analysis.inSelection(wrapper)" (valueChange)=" $event ? analysis.addItems([wrapper]) : analysis.removeItems([wrapper]) diff --git a/src/app/components/network/network-menu-left/network-menu-left.component.html b/src/app/components/network/network-menu-left/network-menu-left.component.html index c251083c4e2e7f682a275259049c664f3ecbee94..16d614924e923c166611266c9b961ea70be4a8e2 100644 --- a/src/app/components/network/network-menu-left/network-menu-left.component.html +++ b/src/app/components/network/network-menu-left/network-menu-left.component.html @@ -151,8 +151,8 @@ (click)="networkHandler.activeNetwork.selectTissue(tissue)" [class.is-active]=" networkHandler.activeNetwork.selectedTissue && - tissue.netexId === - networkHandler.activeNetwork.selectedTissue.netexId + tissue.drugstoneId === + networkHandler.activeNetwork.selectedTissue.drugstoneId " class="dropdown-item" > diff --git a/src/app/components/network/network-menu/network-menu.component.html b/src/app/components/network/network-menu/network-menu.component.html index 5fe50c46f26a47fe6853b1c19cdb4eeaf961d99f..4a80fc1d0c0ad392ad463c891dfe58bfe9608707 100644 --- a/src/app/components/network/network-menu/network-menu.component.html +++ b/src/app/components/network/network-menu/network-menu.component.html @@ -38,194 +38,203 @@ <app-center-view></app-center-view> </div> </div> - </div> - <div - class="row is-full m-1" - *ngIf="drugstoneConfig.config.showNetworkMenuButtonScreenshot" - > - <div class="network-footer-toolbar-element"> - <button - (click)="networkHandler.activeNetwork.toImage()" - class="button is-primary is-rounded has-tooltip" - pTooltip="Take a screenshot of the current network." - [tooltipStyleClass]="'drgstn drgstn-tooltip drgstn-tooltip-left'" - tooltipPosition="left" - [ngClass]="{ - 'is-small': drugstoneConfig.smallStyle - }" - > - <span class="icon"> - <i class="fas fa-camera" aria-hidden="true"></i> - </span> - <span - [ngClass]="{ - 'text-normal': drugstoneConfig.smallStyle - }" - >Screenshot</span - > - </button> - </div> - </div> - <div - class="row is-full m-1" - *ngIf="drugstoneConfig.config.showNetworkMenuButtonExportGraphml" - > - <div class="network-footer-toolbar-element"> - <app-download-button - [nodeData]="networkHandler.activeNetwork.nodeData" - [buttonId]="'explorer-download'" - ></app-download-button> - </div> - </div> - <div - class="row is-full m-1" - *ngIf="drugstoneConfig.config.showNetworkMenuButtonExpression" - > <div - class="dropdown network-footer-toolbar-element" - [class.is-active]="networkHandler.activeNetwork.expressionExpanded" + class="row is-full m-1" + *ngIf="drugstoneConfig.config.showNetworkMenuButtonScreenshot" > - <div class="dropdown-trigger"> + <div class="network-footer-toolbar-element"> <button - (click)=" - networkHandler.activeNetwork.expressionExpanded = - !networkHandler.activeNetwork.expressionExpanded - " - class="button is-rounded is-primary" - [class.is-outlined]="!networkHandler.activeNetwork.selectedTissue" - aria-haspopup="true" - aria-controls="dropdown-menu" - pTooltip="Tissue expression data is provided by the GTEx project." + (click)="networkHandler.activeNetwork.toImage()" + class="button is-primary is-rounded has-tooltip" + pTooltip="Take a screenshot of the current network." [tooltipStyleClass]="'drgstn drgstn-tooltip drgstn-tooltip-left'" tooltipPosition="left" [ngClass]="{ 'is-small': drugstoneConfig.smallStyle }" > - <span class="icon is-small"> - <i class="fas fa-child"></i> + <span class="icon"> + <i class="fas fa-camera" aria-hidden="true"></i> </span> <span - *ngIf="!networkHandler.activeNetwork.selectedTissue" [ngClass]="{ - 'text-small': drugstoneConfig.smallStyle + 'text-normal': drugstoneConfig.smallStyle }" - >Tissue</span + >Screenshot</span > - <span - *ngIf="networkHandler.activeNetwork.selectedTissue" + </button> + </div> + </div> + <div + class="row is-full m-1" + *ngIf="drugstoneConfig.config.showNetworkMenuButtonExportGraphml" + > + <div class="network-footer-toolbar-element"> + <app-download-button + [nodeData]="networkHandler.activeNetwork.nodeData" + [buttonId]="'explorer-download'" + ></app-download-button> + </div> + </div> + <div + class="row is-full m-1" + *ngIf="drugstoneConfig.config.showNetworkMenuButtonExpression" + > + <div + class="dropdown network-footer-toolbar-element" + [class.is-active]="networkHandler.activeNetwork.expressionExpanded" + > + <div class="dropdown-trigger"> + <button + (click)=" + networkHandler.activeNetwork.expressionExpanded = + !networkHandler.activeNetwork.expressionExpanded + " + class="button is-rounded is-primary" + [class.is-outlined]="!networkHandler.activeNetwork.selectedTissue" + aria-haspopup="true" + aria-controls="dropdown-menu" + pTooltip="Tissue expression data is provided by the GTEx project." + [tooltipStyleClass]="'drgstn drgstn-tooltip drgstn-tooltip-left'" + tooltipPosition="left" [ngClass]="{ - 'text-small': drugstoneConfig.smallStyle + 'is-small': drugstoneConfig.smallStyle }" - >{{ networkHandler.activeNetwork.selectedTissue.name }}</span - > - <span - *ngIf="networkHandler.activeNetwork.expressionExpanded" - class="icon is-small" - > - <i class="fas fa-angle-down" aria-hidden="true"></i> - </span> - <span - *ngIf="!networkHandler.activeNetwork.expressionExpanded" - class="icon is-small" > - <i class="fas fa-angle-left" aria-hidden="true"></i> - </span> - </button> - </div> - <div class="dropdown-menu" id="dropdown-menu" role="menu"> - <div class="dropdown-content tissue-dropdown"> - <div class="scroll-area"> - <a - (click)="networkHandler.activeNetwork.selectTissue(null)" - [class.is-active]="!networkHandler.activeNetwork.selectedTissue" - class="dropdown-item" + <span class="icon is-small"> + <i class="fas fa-child"></i> + </span> + <span + *ngIf="!networkHandler.activeNetwork.selectedTissue" + [ngClass]="{ + 'text-small': drugstoneConfig.smallStyle + }" + >Tissue</span + > + <span + *ngIf="networkHandler.activeNetwork.selectedTissue" + [ngClass]="{ + 'text-small': drugstoneConfig.smallStyle + }" + >{{ networkHandler.activeNetwork.selectedTissue.name }}</span + > + <span + *ngIf="networkHandler.activeNetwork.expressionExpanded" + class="icon is-small" > - None - </a> - <a - *ngFor=" - let tissue of networkHandler.activeNetwork.analysis.getTissues() - " - (click)="networkHandler.activeNetwork.selectTissue(tissue)" - [class.is-active]=" - networkHandler.activeNetwork.selectedTissue && - tissue.netexId === - networkHandler.activeNetwork.selectedTissue.netexId - " - class="dropdown-item" + <i class="fas fa-angle-down" aria-hidden="true"></i> + </span> + <span + *ngIf="!networkHandler.activeNetwork.expressionExpanded" + class="icon is-small" > - {{ tissue.name }} - </a> + <i class="fas fa-angle-left" aria-hidden="true"></i> + </span> + </button> + </div> + <div class="dropdown-menu" id="dropdown-menu" role="menu"> + <div class="dropdown-content tissue-dropdown"> + <div class="scroll-area"> + <a + (click)="networkHandler.activeNetwork.selectTissue(null)" + [class.is-active]=" + !networkHandler.activeNetwork.selectedTissue + " + class="dropdown-item" + > + None + </a> + <a + *ngFor=" + let tissue of networkHandler.activeNetwork.analysis.getTissues() + " + (click)="networkHandler.activeNetwork.selectTissue(tissue)" + [class.is-active]=" + networkHandler.activeNetwork.selectedTissue && + tissue.drugstoneId === + networkHandler.activeNetwork.selectedTissue.drugstoneId + " + class="dropdown-item" + > + {{ tissue.name }} + </a> + </div> </div> </div> </div> </div> - </div> - <div - class="row is-full m-1" - *ngIf="drugstoneConfig.config.showNetworkMenuButtonAdjacentDrugs" - > - <app-toggle-inplace - class="network-footer-toolbar-element" - text="{{ drugstoneConfig.config.networkMenuButtonAdjacentDrugsLabel }}" - icon="fas fa-capsules" - tooltip="Display adjacent drugs." - [value]="networkHandler.activeNetwork.adjacentDrugs" - (valueChange)="networkHandler.activeNetwork.updateAdjacentDrugs($event)" - ></app-toggle-inplace> - </div> - <div - class="row is-full m-1" - *ngIf=" - drugstoneConfig.config.showNetworkMenuButtonAdjacentDisordersProteins - " - > - <app-toggle-inplace - class="network-footer-toolbar-element" - text="{{ - drugstoneConfig.config.networkMenuButtonAdjacentDisordersProteinsLabel - }}" - tooltip="Show disorders adjacent to all currently displayed proteins/genes." - [value]="networkHandler.activeNetwork.adjacentDisordersProtein" - (valueChange)=" - networkHandler.activeNetwork.updateAdjacentProteinDisorders($event) - " - icon="fas fa-head-side-mask" - ></app-toggle-inplace> - </div> - <div - class="row is-full m-1" - *ngIf="drugstoneConfig.config.showNetworkMenuButtonAdjacentDisordersDrugs" - > - <app-toggle-inplace - class="network-footer-toolbar-element" - text="{{ - drugstoneConfig.config.networkMenuButtonAdjacentDisordersDrugsLabel - }}" - tooltip="Show disorders adjacent to all currently displayed drugs." - [value]="networkHandler.activeNetwork.adjacentDisordersDrug" - [disabled]="!networkHandler.activeNetwork.hasDrugsLoaded()" - (valueChange)=" - networkHandler.activeNetwork.updateAdjacentDrugDisorders($event) + <div + class="row is-full m-1" + *ngIf="drugstoneConfig.config.showNetworkMenuButtonAdjacentDrugs" + > + <app-toggle-inplace + class="network-footer-toolbar-element" + text="{{ + drugstoneConfig.config.networkMenuButtonAdjacentDrugsLabel + }}" + icon="fas fa-capsules" + tooltip="Display adjacent drugs." + [value]="networkHandler.activeNetwork.adjacentDrugs" + (valueChange)=" + networkHandler.activeNetwork.updateAdjacentDrugs($event) + " + ></app-toggle-inplace> + </div> + <div + class="row is-full m-1" + *ngIf=" + drugstoneConfig.config.showNetworkMenuButtonAdjacentDisordersProteins " - icon="fas fa-biohazard" - ></app-toggle-inplace> - </div> - <div - class="row is-full m-1" - *ngIf="drugstoneConfig.config.showNetworkMenuButtonAnimation" - > - <app-toggle-inplace - class="network-footer-toolbar-element" - text="{{ drugstoneConfig.config.networkMenuButtonAnimationLabel }}" - tooltip="Toggle the network animation." - [value]="drugstoneConfig.config.physicsOn" - (valueChange)=" - networkHandler.activeNetwork.updatePhysicsEnabled($event) + > + <app-toggle-inplace + class="network-footer-toolbar-element" + text="{{ + drugstoneConfig.config + .networkMenuButtonAdjacentDisordersProteinsLabel + }}" + tooltip="Show disorders adjacent to all currently displayed proteins/genes." + [value]="networkHandler.activeNetwork.adjacentDisordersProtein" + (valueChange)=" + networkHandler.activeNetwork.updateAdjacentProteinDisorders($event) + " + icon="fas fa-head-side-mask" + ></app-toggle-inplace> + </div> + <div + class="row is-full m-1" + *ngIf=" + drugstoneConfig.config.showNetworkMenuButtonAdjacentDisordersDrugs " - icon="fas fa-bullseye" - ></app-toggle-inplace> + > + <app-toggle-inplace + class="network-footer-toolbar-element" + text="{{ + drugstoneConfig.config.networkMenuButtonAdjacentDisordersDrugsLabel + }}" + tooltip="Show disorders adjacent to all currently displayed drugs." + [value]="networkHandler.activeNetwork.adjacentDisordersDrug" + [disabled]="!networkHandler.activeNetwork.hasDrugsLoaded()" + (valueChange)=" + networkHandler.activeNetwork.updateAdjacentDrugDisorders($event) + " + icon="fas fa-biohazard" + ></app-toggle-inplace> + </div> + <div + class="row is-full m-1" + *ngIf="drugstoneConfig.config.showNetworkMenuButtonAnimation" + > + <app-toggle-inplace + class="network-footer-toolbar-element" + text="{{ drugstoneConfig.config.networkMenuButtonAnimationLabel }}" + tooltip="Toggle the network animation." + [value]="drugstoneConfig.config.physicsOn" + (valueChange)=" + networkHandler.activeNetwork.updatePhysicsEnabled($event) + " + icon="fas fa-bullseye" + ></app-toggle-inplace> + </div> </div> </div> </div> diff --git a/src/app/components/network/network.component.ts b/src/app/components/network/network.component.ts index 2265d5c9fa641a7e9261acd6fa29ea57225f8d4b..21760f0e010a713a88e268bcebe56b7c1869cdb8 100644 --- a/src/app/components/network/network.component.ts +++ b/src/app/components/network/network.component.ts @@ -73,7 +73,7 @@ export class NetworkComponent implements OnInit { public highlightSeeds = false; public seedMap: NodeAttributeMap = {}; - // keys are node netexIds + // keys are node drugstoneIds public expressionMap: NodeAttributeMap = {}; public gradientMap: NodeAttributeMap = {}; @@ -118,7 +118,7 @@ export class NetworkComponent implements OnInit { } for (const disorder of response.disorders) { disorder.group = 'defaultDisorder'; - disorder.id = disorder.netexId; + disorder.id = disorder.drugstoneId; this.adjacentProteinDisorderList.push(mapCustomNode(disorder, this.drugstoneConfig.config)) } this.saveAddNodes(this.adjacentProteinDisorderList); @@ -146,7 +146,7 @@ export class NetworkComponent implements OnInit { } for (const disorder of response.disorders) { disorder.group = 'defaultDisorder'; - disorder.id = disorder.netexId; + disorder.id = disorder.drugstoneId; this.adjacentDrugDisorderList.push(mapCustomNode(disorder, this.drugstoneConfig.config)); } this.saveAddNodes(this.adjacentDrugDisorderList); @@ -270,7 +270,7 @@ export class NetworkComponent implements OnInit { const updatedNodes = []; // for (const item of this.proteins) { for (const item of this.currentViewProteins) { - if (item.netexId === undefined) { + if (item.drugstoneId === undefined) { // nodes that are not mapped to backend remain untouched continue; } @@ -302,7 +302,7 @@ export class NetworkComponent implements OnInit { // filter out non-proteins, e.g. drugs const proteinNodes = []; this.nodeData.nodes.forEach(element => { - if (element.id.startsWith('p') && element.netexId !== undefined) { + if (element.id.startsWith('p') && element.drugstoneId !== undefined) { proteinNodes.push(element); } }); @@ -312,11 +312,11 @@ export class NetworkComponent implements OnInit { // mapping from netex IDs to network IDs, TODO check if this step is necessary const networkIdMappping = {} this.nodeData.nodes.forEach(element => { - networkIdMappping[element.netexId] = element.id + networkIdMappping[element.drugstoneId] = element.id }); const maxExpr = Math.max(...Object.values(this.expressionMap)); - for (const [netexId, expressionlvl] of Object.entries(this.expressionMap)) { - const networkId = networkIdMappping[netexId] + for (const [drugstoneId, expressionlvl] of Object.entries(this.expressionMap)) { + const networkId = networkIdMappping[drugstoneId] const node = this.nodeData.nodes.get(networkId); if (node === null) { continue; @@ -348,7 +348,7 @@ export class NetworkComponent implements OnInit { public hasDrugsLoaded(): boolean { if (this.nodeData == null || this.nodeData.nodes == null) return false; - return this.nodeData.nodes.get().filter((node: Node) => node.drugId && node.netexId.startsWith('dr')).length > 0; + return this.nodeData.nodes.get().filter((node: Node) => node.drugId && node.drugstoneId.startsWith('dr')).length > 0; } public setLegendContext() { @@ -369,13 +369,13 @@ export class NetworkComponent implements OnInit { /** * To highlight the seeds in the analysis network, not used in the browser network - * @param bool + * @param bool */ public updateHighlightSeeds(bool: boolean) { this.highlightSeeds = bool; const updatedNodes = []; for (const item of this.currentViewProteins) { - if (item.netexId === undefined) { + if (item.drugstoneId === undefined) { // nodes that are not mapped to backend remain untouched continue; } diff --git a/src/app/dialogs/add-expressed-proteins/add-expressed-proteins.component.ts b/src/app/dialogs/add-expressed-proteins/add-expressed-proteins.component.ts index 634873da5fb26e633b2b59b31770da6377942e22..c1e8a59ceb88228e8a45a96243114f24b659b20a 100644 --- a/src/app/dialogs/add-expressed-proteins/add-expressed-proteins.component.ts +++ b/src/app/dialogs/add-expressed-proteins/add-expressed-proteins.component.ts @@ -39,7 +39,7 @@ export class AddExpressedProteinsComponent implements OnChanges { public async addProteins() { this.loading = true; const result = await this.http.post<any>(`${environment.backend}query_tissue_proteins/`, - {tissueId: this.selectedTissue.netexId, threshold: this.threshold}).toPromise(); + {tissueId: this.selectedTissue.drugstoneId, threshold: this.threshold}).toPromise(); const items = []; for (const detail of result) { items.push(getWrapperFromNode(detail)); @@ -59,7 +59,7 @@ export class AddExpressedProteinsComponent implements OnChanges { if (!this.currentViewProteins || this.expressionMap === undefined) { return; } - this.proteins = this.currentViewProteins.filter(p => this.expressionMap[p.netexId] >= threshold); + this.proteins = this.currentViewProteins.filter(p => this.expressionMap[p.drugstoneId] >= threshold); } public close() { diff --git a/src/app/dialogs/launch-analysis/launch-analysis.component.ts b/src/app/dialogs/launch-analysis/launch-analysis.component.ts index 38ef3ecd0f03eec458368d5dba22a0e63ce6937e..bf4637eb5d15325dc9eeda8800f7053777777491 100644 --- a/src/app/dialogs/launch-analysis/launch-analysis.component.ts +++ b/src/app/dialogs/launch-analysis/launch-analysis.component.ts @@ -104,8 +104,8 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { } public async startTask() { - // all nodes in selection have netexId, hence exist in the backend - const seeds = this.analysis.getSelection().map((item) => item.data.netexId) + // all nodes in selection have drugstoneId, hence exist in the backend + const seeds = this.analysis.getSelection().map((item) => item.data.drugstoneId) const seedsFiltered = seeds.filter(function (el) { return el != null; }); diff --git a/src/app/interfaces.ts b/src/app/interfaces.ts index d84da4c1ec071f23d59027395c383b74a202106f..59daa8bf3c2288312d232a032a9c018e5d70177c 100644 --- a/src/app/interfaces.ts +++ b/src/app/interfaces.ts @@ -5,7 +5,7 @@ export interface Node { symbol: string; id: string; type: string; - netexId?: string; + drugstoneId?: string; drugId?:string; uniprotAc?: string; ensg?: Array<string>; @@ -28,7 +28,7 @@ export interface Node { } export interface Tissue { - netexId: number; + drugstoneId: number; name: string; } @@ -42,7 +42,7 @@ export type NetworkType = 'explorer' | 'analysis' export type LegendContext = 'explorer' | 'adjacentDrugs' | 'drug' | 'drugTarget' | 'drugTargetAndSeeds' | 'drugAndSeeds' | 'adjacentDisorders' | 'adjacentDrugsAndDisorders'; -/// netexId to expressionlvl +/// drugstoneId to expressionlvl export type NodeAttributeMap = { string: number } | {}; export interface NetexInteraction { @@ -125,21 +125,21 @@ export function getDrugNodeId(drug: Drug) { /** * Returns backend_id of Drug object */ - return drug.netexId + return drug.drugstoneId } // export function getDisorderNodeId(disorder: Disorder) { // /** // * Returns backend_id of Drug object // */ -// return disorder.netexId +// return disorder.drugstoneId export function getNodeId(node: Node) { /** * Returns backend_id of Gene object */ - // if ('netexId' in node) { - // return node['netexId'] + // if ('drugstoneId' in node) { + // return node['drugstoneId'] // } else { // return node.id // } @@ -150,7 +150,7 @@ export function getNetworkId(node: Node) { /** * Returns ID of a network node */ - return node.netexId + return node.drugstoneId } export function getId(gene: Node) { @@ -182,7 +182,7 @@ export interface Wrapper { label: string; type?: string; symbol?: string; - netexId?: string; + drugstoneId?: string; ensg?: Array<string>; shape?: string; color?: string; @@ -215,7 +215,7 @@ export interface Drug { inTrial: boolean; inLiterature: boolean; trialLinks: string[]; - netexId: string; + drugstoneId: string; group: string; } diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts index 32cfb47803ab002427e084ff99d2df1e45516245..cf615e665f1d39e2c77a73dbc360f3b40f72689a 100644 --- a/src/app/pages/explorer-page/explorer-page.component.ts +++ b/src/app/pages/explorer-page/explorer-page.component.ts @@ -275,7 +275,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { if (nodeIds != null && nodeIds.length > 0) { const nodeId = nodeIds[0]; const node = this.nodeData.nodes.get(nodeId); - if (node.netexId === undefined || !node.netexId.startsWith('p')) { + if (node.drugstoneId === undefined || !node.drugstoneId.startsWith('p')) { // skip if node is not a protein mapped to backend return; } @@ -345,17 +345,17 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { if (this.drugstoneConfig.config.identifier === 'ensg') { // remove possible duplicate IDs - network.nodes = removeDuplicateObjectsFromList(network.nodes, 'netexId'); + network.nodes = removeDuplicateObjectsFromList(network.nodes, 'drugstoneId'); } // at this point, we have nodes synched with the backend - // use netexIds where posssible, but use original id as node name if no label given + // use drugstoneIds where posssible, but use original id as node name if no label given const nodeIdMap = {}; network.nodes.forEach((node) => { // set node label to original id before node id will be set to netex id node.label = node.label ? node.label : node.id; - nodeIdMap[node.id] = node.netexId ? node.netexId : node.id; + nodeIdMap[node.id] = node.drugstoneId ? node.drugstoneId : node.id; node.id = nodeIdMap[node.id]; }); @@ -494,9 +494,9 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { } gProfilerLink(): string { - // nodes in selection have netexId + // nodes in selection have drugstoneId const queryString = this.analysis.getSelection() - .filter(wrapper => wrapper.data.netexId.startsWith('p')) + .filter(wrapper => wrapper.data.drugstoneId.startsWith('p')) .map(wrapper => wrapper.data.uniprotAc) .join('%0A'); return 'http://biit.cs.ut.ee/gprofiler/gost?' + diff --git a/src/app/services/netex-controller/netex-controller.service.ts b/src/app/services/netex-controller/netex-controller.service.ts index baa8a5881e96bacf420bf786364b0eb8f5413dd0..bce39cb133098d227fc03de62e4b62722dfe842f 100644 --- a/src/app/services/netex-controller/netex-controller.service.ts +++ b/src/app/services/netex-controller/netex-controller.service.ts @@ -89,9 +89,9 @@ export class NetexControllerService { * Returns the expression in the given tissue for given nodes and cancerNodes */ // slice prefix of netex id away for direct lookup in db, if node not mapped to db, replace by undefined - const genesBackendIds = nodes.map((node: Node) => node.netexId ? node.netexId.slice(1) : undefined); + const genesBackendIds = nodes.map((node: Node) => node.drugstoneId ? node.drugstoneId.slice(1) : undefined); const params = new HttpParams() - .set('tissue', tissue.netexId) + .set('tissue', tissue.drugstoneId) .set('proteins', JSON.stringify(genesBackendIds)); return this.http.get(`${environment.backend}tissue_expression/`, {params}); } @@ -101,10 +101,10 @@ export class NetexControllerService { const params = {}; if (nodeType === 'proteins') { // @ts-ignore - params.proteins = nodes.map((node: Node) => node.netexId && node.netexId.startsWith('p') ? node.netexId.slice(1) : undefined).filter(id => id != null); + params.proteins = nodes.map((node: Node) => node.drugstoneId && node.drugstoneId.startsWith('p') ? node.drugstoneId.slice(1) : undefined).filter(id => id != null); } else if (nodeType === 'drugs') { // @ts-ignore - params.drugs = nodes.map((node: Node) => node.drugId && node.netexId.startsWith('dr') ? node.netexId.slice(2) : undefined).filter(id => id != null); + params.drugs = nodes.map((node: Node) => node.drugId && node.drugstoneId.startsWith('dr') ? node.drugstoneId.slice(2) : undefined).filter(id => id != null); } return this.http.post<any>(`${environment.backend}adjacent_disorders/`, params); } @@ -114,7 +114,7 @@ export class NetexControllerService { * Returns the expression in the given tissue for given nodes and cancerNodes */ // slice prefix of netex id away for direct lookup in db, if node not mapped to db, replace by undefined - const genesBackendIds = nodes.map((node: Node) => node.netexId && node.netexId.startsWith('p') ? node.netexId.slice(1) : undefined).filter(id => id != null); + const genesBackendIds = nodes.map((node: Node) => node.drugstoneId && node.drugstoneId.startsWith('p') ? node.drugstoneId.slice(1) : undefined).filter(id => id != null); const params = { pdi_dataset: pdiDataset, proteins: genesBackendIds