Skip to content

Commit

Permalink
Pigean all traits (#807)
Browse files Browse the repository at this point in the history
* defaults to all

* getting data from all groups

* getting there

* phewas data is being set but why isn't it propagating

* getting all data

* top 1500 traits

* remove superfluous watch
  • Loading branch information
moriondo2022 authored Dec 10, 2024
1 parent b666d68 commit c04e013
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/components/TraitGroupSelectPicker.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<select v-model="traitGroup" class="form-control">
<option value="all">All</option>
<option value="portal">A2F</option>
<option value="gcat_trait">GWAS Catalog</option>
<option value="rare_v2">Orphanet</option>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/bioIndexUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async function processRequest(req, onResolve, onError, onLoad, limitWhile) {
}
export const DEFAULT_SIGMA = 2;
export const DEFAULT_GENESET_SIZE = "small";
export const DEFAULT_TRAIT_GROUP = "portal";
export const DEFAULT_TRAIT_GROUP = "all";

export default {
query,
Expand Down
9 changes: 7 additions & 2 deletions src/views/PIGEAN/Gene/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ new Vue({
},
plotReady() {
return (
this.$store.state.pigeanGene.data.length > 0 &&
this.pigeanFilteredData.length > 0 &&
Object.keys(this.pigeanPhenotypeMap).length > 0
);
},
Expand All @@ -159,10 +159,15 @@ new Vue({
return adjustedData;
},
pigeanFilteredData(){
return this.$store.state.pigeanGene.data.filter(item => item.log_bf > 0 || item.prior > 0);
let rawData = structuredClone(this.phewasAllData);
let filteredData = rawData.filter(item => item.log_bf > 0 || item.prior > 0);
return filteredData;
},
pigeanMap(){
return this.pigeanPhenotypeMap;
},
phewasAllData(){
return this.$store.state.phewasData;
}
},
watch: {
Expand Down
26 changes: 22 additions & 4 deletions src/views/PIGEAN/Gene/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default new Vuex.Store({
aliasName: null,
traitGroup: keyParams.traitGroup || bioIndexUtils.DEFAULT_TRAIT_GROUP,
traitGroupToQuery: null,

phewasData: [],
},

mutations: {
Expand All @@ -47,6 +47,9 @@ export default new Vuex.Store({
setAliasName(state, aliasName) {
state.aliasName = aliasName || state.aliasName;
},
setPhewasData(state, phewasData){
state.phewasData = phewasData || state.phewasData;
}
},

getters: {
Expand Down Expand Up @@ -82,9 +85,24 @@ export default new Vuex.Store({
context.commit("setTraitGroup", traitGroup);
if (!!name) {
context.dispatch("gene/query", { q: name });
context.dispatch("pigeanGene/query", { q:
`${traitGroup},${name},${bioIndexUtils.DEFAULT_SIGMA},${genesetSize}`,
limit: 1000 });
if (traitGroup !== 'all'){
await context.dispatch("pigeanGene/query", { q:
`${traitGroup},${name},${bioIndexUtils.DEFAULT_SIGMA},${genesetSize}`});
context.commit("setPhewasData", context.state.pigeanGene.data);
} else {
// If ALL is selected, query all trait groups and get top results across all
const TRAIT_GROUPS = ["portal", "gcat_trait", "rare_v2"];
let traitsData = [];
for (let i = 0; i < TRAIT_GROUPS.length; i++){
let group = TRAIT_GROUPS[i];
let traitQuery = `${group},${context.state.geneName},${
bioIndexUtils.DEFAULT_SIGMA},${context.state.genesetSize}`;
let groupData = await bioIndexUtils.query("pigean-gene", traitQuery);
traitsData = traitsData.concat(groupData);
}
traitsData = traitsData.sort((a,b) => b.combined - a.combined);
context.commit("setPhewasData", traitsData.slice(0,1500));
}
}
},
async getPigeanPhenotypes(context) {
Expand Down

0 comments on commit c04e013

Please sign in to comment.