Information for Data Scientists | Developers | Programmatic users

BKB‑HD user | Relational Database Support

Provided Builds & Import Paths 

SQLite (prebuilt):
  • Provided as bkb-2025.1.sqlite.db.gz
  • Decompress and open with R/Python packages or SQL tools like DBeaver
SQLite (manual import):
  • Use sqlite-import.sh /path/to/bkb_flat_files/ /desired/output/
  • Requires sqlite3 in your PATH
PostgreSQL import:
  • Use import.sh --bundle-path=/path/to/bundle --db-name=bkb --user=pg --host=… [--schema …] [--drop-table-if-exists], with psql installed
  • Optional: set password via PGPASSWORD

Built‑in System Tables

These extra tables help you explore the data structure:

System TableDescription
tablesLists all content tables in BKB‑HD
table_columnsColumns, types, and simple stats (distinct values <1000)
table_valuesValues and descriptions for categorical columns with <1000 distinct values
version_infoVersion metadata for the current build
viewsListing of pivot views (e.g., molecule_metadata_pivot)

Pivot views are great for display/output. For filtering, use the base metadata tables and join with pivot views only for presentation.

Example: Exploring the Schema & Data with SQL

  • Begin every query with:

sql
CopyEdit

  • List all tables 

SELECT * FROM tables ORDER BY table_name

  • Inspect columns of a specific table 

SELECT column_name, data_type, distinct_values
FROM table_columns
WHERE table_name = 'molecule_metadata'

  • View categorical values/descriptions 

SELECT column_name, column_value, description
FROM table_values
WHERE table_name = 'molecule_metadata' AND column_name = 'molecule_type'

  • Get database version info 

SELECT * FROM version_info;

  • Use a pivot view to display full metadata for a molecule

SELECT *
FROM molecule_metadata_pivot
WHERE molecule_id = 'GENE12345'

API Access | Automate Your Discovery

KB‑HD provides full REST API access for programmatic exploration.

  • Key Endpoints:
    • /entities – search by name, ID, filters
    • /relationships – query specific entity pairs or types
  • Supports: JSON and CSV output, pagination, filters (type, species)
  • Security: Use your unique API key (in header); rate limits apply
  • Sample Code (Python):
    • python
      CopyEdit
      import requests
  • headers = {"Authorization": "Bearer YOUR_API_KEY"}
  • params = {"query": "BRCA1", "type": "gene"}
  • r = requests.get("https://api.qiagen.com/entities", headers=headers, params=params)
  • Learn More: See our “Quick-start code snippets” section (Python, R, cURL) at MyQDI (Access needed)

BKB‑AI user | SQL‑Driven Graph & AI Integrations

Even though BKB‑AI is powered by knowledge graphs with AI-derived edges, you can still interrogate metadata via standard SQL tables. Graph‑specific querying (e.g., via specialized APIs or graph databases) is available when licensed, but relational querying is a great first step for schema discovery and basic filtering.

Performance Tips & Indexing 

  • Default imports include indexes optimized for standard lookups
  • For heavy queries on aggregated relationships (e.g., molecule ↔ disease/function), you can optionally create:

sql

CopyEdit

CREATE INDEX idx_aggregated_molecule_disease_and_function_id
ON molecule_disease_and_function_relationships_aggregated_ids(aggregated_relationship_id);

  • Adds ~7 GB to DB size; use only if needed for performance

 

Best Practices & Caution

  • Don’t modify the core SQLite build; altering tables or schema may break packaged tools.
  • Use pivot views only for display, not for filtering.
  • Explore system tables first when navigating new datasets.

 

Quick Start Summary 

  • Unzip the SQLite build.
  • Open in your SQL tool or connect via R/Python wrappers.
  • Discover schema via tables & table_columns.
  • Explore sample data via metadata tables.
  • Display via pivot views.
  • Optional: add indexing for speed.
  • For richer graph or AI-driven relationships, consider moving into graph-based tools when licensed.

BKB Services 

Get the most out of your BKB subscription

Partner with Services to tailor or create notebooks to meet your endpoints faster. We can do the heavy lifting while you get onboarding with a proof-of-concept project.

Ready to explore more?

Administrator page

Need to take care of some setup or administration tasks? Check out the admin page.

Upcoming trainings

We also host live virtual trainings on a regular basis. 

Sample to Insight
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.