The GeneFamily class

class ppanggolin.geneFamily.GeneFamily(ID, name)[source]

Bases: object

This represents a single gene family. It will be a node in the pangenome graph, and be aware of its genes and edges.

addGene(gene)[source]

Add a gene to the gene family, and sets the gene’s :attr:family accordingly.

Parameters

gene (ppanggolin.genome.Gene) – the gene to add

Raises

TypeError – If the provided gene is of the wrong type

addPartition(partition)[source]

Assigns a partition to the gene family. It should be the raw partition name provided by NEM.

Parameters

partition (str) – The partition

addSequence(seq)[source]

Assigns a protein sequence to the gene family.

Parameters

seq (str) – the sequence to add to the gene family

property edges

Returns all of the ppanggolin.pangenome.Edge that are linked to this gene family

Returns

Edges of the gene family

Return type

list[ppanggolin.pangenome.Edge]

getGenesPerOrg(org)[source]

Returns the genes belonging to the gene family in the given Organism

Parameters

org (ppanggolin.genome.Organism) – Organism to look for

Returns

a set of gene(s)

Return type

set[ppanggolin.genome.Gene]

getOrgDict()[source]

Returns the organisms and the genes belonging to the gene family

Returns

a dictionnary of organism as key and set of genes as values

Return type

dict[ ppanggolin.genome.Organism ,set[ppanggolin.genome.Gene]

mkBitarray(index)[source]

Produces a bitarray representing the presence / absence of the family in the pangenome using the provided index The bitarray is stored in the bitarray attribute and is a gmpy2.xmpz type.

Parameters

index (dict[ppanggolin.genome.Organism, int]) – The index computed by ppanggolin.pangenome.Pangenome.getIndex()

property namedPartition

Reads the :attr:partition attribute and returns a meaningful name

Raises

Exception – If the gene family has no partition assigned

Returns

the partition name of the gene family

Return type

str

property neighbors

Returns all of the ppanggolin.geneFamily.GeneFamily that are linked with an edge

Returns

Neighbors

Return type

set[ppanggolin.geneFamily.GeneFamily]

property organisms

Returns all of the ppanggolin.genome.Organism that have this gene family

Returns

Organisms that have this gene family

Return type

set[ppanggolin.genome.Organism]