diff --git a/src/app/config.ts b/src/app/config.ts index 6ec2ddea20f8c1db2e61da7712754dc00b154f12..26a8a92210c231f646732ffa95a27e633f1e9a57 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -32,7 +32,7 @@ export type InteractionDrugProteinDB = 'NeDRex' | 'DrugBank' | 'DrugCentral' | ' export type InteractionProteinProteinDB = 'NeDRex' | 'BioGRID' | 'IID' | 'IntAct' | 'STRING' | 'APID'; export type IndicationDrugDisorderDB = 'NeDRex' | 'CTD' | 'DrugCentral' | 'DrugBank'; export type AssociatedProteinDisorderDB = 'NeDRex' | 'DisGeNET' | 'OMIM'; -export type AdvAnalysisContentTypes = 'drug-target-search' | 'drug-search' | 'enrichment-gprofiler' | 'enrichment-digest'; +export type AdvAnalysisContentTypes = 'drug-target-search' | 'drug-search' | 'enrichment-gprofiler' | 'enrichment-digest' | 'search-ndex'; // TODO: should this be external or integrated in the backend? @@ -150,7 +150,7 @@ export const defaultConfig: IConfig = { showItemSelector: true, showSimpleAnalysis: true, showAdvAnalysis: true, - showAdvAnalysisContent: ['drug-search', 'drug-target-search', 'enrichment-gprofiler', 'enrichment-digest'], + showAdvAnalysisContent: ['drug-search', 'drug-target-search', 'enrichment-gprofiler', 'enrichment-digest', 'search-ndex'], showSelection: true, showTasks: true, showNetworkMenu: 'right', diff --git a/src/app/pages/explorer-page/explorer-page.component.html b/src/app/pages/explorer-page/explorer-page.component.html index f47c1a05c5525e369ab8a79828d796549d0c3a60..c72fb62fad87c030b8f8af1aed591e90f77bc2ca 100644 --- a/src/app/pages/explorer-page/explorer-page.component.html +++ b/src/app/pages/explorer-page/explorer-page.component.html @@ -267,6 +267,53 @@ </a> </div> </div> + <div class="field" *ngIf="!drugstoneConfig.config.showAdvAnalysisContent || drugstoneConfig.config.showAdvAnalysisContent.includes('search-ndex')"> + <div class="control"> + <a + *ngIf="analysis.getCount() > 0" + (click)="openNDEx()" + target="_blank" + [ngClass]="{ 'text-small': drugstoneConfig.smallStyle }" + class="button is-primary is-fullwidth is-rounded has-tooltip" + pTooltip="Use NDEx Integrated Query to find similar, curated pathways (external)." + [tooltipStyleClass]=" + 'drgstn drgstn-tooltip drgstn-tooltip-top' + " + tooltipPosition="top" + > + <app-fa-solid-icon + classString="first-item-in-button" + icon="external-link-alt" + ></app-fa-solid-icon> + <span + [ngClass]="{ 'text-small': drugstoneConfig.smallStyle }" + > + NDex Integrated Query + </span> + </a> + <a + *ngIf="analysis.getCount() === 0" + disabled + [ngClass]="{ 'text-small': drugstoneConfig.smallStyle }" + class="button is-primary is-fullwidth is-rounded has-tooltip" + pTooltip="Use NDEx Integrated Query to find similar, curated pathways (external)." + [tooltipStyleClass]=" + 'drgstn drgstn-tooltip drgstn-tooltip-top' + " + tooltipPosition="top" + > + <app-fa-solid-icon + icon="external-link-alt" + classString="first-item-in-button" + ></app-fa-solid-icon> + <span + [ngClass]="{ 'text-small': drugstoneConfig.smallStyle }" + > + NDEx Integrated Query + </span> + </a> + </div> + </div> </div> </div> </div> diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts index 72e46f3e2ac738c960896ab002d12fbdaddff4cc..940bab84f998001210bb148ef9890b4c9962f26f 100644 --- a/src/app/pages/explorer-page/explorer-page.component.ts +++ b/src/app/pages/explorer-page/explorer-page.component.ts @@ -593,14 +593,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { * @param key * @param values */ - public setConfigEdgeGroup(key: string, edgeGroups: { - [key - : - string - ]: - EdgeGroup; - } - ) { + public setConfigEdgeGroup(key: string, edgeGroups: { [key: string]: EdgeGroup; }) { // make sure that default-groups are set const defaultNodeGroups = JSON.parse(JSON.stringify(defaultConfig.edgeGroups)); edgeGroups = merge(defaultNodeGroups, edgeGroups); @@ -621,9 +614,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { this.drugstoneConfig.currentConfig()[key] = edgeGroups; } - gProfilerLink() - : - string { + gProfilerLink(): string { // nodes in selection have drugstoneId const queryString = this.analysis.getSelection() .filter(wrapper => wrapper.data.drugstoneType === 'protein') @@ -667,6 +658,13 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { this.openExternal(url); } + async openNDEx() { + const proteins = this.analysis.getSelection() + .filter(wrapper => wrapper.data.drugstoneType === 'protein') + .flatMap(wrapper => wrapper.data.symbol).filter(n => n != null); + this.openExternal('https://ndexbio.org/iquery/?genes=' + proteins.join('%20')); + } + //TODO change to access through network service @ViewChild('analysisPanel') analysisPanel; diff --git a/src/app/services/analysis/analysis.service.ts b/src/app/services/analysis/analysis.service.ts index f3a4f4746330fef0d9de0ff5df2408f3fa9cb3df..f3e2ccdefb549796446c1a55ff0aa38331d93654 100644 --- a/src/app/services/analysis/analysis.service.ts +++ b/src/app/services/analysis/analysis.service.ts @@ -231,11 +231,17 @@ export class AnalysisService { return this.selectedItems.has(wrapper.id); } + getSelection(): Wrapper[] { const out = Array.from(this.selectedItems.values()); return out != null ? out : []; } + // getSelectionAsWrapper(): Wrapper[] { + // const out = Array.from(this.selectedItems.values()); + // return out != null ? out.map(n => getWrapperFromNode(n)) : []; + // } + getCount(): number { return this.selectedItems.size; }