-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
71 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.