sbol-cli
Command-line tool for SBOL 3 documents. Ships the sbol binary.
Eight subcommands cover the common workflows:
| Subcommand | Use it to… |
|---|---|
sbol validate |
Validate an SBOL 3 document against the spec |
sbol convert |
Cross-serialize SBOL 3 between Turtle, RDF/XML, JSON-LD, N-Triples |
sbol upgrade |
Convert SBOL 2 RDF (SynBioHub, iGEM, JBEI) to SBOL 3 |
sbol downgrade |
Convert SBOL 3 back to SBOL 2 for legacy tools |
sbol import-genbank |
Convert a GenBank .gb / .gbk file to SBOL 3 |
sbol import-fasta |
Convert a FASTA file to SBOL 3 |
sbol rules list |
Inspect the built-in validation rule catalog |
sbol ontology install |
Manage cached extension ontologies (NCIT, custom) |
The conversion path is explained in depth in docs/conversion.md; this README focuses on the CLI surface itself.
sbol validate
Validate an SBOL 3 document. The serialization format is inferred from the
file extension: .ttl (Turtle), .rdf (RDF/XML), .jsonld (JSON-LD), or
.nt (N-Triples):
Pass --treat-warnings-as-errors to make sbol validate exit 1 on
warnings as well as errors.
Exit codes:
| Code | Meaning |
|---|---|
0 |
Document parses and validates with no errors |
1 |
Validation errors found (printed with rule IDs) |
2 |
I/O failure, unsupported / missing file extension, or bad CLI usage |
3 |
--treat-partial-as-errors and at least one rule is partially applied |
sbol convert
Cross-serialize an SBOL 3 document between RDF formats. The input format is
inferred from the source extension; the target format is taken from --to
or inferred from --output:
sbol upgrade
Convert an SBOL 2 RDF document to SBOL 3. Most published synbio content predates SBOL 3 — SynBioHub serves SBOL 2 by default, iGEM Registry parts ship as SBOL 2, JBEI ICE exports SBOL 2. Upgrade once on ingest and use the modern toolchain:
Notable flags:
--from <FORMAT>overrides input-format inference (useful for SBOL 2 files distributed with non-standard extensions).--namespace <IRI>supplies a fallbackhasNamespacefor top-level objects whose namespace can't be derived from the input. Without it, the upgrade falls back to the URL scheme+host, then to omittinghasNamespaceentirely.--report text|jsonprints a structured per-construct summary (warnings + counts of CDs / MDs / SubComponents / MapsTos / collapses rewritten).--validaterunsDocument::checkon the converted document and folds the result into the exit code.--strictexits1if any conversion warnings were produced.
The full conversion model — what the upgrade preserves, what it can't, what triggers warnings — is documented in docs/conversion.md.
sbol downgrade
Convert an SBOL 3 RDF document back to SBOL 2 — for publishing to SynBioHub, libSBOLj2, pySBOL2, or any other tool that hasn't migrated.
The downgrade is the inverse of sbol upgrade. Documents that came
through sbol upgrade round-trip with near-zero loss because the
upgrade preserves SBOL 2 identities and types under a
http://sboltools.org/backport# namespace; the downgrade reads those
triples back. Native SBOL 3 documents lose more — see
docs/conversion.md
for the loss model.
Notable flags:
--default-version <VERSION>sets the version string assigned to top-level objects whose source didn't carrybackport:sbol2version. Omit it to leave those objects unversioned; pass--default-version 1to match the SynBioHub / libSBOLj convention.--from <FORMAT>overrides input-format inference (useful for SBOL 3 RDF/XML files with.xmlor non-standard extensions).--validate— unusual semantics: there is no SBOL 2 schema validator in this workspace, so--validateinstead round-trips the produced SBOL 2 back throughsbol upgradeand validates the resulting SBOL 3. If the round-trip succeeds and the resulting document validates, the SBOL 2 is structurally sound for any downstream consumer.--strictexits1if any downgrade warnings were produced (DualRoleComponentsplits,OrphanComponentReferencedrops, etc.).
sbol import-genbank
Convert a GenBank flat-file to SBOL 3. The whole pipeline runs in pure Rust:
--namespace is required because GenBank carries no IRI concept — you
supply the namespace under which the SBOL 3 top-levels will be rooted.
Each GenBank feature becomes an SBOL 3 SequenceFeature; coordinates become Ranges or Cuts; the LOCUS sequence becomes a Sequence with the appropriate EDAM encoding; molecule type (DNA / RNA / Protein) becomes the Component's SBO type. Mixed-case month names in the LOCUS line (as emitted by SynBioHub) are tolerated.
Notable flags:
--to <FORMAT>chooses the SBOL 3 output serialization; otherwise inferred from--output's extension.--validaterunsDocument::checkon the converted document.--strictexits1on any import warnings.
sbol import-fasta
Convert a FASTA file to SBOL 3:
Each FASTA record becomes a Component plus Sequence. Alphabet
auto-detects from the residue alphabet (DNA / RNA / Protein); pass
--alphabet when a short peptide composed only of A/C/G/T letters
would otherwise be misclassified as DNA.
sbol rules list
Dump the built-in validation rule catalog so you know what --allow /
--deny / --warn can target. Output is tab-separated with a header
row; pass --format json for machine consumption, or --status to
filter:
sbol ontology
Manage runtime ontology extensions for the validator. The bundled snapshot (EDAM, SBO, SO, GO, ChEBI, CL) is always available; this subcommand handles opt-in extensions (NCIT, lab-specific ontologies):
The cache is the only IO surface; validation itself never touches the network. See docs/ontology-extensions.md for the install workflow and the stable TSV contract.
Backing library
The CLI is a thin wrapper around the sbol
library; everything is available programmatically. See the workspace
README for the Rust SDK side and the docs directory for in-depth guides.
License
Dual-licensed under MIT or Apache-2.0, at your option. See the workspace README for project context.