Skip to contents

Implements the two-pass interaction-selection pattern used manually in Akhiad's analysis workflow:

Usage

add_interactions_progressive(
  traj_model,
  thresholds = c(0.01, 5e-04),
  only_sig_motifs = c(TRUE, FALSE),
  only_sig_add_motifs = c(TRUE, TRUE),
  additional_features_builder = NULL,
  interaction_scale_factor = 1,
  min_signal_correlation = NULL,
  seed = 60427,
  ...
)

Arguments

traj_model

A TrajectoryModel.

thresholds

A numeric vector of interaction_threshold values, one per pass. Default c(0.01, 0.0005) mirrors Akhiad's pattern.

only_sig_motifs

A logical vector matched to thresholds. Default c(TRUE, FALSE).

only_sig_add_motifs

A logical vector matched to thresholds. Default c(TRUE, TRUE).

additional_features_builder

NULL or a function taking the traj_model after pass 1 and returning a data frame to cbind onto @additional_features. Use default_score_split_features() as a ready-made builder when atac_scores is available.

interaction_scale_factor, min_signal_correlation

Forwarded to each add_interactions() call.

seed

Integer seed forwarded to add_interactions().

...

Additional arguments forwarded to add_interactions() (e.g. max_motif_n, max_add_n, max_n, logist_interactions).

Value

The updated trajectory model with interactions and any engineered additional features from the builder.

Details

  1. First pass: tight interaction_threshold[1], typically with only_sig_motifs = TRUE — a strict selection to seed the model with high-confidence interactions.

  2. (Optional) Call additional_features_builder(traj_model) to produce engineered additional features (e.g. base_pred, end_pred from default_score_split_features()) and inject them. Relearn once so the next pass sees an enriched anchor set.

  3. Second pass: looser interaction_threshold[2], typically with only_sig_motifs = FALSE and force = TRUE — broader selection that can pick interactions anchored on the newly-injected features.

Without a feature builder, the two passes are equivalent to a single add_interactions() call at the final (loosest) threshold, so the primary use case is with default_score_split_features or a custom builder. For data without multi-bin atac_scores, prefer a single add_interactions() call with interaction_threshold = thresholds[1].