Skip to content

Commit 7009d56

Browse files
committed
add BAM test
1 parent ed10cad commit 7009d56

9 files changed

Lines changed: 471 additions & 20 deletions

File tree

bindings/python/genomicsqlite.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,24 @@ def _cli():
194194
".mode tabs",
195195
"-cmd",
196196
".databases",
197+
"-cmd",
198+
'SELECT "GenomicSQLite " || genomicsqlite_version_check()',
199+
"-cmd",
200+
'.prompt "GenomicSQLite> "',
197201
]
198202
cmd.extend(sys.argv[2:])
199203
if sys.stdout.isatty():
200-
print(f"GenomicSQLite {__version__}")
201-
print(" ".join((arg if " " not in arg else f"'{arg}'" for arg in cmd)))
204+
print(
205+
" ".join(
206+
(
207+
(
208+
(arg if " " not in arg else f"'{arg}'")
209+
+ (" \\\n " if len(arg) > 50 else "")
210+
)
211+
for arg in cmd
212+
)
213+
)
214+
)
202215
os.execvp("sqlite3", cmd)
203216

204217

loaders/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ target_link_libraries(vcf_into_sqlite PRIVATE genomicsqlite SQLiteCpp hts)
33

44
add_executable(vcf_lines_into_sqlite vcf_lines_into_sqlite.cc common.hpp strlcpy.h)
55
target_link_libraries(vcf_lines_into_sqlite PRIVATE genomicsqlite SQLiteCpp)
6+
7+
add_executable(sam_into_sqlite sam_into_sqlite.cc common.hpp strlcpy.h)
8+
target_link_libraries(sam_into_sqlite PRIVATE genomicsqlite SQLiteCpp hts)

loaders/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# GenomicSQLite example loaders
2+
3+
These programs exemplify loading common genomics formats into SQLite databases, with the Genomics Extension providing compression and genomic range indexing. They're used in the extension's test suite, and may perhaps become useful for new applications. Improvement/addition pull requests welcome!
4+
5+
* `vcf_into_sqlite:`: loads VCF/gVCF/pVCF into a highly detailed schema representing all fields in SQL columns.
6+
* `vcf_lines_into_sqlite`: more simply loads VCF with each text line stored alongside bare-essential genomic range columns for indexing.
7+
* `sam_into_sqlite`: loads SAM/BAM/CRAM with a main table for the alignment details and cross-referenced tables for QNAME, SEQ, QUAL, & tags.
8+
9+
Compared to `vcf_into_sqlite`, `vcf_lines_into_sqlite` is much simpler and faster, and produces a smaller database; albeit one less useful for detailed SQL querying. They illustrate opposite ends of a tradeoff in schema design, while the SAM loader occupies a middle ground.

loaders/common.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "SQLiteCpp/SQLiteCpp.h"
44
#include "genomicsqlite.h"
55
#include "strlcpy.h"
6-
#include <htslib/vcf.h>
76
#include <iostream>
87
#include <memory>
98
#include <sqlite3.h>

0 commit comments

Comments
 (0)