A Python script to update logical expressions and annotations in GINsim .zginml files, using data from an Excel (.xlsx) spreadsheet.
.zginmlsupport: Handles the GINsim zip archive format (no .ginml support).- Node Mapping:
- Matches nodes case-insensitively.
- Checks both
idandnameattributes. - Automatically renames all structural references (node orders, edges) if a name change is detected via the
.xlsx. - If a node is not found in the
.xlsxor vice versa, the user is notified.
- Logic & Annotation Injection:
- Replaces the previous logical expression (or parameters) and replaces it with the new logical expression as the first child of the
<node>element. - Populates
<annotation><comment>...</comment></annotation>sub-elements using text from the spreadsheet.
- Replaces the previous logical expression (or parameters) and replaces it with the new logical expression as the first child of the
- Layout conservation: Repackages the modified model alongside all original extra files in the
output.zginmlfile without altering the layout.
- Python 3.x
openpyxllibrary (for reading Excel files)
To install dependencies:
pip install openpyxlThe script read the first tab of the spreadsheet. It expects a header row on line 1 (which is skipped) followed by data in three columns:
- Node Name: The identifier used to match nodes in the model (checks against
idornamein the .ginml file). - Logical Expression: The Boolean/logical string to be injected.
- Annotation: Optional text to be placed in the node's comments.
| node | function | annotation |
|---|---|---|
| ECAD | !ZEB1 & !ZEB2 | ZEB1 and ZEB2 suppress E-cadherin |
| AdhJunc | ECAD & !SRC | SRC can drive the phosphorylation and destabilization of Adherens Junction |
| AP1 | FRA1 & JUN | Fra-1 dimerizes with Jun proteins to form the activator protein 1 (AP-1) TF |
| ... | ... | ... |
A standard GINsim compressed archive. The script specifically targets the GINsim-data/regulatoryGraph.ginml file inside the archive.
Run the script by providing the path to your Excel file and your .zginml model:
python GINsim_XLS_merge.py <input_logic.xlsx> <input_model.zginml>To push new nodes on the XLS into the GINsim model, just use the --add option:
python GINsim_XLS_merge.py <input_logic.xlsx> <input_model.zginml> --addThe tool generates an output.zginml file in the current directory. This file contains:
- The updated regulatory network with new logic and annotations.
- The original DOCTYPE and XML namespaces preserved.
- All other original archive contents (mutants, settings, etc.) kept intact.
Pedro T. Monteiro (https://github.com/ptgm)