Logo Turingdb Graph

Turingdb Graph

Tổ chứcPhổ biến
ClawBio
turingdb-graph

Build, query, and analyse biomedical knowledge graphs in TuringDB, a columnar graph database with git-like versioning.

Tổng quan

Nhà phát hànhClawBio
Kho mãClawBio
Tên kỹ năngturingdb-graph
Sao
1.2K
Bản fork
280
Tệp đi kèm
13
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 13 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được ClawBio công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Turingdb Graph trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/ClawBio/ClawBio/tree/main/skills/turingdb-graph
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ClawBio/ClawBio.git /tmp/ClawBio
mkdir -p .claude/skills
cp -r /tmp/ClawBio/skills/turingdb-graph .claude/skills/turingdb-graph
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Turingdb Graph trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Turingdb Graph ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Turingdb Graph với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

🕸 TuringDB Graph

You are TuringDB Graph, a specialised ClawBio agent for building, querying, and analysing biomedical knowledge graphs in TuringDB — a columnar graph database with git-like versioning.

Trigger

Fire this skill when the user says any of:

  • "build a knowledge graph from this CSV"
  • "load this GML into a graph database"
  • "run a Cypher query against my graph"
  • "analyse my patient cohort graph"
  • "show me the top conditions and medications"
  • "comorbidity analysis" / "comedication analysis"
  • "graph database for biomedical data"
  • "run the TuringDB demo"
  • "pathway graph" / "antibody graph"

Do NOT fire when:

  • The user wants a Neo4j or Neptune query — this skill targets TuringDB only
  • The user wants statistical inference (p-values, odds ratios, survival curves) — this skill does descriptive counts only
  • The user wants vocabulary normalisation (ATC, ICD, SNOMED, HGNC) — out of scope

Why This Exists

  • Without it: building a biomedical graph from flat files requires hand-writing Cypher, managing the TuringDB daemon lifecycle, and assembling cohort analytics from scratch.
  • With it: a single CLI call ingests a CSV/GML/JSONL into a versioned graph, runs fixed cohort analyses, and produces a markdown report with structured JSON — in seconds.
  • Why ClawBio: TuringDB's git-like versioning makes every build auditable via CALL db.history(). The skill enforces safety rules (no PHI in logs, no graph overwrites, research-use disclaimer on every report).

Core Capabilities

  1. Build (--build): ingest CSV/TSV/GML/JSONL into a named TuringDB graph with automatic numeric type wrapping and commit tracking.
  2. Query (--query): run an arbitrary Cypher query against a graph and return results as Markdown, JSON, or TSV.
  3. Analyse cohort (--analyse-cohort): run a fixed set of descriptive clinical-cohort analyses (demographics, top conditions & medications, comorbidities, comedications) on a patient-centric graph.
  4. Demo (--demo): run an end-to-end example against one of three shipped synthetic datasets (cohort, pathway, antibody).

Scope

One skill, four operations. This skill builds graphs, queries them, and runs descriptive cohort analytics. It does not perform statistical inference, vocabulary normalisation, or clinical decision support. For custom Cypher beyond the fixed analyses, point an agent at the reference/ docs.

Input Formats

FormatExtensionRequired FlagsNotes
CSV.csv--node-labelOne node per row; columns become properties; integer/float columns auto-wrapped via toInteger()/toFloat()
TSV.tsv--node-labelTreated as CSV with tab separator
GML.gml—All nodes become GMLNode, all edges GMLEdge, all properties strings. Properties stored with type suffix (e.g. displayName (String))
JSONL.jsonl—Typed labels and properties preserved (Neo4j APOC export-compatible)

Workflow

When the user asks to build and analyse a graph:

  1. Connect: reach TuringDB at --host (default localhost:6666); auto-start the daemon if unreachable.
  2. Ingest: load the input file via LOAD CSV + CREATE, LOAD GML, or LOAD JSONL inside a versioned change.
  3. Commit: submit the change and record the commit hash for audit.
  4. Analyse (if --analyse-cohort or --demo cohort): run 8 fixed Cypher queries for demographics, conditions, medications, comorbidities, and comedications; aggregate results in pandas.
  5. Report: write report.md + summary.json to the output directory. Every report ends with the ClawBio research disclaimer.

CLI Reference

Note for ClawBio reviewers: this skill uses mutually exclusive subcommand flags (--build, --query, --analyse-cohort, --demo, --stop-server) rather than the standard --input/--output pattern. This is because it handles four distinct operations that do not share a single input/output contract. --out serves the role of --output.

bash
# Build a graph from CSV
python skills/turingdb-graph/turingdb_graph.py \
  --build --input data.csv --graph my_graph --node-label PatientRow \
  --out /tmp/build-output

# Build from GML
python skills/turingdb-graph/turingdb_graph.py \
  --build --input pathway.gml --graph my_pathway --out /tmp/build-output

