Skip to content

Commit

Permalink
feat: if foldseek not installed, error out, but make it so it still w…
Browse files Browse the repository at this point in the history
…orks
  • Loading branch information
xnought committed Feb 21, 2024
1 parent 54e394c commit eac52f3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
23 changes: 13 additions & 10 deletions backend/src/api/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,20 @@ def search_species():


@router.get(
"/search/venome/similar/{protein_name:str}", response_model=list[SimilarProtein]
"/search/venome/similar/{protein_name:str}",
response_model=list[SimilarProtein] | None,
)
def search_venome_similar(protein_name: str):
venome_folder = "/app/src/data/pdbAlphaFold/"
# ignore the first since it's itself as the most similar
similar = easy_search(
stored_pdb_file_name(protein_name), venome_folder, out_format="target,prob"
)[1:]
# TODO: replace by returning ids and not names
formatted = [
SimilarProtein(name=name.replace("_", " ").rstrip(".pdb"), prob=prob)
for [name, prob] in similar
]
return formatted
try:
similar = easy_search(
stored_pdb_file_name(protein_name), venome_folder, out_format="target,prob"
)[1:]
formatted = [
SimilarProtein(name=name.replace("_", " ").rstrip(".pdb"), prob=prob)
for [name, prob] in similar
]
return formatted
except Exception:
raise HTTPException(404, "Foldseek not found on the system")
10 changes: 9 additions & 1 deletion frontend/src/lib/SimilarProteins.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
let similarProteins: SimilarProtein[] = [];
onMount(async () => {
similarProteins = await Backend.searchVenomeSimilar(queryProteinName);
try {
similarProteins =
await Backend.searchVenomeSimilar(queryProteinName);
} catch (e) {
console.error(e);
console.error(
"NEED TO DOWNLOAD FOLDSEEK IN THE SERVER. SEE THE SERVER ERROR MESSAGE."
);
}
});
</script>

Expand Down

0 comments on commit eac52f3

Please sign in to comment.