Tree Profile

class pyham.TreeProfile.TreeProfile(ham, hog=None)[source]

Object that map on each node of the Ham species tree the related evolutionary information such as the number of genes the related genome contains or the number of evolutionary events (duplications, genes loss or gain of genes) that occurs between the parent node and itself. This can be either applied to the full Ham comparative genomic setup or for a specific HOG.

Attributes:
pyham (pyham.pyham.Ham): set of HOG ids used by the FilterOrthoXMLParser.
hog (pyham.abstractgene.HOG, optional): If specified, compute TreeProfile on a single HOGs. Defaults is None.
treemap (ete3.Etree): Ete3 Etree object containing the taxonomy of interest with annotated node.
computeTP_hog(hog)[source]

Create the treeMap object (ete3 Etree object with annotated nodes) that contained the following features for each nodes (representing an AbstractGene):

  • nbr_genes: numbers of HOG/Gene the genome contains. For leaves, it also counts the singletons.

  • dupl: numbers of HOGs that have arose by duplication in between this node and its parent.

  • retained: numbers of HOGs that have stay retained (in term of copy numbers) in between this node and its parent.

  • lost: numbers of HOGs that have been lost in between this node and its parent.

Returns:

TreeMap

compute_tree_profile_full()[source]

Create the treeMap object (ete3 Etree object with annotated nodes) that contained the following features for each nodes (the root node contains only nbr_genes):

  • nbr_genes: numbers of HOG/Gene the genome contains. For leaves, it also counts the singletons.

  • dupl: numbers of HOGs that have arose by duplication in between this node and its parent.

  • lost: numbers of HOGs that have been lost in between this node and its parent.

  • gain: numbers of HOGs that have “emerged” at this node.

  • retained: numbers of HOGs that have stay retained (in term of copy numbers) in between this node and its parent.

In order to get all those node informations, the HOGMap between each node and its parent is computed.

Returns:

TreeMap

export(output, layout_function=None, display_internal_histogram=True)[source]

Method to export the tree profile object as figure (available format .SVG, .PDF, .PNG).

– Some magic going there –

Args:
output (str): output file name. The extension of output will set the format of the figure (SVG, .PDF, .PNG)
layout_function (function, optional): custom layout_fn for ete3 TreeStyle.
display_internal_histogram (Boolean, optional): Display internal node as histogram or raw text with numbers. Defaults to True.
export_as_html(output)[source]

Method to export the tree profile object as an interactive tool embedded into a html file.

Args:
output (str): output file name. If filename finish by .html, a double click load the file into your default browser.