Skip to content

Commit

Permalink
Also pass database to select correct alignment result
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Jun 30, 2024
1 parent 2566126 commit 0fba09c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
22 changes: 22 additions & 0 deletions backend/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ func server(jobsystem JobSystem, config ConfigRoot) {
return
}

database := req.URL.Query().Get("database")
var fasta []FastaEntry
var results []SearchResult
var mode string
Expand All @@ -666,6 +667,13 @@ func server(jobsystem JobSystem, config ConfigRoot) {
mode = job.Mode
ids = []int64{id}
databases := job.Database
if database != "" {
if isIn(database, job.Database) == -1 {
http.Error(w, "Database not found", http.StatusBadRequest)
return
}
databases = []string{database}
}
results, err = Alignments(ticket.Id, ids, databases, config.Paths.Results)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
Expand All @@ -676,6 +684,13 @@ func server(jobsystem JobSystem, config ConfigRoot) {
ids = []int64{id}
isFoldseek = true
databases := job.Database
if database != "" {
if isIn(database, job.Database) == -1 {
http.Error(w, "Database not found", http.StatusBadRequest)
return
}
databases = []string{database}
}
results, err = FSAlignments(ticket.Id, ids, databases, config.Paths.Results)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
Expand All @@ -696,6 +711,13 @@ func server(jobsystem JobSystem, config ConfigRoot) {
}
isFoldseek = true
databases := job.Database
if database != "" {
if isIn(database, job.Database) == -1 {
http.Error(w, "Database not found", http.StatusBadRequest)
return
}
databases = []string{database}
}
results, err = ComplexAlignments(ticket.Id, ids, databases, config.Paths.Results)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
Expand Down
5 changes: 3 additions & 2 deletions frontend/ResultView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
<v-icon v-once>{{ $MDI.NotificationClearAll }}</v-icon>
</v-btn> -->
<button
@click="showAlignment(group, $event)"
@click="showAlignment(group, entry.db, $event)"
type="button"
class="v-btn v-btn--icon v-btn--round v-btn--text v-size--default"
:class="{
Expand Down Expand Up @@ -337,12 +337,13 @@ export default {
console.log(args);
return args;
},
showAlignment(item, event) {
showAlignment(item, db, event) {
if (this.alignment === item) {
this.closeAlignment();
} else {
this.alignment = null;
this.$nextTick(() => {
item.map(item => item.db = db);
this.alignment = item;
this.activeTarget = event.target.closest('.alignment-action');
this.alnBoxOffset = getAbsOffsetTop(this.activeTarget) + this.activeTarget.offsetHeight;
Expand Down
3 changes: 2 additions & 1 deletion frontend/StructureViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,10 @@ END
let tSeq = alignment.tSeq;
let tCa = alignment.tCa;
if (Number.isInteger(alignment.tCa) && Number.isInteger(alignment.tSeq)) {
const db = alignment.db;
const idx = alignment.tCa;
const ticket = this.$route.params.ticket;
const response = await this.$axios.get("api/result/" + ticket + '/' + this.$route.params.entry + '?format=brief&index=' + idx);
const response = await this.$axios.get("api/result/" + ticket + '/' + this.$route.params.entry + '?format=brief&index=' + idx + '&database=' + db);
tSeq = response.data.tSeq;
tCa = response.data.tCa;
}
Expand Down

0 comments on commit 0fba09c

Please sign in to comment.