-
Notifications
You must be signed in to change notification settings - Fork 2
/
chromosome-entry-view.html
147 lines (133 loc) · 6.06 KB
/
chromosome-entry-view.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<link rel="import" href="nextprot-elements-shared-styles.html">
<link rel="import" href="external-scripts.html">
<!--
`chromosome-entry-view`
View presenting neXtProt entries plus gene location found on chromosome.
##### Example
<chromosome-entry-view />
@demo demo/chromosome-entry-view-demo.html
-->
<dom-module id="chromosome-entry-view">
<template>
<!-- local styles -->
<style>
:host {
display: block;
background: white;
overflow-y: auto;
}
:host th {
text-align: left;
}
</style>
<!-- local DOM for this element -->
<div id="chromosomeEntryViewContainer">
<paper-spinner-lite id="spinner" active></paper-spinner-lite>
<template is="dom-if" if="[[dataLoaded]]">
<table class="table table-condensed">
<col align="left">
<thead>
<tr>
<th style="text-align:left">Gene name</th>
<th style="text-align:left">neXtProt AC</th>
<th style="text-align:left">Chromosomal location</th>
<th style="text-align:right">Start position</th>
<th style="text-align:right">Stop position</th>
<th style="text-align:left">Coding strand</th>
<th style="text-align:left">Protein existence</th>
<th style="text-align:left">Proteomics</th>
<th style="text-align:left">Antibody</th>
<th style="text-align:left">3D</th>
<th style="text-align:left">Disease</th>
<th style="text-align:right">Isoforms</th>
<th style="text-align:right">Variants</th>
<th style="text-align:right">PTMs</th>
<th style="text-align:left">Description</th>
</tr>
</thead>
<tbody>
<template is="dom-repeat" items="[[results.entryReports]]" as="entryReport" >
<tr>
<td style="text-align:left">[[entryReport.geneName]]</td>
<td style="text-align:left"><a href=[[host]]/entry/[[entryReport.entryAccession]]>[[entryReport.entryAccession]]</a></td>
<td style="text-align:left">[[entryReport.chromosomalLocation]]</td>
<td style="text-align:right">[[entryReport.geneStartPosition]]</td>
<td style="text-align:right">[[entryReport.geneEndPosition]]</td>
<td style="text-align:left">[[entryReport.codingStrand]]</td>
<td style="text-align:left">[[entryReport.proteinExistence]]</td>
<td style="text-align:left">[[entryReport.proteomics]]</td>
<td style="text-align:left">[[entryReport.antibody]]</td>
<td style="text-align:left">[[entryReport.3D]]</td>
<td style="text-align:left">[[entryReport.disease]]</td>
<td style="text-align:right">[[entryReport.isoforms]]</td>
<td style="text-align:right">[[entryReport.variants]]</td>
<td style="text-align:right">[[entryReport.ptms]]</td>
<td style="text-align:left">[[entryReport.entryDescription]]</td>
</tr>
</template>
</tbody>
</table>
</template>
</div>
</template>
<script>
Polymer({
is: 'chromosome-entry-view',
properties: {
nxConfig: {
type: Object,
value: { "env": "pro" },
observer: '_initAndfetchChromosomeReport'
},
chromosome: {
type: String,
observer: '_fetchChromosomeReport'
},
dataLoaded: {
type: Boolean,
observer: '_updateSpinnerStatus'
}
},
attached: function() {
this._initAndfetchChromosomeReport()
},
_initAndfetchChromosomeReport: function() {
if (this.nxConfig.env && !this.nxConfig.env.startsWith('{{')) {
this._initApiClient();
this._fetchChromosomeReport();
}
},
_initApiClient: function() {
this._npClient = new Nextprot.Client("neXtProt chromosome " + this.chromosome + " entries", "Calipho Group");
if (this.nxConfig.env) {
this._npClient.updateEnvironment(this.nxConfig.env);
}
this.host = this._npClient.getNeXtProtUrl();
},
_fetchChromosomeReport: function() {
var self = this;
if (this._npClient !== undefined && this.chromosome !== undefined && !this.chromosome.startsWith('{{')) {
this._npClient.getChromosomeReportEntries(this.chromosome)
.then(function (response) {
Polymer.RenderStatus.afterNextRender(self, function () {
self.results = response;
self.dataLoaded = true;
});
})
.catch(function (error) {
console.error("neXtProt API error", error.responseText);
});
}
},
_dataLoaded: function() {
return this.results;
},
_updateSpinnerStatus: function() {
if (this._dataLoaded()) {
this.$.spinner.active = false;
this.$.spinner.hidden = true;
}
}
});
</script>
</dom-module>