diff --git a/src/app/analysis.service.ts b/src/app/analysis.service.ts index 780307fdced4f8c610a95acc253f7656aa13922c..23ce8084a92007881179f8b55fc341b98426f564 100644 --- a/src/app/analysis.service.ts +++ b/src/app/analysis.service.ts @@ -160,7 +160,7 @@ export class AnalysisService { const newSelection = []; nodes.forEach((node) => { const wrapper: Wrapper = node.wrapper; - if (wrapper.type === 'host' || wrapper.type === 'virus') { + if (wrapper.type === 'protein') { if (!this.inSelection(wrapper)) { newSelection.push(wrapper); } @@ -204,15 +204,7 @@ export class AnalysisService { } public removeAllHostProteins() { - const items: Wrapper[] = Array.from(this.selectedItems.values()).filter(p => p.type === 'host'); - for (const wrapper of items) { - this.selectedItems.delete(wrapper.nodeId); - } - this.selectListSubject.next({items, selected: false}); - } - - public removeAllViralProteins() { - const items: Wrapper[] = Array.from(this.selectedItems.values()).filter(p => p.type === 'virus'); + const items: Wrapper[] = Array.from(this.selectedItems.values()).filter(p => p.type === 'protein'); for (const wrapper of items) { this.selectedItems.delete(wrapper.nodeId); } diff --git a/src/app/components/analysis-panel/analysis-panel.component.ts b/src/app/components/analysis-panel/analysis-panel.component.ts index db25357172167037310a3b4d0ce5255ec855e1a5..ca204933f123933c33135b994e4ac9593b7a7808 100644 --- a/src/app/components/analysis-panel/analysis-panel.component.ts +++ b/src/app/components/analysis-panel/analysis-panel.component.ts @@ -255,7 +255,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { const proteinSelection = this.tableSelectedProteins; const viralProteinSelection = this.tableSelectedViralProteins; for (const item of items) { - if (item.type === 'host') { + if (item.type === 'protein') { // TODO: Refactor! const found = proteinSelection.findIndex((i) => getProteinNodeId(i) === item.nodeId); const tableItem = this.tableProteins.find((i) => getProteinNodeId(i) === item.nodeId); @@ -293,7 +293,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { const proteinSelection = []; const viralProteinSelection = []; for (const item of items) { - if (item.type === 'host') { + if (item.type === 'protein') { const tableItem = this.tableProteins.find((i) => getProteinNodeId(i) === item.nodeId); if (tableItem) { proteinSelection.push(tableItem); @@ -369,12 +369,10 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { } public inferNodeType(nodeId: string): WrapperType { - if (nodeId.indexOf('-') !== -1 || nodeId.indexOf('_') !== -1) { - return 'virus'; - } else if (nodeId.startsWith('DB')) { + if (nodeId.startsWith('DB')) { return 'drug'; } - return 'host'; + return 'protein'; } public createNetwork(result: any): { edges: any[], nodes: any[] } { @@ -393,7 +391,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { const details = attributes.details || {}; const wrappers: { [key: string]: Wrapper } = {}; for (const node of network.nodes) { - if (nodeTypes[node] === 'host') { + if (nodeTypes[node] === 'protein') { this.proteins.push(details[node]); wrappers[node] = getWrapperFromProtein(details[node]); } else if (nodeTypes[node] === 'drug') { @@ -417,7 +415,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges { let wrapper: Wrapper; let drugType; let drugInTrial; - if (nodeType === 'host') { + if (nodeType === 'protein') { const protein = details as Protein; wrapper = getWrapperFromProtein(protein); nodeLabel = protein.name; diff --git a/src/app/components/info-tile/info-tile.component.html b/src/app/components/info-tile/info-tile.component.html index 26cbec22bff0cf7012848e520ad7c7d1dfe3f40a..9d64bd448f771879cbb64f320225984bfe51196f 100644 --- a/src/app/components/info-tile/info-tile.component.html +++ b/src/app/components/info-tile/info-tile.component.html @@ -1,5 +1,5 @@ <div *ngIf="wrapper"> - <div *ngIf="wrapper.type === 'host'"> + <div *ngIf="wrapper.type === 'protein'"> <p> <b><span>Gene Name: </span></b> {{ wrapper.data.name }} @@ -20,17 +20,6 @@ {{ wrapper.data.expressionLevel|number }} </p> </div> - <div *ngIf="wrapper.type === 'virus'"> - <p> - <b><span>Virus:</span></b> - {{ wrapper.data.virusName.replace('V', 'V-') }} - <span class="icon is-small"><i class="fas fa-virus"></i></span> - </p> - <p> - <b><span>Effect: </span></b> - {{ wrapper.data.effectName }} - </p> - </div> <div *ngIf="wrapper.type === 'drug'"> <p> <b><span>Name: </span></b> diff --git a/src/app/components/query-tile/query-tile.component.html b/src/app/components/query-tile/query-tile.component.html index 93bdd6289e73db3b68f390e7be664827dfd8bbd9..b053d67c0db4c7941b5446c139eb92f0c76dc82e 100644 --- a/src/app/components/query-tile/query-tile.component.html +++ b/src/app/components/query-tile/query-tile.component.html @@ -2,11 +2,9 @@ <ng-select [items]="queryItems" bindLabel="backendId" bindValue="data" [virtualScroll]="true" class="custom" placeholder="Search..." [hideSelected]="true" [searchFn]="querySearch" (change)="select($event)" data-tooltip="Find proteins in the network."> <ng-template ng-option-tmp let-item="item"> - <b *ngIf="item.type == 'host'"> {{item.data.name}}</b> - <b *ngIf="item.type == 'virus'"> {{item.data.effectName}}</b> <br/> - <span><small *ngIf="item.type === 'virus'">Viral Protein</small><small *ngIf="item.type === 'host'">Host Protein</small> | </span> - <span *ngIf="item.type == 'host'"><small>AC: <b>{{item.data.proteinAc}}</b></small> </span> - <span *ngIf="item.type == 'virus'"><small><b>{{item.data.virusName.replace('V', 'V-')}}</b></small></span> + <b *ngIf="item.type == 'protein'"> {{item.data.name}}</b> + <span><small *ngIf="item.type === 'protein'">Host Protein</small> | </span> + <span *ngIf="item.type == 'protein'"><small>AC: <b>{{item.data.proteinAc}}</b></small> </span> </ng-template> </ng-select> </div> diff --git a/src/app/dialogs/launch-analysis/launch-analysis.component.html b/src/app/dialogs/launch-analysis/launch-analysis.component.html index 3fee026fc4f868ca4af6eed60d03058abe28fab1..e2ec02687bb4fd619c6471542e0b91fd957f1b1f 100644 --- a/src/app/dialogs/launch-analysis/launch-analysis.component.html +++ b/src/app/dialogs/launch-analysis/launch-analysis.component.html @@ -13,13 +13,6 @@ <button (click)="close()" class="delete" aria-label="close"></button> </header> <section class="modal-card-body"> - <div *ngIf="target === 'drug' && hasBaits"> - <div class="notification is-warning warning"> - You have selected <i class="fa fa-virus"></i> viral proteins. - When finding drugs, make sure you have selected <i class="fa fa-dna"></i> host proteins only. - </div> - </div> - <div *ngIf="!analysis.canLaunchTask()"> <div class="notification is-warning warning"> You can only run {{maxTasks}} tasks at once. Please wait for one of them to finish or delete it from the task @@ -381,13 +374,6 @@ </div> <div *ngIf="algorithm==='keypathwayminer'"> - <div *ngIf="hasBaits"> - <div class="notification is-warning warning"> - You have selected <i class="fa fa-virus"></i> viral proteins. - If you want to use KeyPathwayMiner, please remove them because it cannot process them. - </div> - </div> - <div class="field"> <label class="label" for="keypathwayminer-k">Additional proteins</label> <div class="control"> @@ -511,7 +497,7 @@ <footer class="modal-card-foot"> <button (click)="startTask(); close()" class="button is-success is-rounded has-tooltip" data-tooltip="Run the analysis." - [disabled]="(target === 'drug' && hasBaits) || !analysis.canLaunchTask() || (algorithm === 'keypathwayminer' && hasBaits)"> + [disabled]="!analysis.canLaunchTask()"> <span class="icon"> <i class="fa fa-rocket"></i> </span> diff --git a/src/app/dialogs/launch-analysis/launch-analysis.component.ts b/src/app/dialogs/launch-analysis/launch-analysis.component.ts index 077516b76de0e1894f1fee0009df9b1a186e1e88..6e42901da199ac77c70b0ad98bf882f4513218b8 100644 --- a/src/app/dialogs/launch-analysis/launch-analysis.component.ts +++ b/src/app/dialogs/launch-analysis/launch-analysis.component.ts @@ -9,7 +9,6 @@ import { QuickAlgorithmType, TRUSTRANK } from '../../analysis.service'; -import {Dataset} from '../../interfaces'; @Component({ selector: 'app-launch-analysis', @@ -74,15 +73,9 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { public multisteinerMaxDeg = 0; public multisteinerHubPenalty = 0.0; - public hasBaits; - public maxTasks = MAX_TASKS; constructor(public analysis: AnalysisService) { - this.hasBaits = !!analysis.getSelection().find((i) => i.type === 'virus'); - analysis.subscribeList(() => { - this.hasBaits = !!analysis.getSelection().find((i) => i.type === 'virus'); - }); } ngOnInit(): void { diff --git a/src/app/interfaces.ts b/src/app/interfaces.ts index 3e5bcc41c8cf6792d983f324d79456e72fb995f2..230bb223c1acbabf0ec1b368f7574b048d317332 100644 --- a/src/app/interfaces.ts +++ b/src/app/interfaces.ts @@ -92,7 +92,7 @@ export function getWrapperFromProtein(protein: Protein): Wrapper { return { backendId: getProteinBackendId(protein), nodeId: getProteinNodeId(protein), - type: 'host', + type: 'protein', data: protein, }; } @@ -106,7 +106,7 @@ export function getWrapperFromDrug(drug: Drug): Wrapper { }; } -export type WrapperType = 'host' | 'virus' | 'drug'; +export type WrapperType = 'protein' | 'drug'; export interface Wrapper { backendId: string; diff --git a/src/app/network-settings.ts b/src/app/network-settings.ts index e74902c237f2f299cdaeaa8d8018904f2845dd03..83a622c31f9e00db24565e2b8091288f24b93490 100644 --- a/src/app/network-settings.ts +++ b/src/app/network-settings.ts @@ -80,20 +80,16 @@ export class NetworkSettings { private static drugInTrialShape = 'triangle'; static getNodeSize(wrapperType: WrapperType) { - if (wrapperType === 'host') { + if (wrapperType === 'protein') { return this.hostSize; - } else if (wrapperType === 'virus') { - return this.virusSize; } else if (wrapperType === 'drug') { return this.drugSize; } } static getNodeShape(wrapperType: WrapperType, drugInTrial?: boolean) { - if (wrapperType === 'host') { + if (wrapperType === 'protein') { return this.hostShape; - } else if (wrapperType === 'virus') { - return this.virusShape; } else if (wrapperType === 'drug') { if (drugInTrial) { return this.drugInTrialShape; @@ -125,13 +121,11 @@ export class NetworkSettings { } } - static getColor(color: 'host' | 'virus' | 'approvedDrug' | 'unapprovedDrug' | 'hostFont' | 'virusFont' | 'drugFont' | + static getColor(color: 'protein' | 'approvedDrug' | 'unapprovedDrug' | 'hostFont' | 'virusFont' | 'drugFont' | 'nonSeedHost' | 'nonSeedVirus' | 'selectedForAnalysis' | 'selectedForAnalysisText' | 'edgeHostVirus' | 'edgeHostVirusHighlight' | 'edgeHostDrug' | 'edgeHostDrugHighlight') { - if (color === 'host') { + if (color === 'protein') { return this.hostColor; - } else if (color === 'virus') { - return this.virusColor; } else if (color === 'approvedDrug') { return this.approvedDrugColor; } else if (color === 'unapprovedDrug') { @@ -158,10 +152,8 @@ export class NetworkSettings { } static getFont(wrapperType: WrapperType, drugInTrial?: boolean) { - if (wrapperType === 'host') { + if (wrapperType === 'protein') { return {color: this.hostFontColor, size: this.hostFontSize}; - } else if (wrapperType === 'virus') { - return {color: this.virusFontColor, size: this.virusFontSize}; } else if (wrapperType === 'drug') { if (!drugInTrial) { return {color: this.drugFontColor, size: this.drugFontSize}; @@ -188,20 +180,12 @@ export class NetworkSettings { nodeShape = NetworkSettings.getNodeShape(nodeType); nodeSize = NetworkSettings.getNodeSize(nodeType); nodeFont = NetworkSettings.getFont(nodeType); - if (nodeType === 'host') { + if (nodeType === 'protein') { nodeColor = NetworkSettings.getColor(nodeType); - nodeFont = NetworkSettings.getFont('host'); + nodeFont = NetworkSettings.getFont('protein'); if (!isSeed) { nodeColor = NetworkSettings.getColor('nonSeedHost'); } - } else if (nodeType === 'virus') { - nodeColor = NetworkSettings.getColor(nodeType); - if (nodeType === 'virus') { - nodeFont = NetworkSettings.getFont('virus'); - if (!isSeed) { - nodeColor = NetworkSettings.getColor('nonSeedVirus'); - } - } } else if (nodeType === 'drug') { if (drugType === 'approved') { nodeColor = NetworkSettings.getColor('approvedDrug'); diff --git a/src/app/pages/explorer-page/explorer-page.component.html b/src/app/pages/explorer-page/explorer-page.component.html index 7dd2fdc8f8cbe4f4a1f42fc5174869b481d2af97..9130e3e1caf64d419295b2e223097f1cb9ebe7a4 100644 --- a/src/app/pages/explorer-page/explorer-page.component.html +++ b/src/app/pages/explorer-page/explorer-page.component.html @@ -171,15 +171,13 @@ <p class="card-header-title"> <span class="icon"> <i *ngIf="!selectedWrapper" class="fas fa-info" aria-hidden="true"></i> - <i *ngIf="selectedWrapper && selectedWrapper.type === 'host'" class="fas fa-dna" aria-hidden="true"></i> - <i *ngIf="selectedWrapper && selectedWrapper.type === 'virus'" class="fas fa-virus" aria-hidden="true"></i> + <i *ngIf="selectedWrapper && selectedWrapper.type === 'protein'" class="fas fa-dna" aria-hidden="true"></i> <i *ngIf="selectedWrapper && selectedWrapper.type === 'drug'" class="fas fa-capsules" aria-hidden="true"></i> </span> <span *ngIf="!selectedWrapper">No item selected</span> <span *ngIf="selectedWrapper"> - <span *ngIf="selectedWrapper.type === 'host'">Host Protein</span> - <span *ngIf="selectedWrapper.type === 'virus'">Viral Protein</span> + <span *ngIf="selectedWrapper.type === 'protein'">Host Protein</span> <span *ngIf="selectedWrapper.type === 'drug'">Drug</span> </span> </p> @@ -408,12 +406,10 @@ <tr *ngFor="let p of analysis.getSelection()"> <td> <span class="icon"> - <i class="fa fa-dna" *ngIf="p.type == 'host'"></i> - <i class="fa fa-virus" *ngIf="p.type =='virus'"></i> + <i class="fa fa-dna" *ngIf="p.type == 'protein'"></i> </span> </td> - <td *ngIf="p.type == 'virus'">{{p.data.effectName}}</td> - <td *ngIf="p.type == 'host'">{{p.data.name}}</td> + <td *ngIf="p.type == 'protein'">{{p.data.name}}</td> <td> <button (click)="analysis.removeItems([p])" class="button is-small is-danger is-outlined has-tooltip" data-tooltip="Remove from selection."> diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts index d42cf73363857a219f66f76adcddd40d255a11fe..b8a20738f63e45dffefe50351ddd2bca350db76f 100644 --- a/src/app/pages/explorer-page/explorer-page.component.ts +++ b/src/app/pages/explorer-page/explorer-page.component.ts @@ -299,7 +299,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { private mapHostProteinToNode(hostProtein: Protein): any { const wrapper = getWrapperFromProtein(hostProtein); - const node = NetworkSettings.getNodeStyle('host', true, this.analysis.inSelection(wrapper)); + const node = NetworkSettings.getNodeStyle('protein', true, this.analysis.inSelection(wrapper)); let nodeLabel = hostProtein.name; if (hostProtein.name.length === 0) { nodeLabel = hostProtein.proteinAc; @@ -365,7 +365,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { gProfilerLink(): string { const queryString = this.analysis.getSelection() - .filter(wrapper => wrapper.type === 'host') + .filter(wrapper => wrapper.type === 'protein') .map(wrapper => wrapper.data.proteinAc) .join('%0A'); return 'http://biit.cs.ut.ee/gprofiler/gost?' +