System API

It represents a macromolecular system to detect. See The System object for an overview of its implementation.

Note

a complete description of macromolecular systems modelling is available in the section Macromolecular systems definition

SystemBank API reference

class macsypy.system.SystemBank[source]

Build and store all Systems objects. Systems must not be instanciated directly. This system factory must be used. It ensures there is a unique instance of a system for a given system name. To get a system, use the method __getitem__ via the “[]”. If the System is already cached in the SystemBank, it is returned. Otherwise a new system is built, stored and then returned.

__contains__(system)[source]

Implement the membership test operator

Parameters:system (macsypy.system.System object) – the system to test
Returns:True if the system is in the System factory, False otherwise
Return type:boolean
__getitem__(name)[source]
Parameters:name (string) – the name of the system
Returns:the system corresponding to the name. If the system already exists, return it, otherwise build it and return it.
Return type:macsypy.system.System object
__iter__()[source]

Return an iterator object on the systems contained in the bank

__len__()[source]
Returns:the number of systems stored in the bank
Return type:integer
__weakref__

list of weak references to the object (if defined)

add_system(system)[source]
Parameters:system (macsypy.system.System object) – the system to add
Raise:KeyError if a system with the same name is already registered.

Note

Don’t instanciate your own SystemBank use the system_bank at the top level of the module.

from macsypy.system import system_bank

System API reference

class macsypy.system.System(cfg, name, inter_gene_max_space, min_mandatory_genes_required=None, min_genes_required=None, max_nb_genes=None, multi_loci=False)[source]

Handle a secretion system.

__init__(cfg, name, inter_gene_max_space, min_mandatory_genes_required=None, min_genes_required=None, max_nb_genes=None, multi_loci=False)[source]
Parameters:
  • cfg (macsypy.config.Config object) – the configuration object
  • name (string) – the name of the system
  • inter_gene_max_space (integer) – the maximum distance between two genes (co-localization parameter)
  • min_mandatory_genes_required (integer) – the quorum of mandatory genes to define this system
  • min_genes_required (integer) – the quorum of genes to define this system
  • max_nb_genes (integer) –
  • multi_loci (boolean) –
__weakref__

list of weak references to the object (if defined)

accessory_genes
Returns:the list of genes that are allowed in this secretion system
Return type:list of macsypy.gene.Gene objects
add_accessory_gene(gene)[source]

Add a gene to the list of accessory genes

Parameters:gene (macsypy.gene.Gene object) – gene that is allowed to be present in this system
add_forbidden_gene(gene)[source]

Add a gene to the list of forbidden genes

Parameters:gene (macsypy.genen.Gene object) – gene that must not be found in this system
add_mandatory_gene(gene)[source]

Add a gene to the list of mandatory genes

Parameters:gene (macsypy.gene.Gene object) – gene that is mandatory for this system
forbidden_genes
Returns:the list of genes that are forbidden in this secretion system
Return type:list of macsypy.gene.Gene objects
get_gene(gene_name)[source]
Parameters:gene_name (string) – the name of the gene to get
Returns:the gene corresponding to gene_name.
Return type:a macsypy.gene.Gene object.
Raise:KeyError the system does not contain any gene with name gene_name.
get_gene_ref(gene)[source]
Parameters:gene (a macsypy.gene.Gene or macsypy.gene.Homolog` or macsypy.gene.Analog` object.) – the gene to get the gene reference.
Returns:the gene reference of the gene if exists (if the gene is an Homolog or an Analog), otherwise return None.
Return type:macsypy.gene.Gene object or None
Raise:KeyError if gene is not in the system
inter_gene_max_space
Returns:set the maximum distance allowed between 2 genes for this system
Return type:integer
mandatory_genes
Returns:the list of genes that are mandatory in this secretion system
Return type:list of macsypy.gene.Gene objects
max_nb_genes
Returns:the maximum number of genes to assess the system presence.
Return type:int (or None)
min_genes_required
Returns:get the minimum number of genes to assess for the system presence.
Return type:integer
min_mandatory_genes_required
Returns:get the quorum of mandatory genes required for this system
Return type:integer
multi_loci
Returns:True if the system is authorized to be inferred from multiple loci, False otherwise
Return type:boolean