Converter for logical models: spreadsheets (XLSX, CSV) <--> SBML-qual.
Project description
TabularQual converter
Convert between spreadsheets (XLSX, CSV) and SBML-qual for logical models (Boolean and multi-valued).
Note: the format is specified here.
Web App
Use directly in your browser - no installation required!
Note: there are currently resource limits on Streamlit cloud, please run it locally for large networks.
Install
Option 1: Run Web App Locally
# 1) Install dependencies
pip install -r requirements.txt
# 2) Launch the web app
streamlit run app.py
The app will open in your browser at http://localhost:8501
Option 2: Command-Line Tools
# Install dependencies and console script
pip install -r requirements.txt
pip install -e .
Usage
Spreadsheet ➜ SBML
# Simple usage (output defaults to input name with .sbml extension)
to-sbml examples/ToyExample.xlsx
# From CSV directory
to-sbml examples/ToyExample_csv/
# From CSV files (using prefix - looks for Model_Species.csv, Model_Transitions.csv, etc.)
to-sbml Model
SBML ➜ Spreadsheet
# Simple usage (output defaults to input name with .xlsx extension)
to-table examples/ToyExample.sbml
# To CSV files (creates Model_Model.csv, Model_Species.csv, etc.)
to-table examples/ToyExample.sbml --csv
Options
to-sbml INPUT [OUTPUT]:
- INPUT: input file/path. Supports XLSX, CSV file, directory with CSVs, or CSV prefix (e.g.,
ModelforModel_Species.csv,Model_Transitions.csv, etc.) - OUTPUT: output SBML file (optional, defaults to input name with
.sbmlextension) - --inter-anno: use interaction annotations only (unless
--trans-annois also set) - --trans-anno: use transition annotations only (unless
--inter-annois also set) - --use-name: use Species Name instead of ID in rules and interactions (default: use ID)
- --no-validate: skip annotation validation
to-table INPUT [OUTPUT]:
- INPUT: input SBML file
- OUTPUT: output file/prefix (optional, defaults to input name)
- --csv: output as CSV files (
{prefix}_Model.csv,{prefix}_Species.csv,{prefix}_Transitions.csv,{prefix}_Interactions.csv) - --template: specify a template file for README and Appendix sheets (XLSX only)
- --colon-format: use colon notation for transition rules (
:means>=) - --use-name: use Species Name instead of ID in rules and interactions (default: use ID)
- --no-validate: skip annotation validation
Transition Rules Syntax
The Transition-Rules column supports boolean and comparison expressions using the following operators and syntax (space will be ignored):
- Logical operators:
&(AND),|(OR),!(NOT) - Parentheses:
(and)for grouping expressions - For multi-value model: threshold-based activation:
- Colon notation:
A:2means "A is at level 2 or higher" (A >= 2) - Negated colon:
!A:2means "A is below level 2" (A < 2) - Explicit comparisons:
A >= 2,B <= 1,C != 0for precise control - Equivalent expressions:
!CI:2 & !Cro:3is the same asCI < 2 & Cro < 3orCI <= 1 & Cro <= 2
- Colon notation:
- Simple species references:
A- Species A is active (level >= 1 for multi-valued, or level = 1 for binary)!A- Species A is inactive (level = 0)
Examples:
A & B- Both A and B are active (level ≥ 1 for multi-valued)A:2 | B < 1- A is at level 2+ OR B is inactiveN & !CI:2 & !Cro:3- N active AND CI below level 2 AND Cro below level 3(A & B) | (!C & D != 1)- Complex grouped expression
Validation
TabularQual performs several validations during conversion to ensure data quality and SBML compliance.
SId Format Validation
Model_ID, Species_ID, Transitions_ID, and Compartment fields must conform to the SBML SId specification (SBML Level 3 Version 2):
- Must start with a letter (A–Z, a–z) or underscore (
_) - May contain only letters, digits (0–9), and underscores
- Case-sensitive (equality determined by exact string matching)
- No spaces, slashes, or other special characters allowed
- Unique across their sheets
Automatic Cleanup: If an ID doesn't conform, it is automatically cleaned:
- Special characters (spaces, slashes, dashes, etc.) are replaced with underscores
- IDs starting with a digit get a leading underscore prepended
- Duplicate IDs are automatically renamed with suffixes (
_1,_2, etc.)
Example: PI3K/AKT-pathway → PI3K_AKT_pathway
Field Value Validation
The converter validates controlled vocabulary fields:
- Species Type: Must be one of
Input,Internal, orOutput(case-insensitive) - Interaction Sign: Must be one of
positive,negative,dual, orunknown(case-insensitive) - Relation Qualifiers: Must be one of
is,hasVersion,isVersionOf,isDescribedBy,hasPart,isPartOf,hasProperty,isPropertyOf,encodes,isEncodedBy,isHomologTo,occursIn,hasTaxon(case-insensitive) - TODO: validate Relation qualifiers in SBML.
Annotation Validation
Annotations in the SBML output can be validated using sbmlutils:
- Validates that annotation URIs are correctly formed
- Checks that identifiers.org resources are valid
- Enable/disable with
--no-validateflag or checkbox in web app
To use annotation validation: pip install sbmlutils>=0.9.6
Notes
- The reader ignores a first README sheet if present, and reads
Model,Species,Transitions, andInteractions. - The SBML to Spreadsheet converter automatically uses
doc/template.xlsxif available for README and Appendix sheets (XLSX output only). - When
--use-nameis enabled, the converter uses Species Name in transition rules and interactions instead of Species_ID.- If a name conforms to SId format and is unique, it's used directly. Otherwise, it's quoted:
"Name"or gets suffixes for duplicates:"Name_1","Name_2", etc. - If any species are missing Names when
--use-nameis enabled, a warning is issued and IDs are used instead. - When
--use-nameis enabled, Species_ID becomes optional and is automatically generated from Names if missing.
- If a name conforms to SId format and is unique, it's used directly. Otherwise, it's quoted:
- TODO: automatically detect Species:Type
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tabularqual-0.1.2.tar.gz.
File metadata
- Download URL: tabularqual-0.1.2.tar.gz
- Upload date:
- Size: 50.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25994408251baa1a703df0f86258082bec013a66f54c1564c4f41d0cc1eeeeee
|
|
| MD5 |
67082ca3c97f7ebe856027804ab047cb
|
|
| BLAKE2b-256 |
a2b03be17a577b3c99d976c6fbf666d6de2a091f46d608639748f1c852d6cedf
|
File details
Details for the file tabularqual-0.1.2-py3-none-any.whl.
File metadata
- Download URL: tabularqual-0.1.2-py3-none-any.whl
- Upload date:
- Size: 53.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c446e97c2eaa735d5015bab80ae76fd8ab82ccf403e3e28f2b1c1f537525aa1
|
|
| MD5 |
d50e0c10cb1c31835c7fca45e3c6170e
|
|
| BLAKE2b-256 |
23eb1d4aa7a1d7439083064ff2a2f0077e5be2ef2026dee958d2e1687fcae2a6
|