Skip to content

Score set summary statistics view (#35) #257

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

Draft
wants to merge 1 commit into
base: release-2025.2.2
Choose a base branch
from
Draft
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
127 changes: 127 additions & 0 deletions src/components/ScoreSetStatistics.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<template>
<div class="mave-statistics">
<div v-if="scoreSet.numVariants" class="mave-statistics-group">
<div class="mave-statistic">
<label>Total number of variants:</label>
{{ formatCount(scoreSet.numVariants) }}
</div>
</div>
<div v-if="scoreSet.statistics?.targetLength" class="mave-statistics-group">
<div class="mave-statistic">
<label>Target length:</label>
<label class="mave-statistic-sublabel">DNA</label>
{{ formatCount(scoreSet.statistics.targetLength.dna) }}
<label class="mave-statistic-sublabel">Protein</label>
{{ formatCount(scoreSet.statistics.targetLength.protein) }}
</div>
</div>
<div v-if="scoreSet.statistics?.meanNumMutationsPerPosition?.dna || scoreSet.statistics?.meanNumMutationsPerPosition?.protein" class="mave-statistics-group">
<div class="mave-statistic">
<label>Avg. # mutations per position:</label>
<span v-if="scoreSet.statistics.meanNumMutationsPerPosition.dna">
<label class="mave-statistic-sublabel">DNA</label>
{{ formatFloat(scoreSet.statistics.meanNumMutationsPerPosition.dna) }}
</span>
<span v-if="scoreSet.statistics.meanNumMutationsPerPosition.protein">
<label class="mave-statistic-sublabel">Protein</label>
{{ formatFloat(scoreSet.statistics.meanNumMutationsPerPosition.protein) }}
</span>
</div>
</div>
<div v-if="scoreSet.statistics?.numSpliceVariants != null && scoreSet.statistics?.numSpliceVariants > 0" class="mave-statistics-group">
<div class="mave-statistic">
<label># splice variants:</label>
{{ formatCount(scoreSet.statistics.numSpliceVariants) }}
</div>
</div>
<div v-if="scoreSet.statistics?.numVariantsByMutationCount?.pro" class="mave-statistics-group">
<div class="mave-statistic">
<label>Variants by number of protein sequence mutations:</label>
<label class="mave-statistic-sublabel">Single</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationCount.pro.single) }}
<label class="mave-statistic-sublabel">Double</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationCount.pro.double) }}
<label class="mave-statistic-sublabel">Triple+</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationCount.pro.tripleOrMore) }}
</div>
</div>
<div v-if="scoreSet.statistics?.numVariantsByMutationCount?.nt" class="mave-statistics-group">
<div class="mave-statistic">
<label>Variants by number of NT sequence mutations:</label>
<label class="mave-statistic-sublabel">Single</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationCount.nt.single) }}
<label class="mave-statistic-sublabel">Double</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationCount.nt.double) }}
<label class="mave-statistic-sublabel">Triple+</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationCount.nt.tripleOrMore) }}
</div>
</div>
<div v-if="scoreSet.statistics?.numVariantsByMutationType" class="mave-statistics-group">
<div class="mave-statistic">
<label>Variants by type:</label>
<label class="mave-statistic-sublabel">Nonsense</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationType.nonsense) }}
<label class="mave-statistic-sublabel">Missense</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationType.missense) }}
<label class="mave-statistic-sublabel">Synonymous</label>
{{ formatCount(scoreSet.statistics.numVariantsByMutationType.synonymous) }}
</div>
</div>
</div>
</template>

<script>

export default {
name: 'ScoreSetStatistics',

props: {
scoreSet: {
type: Object,
required: true
}
},

methods: {
formatCount: (n) => n == null ? '' : n.toLocaleString(),
formatFloat: (x) => x == null ? '' : x.toFixed(2)
}
}

</script>

<style scoped>

.mave-statistics {
margin: 1em 0;
}

.mave-statistics-group {
clear: both;
}

.mave-statistic {
clear: both;
}

.mave-statistic::after {
content: "";
clear: both;
display: table;
}

.mave-statistic label {
padding: 0 0.5em 0 0;
}

.mave-statistic label.mave-statistic-sublabel {
float: none;
background-color: #666;
color: #fff;
padding: 0 4px;
border-radius: 3px;
margin-left: 1em;
font-weight: normal;
}

</style>
24 changes: 22 additions & 2 deletions src/components/screens/ScoreSetView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
</template>
<Button class="p-button-outlined p-button-sm" @click="downloadMappedVariants()">Mapped Variants</Button>&nbsp;
</div>
<ScoreSetStatistics :score-set="item" />
<div v-if="requestFromGalaxy == '1'"><br>Send files to <a :href="`${this.galaxyUrl}`">Galaxy</a> <Button class="p-button-outlined p-button-sm" @click="sendToGalaxy('scores')">Scores</Button>&nbsp;
<template v-if="countColumns.length != 0">
<Button class="p-button-outlined p-button-sm" @click="sendToGalaxy('counts')">Counts</Button>&nbsp;
Expand Down Expand Up @@ -340,11 +341,11 @@ import DataTable from 'primevue/datatable'
import TabPanel from 'primevue/tabpanel'
import TabView from 'primevue/tabview'
import Message from 'primevue/message'
import ProgressSpinner from 'primevue/progressspinner'
import ScrollPanel from 'primevue/scrollpanel';

import ScoreSetHeatmap from '@/components/ScoreSetHeatmap'
import ScoreSetHistogram from '@/components/ScoreSetHistogram'
import ScoreSetStatistics from '@/components/ScoreSetStatistics'
import EntityLink from '@/components/common/EntityLink'
import PageLoading from '@/components/common/PageLoading'
import ItemNotFound from '@/components/common/ItemNotFound'
Expand All @@ -362,7 +363,26 @@ import items from '@/composition/items'

export default {
name: 'ScoreSetView',
components: { Accordion, AccordionTab, AutoComplete, Button, Chip, DefaultLayout, EntityLink, ScoreSetHeatmap, ScoreSetHistogram, TabView, TabPanel, Message, DataTable, Column, ProgressSpinner, ScrollPanel, PageLoading, ItemNotFound },
components: {
Accordion,
AccordionTab,
AutoComplete,
Button,
Chip,
Column,
DataTable,
DefaultLayout,
EntityLink,
ItemNotFound,
Message,
PageLoading,
ScoreSetHeatmap,
ScoreSetHistogram,
ScoreSetStatistics,
ScrollPanel,
TabPanel,
TabView
},
computed: {
isMetaDataEmpty: function() {
//If extraMetadata is empty, return value will be true.
Expand Down