Skip to content

Commit

Permalink
Merge branch 'master' into topgene_bgzip
Browse files Browse the repository at this point in the history
  • Loading branch information
robinpaul85 committed Jan 2, 2024
2 parents 2d7932a + 320699a commit 709957b
Show file tree
Hide file tree
Showing 37 changed files with 1,007 additions and 659 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file.

## Unreleased

Features:
- GDC cohort-MAF tool: allow to customize output file columns
- Clicking matrix cell to show similar info table as hovering over the matrix cell.
- Mds3 track uses simpler radio buttons to toggle between view modes such as lollipop and occurrence

Fixes:
- Gene exp clustering will display an alert msg to inform user that a map is not doable when there is just one gene
- display total number of mutations on disco plot
- Fix oncomatrix error: adding dictionary term from row group menu


## 2.38.1
Expand Down
1 change: 0 additions & 1 deletion client/dom/numericAxis.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { keyupEnter } from '#src/client'
//import {make_radios} from './radiobuttons.js'

/*
configure numeric axis
Expand Down
6 changes: 4 additions & 2 deletions client/dom/radiobutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
.inputName
common Name of <input>, use random number if not given
*/

let nameSuffix = 0

export function make_radios(arg) {
const { holder, options, callback, styles } = arg
let nameSuffix = 0
const inputName = arg.inputName || 'dom-radio-' + nameSuffix++
const inputName = arg.inputName || 'pp-dom-radio-' + nameSuffix++

const divs = holder
.selectAll()
Expand Down
81 changes: 52 additions & 29 deletions client/dom/table2col.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
/*
make a html table of two columns, for showing a list of key-value pairs.
1st column shows key in gray text, 2nd column shows value in black text, or arbitrary button/svg etc
as rows are added, as soon as table width exceeds a limit, it auto scrolls
to create new table, do:
const table = table2col({holder})
when a new row needs to be added, do:
const [td1,td2] = table.addRow()
td1.text('Key')
td2.text('Value')
arg{}
.holder
.margin todo
*/
export function table2col(arg) {
const scrollDiv = arg.holder.append('div').style('max-width', '80vw')

const table = scrollDiv.append('table').style('margin', '5px 8px').attr('class', 'sja_simpletable')
return {
scrollDiv,
table,
addRow: () => {
if (table.node().offsetHeight > 500) {
scrollDiv
.style('height', '450px')
.style('resize', 'both')
.style('overflow-y', 'scroll')
.attr('class', 'sjpp_show_scrollbar')
}
const tr = table.append('tr')
const td1 = tr.append('td').style('padding', '3px').style('color', '#858585')
const td2 = tr.append('td')
return [td1, td2]
}
}
}

/*
data[ {} ]
.kvlst[]
.k
.v
deprecated, replace with above
*/
export function make_table_2col(holder, data, overlen) {
const color = '#9e9e9e'
Expand All @@ -14,44 +59,22 @@ export function make_table_2col(holder, data, overlen) {
for (const i of data) {
const tr = table.append('tr')
if (i.kvlst) {
tr.append('td')
.attr('rowspan', i.kvlst.length)
.style('padding', '3px')
.style('color', color)
.html(i.k)
tr.append('td')
.style('padding', '3px')
.style('color', color)
.html(i.kvlst[0].k)
tr.append('td')
.style('padding', '3px')
.html(i.kvlst[0].v)
tr.append('td').attr('rowspan', i.kvlst.length).style('padding', '3px').style('color', color).html(i.k)
tr.append('td').style('padding', '3px').style('color', color).html(i.kvlst[0].k)
tr.append('td').style('padding', '3px').html(i.kvlst[0].v)
for (let j = 1; j < i.kvlst.length; j++) {
const tr2 = table.append('tr')
tr2
.append('td')
.style('padding', '3px')
.style('color', color)
.html(i.kvlst[j].k)
tr2
.append('td')
.style('padding', '3px')
.html(i.kvlst[j].v)
tr2.append('td').style('padding', '3px').style('color', color).html(i.kvlst[j].k)
tr2.append('td').style('padding', '3px').html(i.kvlst[j].v)
}
} else {
tr.append('td')
.attr('colspan', 2)
.style('padding', '3px')
.style('color', color)
.html(i.k)
tr.append('td').attr('colspan', 2).style('padding', '3px').style('color', color).html(i.k)
const td = tr.append('td').style('padding', '3px')
if (overlen && i.v.length > overlen) {
td.html(i.v.substr(0, overlen - 3) + ' ...&raquo;')
.attr('class', 'sja_clbtext')
.on('click', () => {
td.html(i.v)
.classed('sja_clbtext', false)
.on('click', null)
td.html(i.v).classed('sja_clbtext', false).on('click', null)
})
} else {
td.html(i.v)
Expand Down
2 changes: 1 addition & 1 deletion client/mass/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class MassApp {
const newPlots = {}
let sandbox
for (const plot of this.state.plots) {
if (!(plot.id in this.components.plots)) {
if (this.components.plots && !(plot.id in this.components.plots)) {
sandbox = newSandboxDiv(this.dom.plotDiv, {
close: () => {
this.api.dispatch({
Expand Down
65 changes: 39 additions & 26 deletions client/mass/test/barchart.integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ const vocabData = require('../../termdb/test/vocabData')
const hideCategory = require('../../plots/barchart.events.js').hideCategory

/*
TODO cover all combinations
Tests:
single barchart, categorical bars
single chart, with overlay
multiple charts
term1=categorical
term1=categorical, term2=defaultbins
term0=defaultbins, term1=categorical
term1=geneVariant
series visibility - q.hiddenValue
series visibility - numeric
series visibility - condition
Expand Down Expand Up @@ -55,7 +58,7 @@ tape('\n', function (test) {
test.end()
})

tape('single barchart, categorical bars', function (test) {
tape('term1=categorical', function (test) {
test.timeoutAfter(3000)

runpp({
Expand Down Expand Up @@ -101,26 +104,16 @@ tape('single barchart, categorical bars', function (test) {
}
})

tape('single chart, with overlay', function (test) {
tape('term1=categorical, term2=defaultbins', function (test) {
test.timeoutAfter(5000)
test.plan(4)
const termfilter = { filter: [] }
runpp({
state: {
termfilter,
plots: [
{
chartType: 'barchart',
term: { id: 'diaggrp' },
term2: { id: 'agedx' },
settings: {
controls: {
term2: { id: 'agedx', term: termjson['agedx'] }
},
barchart: {
overlay: 'tree'
}
}
term2: { id: 'agedx' }
}
]
},
Expand Down Expand Up @@ -217,23 +210,15 @@ tape('single chart, with overlay', function (test) {
}
})

tape('multiple charts', function (test) {
tape('term0=defaultbins, term1=categorical', function (test) {
test.timeoutAfter(3000)
runpp({
state: {
plots: [
{
chartType: 'barchart',
term: { id: 'diaggrp' },
term0: { id: 'agedx' },
settings: {
barchart: {
divideBy: 'tree'
},
controls: {
term0: { id: 'agedx', term: termjson['agedx'] }
}
}
term0: { id: 'agedx' }
}
]
},
Expand All @@ -254,6 +239,34 @@ tape('multiple charts', function (test) {
}
})

tape('term1=geneVariant', function (test) {
test.timeoutAfter(3000)
runpp({
state: {
plots: [
{
chartType: 'summary', // cannot use 'barchart', breaks
term: { term: { type: 'geneVariant', name: 'TP53' } }
}
]
},
barchart: {
callbacks: {
'postRender.test': testNumCharts
}
}
})

let barDiv
function testNumCharts(barchart) {
barDiv = barchart.Inner.dom.barDiv
const numCharts = barDiv.selectAll('.pp-sbar-div').size()
test.true(numCharts > 2, 'should have more than 2 charts by TP53')
if (test._ok) barchart.Inner.app.destroy()
test.end()
}
})

tape('series visibility - q.hiddenValues', function (test) {
test.timeoutAfter(5000)
test.plan(2)
Expand Down
Loading

0 comments on commit 709957b

Please sign in to comment.