The system parser object “SystemParser” instanciates Systems and Genes objects from XML system definitions (see Macromolecular systems definition). The parsing consists in three phases.
Phase 1.
- each Gene is parsed from the System it is defined
- From the list of System to detect, the list of Systems to parse is established
Phase 2.
- For each system to parse
- create the System
- add this System to the system_bank
- create the Genes defined in this System with their attributes but not their Homologs
- add these Genes in the gene_bank
Phase 3.
For each System to search
For each Gene defined in this System:
- create the Homologs by encapsulating Genes from the gene_bank
- add the Gene to the System
For instance:
Syst_1
<system inter_gene_max_space="10">
<gene name=”A” mandatory=”1” loner="1">
<homologs>
<gene name=”B” sys_ref=”Syst_2”>
</homologs>
</gene>
<system>
Syst_2
<system inter_gene_max_space="15">
<gene name=”B” mandatory=”1”>
<homologs>
<gene name=”B” sys_ref=”Syst_1”
<gene name=”C” sys_ref=”Syst_3”>
</homologs>
</gene>
<system>
Syst_3
<system inter_gene_max_space="20">
<gene name=”c” mandatory=”1” />
<system>
With the example above:
Contrariwise:
Note
The only “full” Systems (i.e., with all corresponding Genes created) are those to detect.
Build a System instance from the corresponding System definition described in the XML file (named after the system’s name) found at the dedicated location (“-d” command-line option).
Constructor
Parameters: |
|
---|
list of weak references to the object (if defined)
Create genes belonging to the systems. Be careful, the returned genes have not their homologs/analogs set yet.
Parameters: |
|
---|---|
Returns: | a list of the genes belonging to the system. |
Return type: | [macsypy.gene.Gene, ...] |
Parameters: |
|
---|---|
Returns: | the system corresponding to the name. |
Return type: | macsypy.system.System object. |
Fill the system with genes found in this system definition. Add homologs to the genes if necessary.
Parameters: |
|
---|
Parse a xml element gene and build the corresponding object
Parameters: |
|
---|---|
Returns: | the gene object corresponding to the node |
Return type: | macsypy.gene.Analog object |
Parse a xml element gene and build the corresponding object
Parameters: |
|
---|---|
Returns: | the gene object corresponding to the node |
Return type: | macsypy.gene.Homolog object |
Check the consistency of the co-localization features between the different values given as an input: between XML definitions, configuration file, and command-line options.
Parameters: | systems (list of class:txssnalib.system.System object) – the list of systems to check |
---|---|
Raise: | macsypy.macsypy_error.SystemInconsistencyError if one test fails |
(see feature)
In the different possible situations, different requirements need to be fulfilled (“mandatory_genes” and “accessory_genes” consist of lists of genes defined as such in the system definition):
- If: min_mandatory_genes_required = None ; min_genes_required = None
- Then: min_mandatory_genes_required = min_genes_required = len(mandatory_genes)
always True by Systems design
- If: min_mandatory_genes_required = value ; min_genes_required = None
- Then: min_mandatory_genes_required <= len(mandatory_genes)
- AND min_genes_required = min_mandatory_genes_required
always True by design
- If: min_mandatory_genes_required = None ; min_genes_required = Value
- Then: min_mandatory_genes_required = len(mandatory_genes)
- AND min_genes_required >= min_mandatory_genes_required
- AND min_genes_required <= len(mandatory_genes+accessory_genes)
to be checked
- If: min_mandatory_genes_required = Value ; min_genes_required = Value
- Then: min_genes_required <= len(accessory_genes+mandatory_genes)
- AND min_genes_required >= min_mandatory_genes_required
- AND min_mandatory_genes_required <= len(mandatory_genes)
to be checked
Parse systems definition in XML format to build the corresponding system objects, and add them to the system factory after checking its consistency. To get the system ask it to system_bank :param systems_2_detect: a list with the names of the systems to parse :type systems_2_detect: list of string