aphylogeo.genetic_trees

class aphylogeo.genetic_trees.GeneticTrees(trees_dict: dict, format: str = 'newick')[source]

Bases: object

Class that contains the genetic trees. It can save and load the trees from file or json format. The trees are stored in a dictionary {str(window), biopython tree}

get_trees_str() dict[source]

Get the trees in string format.

Returns:

{str, str}

Return type:

trees (dict)

save_trees_to_json(file_name: str, format: str = 'newick')[source]

Save the trees in json format.

Parameters:
  • file_name (str) – the name of the file

  • format (str) – the format of the trees - default: newick

classmethod load_trees_from_file(file_name: str, format: str = 'newick') dict[source]

Load the trees from json format.

Parameters:
  • file_name (str) – the name of the file

  • format (str) – the format of the trees - default: newick Can be called with None as format and Biopython will identitfy the format.

Returns:

dict of windows, with the trees in biopython format.

Return type:

GeneticTrees

classmethod load_trees_from_json(trees: str, format: str = 'newick') dict[source]

Load the trees from json format.

Parameters:
  • trees (str) – the trees in json format

  • format (str) – the format of the trees - default: newick Can be called with None as format and Biopython will identitfy the format.

Returns:

dict of windows, with the trees in biopython format.

Return type:

GeneticTrees

classmethod testtrees(file_name: str, format: str = 'newick') dict[source]

Load the trees from json format.

Parameters:
  • file_name (str) – the name of the file

  • format (str) – the format of the trees - default: newick Can be called with None as format and Biopython will identitfy the format.