======================================================================
OPTION A: Within-serovar domain enrichment (PP1 vs rest)
======================================================================

--- A1. Within PP1: Typhimurium vs Monophasic domain carriage ---
  NLPC_P60: Typhimurium 122/134 (91.0%) vs Monophasic 49/50 (98.0%)  OR=0.21 p=0.191
  SLT: Typhimurium 134/134 (100.0%) vs Monophasic 50/50 (100.0%)  OR=nan p=1
  Phage_lysozyme: Typhimurium 132/134 (98.5%) vs Monophasic 46/50 (92.0%)  OR=5.74 p=0.0474
  Amidase_2: Typhimurium 0/134 (0.0%) vs Monophasic 0/50 (0.0%)  OR=nan p=1

--- A2. Within Typhimurium: PP1 vs non-PP1 domain carriage ---
  NLPC_P60: PP1-Typh 122/134 (91.0%) vs non-PP1-Typh 4/4  OR=0.00 p=1  [n_out=4]
  SLT: PP1-Typh 134/134 (100.0%) vs non-PP1-Typh 4/4  OR=nan p=1  [n_out=4]
  Phage_lysozyme: PP1-Typh 132/134 (98.5%) vs non-PP1-Typh 4/4  OR=0.00 p=1  [n_out=4]
  Amidase_2: PP1-Typh 0/134 (0.0%) vs non-PP1-Typh 0/4  OR=nan p=1  [n_out=4]

--- A3. Within Enteritidis: PP2 vs non-PP2 domain carriage ---
  NLPC_P60: PP2-Ent 12/141 (8.5%) vs non-PP2-Ent 0/1  OR=inf p=1  [n_out=1]
  SLT: PP2-Ent 10/141 (7.1%) vs non-PP2-Ent 1/1  OR=0.00 p=0.0775  [n_out=1]
  Phage_lysozyme: PP2-Ent 141/141 (100.0%) vs non-PP2-Ent 1/1  OR=nan p=1  [n_out=1]
  Amidase_2: PP2-Ent 0/141 (0.0%) vs non-PP2-Ent 0/1  OR=nan p=1  [n_out=1]

======================================================================
OPTION B: Direct genome-level domain-vs-MDR test (R2-023)
======================================================================

--- B1. All 542 QC genomes: domain carriage vs MDR ---
  NLPC_P60: MDR rate with domain 70/250 (28.0%) vs without 62/292 (21.2%)  OR=1.44 p=0.0714
  SLT: MDR rate with domain 105/348 (30.2%) vs without 27/194 (13.9%)  OR=2.67 p=1.7e-05
  Phage_lysozyme: MDR rate with domain 115/495 (23.2%) vs without 17/47 (36.2%)  OR=0.53 p=0.0735
  Amidase_2: MDR rate with domain 0/2 (0.0%) vs without 132/540 (24.4%)  OR=0.00 p=1

--- B2. Stratified by serovar: domain vs MDR within each major serovar ---

  Typhimurium (n=138, MDR 35):
    NLPC_P60: MDR with 25/126 (19.8%) vs without 10/12 (83.3%)  OR=0.05 p=1.66e-05
    SLT: no variation (with=138, without=0)
    Phage_lysozyme: MDR with 34/136 (25.0%) vs without 1/2 (50.0%)  OR=0.33 p=0.444

  Monophasic Typhimurium (n=50, MDR 29):
    NLPC_P60: MDR with 29/49 (59.2%) vs without 0/1 (0.0%)  OR=inf p=0.42
    SLT: no variation (with=50, without=0)
    Phage_lysozyme: MDR with 26/46 (56.5%) vs without 3/4 (75.0%)  OR=0.43 p=0.63

  Enteritidis (n=142, MDR 17):
    NLPC_P60: MDR with 2/12 (16.7%) vs without 15/130 (11.5%)  OR=1.53 p=0.638
    SLT: MDR with 1/11 (9.1%) vs without 16/131 (12.2%)  OR=0.72 p=1
    Phage_lysozyme: no variation (with=142, without=0)

  Typhi (n=34, MDR 3):
    NLPC_P60: MDR with 1/1 (100.0%) vs without 2/33 (6.1%)  OR=inf p=0.0882
    SLT: MDR with 3/33 (9.1%) vs without 0/1 (0.0%)  OR=inf p=1
    Phage_lysozyme: no variation (with=34, without=0)

======================================================================
OPTION B3: Logistic regression MDR ~ domain + serovar
======================================================================
n=542, MDR=132
  NLPC_P60: model failed: cannot convert the series to <class 'float'>
  SLT: model failed: cannot convert the series to <class 'float'>
  Phage_lysozyme: model failed: cannot convert the series to <class 'float'>

======================================================================
OPTION B3: Logistic regression MDR ~ domain + serovar (Enteritidis = reference)
======================================================================
n=542, MDR=132
  NLPC_P60: adjusted OR=0.45 (95% CI 0.24-0.84), p=0.0119
  SLT: adjusted OR=1.86 (95% CI 0.95-3.63), p=0.0703
  Phage_lysozyme: adjusted OR=0.67 (95% CI 0.33-1.34), p=0.256
