|
2 | 2 | import polars as pl |
3 | 3 | import pytest |
4 | 4 |
|
5 | | -pytest.skip("Disabled pending refactor", allow_module_level=True) |
| 5 | +# pytest.skip("Disabled pending refactor", allow_module_level=True) |
6 | 6 |
|
7 | | -from hdxms_datasets.datasets import DataSet, allow_missing_fields |
8 | | -from hdxms_datasets.datavault import DataVault |
9 | 7 | from polars.testing import assert_frame_equal |
10 | 8 |
|
| 9 | +from hdxms_datasets.database import DataBase |
| 10 | +from hdxms_datasets.process import merge_peptides, compute_uptake_metrics |
| 11 | + |
11 | 12 |
|
12 | 13 | TEST_PTH = Path(__file__).parent |
| 14 | +DATA_ID_CLUSTER_SECA = "HDX_3BAE2080" |
| 15 | +DATA_ID_STATE_SECA = "HDX_C1198C76" |
13 | 16 |
|
14 | 17 |
|
15 | 18 | # Creating a DataVault without giving a cache path name uses $home/.hdxms_datasets by default |
16 | | -vault = DataVault(TEST_PTH / "datasets") |
17 | | - |
18 | | - |
19 | | -@pytest.fixture |
20 | | -def cluster_data() -> DataSet: |
21 | | - return vault.load_dataset("1744801204_SecA_cluster_Krishnamurthy") |
| 19 | +vault = DataBase(TEST_PTH / "datasets") |
22 | 20 |
|
23 | 21 |
|
24 | 22 | def test_load_convert_cluster(): |
25 | | - with allow_missing_fields(): |
26 | | - ds = vault.load_dataset("1744801204_SecA_cluster_Krishnamurthy") |
| 23 | + """Load and compare to saved result""" |
| 24 | + dataset = vault.load_dataset(DATA_ID_CLUSTER_SECA) |
27 | 25 |
|
28 | | - df_test = ds.get_state(0).compute_uptake_metrics().to_native() |
29 | | - df_ref = pl.read_parquet(TEST_PTH / "test_data" / "dynamx_cluster.pq") |
| 26 | + state = dataset.get_state(0) |
| 27 | + merged = merge_peptides(state.peptides) |
| 28 | + df_test = compute_uptake_metrics(merged, exception='ignore').to_native() |
| 29 | + |
| 30 | + df_ref = pl.read_parquet(TEST_PTH / "test_data" / "HDX_3BAE2080_state_0_processed.pq") |
30 | 31 |
|
31 | 32 | assert_frame_equal(df_test, df_ref) |
32 | 33 |
|
33 | 34 |
|
34 | 35 | def test_load_convert_state(): |
35 | | - with allow_missing_fields(): |
36 | | - ds = vault.load_dataset("1665149400_SecA_Krishnamurthy") |
37 | | - df_test = ds.get_state(0).compute_uptake_metrics().to_native() |
38 | | - df_ref = pl.read_parquet(TEST_PTH / "test_data" / "dynamx_state.pq") |
39 | | - |
40 | | - assert_frame_equal(df_test, df_ref) |
| 36 | + """Load and compare to saved result""" |
| 37 | + dataset = vault.load_dataset(DATA_ID_STATE_SECA) |
41 | 38 |
|
| 39 | + state = dataset.get_state(0) |
| 40 | + merged = merge_peptides(state.peptides) |
| 41 | + df_test = compute_uptake_metrics(merged, exception='ignore').to_native() |
42 | 42 |
|
43 | | -def test_load_convert_hdexaminer(): |
44 | | - with allow_missing_fields(): |
45 | | - ds = vault.load_dataset("1745478702_hd_examiner_example_Sharpe") |
46 | | - df_test = ds.get_state(0).compute_uptake_metrics().to_native() |
47 | | - df_ref = pl.read_parquet(TEST_PTH / "test_data" / "hd_examiner.pq") |
| 43 | + df_ref = pl.read_parquet(TEST_PTH / "test_data" / f"{DATA_ID_STATE_SECA}_state_0_processed.pq") |
48 | 44 |
|
49 | 45 | assert_frame_equal(df_test, df_ref) |
0 commit comments