Skip to content

Commit

Permalink
Fix query endpoint for cif files
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed May 15, 2024
1 parent 8364a21 commit fe64840
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions backend/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,23 @@ func server(jobsystem JobSystem, config ConfigRoot) {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
var suffix string
var queryPath string
switch config.App {
case "foldseek":
suffix = ".pdb"
pdbPath := filepath.Join(config.Paths.Results, string(ticket.Id), "job.pdb")
cifPath := filepath.Join(config.Paths.Results, string(ticket.Id), "job.cif")
if fileExists(pdbPath) {
queryPath = pdbPath
} else if fileExists(cifPath) {
queryPath = cifPath
} else {
http.Error(w, "File not found", http.StatusBadRequest)
return
}
default:
suffix = ".fasta"
queryPath = filepath.Join(config.Paths.Results, string(ticket.Id), "job.fasta")
}
query, err := os.ReadFile(filepath.Join(config.Paths.Results, string(ticket.Id), "job"+suffix))
query, err := os.ReadFile(queryPath)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
Expand Down

0 comments on commit fe64840

Please sign in to comment.