PhyloTree class — A Python Environment for (phylogenetic) Tree Exploration

### Navigation

- index
- modules |
- next |
- previous |
- ETE documentation »
- ETE’s Reference Guide »

# PhyloTree class

class `PhyloNode`(newick=None, alignment=None, alg_format='fasta', sp_naming_function=<function _parse_species at 0x324ae60>, format=0)

  Bases: `ete2.coretype.tree.TreeNode`

  Extends the standard `TreeNode` instance. It adds specific attributes and methods to work with phylogentic trees.

  - Parameters: | newick – Path to the file containing the tree or, alternatively, the text string containing the same information. alignment – file containing a multiple sequence alignment. alg_format – “fasta”, “phylip” or “iphylip” (interleaved) format – sub-newick format
    FORMAT | DESCRIPTION
    --- | ---
    0 | flexible with support values
    1 | flexible with internal node names
    2 | all branches + leaf names + internal supports
    3 | all branches + all names
    4 | leaf branches + leaf names
    5 | internal and leaf branches + leaf names
    6 | internal branches + leaf names
    7 | leaf branches + all names
    8 | all names
    9 | leaf names
    100 | topology only
  sp_naming_function – Pointer to a parsing python function that receives nodename as first argument and returns the species name (see `PhyloNode.set_species_naming_function()`. By default, the 3 first letter of nodes will be used as species identifiers.
  Returns: | a tree node object which represents the base of the tree.

  `get_age`(species2age)
  `get_age_balanced_outgroup`(species2age)

    New in version 2.x.

    Returns the best outgroup according to topological ages and node sizes.

    Currently Experimental !!

  `get_descendant_evol_events`(sos_thr=0.0)

    Returns a list of all duplication and speciation events detected after this node. Nodes are assumed to be duplications when a species overlap is found between its child linages. Method is described more detail in:

    “The Human Phylome.” Huerta-Cepas J, Dopazo H, Dopazo J, Gabaldon T. Genome Biol. 2007;8(6):R109.

  `get_farthest_oldest_leaf`(species2age, is_leaf_fn=None)

    Returns the farthest oldest leaf to the current one. It requires an species2age dictionary with the age estimation for all species.

    Parameters: | is_leaf_fn (None) – A pointer to a function that receives a node instance as unique argument and returns True or False. It can be used to dynamically collapse nodes, so they are seen as leaves.

  `get_farthest_oldest_node`(species2age)

    New in version 2.1.

    Returns the farthest oldest node (leaf or internal). The difference with get_farthest_oldest_leaf() is that in this function internal nodes grouping seqs from the same species are collapsed.

  `get_my_evol_events`(sos_thr=0.0)

    Returns a list of duplication and speciation events in which the current node has been involved. Scanned nodes are also labeled internally as dup=True|False. You can access this labels using the ‘node.dup’ sintaxis.

    Method: the algorithm scans all nodes from the given leafName to the root. Nodes are assumed to be duplications when a species overlap is found between its child linages. Method is described more detail in:

    “The Human Phylome.” Huerta-Cepas J, Dopazo H, Dopazo J, Gabaldon T. Genome Biol. 2007;8(6):R109.

  `get_species`()

    Returns the set of species covered by its partition.

  `is_monophyletic`(species)

    Returns True id species names under this node are all included in a given list or set of species names.

  `iter_species`()

    Returns an iterator over the species grouped by this node.

  `link_to_alignment`(alignment, alg_format='fasta')
  `reconcile`(species_tree)

    Returns the reconcilied topology with the provided species tree, and a list of evolutionary events inferred from such reconciliation.

  `set_species_naming_function`(fn)

    Sets the parsing function used to extract species name from a node’s name.

    Parameters: | fn – Pointer to a parsing python function that receives nodename as first argument and returns the species name.

        # Example of a parsing function to extract species names for
        # all nodes in a given tree.
        def parse_sp_name(node_name):
            return node_name.split("_")[1]
        tree.set_species_naming_function(parse_sp_name)

  `species`

`PhyloTree`

  alias of `PhyloNode`

class `EvolEvent`

  Basic evolutionary event. It stores all the information about an event(node) ocurred in a phylogenetic tree.

  `etype` : `D` (Duplication), `S` (Speciation), `L` (gene loss),

  `in_seqs` : the list of sequences in one side of the event.

  `out_seqs` : the list of sequences in the other side of the event

  `node` : link to the event node in the tree

### Navigation

- index
- modules |
- next |
- previous |
- ETE documentation »
- ETE’s Reference Guide »