CardamomOT.tools.plot_networks

Network analysis and visualisation utilities for inferred GRNs.

Functions

analyse_reseau(matrix[, gene_names, top_regulateurs, ...])

Plot per-regulator subgraphs for the top regulators in the GRN.

reseau_top_regulateurs(matrix[, gene_names, name, ...])

Draw a reduced GRN showing only top regulators and their top targets.

plot_network(p[, seuil, net_toplot, net_index, train, ns])

Visualise the inferred GRN for a project directory.

Module Contents

CardamomOT.tools.plot_networks.analyse_reseau(matrix, gene_names=None, top_regulateurs=10, top_cibles=10, width_scale=5)

Plot per-regulator subgraphs for the top regulators in the GRN.

Parameters:
  • matrix (np.ndarray or pd.DataFrame) – G×G interaction matrix (positive = activation, negative = inhibition).

  • gene_names (list of str, optional) – Gene names matching matrix rows/columns.

  • top_regulateurs (int) – Number of top regulators to show.

  • top_cibles (int) – Number of top targets per regulator.

  • width_scale (float) – Multiplier for edge width (proportional to |weight|).

CardamomOT.tools.plot_networks.reseau_top_regulateurs(matrix, gene_names=None, name='Réseau réduit top régulateurs', top_regulators=10, top_targets_per_reg=8, leaf_threshold=0.0, width_scale=5)

Draw a reduced GRN showing only top regulators and their top targets.

Parameters:
  • matrix (np.ndarray or pd.DataFrame) – G×G interaction matrix.

  • gene_names (list of str, optional) – Gene names matching matrix rows/columns.

  • name (str) – Figure title.

  • top_regulators (int) – Number of top regulators (by total outgoing strength).

  • top_targets_per_reg (int) – Maximum targets per regulator.

  • leaf_threshold (float) – Minimum absolute weight (as fraction of max) to include a target.

  • width_scale (float) – Multiplier for edge width.

Returns:

The reduced graph.

Return type:

nx.DiGraph

CardamomOT.tools.plot_networks.plot_network(p, seuil=0.3, net_toplot='inter_simul', net_index=0, train='full', ns=1)

Visualise the inferred GRN for a project directory.

Loads net_toplot.npy and plots the top regulators using analyse_reseau() and reseau_top_regulateurs().

Parameters:
  • p (str) – Path to the project directory (trailing slash included).

  • seuil (float) – Edge-weight threshold passed as leaf_threshold to reseau_top_regulateurs() (fraction of max weight).

  • net_index (int) – Index along the third axis of net_toplot.npy to visualise (default 0).

  • train (str) – Data split used to recover gene names ("full" or "train").

  • ns (int) – Number of leading rows/columns to skip in net_toplot.npy (default 1, which drops the basal/stimulus node).