Skip to content

Commit

Permalink
Merge pull request #80 from gamcil/master
Browse files Browse the repository at this point in the history
Consolidate local/server search result views into single codebase
  • Loading branch information
gamcil authored Aug 29, 2023
2 parents 44194e3 + bc32a51 commit 7d13dd1
Show file tree
Hide file tree
Showing 20 changed files with 1,268 additions and 2,016 deletions.
10 changes: 5 additions & 5 deletions frontend/Alignment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const blosum62Sim = [
function getRange(map, start, end) {
let first = null, last = null
for (let i = start; i <= end; i++) {
let val = map.get(i)
let val = map[i]
if (val !== null) {
if (first === null) first = val
last = val
Expand All @@ -49,12 +49,12 @@ export default {
props: ['alignment', 'lineLen', 'queryMap', 'targetMap'],
methods: {
// Get the index of a given residue in the alignment
getQueryIndex(index) { return this.queryMap.get(index) },
getTargetIndex(index) { return this.targetMap.get(index) },
getQueryIndex(index) { return this.queryMap[index] },
getTargetIndex(index) { return this.targetMap[index] },
getFirstResidueNumber(map, i) {
let start = this.lineLen * (i - 1)
while (map.get(start) === null) start--
return map.get(start)
while (map[start] === null) start--
return map[start]
},
getQueryRowStartPos(i) { return this.getFirstResidueNumber(this.queryMap, i) },
getTargetRowStartPos(i) { return this.getFirstResidueNumber(this.targetMap, i) },
Expand Down
18 changes: 13 additions & 5 deletions frontend/AlignmentPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
:alignment="alignment"
:queryMap="queryMap"
:targetMap="targetMap"
:hits="hits"
bgColorLight="white"
bgColorDark="#1E1E1E"
qColor="lightgrey"
Expand All @@ -30,11 +31,17 @@
import Alignment from './Alignment.vue'
// Map indices in the alignment to the corresponding indices in the structure
// realStart will be 1-based
function makePositionMap(realStart, alnString) {
let map = new Map()
for (let i = 0, gaps = 0; i <= alnString.length; i++) {
if (alnString[i] === '-') map.set(i, null) && gaps++
else map.set(i, realStart + i - gaps)
let map = Array(alnString.length);
// let map = new Map()
for (let i = 0, gaps = 0; i < alnString.length; i++) {
if (alnString[i] === '-') {
map[i] = null;
gaps++;
} else {
map[i] = realStart + i - gaps;
}
}
return map
}
Expand All @@ -47,7 +54,8 @@ export default {
}),
props: {
alignment: { type: Object, required: true, },
lineLen: { type: Number, required: true, }
lineLen: { type: Number, required: true, },
hits: { type: Object }
},
methods: {
setUserSelection([start, end]) {
Expand Down
5 changes: 3 additions & 2 deletions frontend/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<v-app id="app" :class="{'electron' : $ELECTRON}">
<navigation />
<v-main>
<router-view></router-view>
<router-view />
</v-main>
</v-app>
</template>

<script>
import Navigation from './Navigation.vue';
import Result from './Result.vue';
export default {
components: { Navigation },
components: { Navigation, Result },
}
</script>
102 changes: 102 additions & 0 deletions frontend/AppLocal.vue

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions frontend/Navigation.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<v-navigation-drawer stateless app permanent clipped :mini-variant="mini" :expand-on-hover="false" ref="drawer">
<v-list>
<v-navigation-drawer v-if="!$LOCAL" stateless app permanent clipped :mini-variant="mini" :expand-on-hover="false" ref="drawer">
<v-list v-if="!$LOCAL">
<v-list-item to="/search">
<v-list-item-action>
<v-icon>{{ $MDI.Magnify }}</v-icon>
Expand All @@ -12,8 +12,7 @@
</v-list-item>

<router-view name="sidebar"></router-view>

<history />
<history v-if="!$LOCAL" />

<v-list-item v-if="$ELECTRON" to="/preferences">
<v-list-item-action>
Expand All @@ -26,8 +25,11 @@
</v-list>
</v-navigation-drawer>
<v-app-bar v-on:dblclick.native="electronHandleTitleBarDoubleClick()" app :height="$ELECTRON ? '72px' : '48px'" fixed clipped-left :class="['ml-0', 'pl-3', $ELECTRON ? 'pt-2' : null]" :style="{'-webkit-app-region': $ELECTRON ? 'drag' : null, '-webkit-user-select': $ELECTRON ? 'none' : null}">
<v-app-bar-nav-icon :input-value="!mini ? 'activated' : undefined" @click.stop="toggleMini"></v-app-bar-nav-icon>
<v-app-bar-title><router-link to="/" style="color: inherit; text-decoration: none">{{ $STRINGS.APP_NAME }} Search</router-link></v-app-bar-title>
<v-app-bar-nav-icon v-if="!$LOCAL" :input-value="!mini ? 'activated' : undefined" @click.stop="toggleMini"></v-app-bar-nav-icon>
<v-app-bar-title>
<router-link v-if="!$LOCAL" to="/" style="color: inherit; text-decoration: none">{{ $STRINGS.APP_NAME }} Search</router-link>
<span v-if="$LOCAL">{{ $STRINGS.APP_NAME }} Search</span>
</v-app-bar-title>
<object style="margin-left:8px; display: inline-block; width: 38px;height: 38px;vertical-align: middle"
v-if="$APP == 'mmseqs'"
type="image/svg+xml"
Expand All @@ -53,14 +55,14 @@ import History from './History.vue';
export default {
components : { History },
data: () => ({
mini: true
mini: true,
}),
created() {
this.$root.$on('multi', this.shouldExpand);
},
mounted() {
// defeat https://github.com/vuetifyjs/vuetify/pull/14523
Object.defineProperty(this.$refs.drawer._data, 'isMouseover', { get: () => { false } })
if (!__LOCAL__) Object.defineProperty(this.$refs.drawer._data, 'isMouseover', { get: () => { false } });
},
beforeDestroy() {
this.$root.$off('multi', this.shouldExpand);
Expand Down
Loading

0 comments on commit 7d13dd1

Please sign in to comment.