Newer
Older
<template>
<div>
<h2 v-if="sequence">
{{ sequence.name }}
<span v-if="sequence.name !== analysisInfo.title">: {{ analysisInfo.title }}</span>
<!-- slot for back button -->
<slot></slot>
</h2>
<!-- overview -->
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
@dataPointClick="showSegment"
@onZoom="zoomHeatchart"
></heatchart>
<heatmap v-if="heatmapData" :data="heatmapData" @segmentClick="showSegment" :selected="selectedSegment">
</heatmap>
<table class="table table-striped table-hover">
<tbody>
<tr>
<th>Analysis settings</th>
<th>Analysis results</th>
<th class="text-center">Export</th>
<th v-if="sequence">Sequence info</th>
</tr>
<tr>
<td>
Minimal window size: {{ analysisInfo.minWindowSize | number(0) }}
<br />
Minimal GC percentage: {{ analysisInfo.minGcPercentage }}
<br />
Minimal observed/expected CpG: {{ analysisInfo.minObservedToExpectedCpG }}
<br />
Minimal island merge gap: {{ analysisInfo.minIslandMergeGap }}
<br />
First nucleotide: {{ analysisInfo.firstNucleotide }}
<br />
Second nucleotide: {{ analysisInfo.secondNucleotide }}
</td>
<td>
Islands found: {{ analysisInfo.resultCount | number(0) }}
<br />
<span v-if="sequence">Frequency: {{ (analysisInfo.resultCount / sequence.length) * 1000 | number(3) }} / 1000 bp</span>
</td>
<td class="text-center">
<a v-if="downloadToken" :href="downloadCSV()" class="btn btn-primary btn-sm">
<span class="fa fa-cube"></span> CSV
</a>
<a v-if="downloadToken" :href="downloadBED()" class="btn btn-primary btn-sm">
<span class="fa fa-bed"></span> BedGraph
</a>
</td>
<td v-if="sequence">
{{ sequence.name }}
<br />
{{ sequence.length | number(0) }} bp
<br />
GC: {{ GCCount }} ({{ GCRate | number(1) }}%)
</td>
</tr>
</tbody>
</table>
<!-- list of results -->
<pagination ref="pagination" @pageChange="reload" :page-size="10">
<table class="table table-striped table-hover">
<tbody>
<tr>
<th>
<sort-toggle @sort="sortSequences" crit="start" :current="currentSort">Start</sort-toggle>
</th>
<th>
<sort-toggle @sort="sortSequences" crit="end" :current="currentSort">End</sort-toggle>
</th>
<th>Sequence</th>
<th>
<sort-toggle @sort="sortSequences" crit="gcPerc" :current="currentSort">
GC Percentage
</sort-toggle>
</th>
<th>
<sort-toggle @sort="sortSequences" crit="observedToExpectedCpG" :current="currentSort">
Observer/expected CpG
</sort-toggle>
</th>
<th class="text-center">
<sort-toggle @sort="sortSequences" crit="length" :current="currentSort">Length</sort-toggle>
</th>
</tr>
<tr>
<td>
{{ zdna.position | number(0) }}
</td>
<td>
{{ zdna.end }}
</td>
<td class="sequence text-monospace text-bold">
<highlight :sequence="zdna.sequence.slice(0, 20)+'...'"></highlight>
</td>
<td class="sequence text-monospace">{{ zdna.gcPerc | number(3) }}</td>
<td class="sequence text-monospace">{{ zdna.observedToExpectedCpG | number(3) }}</td>
<td class="text-right">
{{ zdna.length | number }}
</td>
</tr>
</template>
</tbody>
</table>
</pagination>
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
<p class="alert alert-warning">
No CpG islands found.
</p>
</div>
</div>
</div>
</template>
<script>
import Formatters from '@/formatters'
import SortToggle from '@/components/core/sort-toggle'
import Pagination from '@/components/core/pagination'
import SequenceStats from '@/components/sequence/helpers/sequence-stats'
import Helpers from '@/helpers'
import Heatchart from '@/components/core/visualisation/heatchart'
import Heatmap from '@/components/core/visualisation/heatmap'
import Highlight from '@/components/core/visualisation/highlight'
/**
* list of results for sequence analysis
*/
export default {
props: ['analysisInfo', 'downloadToken'],
data() {
return {
sequence: null,
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
avgZdnaLen: null,
totalZdnaLenM1: null,
totalZdnaLenM2: null,
heatmapData: null,
selectedSegment: undefined,
sequenceStart: undefined,
sequenceLength: undefined,
currentSort: {
crit: 'position',
asc: true,
},
}
},
methods: {
getSequenceInfo() {
return this.$http.get('sequence/' + this.analysisInfo.sequenceId).then(response => {
this.sequence = response.data.payload
})
},
countNucleic() {
this.$http.patch('sequence/' + this.analysisInfo.sequenceId + '/nucleic-counts').catch(err => {
this.httpError = err
})
},
reload() {
return this.$http
.get('analyse/cpg/' + this.analysisInfo.id + '/cpg', {
params: {
sort: this.currentSort.crit,
order: this.currentSort.asc ? 'ASC' : 'DESC',
sequenceStart: this.sequenceStart,
sequenceLength: this.sequenceLength,
pageSize: this.$refs.pagination.getPageSize(),
pageNumber: this.$refs.pagination.getPageCurrent() - 1,
},
})
.then(response => {
this.$refs.pagination.setPageCount(response.data.page.totalElements)
Helpers.setUIState(response.data.items, 'showDetails', false)
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
this.countNucleic()
})
},
toggleDetails(zdna) {
zdna.ui.showDetails = !zdna.ui.showDetails
},
getAvgRizLen() {
return this.$http.get('analyse/cpg/' + this.analysisInfo.id + '/average/length').then(response => {
this.avgZdnaLen = response.data
})
},
sortSequences(info) {
this.currentSort = info
this.reload()
},
async downloadHeatmap() {
const total = this.sequence.length
const { sequenceFrom: from = 0, sequenceTo: to = total, analysisInfo } = this
const segments = 80
const { data } = await this.$http.get(`analyse/cpg/${analysisInfo.id}/heatmap`, {
params: { segments, from, to },
})
this.heatmapData = { ...data, from, to, total }
},
/**
* click in heatmap
*
* @param seg
*/
showSegment(pos, size) {
if (this.selectedSegment === pos) {
this.selectedSegment = undefined
this.sequenceStart = undefined
this.sequenceLength = undefined
} else {
this.selectedSegment = pos
this.sequenceStart = Math.floor(pos * size)
this.sequenceLength = Math.ceil(size)
}
this.reload()
},
async zoomHeatchart(from, to, onSuccess) {
this.sequenceFrom = from
this.sequenceTo = to
await this.downloadHeatmap()
onSuccess()
},
downloadCSV() {
return `${this.$http.defaults.baseURL}analyse/cpg/${this.analysisInfo.id}/cpg.csv`
},
downloadBED() {
return `${this.$http.defaults.baseURL}analyse/cpg/${this.analysisInfo.id}/cpg.bedgraph`
},
},
mounted() {
this.reload()
this.getSequenceInfo().then(() => {
this.getAvgRizLen().then(() => {
this.downloadHeatmap()
})
})
},
computed: {
GCCount() {
return SequenceStats.calcGCCount(this.sequence)
},
GCRate() {
return SequenceStats.calcGCRate(this.sequence)
},
},
components: {
highlight: Highlight,
'sort-toggle': SortToggle,
pagination: Pagination,
heatmap: Heatmap,
heatchart: Heatchart,
},
filters: {
number: Formatters.number,
genePos: Formatters.genePos,
},
}
</script>
<style scoped>
td,
th {
padding: 0.5rem;
}
td.sequence {
max-width: 400px;
}
td.details {
max-width: 600px;
}
td.details .feature {
border: 1px solid red;
}
td .toggle {
cursor: pointer;
}
</style>