Skip to content

Commit

Permalink
fix chain res map index
Browse files Browse the repository at this point in the history
  • Loading branch information
gamcil committed Aug 31, 2023
1 parent 7d13dd1 commit 723747f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 1 addition & 3 deletions frontend/AlignmentPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
<script>
import Alignment from './Alignment.vue'
// Map indices in the alignment to the corresponding indices in the structure
// realStart will be 1-based
// Map 0-based indices in the alignment to corresponding 1-based indices in the structure
function makePositionMap(realStart, alnString) {
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;
Expand Down
12 changes: 5 additions & 7 deletions frontend/StructureViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,9 @@ const atomToPDBRow = (ap) => {
// Map 1-based indices in a selection to residue index/resno
const makeChainMap = (structure, sele) => {
// let idx = 1
let map = new Map()
structure.eachResidue(rp => {
map.set(rp.resno, { index: rp.index, resno: rp.resno });
// idx++;
map.set(rp.index + 1, { index: rp.index, resno: rp.resno });
}, new Selection(sele));
return map
}
Expand Down Expand Up @@ -416,9 +414,9 @@ END
if (!this.qChainResMap) {
return '';
}
let start = this.alignment.qStartPos;
let end = this.alignment.qEndPos;
let sele = `${start}-${end}`;
let start = this.qChainResMap.get(this.alignment.qStartPos);
let end = this.qChainResMap.get(this.alignment.qEndPos);
let sele = `${start.resno}-${end.resno}`;
if (this.queryChain) {
sele = `${sele} AND ${this.queryChainSele}`;
}
Expand Down Expand Up @@ -472,7 +470,7 @@ END
})
Promise.all([
(__LOCAL__)
(this.$LOCAL)
? pulchra(mockPDB(this.hits.query.qCa, this.hits.query.sequence))
: this.$axios.get("api/result/" + this.$route.params.ticket + '/query'),
pulchra(mockPDB(this.alignment.tCa, this.alignment.tSeq))
Expand Down

0 comments on commit 723747f

Please sign in to comment.