Working with sequence files in BioseqDB and SeqKit
Description and use
The article demonstrates using BioseqDB to store and analyze UCSC Genome Browser sequences directly in PostgreSQL, eliminating intermediate files.
Problem
Need to perform sequence operations without exporting intermediate files, keeping DNA and metadata together.
Outcome
Successfully fetched and stored mitochondrial chromosome sequences in BioseqDB, enabling direct SQL analysis without intermediate files.
Workflow
- 1. Build BioseqDB with external API clients enabled via cmake flag BIOSEQ_BUILD_EXTERNAL_API_CLIENTS=ON.
- 2. Install extension and create schema seqkit_lab.
- 3. Create table genomes with columns assembly, species, seq using bioseq storage.
- 4. Insert mitochondrial chromosome records for human, mouse, zebrafish from UCSC using INSERT ... SELECT from bioseq_external.sequences.
- 5. Verify external_sequences_available is true and grant necessary permissions.
- 6. Use SQL queries to perform length checks, base counting, motif finding, record selection, and name handling.
- 7. Compare results with SeqKit 2.14.0 examples and FAQ tasks.
Evidence
Create a schema for this exercise and a table for the chromosome records: CREATE SCHEMA seqkit_lab; CREATE TABLE seqkit_lab.genomes ( assembly text NOT NULL, species text NOT NULL, seq bioseq.seq('dna5', 64) NOT NULL ) USING bioseq;
INSERT INTO seqkit_lab.genomes (assembly, species, seq) SELECT 'hg38', 'human', sequence::bioseq.seq('dna5', 64) FROM bioseq_external.sequences WHERE provider = 'ucsc' AND assembly_database = 'hg38' AND chromosome = 'chrM' AND start0 = 0 AND end0 = 16569;
Result · 1 row
external_sequences_available / boolean -------------------------------------- t
- Record date: 2026-10-19T18:41:43.223Z