CardamomOT.tools.plot_networks ============================== .. py:module:: CardamomOT.tools.plot_networks .. autoapi-nested-parse:: Network analysis and visualisation utilities for inferred GRNs. Functions --------- .. autoapisummary:: CardamomOT.tools.plot_networks.analyse_reseau CardamomOT.tools.plot_networks.reseau_top_regulateurs CardamomOT.tools.plot_networks.plot_network Module Contents --------------- .. py:function:: 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. :param matrix: G×G interaction matrix (positive = activation, negative = inhibition). :type matrix: np.ndarray or pd.DataFrame :param gene_names: Gene names matching matrix rows/columns. :type gene_names: list of str, optional :param top_regulateurs: Number of top regulators to show. :type top_regulateurs: int :param top_cibles: Number of top targets per regulator. :type top_cibles: int :param width_scale: Multiplier for edge width (proportional to |weight|). :type width_scale: float .. py:function:: 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. :param matrix: G×G interaction matrix. :type matrix: np.ndarray or pd.DataFrame :param gene_names: Gene names matching matrix rows/columns. :type gene_names: list of str, optional :param name: Figure title. :type name: str :param top_regulators: Number of top regulators (by total outgoing strength). :type top_regulators: int :param top_targets_per_reg: Maximum targets per regulator. :type top_targets_per_reg: int :param leaf_threshold: Minimum absolute weight (as fraction of max) to include a target. :type leaf_threshold: float :param width_scale: Multiplier for edge width. :type width_scale: float :returns: The reduced graph. :rtype: nx.DiGraph .. py:function:: 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 :func:`analyse_reseau` and :func:`reseau_top_regulateurs`. :param p: Path to the project directory (trailing slash included). :type p: str :param seuil: Edge-weight threshold passed as ``leaf_threshold`` to :func:`reseau_top_regulateurs` (fraction of max weight). :type seuil: float :param net_index: Index along the third axis of ``net_toplot.npy`` to visualise (default 0). :type net_index: int :param train: Data split used to recover gene names (``"full"`` or ``"train"``). :type train: str :param ns: Number of leading rows/columns to skip in ``net_toplot.npy`` (default 1, which drops the basal/stimulus node). :type ns: int