Genome

AbstractGene is an abstract class representing extant or ancestral genes. An AbstractGene is defined by an unique id, the genome it belongs to and its parent AbstractGene.

class pyham.genome.Genome[source]

Genome is an abstract class representing extant or ancestral genomes. An Genome is defined by a unique taxon (node) in the Taxonomy.tree.

Attributes:
taxon (ete3.TreeNode of the pyham.taxonomy.tree): corresponding taxon.
name (str): Name of the Genome. Get from the newick tree if specified otherwise build it by concatenating all children genome names.
genes (list): list of pyham.abstractgene.AbstractGene related to this Genome.
add_gene(gene)[source]

This method adds an AbstractGene to the genes attributes and updates the AbstractGene.genome attribute.

Attributes:
taxon (Taxonomy.tree node): corresponding taxon.
name (str): Name of the Genome. Get from the newick tree if specified otherwise build it by concatenating all children genome names.
genes (list): list of AbstractGene related to this Genome.
Raises:

TypeError: if gene is not an AbstractGene.

abstractmethod get_number_genes()[source]

Return the number of genes

set_taxon(taxon)[source]

This method sets the taxon of the Genome.

Attributes:

taxon (Taxonomy.tree node): corresponding taxon.

Raises:

TypeError: if taxon is not an ete4.Tree. EvolutionaryConceptError: if the genome already has a taxon set.


class pyham.genome.ExtantGenome(name, NCBITaxId='-1', **kwargs)[source]

ExtantGenome class representing extant genomes. An ExtantGenome is defined by a unique name and a NCBI taxId.

Attributes:
name (str): unique genome name. This is the unique identifier of ExtantGenome.
taxid (dict): NCBI taxId.
get_number_genes(singleton=True)[source]

Get the number of genes of this ExtantGenome.

Args:
singleton (Bool): boolean to take into account singleton or not.
Returns:

int.


class pyham.genome.AncestralGenome[source]

AncestralGenome class representing ancestral genomes.

Attributes:

ancestral_clustering (dict): a dictionary that map each of this ancestral genome HOGs to its list of descendant extant genes.

get_ancestral_clustering()[source]

Lazy getter of the ancestral_clustering attribute.

Returns:

dict.

get_number_genes()[source]

Return the number of genes