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: Model) bool [source]
Implement the membership test operator
- Parameters:
model – the model to test
- Returns:
True if the model is in the Model factory, False otherwise
- __getitem__(fqn: str) Model [source]
- Parameters:
fqn – the fully qualified name of the model
- Returns:
the model corresponding to the fqn.
- Raises:
KeyError – if the model corresponding to the name does not exist
- __weakref__
list of weak references to the object (if defined)
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: Model) bool [source]
- Parameters:
other – the other model to compare
- Returns:
True if this fully qualified name is equal to other fully qualified name. False otherwise.
- __gt__(other: Model) bool [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.
- __init__(fqn: str, inter_gene_max_space: int, min_mandatory_genes_required: int | None = None, min_genes_required: int | None = None, max_nb_genes: int | None = None, multi_loci: bool = False) None [source]
- Parameters:
fqn – the fully qualified name of the model CRISPR-Cas/sub-typing/CAS-TypeIE
inter_gene_max_space – the maximum distance between two genes (co-localization parameter)
min_mandatory_genes_required – the quorum of mandatory genes to define this model
min_genes_required – the quorum of genes to define this model
max_nb_genes – 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 – if the systems can split in different loci on the genome
- Raises:
ModelInconsistencyError – if an error is found in model logic. For instance genes_required > min_mandatory_genes_required
- __lt__(other: Model) bool [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.
- __weakref__
list of weak references to the object (if defined)
- property family_name: str
- Returns:
the family name of the model for instance ‘CRISPRCas’ or ‘TXSS’
- filter(hits: list[CoreHit]) list[ModelHit] [source]
filter out the hits according to this model and cast them in ModelHit. 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 embedded 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: bool = False) set[ModelGene] [source]
- Parameters:
exchangeable – include exchangeable if True
- Returns:
all the genes described in the model. with exchangeables if exchangeable is True. otherwise only “first level” genes.
- get_gene(gene_name: str) ModelGene [source]
- Parameters:
gene_name – the name of the gene to get
- Returns:
the gene corresponding to gene_name.
- Raise:
KeyError the model does not contain any gene with name gene_name.
- property inter_gene_max_space: int
- Returns:
set the maximum distance allowed between 2 genes for this model
- property max_nb_genes: int
- Returns:
the maximum number of genes to assess the model presence.
- property min_genes_required: int
- Returns:
get the minimum number of genes to assess for the model presence.
- Return type:
integer
- property min_mandatory_genes_required: int
- Returns:
get the quorum of mandatory genes required for this model
- property multi_loci: bool
- Returns:
True if the model is authorized to be inferred from multiple loci, False otherwise
- property name: str
- Returns:
the short name of this model