Skip to content

Commit

Permalink
fix: Present hpo terms on seqvar page (#286) (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon authored Dec 15, 2023
1 parent bdf7583 commit a61b57e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/src/stores/__tests__/variantInfo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe.concurrent('geneInfo Store', () => {
expect(store.seqvar).toBe(undefined)
expect(store.varAnnos).toBe(null)
expect(store.geneInfo).toBe(null)
expect(store.hpoTerms).toEqual([])
expect(store.txCsq).toBe(null)
})

Expand Down Expand Up @@ -218,6 +219,6 @@ describe.concurrent('geneInfo Store', () => {

await store.loadData(deepCopy(seqvarInfo))

expect(fetchMocker.mock.calls.length).toBe(4)
expect(fetchMocker.mock.calls.length).toBe(5)
})
})
12 changes: 12 additions & 0 deletions frontend/src/stores/seqVarInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ref } from 'vue'

import { AnnonarsClient } from '@/api/annonars'
import { MehariClient } from '@/api/mehari'
import { type HpoTerm, VigunoClient } from '@/api/viguno'
import { type Seqvar } from '@/lib/genomicVars'
import { StoreState } from '@/stores/misc'

Expand All @@ -28,6 +29,9 @@ export const useSeqVarInfoStore = defineStore('seqVarInfo', () => {
/** Information about related gene. */
const geneInfo = ref<any | null>(null)

/** The HPO terms retrieved from viguno. */
const hpoTerms = ref<HpoTerm[]>([])

/** Transcript consequence information from mehari. */
const txCsq = ref<any | null>(null)

Expand Down Expand Up @@ -64,6 +68,7 @@ export const useSeqVarInfoStore = defineStore('seqVarInfo', () => {
storeState.value = StoreState.Loading
const annonarsClient = new AnnonarsClient()
const mehariClient = new MehariClient()
const vigunoClient = new VigunoClient()
let hgncId = ''

const { genomeBuild, chrom, pos, del, ins } = seqvar$
Expand All @@ -86,6 +91,12 @@ export const useSeqVarInfoStore = defineStore('seqVarInfo', () => {
}),
annonarsClient.fetchGeneClinvarInfo(hgncId).then((data) => {
geneClinvar.value = data.genes[hgncId]
}),
vigunoClient.fetchHpoTermsForHgncId(hgncId).then((data) => {
if (data === null) {
throw new Error('No HPO terms found.')
}
hpoTerms.value = data
})
])
} else {
Expand All @@ -112,6 +123,7 @@ export const useSeqVarInfoStore = defineStore('seqVarInfo', () => {
varAnnos,
geneClinvar,
geneInfo,
hpoTerms,
txCsq,
loadData,
clearData
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/views/SeqvarDetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ const SECTIONS: { [key: string]: Section[] } = {
<GenePathogenicityCard :gene-info="seqvarInfoStore?.geneInfo" />
</div>
<div id="gene-conditions">
<GeneConditionsCard :gene-info="seqvarInfoStore?.geneInfo" :hpo-terms="[]" />
<GeneConditionsCard
:gene-info="seqvarInfoStore?.geneInfo"
:hpo-terms="seqvarInfoStore.hpoTerms"
/>
</div>
<div id="gene-expression">
<GeneExpressionCard
Expand Down

0 comments on commit a61b57e

Please sign in to comment.