gbz-base
v0.1.0-alpha.1
Published
Prototype for an immutable pangenome graph in SQLite
Readme
GBZ in SQLite
This is a prototype for storing a GBZ graph in an SQLite database. It is intended for interactive applications, where you want to access parts of the graph immediately without loading the entire graph into memory.
Once the implementation has stabilized, it will be included as an optional feature in GBWT-rs.
Building
To build the package, run:
cargo build --releaseYou will then have the gbz2db and query tool binaries in target/release/.
Building for WebAssembly
To build for a WASI WebAssembly runtime, run:
./build-wasm.shThis will make sure you have the wasm32-wasi target installed via rustup, and produce gbz2db.wasm and query.wasm files in target/wasm32-wasi/release/.
Publishing to NPM
After building the .wasm files, and increasing the version in package.json, you can publish to the gbz-base NPM package.
First do a dry run and make sure that you are publishing the files you want to publish:
npm publish --dry-runThen, publish for real:
npm publishUsing from NPM
To use the published NPM module in a project, first install it:
npm install --save gbz-baseThe gbz2db.wasm and query.wasm files are available for import as gbz-db/gbz2db.wasm and gbz2db/query.wasm. If you are targeting the browser using Webpack, you can await import() them and then get a fetchable URL in the default field of the result:
let blobImport = import("gbz-base/query.wasm");
let blob = await fetch(blobImport.default);You can then use a library like browser-wasi-shim to execute the command-line tool with particular arguments in a particular filesystem.
If you are not targeting the browser, you will have to open and read the files at their actual filesystem paths, node_modules/gbz-base/target/wasm32-wasi/release/gbz2db.wasm and node_modules/gbz-base/target/wasm32-wasi/release/query.wasm. Node itself cannot import or require() a WASI file in a useful way, and this module doesn't itself include any JavaScript code to help find and load the WASM files.
