diff --git a/src/api/mehari/constants.ts b/src/api/mehari/constants.ts new file mode 100644 index 0000000..68e2345 --- /dev/null +++ b/src/api/mehari/constants.ts @@ -0,0 +1,10 @@ +/** Mapping from transcript effect to label. */ +export const TX_EFFECT_LABELS: { [key: string]: string } = { + transcript_variant: 'whole tx', + exon_variant: 'exonic', + splice_region_variant: 'splicing', + intron_variant: 'intronic', + upstream_variant: 'upstream', + downstream_variant: 'downstream', + other: 'other' +} diff --git a/src/api/mehari/index.ts b/src/api/mehari/index.ts index 886d07b..ff84328 100644 --- a/src/api/mehari/index.ts +++ b/src/api/mehari/index.ts @@ -1,2 +1,3 @@ export * from './types' export * from './client' +export * from './constants' diff --git a/src/components/StrucvarGeneListCard/GeneDosage.vue b/src/components/StrucvarGeneListCard/GeneDosage.vue new file mode 100644 index 0000000..dad2672 --- /dev/null +++ b/src/components/StrucvarGeneListCard/GeneDosage.vue @@ -0,0 +1,43 @@ + + + diff --git a/src/components/StrucvarGeneListCard/GeneListEntry.vue b/src/components/StrucvarGeneListCard/GeneListEntry.vue new file mode 100644 index 0000000..4127ca8 --- /dev/null +++ b/src/components/StrucvarGeneListCard/GeneListEntry.vue @@ -0,0 +1,294 @@ + + + diff --git a/src/components/StrucvarGeneListCard/ScoreChip.vue b/src/components/StrucvarGeneListCard/ScoreChip.vue new file mode 100644 index 0000000..709cff8 --- /dev/null +++ b/src/components/StrucvarGeneListCard/ScoreChip.vue @@ -0,0 +1,92 @@ + + + diff --git a/src/components/StrucvarGeneListCard/StrucvarGeneListCard.spec.ts b/src/components/StrucvarGeneListCard/StrucvarGeneListCard.spec.ts new file mode 100644 index 0000000..4e4ac8a --- /dev/null +++ b/src/components/StrucvarGeneListCard/StrucvarGeneListCard.spec.ts @@ -0,0 +1,57 @@ +import { describe, expect, it } from 'vitest' +import { nextTick } from 'vue' + +import * as BRCA1GeneInfo from '@/assets/__tests__/BRCA1GeneInfo.json' +import * as CurrentSV from '@/assets/__tests__/ExampleSV.json' +import GeneListCard from '@/components/StrucvarDetails/GeneListCard.vue' +import { setupMountedComponents } from '@/lib/testUtils' +import { StoreState } from '@/stores/misc' + +describe.concurrent('GeneListCard', async () => { + it('renders the GeneListCard table', async () => { + // arrange: + const { wrapper } = await setupMountedComponents( + { component: GeneListCard }, + { + props: { + genesInfos: JSON.parse(JSON.stringify([BRCA1GeneInfo['genes']['HGNC:1100']])), + currentSvRecord: JSON.parse(JSON.stringify(CurrentSV)), + selectedGeneHgncId: 'HGNC:1100', + storeState: StoreState.Active + } + } + ) + + // act: nothing, only test rendering + + // assert: + const table = wrapper.findComponent({ name: 'VDataIterator' }) + expect(table.exists()).toBe(true) + expect(wrapper.text()).toContain('Overlapping and Contained Genes') + }) + + it('shows the gene info on row click', async () => { + // arrange: + const { wrapper } = await setupMountedComponents( + { component: GeneListCard }, + { + props: { + genesInfos: JSON.parse(JSON.stringify([BRCA1GeneInfo['genes']['HGNC:1100']])), + currentSvRecord: JSON.parse(JSON.stringify(CurrentSV)), + selectedGeneHgncId: 'HGNC:1100', + storeState: StoreState.Active + } + } + ) + + // act: + const table = wrapper.findComponent({ name: 'VDataIterator' }) + expect(table.exists()).toBe(true) + // Click on the first gene + await table.get('div.v-sheet div.v-row div.v-col').trigger('click') + await nextTick() + + // assert: + expect(table.emitted('update:options')).toBeTruthy() + }) +}) diff --git a/src/components/StrucvarGeneListCard/StrucvarGeneListCard.stories.ts b/src/components/StrucvarGeneListCard/StrucvarGeneListCard.stories.ts new file mode 100644 index 0000000..38f897f --- /dev/null +++ b/src/components/StrucvarGeneListCard/StrucvarGeneListCard.stories.ts @@ -0,0 +1,36 @@ +import type { Meta, StoryObj } from '@storybook/vue3' + +import { Strucvar } from '../../lib/genomicVars' +import StrucvarToolsCard from './StrucvarToolsCard.vue' + +// We define the fixtures inline here as they are small. +const delBrca1: Strucvar = { + svType: 'DEL', + genomeBuild: 'grch37', + chrom: '17', + start: 41176312, + stop: 41277500, + userRepr: 'DEL:chr17:41176312:41277500' +} + +const meta = { + title: 'Strucvar/StrucvarToolsCard', + component: StrucvarToolsCard, + tags: ['autodocs'], + argTypes: { + strucvar: { control: { type: 'object' } } + }, + args: { + strucvar: delBrca1 + } +} satisfies Meta + +export default meta + +type Story = StoryObj + +export const DelBRCA1: Story = { + args: { + strucvar: delBrca1 + } +} diff --git a/src/components/StrucvarGeneListCard/StrucvarGeneListCard.vue b/src/components/StrucvarGeneListCard/StrucvarGeneListCard.vue new file mode 100644 index 0000000..8a65f74 --- /dev/null +++ b/src/components/StrucvarGeneListCard/StrucvarGeneListCard.vue @@ -0,0 +1,264 @@ + + +