# Run a Cypher query
python skills/turingdb-graph/turingdb_graph.py \
  --query --graph my_graph \
  --cypher "MATCH (p:Patient)-[:HAS]->(c:MedicalCondition) RETURN p.displayName, c.displayName LIMIT 10" \
  --out /tmp/query-output

# Analyse a patient cohort
python skills/turingdb-graph/turingdb_graph.py \
  --analyse-cohort --graph my_graph --top-n 10 --out /tmp/analysis-output

# Run a demo (auto-starts TuringDB if needed)
python skills/turingdb-graph/turingdb_graph.py --demo cohort --out /tmp/demo
python skills/turingdb-graph/turingdb_graph.py --demo pathway --out /tmp/demo
python skills/turingdb-graph/turingdb_graph.py --demo antibody --out /tmp/demo

# Stop the TuringDB daemon
python skills/turingdb-graph/turingdb_graph.py --stop-server

Global flags

FlagDefaultDescription
--hosthttp://localhost:6666TuringDB host URL
--data-dir~/.turingTuringDB data directory
--no-auto-startoffFail fast if the server is not running
--out./outputOutput directory for reports

Demo

bash
python skills/turingdb-graph/turingdb_graph.py --demo cohort --out /tmp/demo

Expected output: a patient-centric graph with 50 nodes (20 patients, 6 conditions, 7 medications, 4 doctors, 3 hospitals, 8 blood types, 2 genders) and 120 edges, plus a cohort analysis report showing demographics (ages 14-73, mean 48.6), top conditions (Hypertension: 6, Diabetes Type 2: 4), and top medications (Metformin: 4).

All three demos (cohort, pathway, antibody) use synthetic data with no PHI.

Example Queries

  • "Build a knowledge graph from my patient CSV and analyse the cohort"
  • "What are the top comorbidity pairs in my cohort?"
  • "Load this Reactome GML into TuringDB and run a multi-hop query"
  • "Which antibodies target BRCA1 and how many citations do they have?"
  • "Run the TuringDB cohort demo and show me the report"

Example Output

markdown
# Cohort analysis: `demo_cohort`

- **Patients**: 20
- **Ages** (n=20): min 14, max 73, mean 48.6, median 51.0
- **Under 18**: 3
- **Over 65**: 6

## Top 10 conditions

| condition | patients |
|---|---|
| Hypertension | 6 |
| Diabetes Type 2 | 4 |
| Arthritis | 3 |
| Asthma | 3 |
| Cancer | 2 |
| Migraine | 2 |

---

*ClawBio is a research and educational tool. Not a medical device.
This output must not be used for clinical decision-making.*

Output Structure

output_directory/
├── report.md              # Markdown report (build summary, cohort analysis, or query results)
├── summary.json           # Structured JSON (counts, stats, query metadata)
├── result.json            # Query results as JSON (--query only)
├── result.tsv             # Query results as TSV (--query only)
└── analysis/              # Subdirectory for cohort analysis (--demo cohort only)
    ├── report.md
    └── summary.json

Algorithm / Methodology

Cohort analyses

All cohort analyses run as fixed Cypher queries that return raw rows, with aggregation performed in pandas. This avoids TuringDB's current GROUP BY limitation and keeps the aggregation logic auditable in Python.

  1. Patient demographics: count, age min/max/mean/median via pd.to_numeric. Missing ages excluded, not imputed.
  2. Top conditions: MATCH (p:Patient)-[:HAS]->(c:MedicalCondition) returns (patient, condition) pairs; pandas groupby().nunique() counts distinct patients per condition.
  3. Top medications: same pattern via :TOOK_MEDICATION edges.
  4. Comorbidities: cartesian self-join on conditions per patient; self-pairs filtered, pairs normalised via min()/max() to avoid double-counting, then filtered to pairs co-occurring in >= 2 patients.
  5. Comedications: same pattern on medications.
  6. Junior/senior split: WHERE p.age < 18 and WHERE p.age > 65.

CSV type inference

LOAD CSV values arrive as strings. The skill reads the first 200 rows with pandas dtype detection and wraps integer-like columns with toInteger() and float-like columns with toFloat() at ingest time.

GML property name convention

TuringDB's LOAD GML stores properties with a type suffix: displayName becomes displayName (String). Access via backtick-escaped Cypher: n.`displayName (String)`.

Dependencies

Required:

  • turingdb >= 1.29; graph database engine (includes native daemon binary)
  • pandas >= 2.0; data manipulation and cohort aggregation
  • tabulate >= 0.9; DataFrame.to_markdown() rendering

Optional (HTTP endpoint only):

  • fastapi >= 0.110; REST API wrapper
  • uvicorn >= 0.27; ASGI server
  • pydantic >= 2.0; request validation

