Skip to content

Commit

Permalink
Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
airenzp authored and xzhou82 committed Oct 16, 2024
1 parent af8a146 commit 493aadd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/src/termdb.violin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export async function trigger_getViolinPlotData(q, res, ds, genome) {
ds,
genome
)
const sampleType = data.sampleType?.plural_name || 'samples'
if (data.error) throw data.error
//get ordered labels to sort keys in key2values
if (q.divideTw && data.refs.byTermId[q.divideTw.term.id]) {
Expand All @@ -38,8 +39,8 @@ export async function trigger_getViolinPlotData(q, res, ds, genome) {

if (q.scale) scaleData(q, data, q.tw)

const valuesObject = divideValues(q, data, q.tw)
const result = resultObj(valuesObject, data, q, ds)
const valuesObject = divideValues(q, data, q.tw, sampleType)
const result = resultObj(valuesObject, data, q, sampleType)

// wilcoxon test data to return to client
await wilcoxon(q.divideTw, result)
Expand Down Expand Up @@ -103,7 +104,7 @@ function scaleData(q, data, tw) {
}
}

function divideValues(q, data, tw) {
function divideValues(q, data, tw, sampleType) {
const overlayTerm = q.divideTw
const useLog = q.unit == 'log'

Expand Down Expand Up @@ -137,7 +138,6 @@ function divideValues(q, data, tw) {
if (useLog === 'log') {
if (min === 0) min = Math.max(min, value.value)
}
const sampleType = data.sampleType.plural_name
if (overlayTerm) {
if (!v[overlayTerm?.$id]) continue
const value2 = v[overlayTerm.$id]
Expand Down Expand Up @@ -187,7 +187,7 @@ function sortKey2values(data, key2values, overlayTerm) {
return key2values
}

function resultObj(valuesObject, data, q, ds) {
function resultObj(valuesObject, data, q, sampleType) {
const overlayTerm = q.divideTw
const result = {
min: valuesObject.minMaxValues.min,
Expand All @@ -212,7 +212,7 @@ function resultObj(valuesObject, data, q, ds) {
})
} else {
const plot = {
label: data.sampleType.plural_name,
label: sampleType,
values,
plotValueCount: values.length
}
Expand Down

0 comments on commit 493aadd

Please sign in to comment.