Skip to content

Commit

Permalink
Pigean hover (#812)
Browse files Browse the repository at this point in the history
* starting to work on hoverable links

* gene page pigean table hover links

* fixing this up
  • Loading branch information
moriondo2022 authored Dec 11, 2024
1 parent 0038f34 commit 9d6598a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/PigeanPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default Vue.component("pigean-plot", {
hoverDot(dotString) {
this.unHoverDot();
this.$emit("dotHovered", dotString);
let xcoord = d3.event.layerX;
let ycoord = d3.event.layerY;
Expand Down
13 changes: 13 additions & 0 deletions src/views/PIGEAN/Gene/Template.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,17 @@
$parent.pigeanMap
"
:filter="filter"
@dotHovered="(dot) => $parent.showLink(dot)"
>
</pigean-plot>
<div id="pigean-hover-link">
<p v-if="!!$parent.phenotypeLinkAddress">
View phenotype:
<a :href="$parent.phenotypeLinkAddress"
v-html="$parent.phenotypeLinkText">
</a>
</p>
</div>
</div>
</div>
<div class="card-body pigean-table">
Expand Down Expand Up @@ -247,4 +256,8 @@
.card-body.pigean-table {
padding-top: 0;
}
#pigean-hover-link{
padding-left: 25px;
}
</style>
16 changes: 16 additions & 0 deletions src/views/PIGEAN/Gene/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ new Vue({
data() {
return {
pigeanPhenotypeMap: {},
hoverPhenotype: "",
filterFields: [
{ key: "combined", label: "Combined genetic support" },
{ key: "huge_score", label: "Direct support w/o gene sets" },
Expand Down Expand Up @@ -168,6 +169,17 @@ new Vue({
},
phewasAllData(){
return this.$store.state.phewasData;
},
phenotypeLinkAddress(){
if (!this.hoverPhenotype){
return "";
}
return `/pigean/phenotype.html?phenotype=${this.hoverPhenotype
}&genesetSize=${this.$store.state.genesetSize}&traitGroup=${
this.$store.state.traitGroup}`;
},
phenotypeLinkText(){
return this.pigeanMap[this.hoverPhenotype]?.description || this.hoverPhenotype;
}
},
watch: {
Expand Down Expand Up @@ -195,6 +207,10 @@ new Vue({
}&start=${r.start - expanded}&end=${r.end + expanded}`;
}
},
showLink(dot){
let dotObject = JSON.parse(dot);
this.hoverPhenotype = dotObject.phenotype;
}
},

render(createElement, context) {
Expand Down

0 comments on commit 9d6598a

Please sign in to comment.