Skip to content
Snippets Groups Projects
Commit 2023a553 authored by Julian Matschinske's avatar Julian Matschinske
Browse files

Merge branch 'scores' into 'master'

Display score

See merge request covid-19/frontend!59
parents 0c654e51 6ca6deef
No related branches found
No related tags found
No related merge requests found
...@@ -101,13 +101,14 @@ ...@@ -101,13 +101,14 @@
</footer> </footer>
</div> </div>
<div class="content tab-content scrollable" *ngIf="task && task.info.done" [class.is-visible]="tab === 'table'"> <div class="content tab-content scrollable" *ngIf="task && task.info.done" [class.is-visible]="tab === 'table'">
<h4 class="is-4">Drugs</h4> <h4 class="is-4" *ngIf="tableDrugs.length > 0">Drugs</h4>
<table class="table is-striped"> <table class="table is-striped" *ngIf="tableDrugs.length > 0">
<thead> <thead>
<tr> <tr>
<td>ID</td> <td>ID</td>
<td>Name</td> <td>Name</td>
<td>Status</td> <td>Status</td>
<td>Score</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -115,38 +116,43 @@ ...@@ -115,38 +116,43 @@
<td>{{e.drugId}}</td> <td>{{e.drugId}}</td>
<td>{{e.name}}</td> <td>{{e.name}}</td>
<td>{{e.status}}</td> <td>{{e.status}}</td>
<td>{{e.score}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h4 class="is-4">Proteins</h4> <h4 class="is-4" *ngIf="tableProteins.length > 0">Proteins</h4>
<table class="table is-striped"> <table class="table is-striped" *ngIf="tableProteins.length > 0">
<thead> <thead>
<tr> <tr>
<td>AC</td> <td>AC</td>
<td>Gene</td> <td>Gene</td>
<td>Score</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let e of tableProteins"> <tr *ngFor="let e of tableProteins">
<td>{{e.proteinAc}}</td> <td>{{e.proteinAc}}</td>
<td>{{e.name}}</td> <td>{{e.name}}</td>
<td>{{e.score}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h4 class="is-4">Viral Proteins</h4> <h4 class="is-4" *ngIf="tableViralProteins.length > 0">Viral Proteins</h4>
<table class="table is-striped"> <table class="table is-striped" *ngIf="tableViralProteins.length > 0">
<thead> <thead>
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>Virus Strain</td> <td>Virus Strain</td>
<td>Score</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let e of tableViralProteins"> <tr *ngFor="let e of tableViralProteins">
<td>{{e.effectName}}</td> <td>{{e.effectName}}</td>
<td>{{e.virusName}}</td> <td>{{e.virusName}}</td>
<td>{{e.score}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -42,9 +42,9 @@ export class AnalysisWindowComponent implements OnInit, OnChanges { ...@@ -42,9 +42,9 @@ export class AnalysisWindowComponent implements OnInit, OnChanges {
public showDrugs = false; public showDrugs = false;
public tab = 'network'; public tab = 'network';
public tableDrugs: Array<Drug> = []; public tableDrugs: Array<any> = [];
public tableProteins: Array<Protein> = []; public tableProteins: Array<any> = [];
public tableViralProteins: Array<ViralProtein> = []; public tableViralProteins: Array<any> = [];
constructor(private http: HttpClient, public analysis: AnalysisService) { constructor(private http: HttpClient, public analysis: AnalysisService) {
} }
...@@ -79,22 +79,33 @@ export class AnalysisWindowComponent implements OnInit, OnChanges { ...@@ -79,22 +79,33 @@ export class AnalysisWindowComponent implements OnInit, OnChanges {
const attributes = result.nodeAttributes[i]; const attributes = result.nodeAttributes[i];
const nodeTypes = attributes.nodeTypes || {}; const nodeTypes = attributes.nodeTypes || {};
const nodeDetails = attributes.details || {}; const nodeDetails = attributes.details || {};
const nodeScores = attributes.scores || {};
const normalizeScore = network.maxScore || 1.0;
network.nodes.forEach((nodeId, j) => { network.nodes.forEach((nodeId, j) => {
const nodeType = nodeTypes[nodeId] || this.inferNodeType(nodeId); const nodeType = nodeTypes[nodeId] || this.inferNodeType(nodeId);
const entry = nodeDetails[nodeId] || {};
entry.score = nodeScores[nodeId] || null;
if (entry.score) {
entry.score /= normalizeScore;
}
switch (nodeType) { switch (nodeType) {
case 'drug': case 'drug':
this.tableDrugs.push(nodeDetails[nodeId] || {}); this.tableDrugs.push(entry);
break; break;
case 'host': case 'host':
this.tableProteins.push(nodeDetails[nodeId] || {}); this.tableProteins.push(entry);
break; break;
case 'virus': case 'virus':
this.tableViralProteins.push(nodeDetails[nodeId] || {}); this.tableViralProteins.push(entry);
break; break;
} }
}); });
}); });
this.tableDrugs = this.tableDrugs.reverse();
this.tableProteins = this.tableProteins.reverse();
this.tableViralProteins = this.tableViralProteins.reverse();
const container = this.networkEl.nativeElement; const container = this.networkEl.nativeElement;
const options = {}; const options = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment