Skip to content

Commit f3a13cc

Browse files
committed
Changes to support multiomics
1 parent 67bde66 commit f3a13cc

File tree

8 files changed

+102
-14
lines changed

8 files changed

+102
-14
lines changed

src/components/DataTable/DataTable.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,13 @@
6363
<template #item.signal1.analysis.trait.uuid="{item}"><TraitLabel :trait="item.signal1?.analysis?.trait"/></template>
6464
<template #item.signal1.analysis.analysis_type="{item}">
6565
{{ item.signal1?.analysis?.analysis_type ?? '' }}
66-
<div v-if="item.signal1?.analysis?.trait?.biomarker_type && item.signal1?.analysis?.trait?.biomarker_type !== 'phenotype'">
67-
<span>({{ item.signal1?.analysis?.trait?.biomarker_type.replace("-expression", "") }})</span>
68-
</div>
6966
</template>
7067
<template #item.signal1.analysis.trait.gene.ens_id="{item}"><EnsgLabel :trait="item.signal1?.analysis?.trait ?? ''" /></template>
7168
<template #item.signal1.analysis.tissue="{item}">{{ item.signal1?.analysis?.tissue ?? '' }}</template>
7269
<template #item.signal2.analysis.study.uuid="{item}"><StudyLabel :study="item.signal2?.analysis?.study?.uuid ?? ''" abbrev/></template>
7370
<template #item.signal2.analysis.trait.uuid="{item}"><TraitLabel :trait="item.signal2?.analysis?.trait"/></template>
7471
<template #item.signal2.analysis.analysis_type="{item}">
7572
{{ item.signal2?.analysis?.analysis_type ?? '' }}
76-
<div v-if="item.signal2?.analysis?.trait?.biomarker_type && item.signal2?.analysis?.trait?.biomarker_type !== 'phenotype'">
77-
<span>({{ item.signal2?.analysis?.trait?.biomarker_type.replace("-expression", "") }})</span>
78-
</div>
7973
</template>
8074
<template #item.signal2.analysis.trait.gene.ens_id="{item}"><EnsgLabel :trait="item.signal2?.analysis?.trait ?? ''" /></template>
8175
<template #item.signal2.analysis.tissue="{item}">{{ item.signal2?.analysis?.tissue ?? '' }}</template>

src/components/DataTable/labels/TraitLabel.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22
<div v-if="theBiomarkerType === BIOMARKER_TYPES.PHENOTYPE" class="d-inline" >
33
<TraitLabelPhenotype :trait="trait" :analysisID="analysisID"/>
44
</div>
5-
<div v-else class="d-inline">
5+
<div v-else-if="[BIOMARKER_TYPES.GENE_EXPRESSION, BIOMARKER_TYPES.EXON_EXPRESSION].includes(theBiomarkerType)" class="d-inline" >
66
<TraitLabelGene :trait="trait"/>
77
</div>
8+
<div v-else-if="theBiomarkerType === BIOMARKER_TYPES.PROTEIN_EXPRESSION" class="d-inline" >
9+
<TraitLabelProtein :trait="trait"/>
10+
</div>
11+
<div v-else class="d-inline">
12+
<span>
13+
{{ trait?.uuid }}
14+
</span>
15+
</div>
816
</template>
917

1018
<script setup>

src/components/DataTable/labels/TraitLabelGene.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<ToolTippy :isInteractive="true" @trigger="onTrigger">
3-
<span class="text-no-wrap">
3+
<span style="font-style: italic" class="text-no-wrap">
44
{{ middleTrim(theGene, 6, 6) }}
55
</span>
66
<template #tooltipContent>
77
<div @click.stop>
8-
<span>{{ theGene }}</span>
8+
<span style="font-style: italic">{{ theGene }}</span>
99
</div>
1010
</template>
1111
</ToolTippy>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<template>
2+
<ToolTippy :isInteractive="true" @trigger="onTrigger">
3+
<span class="text-no-wrap">
4+
{{ middleTrim(theGene, 6, 6) }}
5+
</span>
6+
<template #tooltipContent>
7+
<div @click.stop>
8+
<span>{{ theGene }}</span>
9+
</div>
10+
</template>
11+
</ToolTippy>
12+
</template>
13+
14+
<script setup>
15+
import { computed, ref } from 'vue'
16+
import router from '@/router'
17+
import { useFetchData } from '@/composables/fetchData'
18+
import { PAGE_NAMES, URLS } from '@/constants'
19+
import { middleTrim } from '@/util/util'
20+
import { useAppStore } from '@/stores/AppStore'
21+
22+
const { data, errorMessage, fetchData } = useFetchData()
23+
const appStore = useAppStore()
24+
25+
const genePage = PAGE_NAMES.GENE
26+
27+
const props = defineProps({
28+
trait: Object,
29+
})
30+
31+
const theGene = computed(() => props?.trait?.gene?.symbol)
32+
33+
const geneLink = ref(null)
34+
const geneText = ref(`Checking ${theGene.value}, please wait ...`)
35+
const geneLinkText = computed(() => {
36+
return geneText.value
37+
})
38+
const geneChecked = ref(false)
39+
40+
const onTrigger = async () => {
41+
if(!geneChecked.value) {
42+
const url = encodeURI(`${URLS.PORTAL_GENE_CHECK}?q=${theGene.value}`)
43+
if(await fetchData(url, 'gene check', appStore.currentPageName)) {
44+
geneChecked.value = true
45+
if(data?.value?.count > 0) {
46+
const u = encodeURI(`${URLS.PORTAL_GENE_PAGE}?gene=${theGene.value}`)
47+
geneLink.value = u
48+
geneText.value = `View ${ theGene.value } in CMDKP portal`
49+
} else {
50+
geneText.value = `Unknown gene: ${ theGene.value }`
51+
}
52+
} else {
53+
console.error(`Error checking gene: ${ theGene.value } on portal:`, errorMessage)
54+
}
55+
}
56+
}
57+
58+
const onClick = () => {
59+
router.push({ name: genePage, query: { gene: theGene.value } })
60+
}
61+
</script>
62+
63+
<style scoped>
64+
</style>

src/components/FilterPanel/CtlAutocomplete.vue

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,17 @@
2020
multiple
2121
persistent-clear
2222
variant="outlined"
23-
></v-autocomplete>
23+
>
24+
<template v-slot:no-data>
25+
<v-list-item>
26+
<v-list-item-title>
27+
{{ selectedItems.length >= controlSet.limit
28+
? `Maximum of ${controlSet.limit} items selected`
29+
: 'No data available' }}
30+
</v-list-item-title>
31+
</v-list-item>
32+
</template>
33+
</v-autocomplete>
2434
</template>
2535

2636
<script setup>
@@ -90,8 +100,12 @@ const onGenesPaste = (event) => {
90100
}
91101
92102
const onModelChanged = async (newValue) => {
93-
// console.log('onModelChanged', controlSet.storeKey, newValue)
103+
if (controlSet.limit && newValue.length > controlSet.limit) {
104+
// Enforce limit
105+
newValue = newValue.slice(0, controlSet.limit)
106+
}
94107
await appStore.updateFilter(controlSet.storeKey, newValue)
108+
populateControlSelectList()
95109
}
96110
97111
// *** Utility functions *******************************************************
@@ -100,6 +114,11 @@ const mlc = ((itemTitle, queryText, item) => {
100114
})
101115
102116
const populateControlSelectList = () => {
117+
if (controlSet.limit && selectedItems.value.length >= controlSet.limit) {
118+
selectListItems.value = []
119+
return
120+
}
121+
103122
selectListItems.value = appStore.filterPanelControls[controlSet.storeKey]
104123
}
105124

src/components/FilterPanel/FilterPanel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ const rules = {
5656
*/
5757
const controlConfig = {
5858
study: { title: 'Study', storeKey: 'studies', rules: null, emptyValue: null, defaultValue: null, placeholder: 'Select study(ies)' },
59-
analysisTypes: { title: 'Analysis Types', storeKey: 'analysisTypes', rules: null, emptyValue: null, defaultValue: null, placeholder: 'Select analysis type(s)' },
60-
analysisTypePriority: { title: 'Analysis Type Priority', storeKey: 'analysisTypePriority', rules: null, emptyValue: null, defaultValue: ['gwas', 'eqtl'], placeholder: 'Select analysis type priority' },
59+
analysisTypes: { title: 'OMICS Types', storeKey: 'analysisTypes', rules: null, emptyValue: null, defaultValue: null, placeholder: 'Select analysis type(s)' },
60+
analysisTypePriority: { title: 'OMICS Columns 1/2', storeKey: 'analysisTypePriority', limit: 2, rules: null, emptyValue: null, defaultValue: ['gwas', 'eqtl'], placeholder: 'Select analysis type priority' },
6161
gene: { title: 'eQTL gene', storeKey: 'genes', rules: null, emptyValue: null, defaultValue: null, placeholder: 'Select gene(s)' },
6262
region: { title: 'Genomic Region', storeKey: 'region', items: null, rules: [rules.chrRegionRule], emptyValue: null, defaultValue: '', placeholder: 'chr:start-end' },
6363
phenotype: { title: 'GWAS Phenotype', storeKey: 'phenotypes', rules: null, emptyValue: null, defaultValue: null, placeholder: 'Select phenotype(s)' },

src/composables/DataTableHelpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const useDataTableHelpers = () => {
3535
{ title: 'Add plots', value: 'actions', sortable: false, minWidth: '8rem', visible: () => showAddPlotIcon() },
3636
{ title: 'Study 1', sortable: true, value: 'signal1.analysis.study.uuid', minWidth: '7rem', visible: alwaysShow },
3737
{ title: 'Trait 1', sortable: true, value: 'signal1.analysis.trait.uuid', minWidth: '7rem', visible: alwaysShow },
38-
{ title: 'Type 1', sortable: false, value: 'signal1.analysis.analysis_type', minWidth: '5rem', visible: alwaysShow },
38+
{ title: 'Type 1', sortable: false, value: 'signal1.analysis.analysis_type', minWidth: '7rem', visible: alwaysShow },
3939
{ title: 'ENSG 1', sortable: true, value: 'signal1.analysis.trait.gene.ens_id', minWidth: '9rem', visible: () => showEnsIDs.value },
4040
{ title: 'Tissue 1', sortable: true, value: 'signal1.analysis.tissue', minWidth: '5rem', visible: alwaysShow },
4141
{ title: 'Cell Type 1', sortable: true, value: 'signal1.analysis.cell_type', minWidth: '5rem', visible: () => showCellType.value },

src/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const BIOMARKER_TYPES = Object.freeze({
55
PHENOTYPE: 'phenotype',
66
GENE_EXPRESSION: 'gene-expression',
77
EXON_EXPRESSION: 'exon-expression',
8+
PROTEIN_EXPRESSION: 'protein-expression',
9+
METHYLATION_STATUS: 'methylation-status',
10+
METABOLITE_LEVEL: 'metabolite-level',
811
})
912

1013
const COLORS = {

0 commit comments

Comments
 (0)