Skip to content

Commit

Permalink
add torch dependency, fix 3dzd embedding test (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
TerkaSlan authored Feb 1, 2025
1 parent fe53af2 commit b24c049
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
3 changes: 1 addition & 2 deletions training/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
pandas
pillow
keras
torch
scikit-learn
matplotlib
numpy
pandas
pyyaml
kaleido
faiss-cpu
Expand Down
10 changes: 3 additions & 7 deletions training/tests/test_create_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
import re
import tempfile
from pathlib import Path

import pandas as pd
import pytest
from alphafind_training.create_embedding import create_embedding


@pytest.fixture(scope="function")
def output_file():
# Setup: Define the output file path
Expand All @@ -32,17 +30,15 @@ def test_create_embedding():
with tempfile.TemporaryDirectory() as tmpdir:
cif_path = "./data/cifs"
output_path = f"{tmpdir}/embedding.pkl"
granularity = 10

# 45 features for each protein - (10x10 - 10) / 2
expected_dimensionality = 45
expected_dimensionality = 121

create_embedding(Path(cif_path), Path(output_path), granularity)
create_embedding(Path(cif_path), Path(output_path))

assert os.path.exists(output_path)
assert os.path.getsize(output_path) > 0
# load embedding.pkl and check if it has the correct shape
df = pd.read_pickle(output_path)
df = pd.read_parquet(output_path)
assert df.shape[0] == len(os.listdir(cif_path))
assert df.shape[1] == expected_dimensionality

Expand Down
3 changes: 1 addition & 2 deletions training/tests/test_create_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
def _setup(tempdir: str):
create_embedding(
input_path=Path("./data/cifs"),
output_path=Path(f"{tempdir}/embedding.pkl"),
granularity=10
output_path=Path(f"{tempdir}/embedding.pkl")
)


Expand Down
3 changes: 1 addition & 2 deletions training/tests/test_model_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
def _setup(tempdir: str):
create_embedding(
input_path=Path("./data/cifs"),
output_path=Path(f"{tempdir}/embedding.pkl"),
granularity=10
output_path=Path(f"{tempdir}/embedding.pkl")
)

create_kmeans(
Expand Down

0 comments on commit b24c049

Please sign in to comment.