Enabling interoperability between BridgeDb and SSSOM
Last week, I joined long-time collaborators Egon Willighagen and Denise Slenter at the Department of Translational Genomics of Maastricht University quarterly hackathon to improve interoperability between BridgeDb and the Simple Standard for Sharing Ontological Mappings (SSSOM). This post gives some background on BridgeDb, some of my thoughts on how it could evolve towards a more SSSOM-like data model, and a demonstration of the hackathon results to do lossy round-trip exchange to SSSOM
Background
BridgeDb is a software framework, accompanying database, and web service for semantic mappings between biomedical entities including genes, proteins, protein complexes, metabolites, reactions, diseases, and publications. Its development started in April 2009, and was first published in 2010 in The BridgeDb framework: standardized access to gene, protein and metabolite identifier mapping services. It the interim, it supported curation and data standardization in WikiPathways and several related projects (see citations). For comparison, SSSOM development began more than ten years later in 2020.
Integration with the Semantic Farm
BridgeDb developed a
data sources registry that assigned
codes to each database (e.g., Wd for Wikidata), stored regular expressions for
local unique identifiers, and stored format strings for expanding local unique
identifiers to URLs. This enabled BridgeDb, WikiPathways, and other related
resources to standardize their identifiers in a principled way, while keeping
the necessary metadata in a reusable TSV that wasn’t part of a larger software
component.
I started developing the Semantic Farm in 2019, unaware of the similar work done in BridgeDb. Ultimately, the Semantic Farm became a much more generic and comprehensive resource, and in 2022, I added support for Semantic Farm in the BridgeDb data sources registry which resulted in filling in missing data and adding tests for data integrity.
BridgeDb Schema
While BridgeDb was originally implemented in Java using Apache Derby as a relational database management system, Derby was discontinued in Fall 2025 and BridgeDb is currently in the process of upgrading its schema and tech stck to use DuckDb. Below is a schematic diagram of the proposed BridgeDb Schema v4:
erDiagram
datanode ||--o{ link: "idLeft and<br>codeLeft"
datanode ||--o{ link: "idRight and<br>codeRight"
link {
VARCHAR(50) idLeft
VARCHAR(50) codeLeft
VARCHAR(50) idRight
VARCHAR(50) codeRight
}
datanode {
VARCHAR(50) id
VARCHAR(50) code
SMALLINT isPrimary
}
datanode ||--o{ attribute: id
attribute {
VARCHAR(50) id
VARCHAR(50) code
SMALLINT isPrimary
VARCHAR(50) attrname
VARCHAR(255) attrvalue
}
info {
integer schemaversion
VARCHAR BUILDDATE
VARCHAR DATASOURCENAME
VARCHAR DATASOURCEVERSION
VARCHAR DATATYPE
VARCHAR SERIES
}
I have a few suggestions for improving the schema before finalization:
- The
isPrimarycolumn can be removed from theattributetable - it’s already a part of thedatanodetable - The
infotable is currently quite limited. I would like to see it extended to come to parity with the mapping set metadata model in SSSOM (seeMappingSet). - BridgeDb uses a void-based data model for
describing the datasets from which its mappings were derived (e.g.,
Wikidata). These annotations are stored as independent tables whose names
correspond to the BridgeDb data sources registry codes and whose columns are
the same (not shown above). I propose unifying these in a single
sourcetable that that has acodecolumn that can more easily be joined to thedatanodeandlinktables. - BridgeDb currently assumes mappings are sourced from the resource in the
subject. This is not always the case, e.g., when using third-party mappings
from Biomappings. It would be
valuable to add a source to the
linktable to make this explicit. SSSOM does this with themapping_sourceslot, which uses a CURIE as the primary key for sources. In many cases, this could map to thesourcetable I proposed above, and could - In general, I would like to see convergence on a more SSSOM-like data model that makes the mapping predicate, justification, license, and curator information more explicit.
There are also a few clarifications I think are important:
- I haven’t been able to figure out what the
bridgecolumn of thelinktable does, it should be documented better or removed - How should
isPrimarybe derived? Is this local to a given BridgeDb file, or does it need to be calculated globally from the original database from which an entity comes? Is this field nullable, e.g., for resources that aren’t sure how to decide?
I/O for SSSOM
The goal of the hackathon was to implement bidirectional exchange between
BridgeDb and SSSOM. Despite some of the difference in precision between the
formats and ongoing discussion, we were able to complete an initial
implementation in
this pull request,
which was released as part of
sssom-pydantic v0.6.11
and can be installed with pip intall sssom-pydantic.
Compared to SSSOM, BridgeDb has a relatively simple model for semantic mappings
that only includes the identity of the subject and object. Therefore, conversion
from SSSOM to BridgeDb is lossy, and conversion from BridgeDb to SSSOM assigns
the least precise mapping type oboInOwl:hasDbXref and unknown mapping
justification semapv:UnspecifiedMatching. Addressing some of the proposals
in the previous section could improve interoperability and the value of the
content already in BridgeDb.
SSSOM to BridgeDb
To construct a BridgeDb-compatible from a SSSOM file, such as Biomappings, use:
import sssom_pydantic
from sssom_pydantic.contrib.bridgedb import to_bridgedb
url = "https://w3id.org/biopragmatics/biomappings/sssom/biomappings.sssom.tsv"
mappings, _converter, metadata = sssom_pydantic.read(url)
to_bridgedb(mappings, "biomappings.bridge.duckdb", metadata=metadata)
To construct a BridgeDb-compatible database of semantic mappings imported from
Wikidata, use
to_bridgedb:
from sssom_pydantic.contrib.wikidata import get_mappings_by_prefix
from sssom_pydantic.contrib.bridgedb import to_bridgedb
mappings = get_mappings_by_prefix("chebi")
to_bridgedb(mappings, "wikidata-chebi.bridge.duckdb")
BridgeDb to SSSOM
To import mappings from a BridgeDb file, such as the example amino acids mapping
database used in the SSSOM Pydantic testing suite, use
from_bridgedb:
import bioregistry
from sssom_pydantic import SemanticMapping
from sssom_pydantic.contrib.bridgedb import from_bridgedb
# Internally, BridgeDb uses the Bioregistry default prefixes
converter = bioregistry.get_preferred_converter()
bridgedb_url = "https://raw.githubusercontent.com/cthoyt/sssom-pydantic/refs/heads/main/tests/test_contrib/test_bridgedb/aminoacids_duckdb_db4.bridge"
mappings, metadata = from_bridgedb(bridgedb_url)
sssom_pydantic.write(
mappings,
"aminoacids.sssom.tsv",
metadata=metadata,
converter=converter,
)
By default, mappings are assigned oboInOwl:hasDbXref as a mapping predicate
and semapv:UnspecifiedMatching as a mapping justification.
Motivation from NFDI
The assembly of chemical and biological knowledge has been a key part of my research agenda for the last ten years. My work on identifier mappings, specifically here for metabolites and chemicals, is a key deliverable for NFDI4Chem and the NFDI Section Metadata WG Ontology Harmonization and Mappings.
I’m very pleased with the results of the hackathon, and the chance to spend time with Egon, Denise, and colleagues. I’m looking forward to next one in 2027!
