netmap.downstream.regulon.load_edge_dict_from_dataframe

netmap.downstream.regulon.load_edge_dict_from_dataframe(all_regulons)[source]

Reconstruct a nested edge dictionary from a flat regulon DataFrame.

Reverses the transformation performed by make_cluster_regulon_dataframe(), grouping rows back into the {set_type: {cluster: {'edges': DataFrame}}} structure. The 'set_type' and 'cluster' columns are dropped from the reconstructed edge DataFrames.

Parameters:

all_regulons (pd.DataFrame) – Flat DataFrame with at least columns 'set_type' and 'cluster' (as produced by make_cluster_regulon_dataframe()) plus whatever edge columns were present in the original nested structure.

Returns:

Nested dict of the form {set_type: {cluster: {'edges': pd.DataFrame}}}.

Return type:

dict