Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pigean all traits #807

Merged
merged 8 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading