birdie
is an experimental bioinformatics module for Deno running on
WebAssembly (WASM). At the moment the project is in very early stages of
development and all features are considered unstable.
Example:
import * as io from "https://deno.land/x/birdie/io/mod.ts";
import { readAll } from "https://deno.land/std/streams/conversion.ts";
await io.initWasm();
// Read a file in FASTA format from standard input, e.g.:
// cat file.fasta | deno run --allow-read ./analysis.ts
io.readFastaFile(await readAll(Deno.stdin));
deno
is required to run this module.
birdie
provides modules that can be used in JavaScript and TypeScript by
importing them from a URL and initializing the WASM:
// A module with pattern matching algorithms
import * as pm from "https://deno.land/x/birdie/pattern_matching/mod.ts";
await pm.initWasm();
WASM dependencies are not locally cached along with JS/TS files in Deno yet, so
you need to pass --allow-net=deno.land
in order to run code using birdie
.
import * as distance from "https://deno.land/x/birdie/distance/mod.ts";
await distance.initWasm();
const x = "GTCTGCATGCG";
const y = "TTTAGCTAGCG";
// Hamming distance
const hammingDistance = distance.hamming(x, y);
console.log(hammingDistance); // 5n (BigInt)
// Levenshtein distance (Wagner-Fischer Algorithm)
const levenshteinDistance = distance.levenshtein(x, y);
console.log(levenshteinDistance);
// Myers' Algorithm
const myersDistance = distance.myers(x, y);
console.log(myersDistance);
import * as sequence from "https://deno.land/x/birdie/sequence/mod.ts";
await sequence.initWasm();
const gcRatio = sequence.gcContent("GATATACA");
console.log(gcRatio); // 0.25
const gc3Ratio = sequence.gc3Content("GATATACA");
console.log(gc3Ratio); // 0.67
- shift_and
import * as pm from "https://deno.land/x/birdie/pattern_matching/mod.ts";
await pm.initWasm();
const pattern = "AAAA";
const text = "ACGGCTAGAAAAGGCTAG";
const startPos = pm.shiftAnd(pattern, text);
console.log(startPos); // 8
Any contributions are welcome and much appreciated!