Files
SimurgArray/tests/conftest.py
T
kemal c0d556d4af P3: normalization fit (1.2.0 and 1.1.2), apply, polar, simurg normalize
- signal/normalization/numerics.py: vendor percentile, trimmean, MAD sigma
  (old/new), bisquare robust fits, float32/float64 typing and sequential
  sums reproduced exactly (ported from gtc2vcf, MIT)
- signal/normalization/fit.py: outlier removal, offset, rotation, shear,
  scale, nn12/rr12, single-channel model for small Infinium I bins,
  exact and binned nearest-neighbour sweeps; vendor quirks marked QUIRK
- signal/normalization/apply.py: affine transform and theta/R
- pipeline/normalize.py + CLI `simurg normalize`
- oracle GTCs rebuilt with -ffp-contract=off (aarch64 gcc fuses a*b+c by
  default, shifting the last bits); the old FMA oracle differed by <=4 ULP

Result: transforms bit-identical to the oracle for all 36 GSA samples x
48 bins, for both normalization versions (3456/3456 bins, 0 ULP).
2026-09-27 22:51:06 +01:00

47 lines
1.9 KiB
Python

"""Shared test configuration.
Tests marked ``data`` need files fetched by ``scripts/fetch_data.sh p0``; tests marked ``oracle`` need
reference repositories under ``refs/`` (``scripts/bootstrap_refs.sh``). Both are skipped when absent.
"""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
DATA = ROOT / "data" / "p0"
REFS = ROOT / "refs"
GSA = DATA / "gsa_v4_pgx"
GSA_BPM = GSA / "GSA-PGx-48v4-0_20079540_E2_bpm" / "GSA-PGx-48v4-0_20079540_E2.bpm"
GSA_CSV = GSA / "GSA-PGx-48v4-0_20079540_E2_csv" / "GSA-PGx-48v4-0_20079540_E2.csv"
GSA_EGT = GSA / "GSA-PGx-48v4-0_20079540_E2_ClusterFile" / "GSA-PGx-48v4-0_20079540_E2_ClusterFile.egt"
GSA_IDATS = GSA / "idats_Demo_36" / "idats_Demo_36"
GDA_EGT = DATA / "gda_v1" / "infinium-global-diversity-array-8-v1-0-D1-cluster-file" / "GDA-8v1-0_D1_ClusterFile.egt"
GDA_BPM = DATA / "gda_v1" / "infinium-global-diversity-array-8-v1-0-D1-manifest-file-bpm" / "GDA-8v1-0_D1.bpm"
GDA_SHEET = DATA / "gda_v1" / "infinium-global-diversity-array-8-v1-0_D1_SampleSheet_Demo_36.csv"
BIOC_IDATS = DATA / "bioc" / "IlluminaDataTestFiles_1.50.0" / "IlluminaDataTestFiles" / "inst" / "extdata" / "idat"
ORACLE_GTCS = DATA / "oracle" / "gsa_gt3_nofma" # gtc2vcf, normalization 1.2.0, no FMA
ORACLE_GTCS_GT2 = DATA / "oracle" / "gsa_gt2_nofma" # normalization 1.1.2
def need(*paths: Path) -> None:
missing = [p for p in paths if not p.exists()]
if missing:
pytest.skip(f"missing test data: {missing[0]} (run scripts/fetch_data.sh p0)")
@pytest.fixture(scope="session")
def beadarrayfiles(): # type: ignore[no-untyped-def]
"""Illumina BeadArrayFiles (BSD-2) as an oracle."""
path = REFS / "BeadArrayFiles"
if not (path / "module").is_dir():
pytest.skip("refs/BeadArrayFiles not present (run scripts/bootstrap_refs.sh)")
sys.path.insert(0, str(path))
import module # type: ignore[import-not-found]
return module