CardamomOT.inference.trajectory

Core functions for the inference of trajectories, mainly used in loop_trajectories

Functions

find_next_prot_mixed(d1, P0, M0, M1, mode_init, ...)

Deterministic flow interpolating between two points

find_next_prot(d1, P0, M0, M1, mode_init, mode_end, ...)

Deterministic flow interpolating between two points

filter_network_fancy(T, N_traj, prot_traj, ks, ...[, ...])

Structured three-pass edge filtering that avoids both the greedy

Module Contents

CardamomOT.inference.trajectory.find_next_prot_mixed(d1, P0, M0, M1, mode_init, mode_end, alpha, s, delta_t)

Deterministic flow interpolating between two points

CardamomOT.inference.trajectory.find_next_prot(d1, P0, M0, M1, mode_init, mode_end, alpha, s, delta_t)

Deterministic flow interpolating between two points

CardamomOT.inference.trajectory.filter_network_fancy(T, N_traj, prot_traj, ks, basal_ref, inter_ref, seuil_intensity=0.05, seuil_variations=0.05, seuil_synergy=1.5, samples_data=None, n_jobs=-1)

Structured three-pass edge filtering that avoids both the greedy order-dependence problem and the silent-synergy problem.

Pass 1 — Canonical individual scoring

Each edge is evaluated independently against the full reference network. Produces a continuous impact score per edge.

Pass 2 — Conditional re-evaluation of rejected edges

Edges rejected in pass 1 are re-evaluated inside the filtered network (without other rejected edges). An edge that was silent in the full network but becomes significant once dominant edges are removed was being masked — it is reinstated.

Pass 3 — Pairwise synergy check among weak edges

Among edges with low but non-zero individual scores, pairs are tested jointly. If removing both edges together produces an impact significantly greater than the sum of their individual impacts (super-additivity), both edges are retained.

Parameters:
  • T (int) – Number of time steps.

  • N_traj (int) – Number of trajectories.

  • prot_traj (array) – Protein trajectories, shape (T * N_traj, G).

  • ks (array) – Kinetic parameters.

  • basal_ref (array) – Basal transcription rates, shape (G, n_networks) or (n_samples, G, n_networks).

  • inter_ref (array) – Reference interaction matrix, shape (G, G, n_networks).

  • seuil_intensity (float) – Minimum absolute edge weight to enter evaluation at all.

  • seuil_variations (float) – Minimum variation score to retain an edge (main threshold).

  • seuil_synergy (float) – Multiplicative factor above which joint impact is considered super-additive. An edge pair (e1, e2) is flagged as synergistic if impact(e1 + e2 removed) > seuil_synergy * (score(e1) + score(e2)). Default 2.0 (joint impact must be at least twice the additive sum).

  • samples_data (optional) – Additional per-sample data passed to _kon_per_sample.

  • n_jobs (int) – Number of parallel jobs for joblib (-1 = all cores).

Returns:

  • inter (array, shape (G, G, n_networks)) – Filtered interaction matrix (binary mask applied to inter_ref).

  • inter_t (array, shape (T, G, G, n_networks)) – Time-resolved interaction tensor.

  • report (dict) – Diagnostic report with keys: - ‘scores_pass1’ : raw scores from pass 1, shape (G, G, n_networks) - ‘reinstated’ : list of edges reinstated by pass 2 - ‘synergistic’ : list of edge pairs flagged as synergistic in pass 3 - ‘retained_mask’ : final boolean retention mask