Help needed to import `biowasm`


I’m trying to run biowasm inside an Observable notebook.

I can successfully import the module via

a = require("@biowasm/aioli@3.1.0/dist/aioli.js")

but when I call the class constructor, as suggested in the docs, with

cli = await new a(["samtools/1.10", "seqtk/1.3"])

I get the error
cli = TypeError: undefined is not an object (evaluating 'f.apply')

Any help would be appreciated!

PS If this requires developer input rather than a general query here, let me know!

This error seems specific to the bundle. I would recommend to create an issue in their GitHub repo.

For reference you might also want to try a standalone example in a plain HTML file.


Thanks, will file an issue on their repo.

PS I can run their examples in a plain HTML file locally.

I took another stab at it. Turns out the problem is that CLI exposes a property .then, which causes it to get treated as a Thenable when passed through Promise.resolve(). Example:

  then(resolve) { resolve("Hello there!") }

Observable’s Runtime resolves all top-level promises automatically, so with the above in mind returning CLI from a cell will break. However, you should be able to make biowasm work as long as you don’t return CLI directly:

Aioli = require("")
cli = ({cli: await new Aioli(["samtools/1.10"])})
cli.cli.exec("samtools view /samtools/examples/toy.sam")

This works as expected, many thanks!!