Taxonomy¶
- class pyham.taxonomy.Taxonomy(tree, **kwargs)[source]¶
Taxonomy is a class to wrap the ete4 tree used as reference species tree by Ham.
- Attributes:
- Args:
- tree_file (
str): Path to the file that contained the taxonomy information.tree_format (str): type of inputted tree file. Defaults to newick_string. Can be ‘newick’, ‘phyloxml, ‘newick_string’.use_internal_name (Boolean, optional): Specify wheter using the given internal node name or use theconcatenatation of the children name. Defaults to False.quoted_node_names (:obj:’Boolean’, optional): Specify whether newick file has quoted node names.
- add_genome_to_node(node, genome)[source]¶
add the given genome to the node attribute “genome”.
- Args:
- node (
node): receptor node.genome (Genome):Genometo attach.
- classmethod from_newick(tree: str | PathLike, use_internal_name=False, quoted_node_names=True)[source]¶
Create a Taxonomy object from a newick file or string.
- Args:
- tree (
str): Path to the file that contained the taxonomy information, or a newick string.use_internal_name (Boolean, optional): Specify whether using the given internal node name or use theconcatenatation of the children name. Defaults to False.quoted_node_names (:obj:’Boolean’, optional): Specify whether the newick tree has quoted node names. Defaults to True. - Returns:
obj:Taxonomy: Taxonomy object with the ete3 tree.
- get_extant_taxa_by_name(name)[source]¶
Return the extant taxa with the given name.
- Args:
- name (
str): name of the node to search. - Returns:
ete4.TreeNode: node with the given name.
- get_genome_from_taxnode(node)[source]¶
return the genome attached to the node.
- Args:
- node (
node): node to get the genome from. - Returns:
Genome: genome attached to the node.
- get_mrca_taxnode(*tax_nodes)[source]¶
return the most recent common ancestor of the given tax nodes.
- get_newick_from_tree(node)[source]¶
return the newick tree string (format 8: all names) rooted at the given node.
- Args:
node (
node): root node.- Returns:
strof the subtree.
- get_node_by_name(name)[source]¶
Return the node with the given name.
- Args:
- name (
str): name of the node to search. - Returns:
ete4.TreeNode: node with the given name.