xiaohongshu
xiaohongshu
go-db-query
Skills for querying Gene Ontology annotation databases in DuckDB format. Use this for queries about GO annotations, genes, terms, evidence codes, or taxonomic relationships in GO-DB databases (db/*.ddb files). Particularly useful for hierarchical queries using closure tables to find genes annotat...
Full skill instructions
This skill provides expertise for querying GO-DB DuckDB databases containing Gene Ontology (GO) annotations. GO-DB databases store annotations linking genes/proteins to GO terms, along with the full GO ontology structure. The key feature is the use of closure tables that enable efficient hierarchical queries across the ontology graph.
Use this skill when working with queries involving:
Closure tables are the heart of GO-DB querying. They contain the transitive closure of ontological relationships:
isa_partof_closure: Contains all is-a and part-of relationships, both direct and inferred
How to use: Join annotations with closure tables to find all genes annotated to a term OR its descendants
-- Find all yeast kinases (including specific types like protein kinase)
SELECT DISTINCT a.db_object_symbol, a.db_object_id
FROM gaf_association a
INNER JOIN isa_partof_closure ipc ON a.ontology_class_ref = ipc.subject
WHERE ipc.object = 'GO:0016301' -- kinase activity
AND a.db_object_taxon LIKE '%559292%'; -- yeast
Available databases are located in db/*.ddb:
sgd.ddb (yeast), fb.ddb (fly), pombase.ddb (fission yeast)mammal.ddb, fungi.ddb, plant.ddbgoa_human.ddb, goa_uniprot_all.ddbThe most common pattern: find all genes annotated to a term or its descendants.
Pattern:
SELECT DISTINCT
a.db_object_symbol,
a.ontology_class_ref,
t.label AS term_label
FROM gaf_association a
INNER JOIN isa_partof_closure ipc ON a.ontology_class_ref = ipc.subject
INNER JOIN term_label t ON a.ontology_class_ref = t.id
WHERE ipc.object = '<GO_TERM_ID>'
AND a.db_object_taxon LIKE '%<TAXON_ID>%';
Why use closure: Without the closure join, only direct annotations are found. The closure captures all annotations to descendant terms (e.g., "protein kinase", "lipid kinase" when searching for "kinase").
Aggregate annotations by dimensions like evidence type, taxon, or assigned_by.
Pattern:
SELECT
evidence_type,
COUNT(*) AS annotation_count,
COUNT(DISTINCT db_object_id) AS unique_genes
FROM gaf_association
WHERE <filters>
GROUP BY evidence_type
ORDER BY annotation_count DESC;
Combine with closure tables to count within ontology subtrees.
Identify annotations that are not redundant with more specific annotations from other sources.
Pattern:
SELECT a.*
FROM gaf_association a
WHERE NOT EXISTS (
SELECT 1
FROM gaf_association a2
INNER JOIN isa_partof_closure ipc ON a2.ontology_class_ref = ipc.subject
WHERE a2.supporting_references != a.supporting_references
AND ipc.object = a.ontology_class_ref -- a2 is to a child term
AND a2.db_object_id = a.db_object_id
);
Logic: An annotation is unique if no child-term annotation exists from a different source for the same gene.
Navigate the ontology structure itself using edge and closure tables.
Find direct children:
SELECT DISTINCT e.subject, t.label
FROM edge e
INNER JOIN term_label t ON e.subject = t.id
WHERE e.object = '<GO_TERM_ID>'
AND e.predicate = 'rdfs:subClassOf';
Find all ancestors:
SELECT DISTINCT ipc.object, t.label
FROM isa_partof_closure ipc
INNER JOIN term_label t ON ipc.object = t.id
WHERE ipc.subject = '<GO_TERM_ID>';
Find genes with annotations to both T1 and T2 (or their descendants).
Pattern:
SELECT DISTINCT a1.db_object_symbol, a1.db_object_id
FROM gaf_association a1
INNER JOIN isa_partof_closure ipc1 ON a1.ontology_class_ref = ipc1.subject
INNER JOIN gaf_association a2 ON a1.db_object_id = a2.db_object_id
INNER JOIN isa_partof_closure ipc2 ON a2.ontology_class_ref = ipc2.subject
WHERE ipc1.object = '<GO_TERM_1>'
AND ipc2.object = '<GO_TERM_2>';
Logic: Self-join gaf_association on gene ID, then join each side with closure tables to check ancestry.
# Query a specific database
duckdb db/sgd.ddb "SELECT COUNT(*) FROM gaf_association"
# Interactive mode
duckdb db/sgd.ddb
D SELECT * FROM term_label WHERE label LIKE '%kinase%' LIMIT 10;
D .quit
# Export results to CSV
duckdb db/goa_human.ddb "COPY (SELECT ...) TO 'results.csv' (HEADER, DELIMITER ',')"
sgd.ddb for yeast)mammal.ddb)goa_human.ddbgoa_uniprot_all.ddb (largest, >400M annotations)Check available databases:
ls -lh db/*.ddb
Main annotation table with columns:
db_object_symbol, db_object_id: Gene identifier and symbolontology_class_ref: GO term ID (e.g., "GO:0016301")evidence_type: Evidence code (e.g., "IEA", "IDA")db_object_taxon: NCBI taxon ID (e.g., "taxon:9606")aspect: GO aspect - "P" (process), "F" (function), "C" (component)supporting_references: Reference IDsassigned_by: Annotation sourceTransitive closure table with columns:
subject: Descendant term IDpredicate: Relationship typeobject: Ancestor term IDTerm ID to label mapping:
id: GO term IDlabel: Human-readable labelAll ontology relationships (including inferred):
subject, predicate, objectFor complete schema documentation, refer to references/schema.md.
When handling a query request:
references/common_queries.mdduckdb and check results make senseExperimental: IDA, IMP, IGI, IPI, IEP Computational: IEA, ISS, ISO, ISA, ISM, IBA Curator/Author: TAS, NAS, IC, ND
Complete schema documentation including:
Comprehensive SQL examples for all query patterns:
Load these references when detailed examples or schema information is needed to construct queries.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience