io¶

I/O helpers for tree genomes (JSON load/save and networkx conversion).

Module Contents¶

Functions¶

load_genome(...)

Load a TreeGenome from a JSON file.

save_genome(→ None)

Save a TreeGenome to a JSON file.

genome_to_networkx_dict(→ dict[str, Any])

Convert a TreeGenome to a dictionary format compatible with networkx.

load_genome(path: str) ariel.ec.genotypes.tree.tree_genome.TreeGenome¶

Load a TreeGenome from a JSON file.

Parameters:

path (str) – Path to the JSON file containing the genome.

Returns:

The loaded TreeGenome instance.

Return type:

TreeGenome

save_genome(genome: ariel.ec.genotypes.tree.tree_genome.TreeGenome, path: str) None¶

Save a TreeGenome to a JSON file.

Parameters:
  • genome (TreeGenome) – The TreeGenome instance to save.

  • genome.save_json(path)

genome_to_networkx_dict(genome: ariel.ec.genotypes.tree.tree_genome.TreeGenome) dict[str, Any]¶

Convert a TreeGenome to a dictionary format compatible with networkx.

Parameters:

genome (TreeGenome) – The TreeGenome instance to convert.

Returns:

A dictionary representation of the genome suitable for networkx.

Return type:

dict[str, Any]