Mapper (genomes)

class pyham.mapper.HOGsMap(ham_object, genome1, genome2)[source]

Class to compare HOG evolutionary relations (duplication, loss, gain and retained) between an ancestor genome and its descendant genome.

Let’s consider Go the oldest genome and Gy the youngest genome with their respected HOGs Ho and Hy.

Those relations are classified into the following categories:
  • RETAINED: if Ho will correspond to a single Hy.

  • DUPLICATE: If a duplication occurred in Ho in between Go ang Gy.

  • LOSS: If Ho have no representative Hy in Gy.

  • GAIN: if Hy have no ancestor Ho in Go.

First, a “UpMap” is build to find for each Hy its potential ancestor Ho. If during the traversal from Hy to Ho a duplication occurred, a flag “paralog” is added in the UpMap[Hy]. Hy with no corresponding Ho are considered as gained meanwhile Ho without corresponding Hy are considered as lost. Ho with only one corresponding Hy (and no duplication tag) are clustered as retained otherwhise as duplicated.

Attributes:
Ham (pyham.pyham.Ham): Ham object.
upMap (dict): a dictionary that map each Ho with its related Hy (or None if no HOG founded) associated a boolean if a duplication occurs or not in between them.
RETAINED (dict): Dictionary that map a Ho with its descendant Hy.
DUPLICATE (dict): Dictionary that map a Ho with its list of descendants Hy.
LOSS (list): a list of Ho with no matching in Gy.
GAIN: (list): a list of Hy with no ancestor in Go.
number_duplication: (int): number of duplication events that explain the DUPLICATE genes.
Args:
genome1 (pyham.genome.Genome): First pyham.genome.Genome to compare.
genome2 (pyham.genome.Genome): Second pyham.genome.Genome to compare.

class pyham.mapper.MapResults(HAM)[source]

Abstract class to map HOGs across multiple genomes through their most recent common ancestral genome. The HOGs are all clustered based on their relation with the mrca genome HOGs (duplicated, lost, gained and retained).

Let’s consider Go the mrca genome and Gn the youngest genomes with their respected HOGs Ho and Hn.

The HOG relations between Ho and Hn are classified into the following categories:
  • RETAINED: if Ho will correspond to a single Hn in Gn.

  • DUPLICATE: If a duplication occurred in Ho in between Go ang Gn.

  • LOSS: If Ho have no representative Hn in Gn.

  • GAIN: if Hn have no ancestor Ho in Go.

There is two type of possible mapping:
  • vertical: compare a genome with its ancestor (that act as “mrca”).

  • lateral: compare genomes with their mrca.

The MapResults provides methods to compare HOGs across genomes:
  • get_loss()

  • get_gain()

  • get_duplicate()

  • get_retained()

Attributes:
Ham (pyham.pyham.Ham): Ham object.
abstractmethod add_map(map)[source]

Add a map to the MapResults object

abstractmethod get_duplicated()[source]

Return genes that duplicate

abstractmethod get_gained()[source]

Return the gained genes

abstractmethod get_lost()[source]

Return the lost genes

abstractmethod get_retained()[source]

Return genes that stay single copy


class pyham.mapper.MapVertical(ham)[source]

Class to map HOGs between a genome and its ancestor.

Let’s consider Go the oldest genome and Gn the youngest genome with their respected HOGs Ho and Hn.

Attributes:
add_map(HogMap)[source]

Method to set the HOGsMap.

Args:

HogMap (pyham.mapper.HOGsMap): HOGsMap to add.

Raises:

TypeError: if HogMap is not pyham.mapper.HOGsMap or if a pyham.mapper.HOGsMap is already set.

get_duplicated()[source]

Getter for duplicated genes.

Returns:

Dictionary of Ho mapped to their list of descendants Hy.

get_gained()[source]

Getter for gained genes.

Returns:

List of Hn.

get_lost()[source]

Getter for lost genes.

Returns:

List of Ho.

get_number_duplications()[source]

Getter of number of duplication events.

Returns:

int for number of duplications.

get_retained()[source]

Getter for retained genes.

Returns:

Dictionary of Ho mapped to their descendant Hy.


class pyham.mapper.MapLateral(HAM)[source]

Class to map HOGs between genomes through their ancestor.

Let’s consider Go the oldest genome and Gn the youngest genomes with their respected HOGs Ho and Hn.

Attributes:
descendant (list): list of Gn.
map (dict): dictionary of Gn mapped to a HOGMap(Go,Gn).
LOSS (dict): dictionary of Ho mapped to the list of Gn where this HOG is lost.
GAIN (dict): dictionary of Gn mapped to their list of gained Hn.
RETAINED (dict): dictionary of Ho mapped to a dict of Gn mapped to a Hn.
DUPLICATE (dict): dictionary of Ho mapped to a dict of Gn mapped to a list of Hn.
add_map(HogMap)[source]

Method to add the HOGsMap.

Args:

HogMap (pyham.mapper.HOGsMap): HOGsMap to add.

Raises:

TypeError: if HogMap is not pyham.mapper.HOGsMap or if HOGMap ancestor doesn’t match the MapLateral one.

get_duplicated()[source]

Lazy getter for duplicated genes.

Returns:

dictionary of Hi -> dict of Gn -> list of Hn.

get_gained()[source]

Lazy getter for gained genes.

Returns:

dictionary of Gn -> [Hn].

get_lost()[source]

Lazy getter for lost genes.

Returns:

dictionary of Ho -> [Gn].

get_retained()[source]

Lazy getter for retained genes.

Returns:

dictionary of Hi -> dict of Gn -> Hn.