model
The model is a formal representation of system. The model is describe in terms of components. There are 4 component classes:
genes which are mandatory
genes which are accessory
genes which are neutral
genes which are forbiden
Each genes can have Exchangeable. An exchangeable is another gene which can paly the same role in the system. Usualy an analog or homolog. 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
and if a gene can be shared by several systems (several occurrences of the same model)
multisystem
model API reference
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
- __weakref__
list of weak references to the object
- 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(*args, **kwargs)[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
- __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
- __weakref__
list of weak references to the object
- property 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.CoreHit
object) – list of hits to filter- Returns:
list of hits
- Return type:
list of
macsypy.report.Model
object
- genes(exchangeable=False)[source]
- Parameters:
exchangeable (bool) – include exchageables if True
- Returns:
all the genes described in the model. with exchangeables if exchageable is True. otherwise only “first level” genes.
- 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.
- property inter_gene_max_space
- Returns:
set the maximum distance allowed between 2 genes for this model
- Return type:
integer
- property max_nb_genes
- Returns:
the maximum number of genes to assess the model presence.
- Return type:
int (or None)
- property min_genes_required
- Returns:
get the minimum number of genes to assess for the model presence.
- Return type:
integer
- property min_mandatory_genes_required
- Returns:
get the quorum of mandatory genes required for this model
- Return type:
integer
- property multi_loci
- Returns:
True if the model is authorized to be inferred from multiple loci, False otherwise
- Return type:
boolean
- property name
- Returns:
the short name of this model