Commit e909be00 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Adapted code to the back end changes

parent 58af4023
......@@ -159,7 +159,7 @@
},
args () {
return {
variables: this.numData,
features: this.numData,
categories: this.catData,
id_filter: this.idFilter,
subsets: store.getters.subsets
......@@ -186,21 +186,24 @@
points () {
const points = {}
this.labels.forEach(label => {
let [variable, category, subset] = label.split('//')
let [feature, category, subset] = label.split('//')
subset = parseInt(subset.substring(1)) - 1 // revert subset string formatting
points[label] = this.results.data
.filter(d => d.subset === subset && d.category === category && typeof d[variable] === 'number')
.filter(d => d.subset === subset &&
d.feature === feature &&
d.category === category &&
typeof d.value === 'number')
.map(d => {
return {
id: d.id,
value: d[variable],
value: d.value,
jitter: this.params.jitter ? Math.random() * this.boxplotWidth / 2 : this.boxplotWidth / 2,
subset: d.subset,
category: d.category,
get tooltip () {
return `
<div>
<p>${variable}: ${this.value}</p>
<p>${d.feature}: ${this.value}</p>
<p>Category: ${this.category}</p>
<p>Subset: ${this.subset + 1}</p>
</div>
......@@ -236,7 +239,7 @@
return boxplotWidth
},
scales () {
const values = this.results.data.map(entry => this.results.variables.map(v => entry[v]))
const values = this.results.data.map(d => d.value)
const flattened = [].concat.apply([], values)
const extent = d3.extent(flattened)
const padding = (extent[1] - extent[0]) / 20
......@@ -354,8 +357,7 @@
runAnalysis({task_name: 'compute-boxplot', args})
.then(response => {
const results = JSON.parse(response)
const data = JSON.parse(results.data)
results.data = Object.keys(data).map(key => data[key])
results.data = JSON.parse(results.data)
deepFreeze(results) // massively improve performance by telling Vue that the objects properties won't change
this.results = results
})
......
......@@ -202,15 +202,15 @@
const subsets = []
const categories = []
const all = this.shownResults.data.map(d => {
const x = d[this.shownResults.x_label]
const y = d[this.shownResults.y_label]
const x = d.value_x
const y = d.value_y
const id = d.id
const subset = d.subset
const category = d.category
let tooltip = `
<div>
<p>${[this.shownResults.x_label]}: ${x}</p>
<p>${[this.shownResults.y_label]}: ${y}</p>
<p>${d.feature_x}: ${x}</p>
<p>${d.feature_y}: ${y}</p>
<p>Subset: ${subset}</p>
${typeof category !== 'undefined' ? '<p>Category: ' + category + '</p>' : ''}
</div>
......@@ -231,8 +231,8 @@
const subsets = []
const categories = []
const all = this.tmpResults.data.map(d => {
const x = d[this.tmpResults.x_label]
const y = d[this.tmpResults.y_label]
const x = d.value_x
const y = d.value_y
const id = d.id
const subset = d.subset
const category = d.category
......@@ -464,8 +464,7 @@
runAnalysis({task_name: 'compute-correlation', args})
.then(response => {
const results = JSON.parse(response)
const data = JSON.parse(results.data)
results.data = Object.keys(data).map(key => data[key])
results.data = JSON.parse(results.data)
deepFreeze(results) // massively improve performance by telling Vue that the objects properties won't change
if (init) {
this.shownResults = results
......
......@@ -220,7 +220,7 @@
if (typeof df[d.id] === 'undefined') {
df[d.id] = {}
}
df[d.id][d.variable] = d.zscore
df[d.id][d.feature] = d.zscore
})
return {
df: df,
......@@ -265,7 +265,7 @@
if (this.cluster.results.rows.length) {
rows = rows.concat(this.cluster.results.rows.map(d => d[0]))
} else {
rows = rows.concat([...new Set(this.results.data.map(d => d.variable))])
rows = rows.concat([...new Set(this.results.data.map(d => d.feature))])
}
return rows
},
......@@ -324,14 +324,14 @@
this.results.data.forEach(d => {
cells.push({
x: this.scales.x(d.id),
y: this.scales.y(d.variable),
y: this.scales.y(d.feature),
width: this.grid.main.width,
height: this.grid.main.height,
fill: this.colorScale(1 / (1 + Math.pow(Math.E, -d.zscore))),
tooltip: `
<div>
<p>Column: ${d.id}</p>
<p>Row: ${d.variable}</p>
<p>Row: ${d.feature}</p>
<p>Value: ${d.value}</p>
<p>z-Score ${d.zscore}</p>
</div>
......@@ -376,7 +376,7 @@
return this.results.stats.map(d => {
return {
x: -this.sigScales.x(d[this.rankingMethod]),
y: this.sigScales.y(d.variable),
y: this.sigScales.y(d.feature),
width: this.sigScales.x(d[this.rankingMethod]),
height: this.grid.main.height,
fill: d[this.rankingMethod] < 0 ? '#0072ff' : '#ff006a',
......@@ -393,12 +393,9 @@
runAnalysis({task_name: 'compute-heatmap', args})
.then(response => {
const results = JSON.parse(response)
const data = JSON.parse(results.data)
const stats = JSON.parse(results.stats)
results.data = Object.keys(data).map(key => data[key])
results.stats = Object.keys(stats).map(key => stats[key])
results.data = JSON.parse(results.data)
results.stats = JSON.parse(results.stats)
deepFreeze(results) // massively improve performance by telling Vue that the objects properties won't change
deepFreeze(stats) // massively improve performance by telling Vue that the objects properties won't change
this.results = results
})
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment