model

The model is a formal representation of system. The model is describe in terms of components. There are 3 component classes:

  • genes which are mandatory
  • genes which are accessory
  • genes which are forbiden

each genes can have homolgs or analogs. Analogs and Homolgs refer to genes described in an other model.

The models describe also distance constraints between genes:

  • inter_gene_max_space
  • loner
  • multi_loci

and quorum constraints

  • min_mandatory_genes_required
  • min_genes_required

ModelBank

class macsypy.model.ModelBank[source]

Store all Models objects.

__contains__(model)[source]

Implement the membership test operator

Parameters:model (macsypy.model.Model object) – the model to test
Returns:True if the model is in the Model factory, False otherwise
Return type:boolean
__getitem__(fqn)[source]
Parameters:fqn (string) – the fully qualified name of the model
Returns:the model corresponding to the fqn.
Return type:macsypy.model.Model object
Raises:KeyError – if the model corresponding to the name does not exists
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

__iter__()[source]

Return an iterator object on the models contained in the bank

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

list of weak references to the object (if defined)

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

Model

class macsypy.model.Model(fqn, inter_gene_max_space, min_mandatory_genes_required=None, min_genes_required=None, max_nb_genes=None, multi_loci=False)[source]

Handles a macromolecular model.

Contains all its pre-defined characteristics expected to be fulfilled to predict a complete model:
  • component list (genes that are mandatory, accessory, neutral, forbidden)
  • quorum (number of genes)
  • genetic architecture
__eq__(other)[source]
Parameters:other – the other model to compare
Returns:True if this fully qualified name is equal to other fully qualified name. False otherwise.
Return type:boolean
__gt__(other)[source]
Parameters:other – the other model to compare
Returns:True if this fully qualified name is greater than to other fully qualified name. False otherwise.
Return type:boolean
__hash__()[source]
Returns:
__init__(fqn, inter_gene_max_space, min_mandatory_genes_required=None, min_genes_required=None, max_nb_genes=None, multi_loci=False)[source]
Parameters:
  • fqn (string) – the fully qualified name of the model CRISPR-Cas/sub-typing/CAS-TypeIE
  • 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 model
  • min_genes_required (integer) – the quorum of genes to define this model
  • max_nb_genes (integer) – The number of gene to be considered as full system Used to compute the wholeness. If None the mx_nb_genes = mandatory + accessory
  • multi_loci (boolean) –
Raises:

ModelInconsistencyError – if an error is found in model logic. For instance genes_required > min_mandatory_genes_required

__lt__(other)[source]
Parameters:other – the other model to compare
Returns:True if this fully qualified name is lesser than to other fully qualified name. False otherwise.
Return type:boolean
__str__()[source]

Return str(self).

__weakref__

list of weak references to the object (if defined)

family_name
Returns:the family name of the model for instance ‘CRISPRCas’ or ‘TXSS’
Return type:str
filter(hits)[source]

filter out the hits according to this model. The filtering is based on the name of CoreGene associated to hit and the name of ModelGene of the model (the name of the ModelGene is the name of the CoreGene embed in the ModelGene) only the hits related to genes implied in the model are kept.

Parameters:hits (list of macsypy.report.Hit object) – list of hits to filter
Returns:list of hits
Return type:list of macsypy.report.Hit object
genes
Returns:all the genes without the exchangeables which are described in the model.
Return type:set of macsypy.gene.ModelGene 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.ModelGene object.
Raise:KeyError the model does not contain any gene with name gene_name.
inter_gene_max_space
Returns:set the maximum distance allowed between 2 genes for this model
Return type:integer
max_nb_genes
Returns:the maximum number of genes to assess the model presence.
Return type:int (or None)
min_genes_required
Returns:get the minimum number of genes to assess for the model presence.
Return type:integer
min_mandatory_genes_required
Returns:get the quorum of mandatory genes required for this model
Return type:integer
multi_loci
Returns:True if the model is authorized to be inferred from multiple loci, False otherwise
Return type:boolean
name
Returns:the short name of this model