Skip to content

Commit

Permalink
feat: similar search accross pdb
Browse files Browse the repository at this point in the history
  • Loading branch information
xnought committed Feb 1, 2024
1 parent b034f76 commit c634622
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ __pycache__/
.foldseek_cache/
foldseek/bin/foldseek
foldseek/README.md
foldseek-linux-sse2.tar.gz
foldseek-linux-sse2.tar.gz
pdb*
11 changes: 5 additions & 6 deletions backend/src/api/similar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
pdb_file_name,
revert_pdb_filename,
)
from ..foldseek import easy_search
from ..foldseek import easy_search, create_db

router = APIRouter()


@router.get("/similar-pdb/{protein_name:str}", response_model=list[SimilarProtein])
def get_pdb_proteins(protein_name: str):
# query_name = pdb_file_name(protein_name)
# target_folder = "src/data/pdbAlphaFold/"
# similar = easy_search(query_name, target_folder, out_format=["target", "prob"])
pass
# return [SimilarProtein(name=revert_pdb_filename(s[0]), prob=s[1]) for s in similar]
query_name = pdb_file_name(protein_name)
PDB = create_db("PDB", "pdb")
similar = easy_search(query_name, PDB, out_format=["target", "prob"])
return [SimilarProtein(name=s[0].split(".")[0], prob=s[1]) for s in similar]


@router.get("/similar-venome/{protein_name:str}", response_model=list[SimilarProtein])
Expand Down
6 changes: 1 addition & 5 deletions backend/src/foldseek.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,10 @@ def easy_search(
def create_db(
dir: str,
db_name: str,
foldseek_executable="foldseek",
foldseek_executable="foldseek/bin/foldseek",
print_stdout=False,
temp_dir=".foldseek_cache",
):
# don't continue unless they actually have foldseek installed
if bash_cmd(f"which {foldseek_executable}") == "":
raise Exception("foldseek not found in PATH")

# check that our dir exists
try:
bash_cmd(f"ls {dir}")
Expand Down

0 comments on commit c634622

Please sign in to comment.