Skip to content

Commit

Permalink
setting aside nfs-dependent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davek44 committed Oct 27, 2024
1 parent 902ad29 commit ebbb789
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 50 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,6 @@ dmypy.json
src/baskerville/scripts/borzoi_test_genes.py
src/baskerville/pygene.py
src/baskerville/snps_old.py

# backup
**/*.py~
19 changes: 19 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest
from pathlib import Path

def pytest_collection_modifyitems(config, items):
if not config.getoption("--integration"):
skip_integration = pytest.mark.skip(reason="Integration test - use --integration to run")
for item in items:
test_path = Path(item.fspath)
if "integration" in test_path.parts:
item.add_marker(skip_integration)

def pytest_addoption(parser):
print("Adding custom option") # Debug print
parser.addoption(
"--integration",
action="store_true",
default=False,
help="run integration tests"
)
File renamed without changes.
49 changes: 49 additions & 0 deletions tests/integration/test_transfer_load.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import json
import numpy as np
import pandas as pd
from baskerville import seqnn

def test_housby():
model_file = "/home/yuanh/analysis/Borzoi_transfer/exp_10_10_23/hayflick/houlsby/latent_8/train/f0c0/train/model_best.h5"
targets_file = "tests/data/transfer/targets.txt"
params_file = "tests/data/transfer/json/model_houlsby.json"

# model params
with open(params_file) as params_open:
params = json.load(params_open)
params_model = params["model"]
params_model["verbose"] = False

# set strand pairs
targets_df = pd.read_csv(targets_file, index_col=0, sep="\t")
if "strand_pair" in targets_df.columns:
params_model["strand_pair"] = [np.array(targets_df.strand_pair)]
strand_pair = np.array(targets_df.strand_pair)

seqnn_model = seqnn.SeqNN(params_model)
seqnn_model.restore(model_file)

print("load model success!")


def test_se4():
model_file = "/home/yuanh/analysis/Borzoi_transfer/exp_10_10_23/hayflick/houlsby_se/se2/train/f0c0/train/model_best.h5"
targets_file = "tests/data/transfer/targets.txt"
params_file = "tests/data/transfer/json/model_se4.json"

# model params
with open(params_file) as params_open:
params = json.load(params_open)
params_model = params["model"]
params_model["verbose"] = False

# set strand pairs
targets_df = pd.read_csv(targets_file, index_col=0, sep="\t")
if "strand_pair" in targets_df.columns:
params_model["strand_pair"] = [np.array(targets_df.strand_pair)]
strand_pair = np.array(targets_df.strand_pair)

seqnn_model = seqnn.SeqNN(params_model)
seqnn_model.restore(model_file)

print("load model success!")
25 changes: 0 additions & 25 deletions tests/test_transfer/test_load_houlsby.py

This file was deleted.

25 changes: 0 additions & 25 deletions tests/test_transfer/test_load_houlsby_se4.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ebbb789

Please sign in to comment.