oadr_cpep.common_utils module

Shared low-level helpers for the oadr-cpep steps: data loading, within-site scaling, cross-validation, and metrics. No step logic and no plotting live here (plotting is in plot.py).

oadr_cpep.common_utils.load_site(site, panel, *, tidy=None, aa=None, demo=None, cpeptide=None, arms=None, arm_subjects=None)[source]

Load one study + panel from explicit file paths -> (frame, feature_names, target).

oadr_cpep.common_utils.read_feature_list(features)[source]

Read a feature-list CSV (column ‘feature’) -> (feats, source_basename, source_tag).

source_tag is the leading token of the filename (e.g. SDY524), used to stamp every fit output so you can see which feature set it was fit on.

oadr_cpep.common_utils.stem(site, panel, source_tag)[source]

The <site>_from-<src>_panel<X> filename stem shared by every fit output.

oadr_cpep.common_utils.design_matrix(frame, feats)[source]

Reindex the site frame to feats, fill missing with 0 -> float ndarray.

oadr_cpep.common_utils.kfold(n, seed)[source]

5-fold (fewer for tiny studies) shuffled KFold.

oadr_cpep.common_utils.cv_predict(build_model, X, y, kf)[source]

Out-of-fold predictions, a fresh model per fold, scaled within the fold.

oadr_cpep.common_utils.r2(y, p)[source]
oadr_cpep.common_utils.mse(y, p)[source]
oadr_cpep.common_utils.bootstrap_r2_ci(y, p, n_boot, seed)[source]