Skip to content

Commit 595bea5

Browse files
committed
Display count of credible sets of eqtls
Handle visual change when eqtl tab is not highlighted. Avoid loading eqtl count until ensembl id is known. Accomodate displaying phenotype in region eqtl table. Remove traling spaces in code
1 parent 3a0e0ac commit 595bea5

File tree

9 files changed

+62
-33
lines changed

9 files changed

+62
-33
lines changed

src/components/GeneDashboard.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export default {
207207
start: null,
208208
stop: null,
209209
chrom: null,
210-
ensemblId: "",
210+
ensemblId: null,
211211
212212
// introns may not be needed as it's assumed for genes
213213
introns: false,
@@ -255,9 +255,6 @@ export default {
255255
},
256256
},
257257
methods:{
258-
demo: function(){
259-
this.load_eqtl_count(this.ensemblId)
260-
},
261258
handleOpenModal: function(rowData){
262259
this.modalData = rowData
263260
this.showModal = true

src/components/RegionDashboard.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</div>
2929
</div>
3030

31-
<!-- strucvar tab
31+
<!-- strucvar tab
3232
<div id="structvar-tab" v-if="showTab.structvar">
3333
<div class="row justify-content-left px-5" >
3434
<div class="col-md-11">
@@ -290,6 +290,7 @@ export default {
290290
toggleTab: function(tabName) {
291291
this.showTab.snv = false
292292
this.showTab.structvar = false
293+
this.showTab.eqtl = false
293294
this.showTab[tabName] = true
294295
},
295296
tabClass: function(isActive) {

src/components/summary/BaseEqtlSummaries.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="child-component">
3-
<NumericSummaryCard title="Tissue" numericLabel="eQTL Count" :state="loadingState" :summaryData="tissueSummary"/>
3+
<NumericSummaryCard title="Tissue" numericLabel="Credible Set Count" :state="loadingState" :summaryData="tissueSummary"/>
44
</div>
55
</template>
66

@@ -15,12 +15,14 @@ export default {
1515
},
1616
inject: {
1717
api: {default: ''},
18-
/* May need additional injects by the extending component */
1918
},
2019
computed: {
2120
/* Needs to be overridden by the extending component */
2221
ajaxUrl() { return `${this.api}/example` },
23-
ajaxParams() {return {param1: "foo"} }
22+
ajaxParams() {return null},
23+
/* Simple locking function that can be overridden by extending component
24+
in order to prevent loading when ajax parameters haven't been resolved. */
25+
ready_to_load() { return true },
2426
},
2527
data: function() {
2628
return {
@@ -31,16 +33,16 @@ export default {
3133
},
3234
methods: {
3335
load: function() {
34-
console.log("loading eqtl tissue summary")
36+
if(this.ready_to_load === false){ return }
3537
axios
36-
.get(this.ajaxUrl,
38+
.get(this.ajaxUrl,
3739
{params: this.ajaxParams})
38-
.then( resp => {
39-
this.tissueSummary = resp.data
40+
.then( resp => {
41+
this.tissueSummary = resp.data
4042
this.loadingState = "loaded"
4143
})
42-
.catch(error => {
43-
console.log("Error loading region tissue count:" + error)
44+
.catch(error => {
45+
console.log("Error loading region tissue count:" + error)
4446
this.loadingState = "failed"
4547
})
4648
}

src/components/summary/GeneEqtlSummaries.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ export default {
55
name: "GeneEqtlSummaries",
66
extends: BaseEqtlSummaries,
77
inject: {
8-
/* The override to inject appropriate provided data */
9-
ensemblId: {default: 0},
8+
ensemblId: {default: null},
9+
},
10+
methods: {
1011
},
1112
computed: {
12-
/* Needs to be overridden by the extending component */
1313
ajaxUrl() { return `${this.api}/eqtl/ensembl_tissue_count` },
14-
ajaxParams() {return {ensembl: this.ensemblId} }
14+
ajaxParams() { return {ensembl: this.ensemblId} },
15+
ready_to_load() { return this.ensemblId !== null }
1516
},
17+
watch: {
18+
ensemblId: function() {
19+
// Handles the case where the ensemblId was not available at mount time.
20+
this.load()
21+
}
22+
}
1623
}
1724
</script>

src/components/summary/NumericSummaryCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export default {
6060
},
6161
summaryData: {
6262
type: Object,
63-
default: function(){
64-
return {foo: 1, bar: 100}
63+
default: function(){
64+
return {foo: 1, bar: 100}
6565
}
6666
},
6767
state: {

src/components/table/BaseEqtlTable.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export default {
5656
this.empty = data.length == 0
5757
},
5858
tblColumnDefs: function(){
59+
return this.baseColumnDefs()
60+
},
61+
baseColumnDefs: function(){
5962
return([
6063
{
6164
title: "Variant Id",

src/components/table/BaseSNVTable.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ export default {
112112
visibleRowsData.push(this.tabulator.rowManager.displayRows[0][i].data);
113113
}
114114
}
115-
return {
116-
firstRowIdx: firstVisibleRowIndex,
117-
lastRowIdx: lastVisibleRowIndex,
115+
return {
116+
firstRowIdx: firstVisibleRowIndex,
117+
lastRowIdx: lastVisibleRowIndex,
118118
rowsData: visibleRowsData }
119119
},
120120
hover: function(variant, hovered) {
@@ -141,7 +141,7 @@ export default {
141141
let visVars = this.getVisibleVariants();
142142
143143
// make sure that row is hovered after re-rendering on mobile touch screen
144-
if (this.hoveredRowPosition != null) {
144+
if (this.hoveredRowPosition != null) {
145145
var row = this.tabulator.getRowFromPosition(this.hoveredRowPosition);
146146
row.getElement().classList.add('row-hovered');
147147
}
@@ -150,7 +150,7 @@ export default {
150150
//formerly enterMouseEnter callback
151151
tblRowMouseEnter: function(e, row) {
152152
// row was hovered from before and mouseleave was never called
153-
if ((this.hoveredRowPosition != null) && (this.hoveredRowPosition != row.getPosition())) {
153+
if ((this.hoveredRowPosition != null) && (this.hoveredRowPosition != row.getPosition())) {
154154
var hoveredRow = this.tabulator.getRowFromPosition(this.hoveredRowPosition);
155155
hoveredRow.getElement().classList.remove('row-hovered');
156156
this.$emit("hover", hoveredRow.getPosition(), hoveredRow.getData(), false);
@@ -170,11 +170,11 @@ export default {
170170
formatCaddValue: function(cell) {
171171
return(cell.getValue() === null ? "" : cell.getValue().toFixed(2))
172172
},
173-
// function to override to customize column defs.
173+
// function to override to customize column defs.
174174
tblColumnDefs: function(){
175175
return this.baseColumnDefs()
176176
},
177-
// common column defs.
177+
// common column defs.
178178
baseColumnDefs: function(){
179179
return([
180180
{

src/components/table/GeneSNVTable.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default {
1919
emits: ['openModal'],
2020
computed: {
2121
// define url to get data appropriate for region snv table
22-
ajaxUrl() {
23-
return(`${this.api}/variants/gene/snv/${this.ensemblId}`)
22+
ajaxUrl() {
23+
return(`${this.api}/variants/gene/snv/${this.ensemblId}`)
2424
}
2525
},
2626
methods: {
@@ -124,7 +124,7 @@ export default {
124124
let baseCols = this.baseColumnDefs()
125125
baseCols.splice(2, 0, consequenceCol, annoCol, lofteeCol)
126126
127-
return baseCols
127+
return baseCols
128128
},
129129
}
130130
}

src/components/table/RegionEqtlTable.vue

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,29 @@ export default {
1414
/* The override to get data from appropriate endpoint */
1515
ajaxUrl() { return(`${this.api}/eqtl/region`) },
1616
ajaxParams(){
17-
return {chrom: this.chrom,
18-
start: this.start,
19-
stop: this.stop}
17+
return {chrom: this.chrom,
18+
start: this.start,
19+
stop: this.stop}
2020
}
2121
},
22+
methods: {
23+
tblColumnDefs: function(){
24+
25+
let phenoCol = {
26+
title: "Phenotype Id",
27+
titleDownload: "Phenotype Id",
28+
headerTooltip: "affected phenotype",
29+
minWidth: 130,
30+
widthGrow: 1,
31+
field: "phenotype_id",
32+
formatter: (cell) => { return `<a href='gene.html?id=${cell.getValue()}'>${cell.getValue()}</a>`; }
33+
}
34+
35+
let baseCols = this.baseColumnDefs()
36+
baseCols.push(phenoCol)
37+
38+
return baseCols
39+
},
40+
}
2241
}
2342
</script>

0 commit comments

Comments
 (0)