diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 1890d042..c28eb963 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "dependencies": { "@mdi/font": "^7.2.96", + "lodash.isequal": "^4.5.0", "pinia": "^2.1.6", "resize-observer-polyfill": "^1.5.1", "vue": "^3.3.4", @@ -20,6 +21,7 @@ "@rushstack/eslint-patch": "^1.3.3", "@tsconfig/node18": "^18.2.1", "@types/jsdom": "^21.1.2", + "@types/lodash.isequal": "^4.5.6", "@types/node": "^20.5.6", "@vitejs/plugin-vue": "^4.3.3", "@vitejs/plugin-vue-jsx": "^3.0.2", @@ -1689,6 +1691,21 @@ "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, + "node_modules/@types/lodash": { + "version": "4.14.198", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.198.tgz", + "integrity": "sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==", + "dev": true + }, + "node_modules/@types/lodash.isequal": { + "version": "4.5.6", + "resolved": "https://registry.npmjs.org/@types/lodash.isequal/-/lodash.isequal-4.5.6.tgz", + "integrity": "sha512-Ww4UGSe3DmtvLLJm2F16hDwEQSv7U0Rr8SujLUA2wHI2D2dm8kPu6Et+/y303LfjTIwSBKXB/YTUcAKpem/XEg==", + "dev": true, + "dependencies": { + "@types/lodash": "*" + } + }, "node_modules/@types/node": { "version": "20.5.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.6.tgz", @@ -6365,6 +6382,11 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index d563229b..33074970 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,6 +15,7 @@ }, "dependencies": { "@mdi/font": "^7.2.96", + "lodash.isequal": "^4.5.0", "pinia": "^2.1.6", "resize-observer-polyfill": "^1.5.1", "vue": "^3.3.4", @@ -26,6 +27,7 @@ "@rushstack/eslint-patch": "^1.3.3", "@tsconfig/node18": "^18.2.1", "@types/jsdom": "^21.1.2", + "@types/lodash.isequal": "^4.5.6", "@types/node": "^20.5.6", "@vitejs/plugin-vue": "^4.3.3", "@vitejs/plugin-vue-jsx": "^3.0.2", diff --git a/frontend/src/api/utils.ts b/frontend/src/api/utils.ts index ab5a9319..a4f1a816 100644 --- a/frontend/src/api/utils.ts +++ b/frontend/src/api/utils.ts @@ -146,8 +146,8 @@ export const search = (searchTerm: string, genomeRelease: string) => { } /** - * Take a query string and return an object with the chromosome, pos, reference and - * alternative value. + * Return an object with the chromosome, pos, reference and + * alternative values from the given query string. * * @param query Incoming query string */ @@ -161,3 +161,7 @@ export const infoFromQuery = (query: string): any => { hgnc_id: hgnc_id } } + +export function copy(value: Object) { + return JSON.parse(JSON.stringify(value)) +} diff --git a/frontend/src/components/VariantDetails/AcmgRating.vue b/frontend/src/components/VariantDetails/AcmgRating.vue new file mode 100644 index 00000000..41bb4443 --- /dev/null +++ b/frontend/src/components/VariantDetails/AcmgRating.vue @@ -0,0 +1,854 @@ + + + + + diff --git a/frontend/src/stores/variantAcmgRating.ts b/frontend/src/stores/variantAcmgRating.ts new file mode 100644 index 00000000..f284a1d2 --- /dev/null +++ b/frontend/src/stores/variantAcmgRating.ts @@ -0,0 +1,59 @@ +/** + * Pinia store for handling per-variant ACMG rating. + * + * ## Store Dependencies + * + * - `caseDetailsStore` + */ +import { defineStore } from 'pinia' +import { ref } from 'vue' + +import { StoreState } from '@/stores/misc' + +/** Alias definition of SmallVariant type; to be defined later. */ +type SmallVariant = any +/** Alias definition of AcmgRating type; to be defined later. */ +type AcmgRating = any + +export const useVariantAcmgRatingStore = defineStore('variantAcmgRating', () => { + /** The small variant that acmgRating are handled for. */ + const smallVariant = ref(null) + + /* The current store state. */ + const storeState = ref(StoreState.Initial) + + /** The small variants ACMG rating as fetched from API. */ + const acmgRating = ref(null) + + function clearData() { + storeState.value = StoreState.Initial + acmgRating.value = null + } + + const createAcmgRating = async (smallVariant: SmallVariant, acmgRating: Object) => { + console.log('createAcmgRating', smallVariant, acmgRating) + } + + const retrieveAcmgRating = async (smallVariant: SmallVariant) => { + console.log('retrieveAcmgRating', smallVariant) + } + + const updateAcmgRating = async (acmgRating: Object) => { + console.log('updateAcmgRating', acmgRating) + } + + const deleteAcmgRating = async () => { + console.log('deleteAcmgRating') + } + + return { + smallVariant, + storeState, + acmgRating, + clearData, + createAcmgRating, + retrieveAcmgRating, + updateAcmgRating, + deleteAcmgRating + } +}) diff --git a/frontend/src/views/VariantDetailView.vue b/frontend/src/views/VariantDetailView.vue index d2ecfc8d..fa105802 100644 --- a/frontend/src/views/VariantDetailView.vue +++ b/frontend/src/views/VariantDetailView.vue @@ -5,6 +5,7 @@ import { useRoute, useRouter } from 'vue-router' import { useVariantInfoStore } from '@/stores/variantInfo' import { StoreState } from '@/stores/misc' +import AcmgRating from '@/components/VariantDetails/AcmgRating.vue' import HeaderDetailPage from '@/components/HeaderDetailPage.vue' import VariantDetailsGene from '@/components/VariantDetails/VariantGene.vue' import BeaconNetwork from '@/components/VariantDetails/BeaconNetwork.vue' @@ -67,6 +68,7 @@ const SECTIONS = [ { id: 'clinvar', title: 'ClinVar' }, { id: 'freqs', title: 'Population Frequencies' }, { id: 'variant-tools', title: 'Variant Tools' }, + { id: 'acmg-rating', title: 'ACMG Rating' }, { id: 'tx-csq', title: 'Consequences' }, { id: 'conservation', title: 'Conservation' }, { id: 'variant-validator', title: 'VariantValidator' } @@ -146,6 +148,12 @@ const genomeReleaseRef = ref(props.genomeRelease) /> +
+

ACMG Rating

+ + +
+

Consequences