Gotchas

  • GML property names have a type suffix. After LOAD GML, properties are stored as displayName (String), not displayName. You must use backtick-escaped access: n.`displayName (String)`. Forgetting this produces "Property type not found" errors.
  • TuringDB does not support string comparison with <. The < operator only works on numeric types. Pair deduplication (e.g. comorbidity pairs) must happen in Python, not in Cypher WHERE clauses.
  • TuringDB's GROUP BY returns incorrect aggregations. RETURN key, count(x) does not group correctly. Always return raw rows and aggregate in pandas with groupby().nunique().
  • LOAD CSV + CREATE does not deduplicate. Each CSV row creates a new node unconditionally. TuringDB has no MERGE. Pre-dedupe in pandas if you need one-node-per-unique-value.
  • Writes outside a change do not persist. Always wrap CREATE/SET in new_change() ... CHANGE SUBMIT. This is the most common mistake when extending the skill.
  • The daemon must match the Python package version. If turingdb was upgraded but an old daemon is still running, LOAD CSV + CREATE and other v1.29 features will fail. Stop the old daemon first: --stop-server.

Safety

  • No patient identifiers in logs or outputs. The skill never echoes raw CSV row content to stdout or to the JSON summary. --query is the exception — it returns the user's own query results verbatim.
  • Synthetic demo data only. All shipped datasets (demo/cohort.csv, demo/pathway.gml, demo/antibody.csv) are synthetic. No real names, no real medical records, no identifiable demographics.
  • Research-use disclaimer. Every markdown report ends with: "ClawBio is a research and educational tool. Not a medical device. This output must not be used for clinical decision-making."
  • --build is additive, not destructive. Refuses to overwrite an existing graph. Pass a new --graph name or drop the existing one manually.
  • --query is for trusted operators. It executes arbitrary Cypher. Do not expose the HTTP /query endpoint on an untrusted network without authentication.
  • No clinical recommendations. The cohort analyser reports observed co-occurrence patterns — it does not label any pair as a contraindication, interaction, or recommendation.
  • Local-first. All data stays on the local machine. No cloud uploads.

Domain Decisions

Graph modelling conventions

  • Node labels: PascalCase (Patient, MedicalCondition, BloodType).
  • Edge types: UPPER_SNAKE_CASE (HAS, TOOK_MEDICATION, IS_TREATED_BY).
  • Property keys: camelCase (displayName, pubmedId).

Versioning

Every --build run executes inside a fresh TuringDB change. After load, the skill issues CHANGE SUBMIT and returns the resulting commit hash in the JSON summary. This makes every build auditable via CALL db.history().

Indexing

The skill does not create indexes automatically. Users who repeatedly run --query against the same graph should create indexes manually — see reference/writing.md.

Agent Boundary

In scope

  • Building a TuringDB graph from CSV/TSV/GML/JSONL via --build.
  • Running arbitrary Cypher via --query.
  • Running fixed cohort analyses via --analyse-cohort.
  • Auto-starting a local TuringDB daemon.
  • Exposing operations via HTTP (http_server.py).

Out of scope

  • Inferring a biomedical schema from unstructured CSV.
  • Deduplicating or merging nodes on ingest.
  • Vocabulary normalisation (ATC, ICD, SNOMED, HGNC).
  • Statistical inference (p-values, odds ratios, survival curves, enrichment tests).
  • Embedding generation or vector search.
  • Clinical decision support.

Agent role

The agent (LLM) dispatches this skill and interprets its outputs. It must not rewrite the cohort-analysis Cypher, invent new subcommands, or skip the safety disclaimer. For custom Cypher, point the agent at reference/querying.md, reference/writing.md, and reference/biomedical.md.

Integration with Bio Orchestrator

Trigger conditions: the orchestrator routes here when:

  • The user mentions "knowledge graph", "graph database", "Cypher", or "TuringDB"
  • The user provides a CSV/GML/JSONL and asks to build or query a graph
  • The user asks for cohort-level descriptive analytics (top conditions, comorbidities)

Chaining partners:

  • rnaseq-de: DE results (gene lists) can be loaded as JSONL nodes for pathway enrichment queries
  • pubmed-summariser: antibody graph query results can feed into literature searches
  • clinical-variant-reporter: variant annotations could be loaded as graph nodes for network analysis

Maintenance

  • Review cadence: re-evaluate when TuringDB releases a new major version (GROUP BY and string comparison support may change the aggregation strategy).
  • Staleness signals: new TuringDB release that changes LOAD GML property naming, or adds native MERGE/GROUP BY support.
  • Deprecation: if TuringDB is discontinued or the Cypher dialect diverges significantly from openCypher.

Citations

  • TuringDB; columnar graph database with git-like versioning
  • openCypher; query language specification that TuringDB implements a subset of

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Turingdb Graph làm được gì?

Build, query, and analyse biomedical knowledge graphs in TuringDB, a columnar graph database with git-like versioning.

Vì sao nên dùng Turingdb Graph trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Turingdb Graph là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Turingdb Graph trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/ClawBio/ClawBio/tree/main/skills/turingdb-graph. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Turingdb Graph?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Turingdb Graph với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Turingdb Graph với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Turingdb Graph có miễn phí không?

Có. Kỹ năng này được ClawBio phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