GeneContext#
- class panorama.region.GeneContext(pangenome, gc_id, families, families_of_interest)#
Bases:
GeneContextA class used to represent a gene context
- __delitem__(name)#
Remove the gene family for the given name in the context
- Parameters:
name – Name of the gene family
- Raises:
KeyError – Family with the given name does not exist in the context
- __eq__(other)#
Test whether two gene context objects have the same gene families
- Parameters:
other (
GeneContext) – Another gene context to test equality- Return type:
bool- Returns:
Equal or not
- Raises:
TypeError – Try to compare a gene context with another type object
- __getitem__(name)#
Get the gene family for the given name in the context
- Parameters:
name – Name of the gene family
- Return type:
GeneFamily- Returns:
Gene family with the given name
- Raises:
KeyError – Family with the given name does not exist in the context
- __hash__()#
Create a hash value for the region
- Return type:
int
- __init__(pangenome, gc_id, families, families_of_interest)#
:param gc_id : identifier of the Gene context :type families:
Set[GeneFamily] :param families: Gene families included in the GeneContext
- __len__()#
Get the number of families in the context
- Return type:
int
- __repr__()#
Context representation
- Return type:
str
- __setitem__(name, family)#
Set a gene family in the gene context
- Parameters:
name – Name of the family
family – Gene family belonging to the context
- Raises:
TypeError – Family is not instance GeneFamily
KeyError – Another family with the same name already exists in the context
- __str__()#
String representation of the gene context
- Return type:
str
- add_family(family)#
Add a gene family to the gene context.
- Parameters:
family (
GeneFamily) – The gene family to add.
- property families: Generator[GeneFamily, None, None]#
Generator of the family in the context
- Returns:
Gene families belonging to the context
- property graph#
- summarize()#
Summarize gene context information in a dict
- Return type:
dict- Returns:
dict with gene context info.