npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

amoca-bio-wasm-lib

v1.0.2

Published

A TypeScript library for integrating AMOCA bio-wasm functionalities in React applications.

Downloads

274

Readme

AMOCA Bio-Wasm Library

AMOCA Bio-Wasm is a TypeScript library that provides WebAssembly bindings for the AMOCA bioinformatics module, designed for seamless integration with React applications. This library allows developers to leverage the performance benefits of WebAssembly while maintaining type safety and ease of use in TypeScript.

Installation

To install the AMOCA Bio-Wasm library, use npm or yarn:

npm install amoca-bio-wasm-lib

or

yarn add amoca-bio-wasm-lib

Usage

Importing the Library

You can import the WebAssembly initializer and the individual bioinformatics functions directly:

import init, { 
    align_sequences, 
    gc_content, 
    find_orfs 
} from 'amoca-bio-wasm-lib';

Alternatively, you can use the built-in React hook for automatic initialization and state management:

import { useAmoca } from 'amoca-bio-wasm-lib';

Using the Custom Hook

The useAmoca hook handles WASM initialization and provides a state-driven way to execute operations:

import React, { useState } from 'react';
import { useAmoca } from 'amoca-bio-wasm-lib';

const MyComponent: React.FC = () => {
    const { data, error, loading, executeWasmFunction } = useAmoca();
    const [seq, setSeq] = useState('ATGCATGC');

    const handleAlign = async () => {
        // executeWasmFunction handles initialization automatically
        await executeWasmFunction({
            type: 'align',
            seq1: seq,
            seq2: 'ATGCTAGC',
            mode: 'global',
            isProtein: false
        });
    };

    if (loading) return <div>Loading WASM...</div>;
    
    return (
        <div>
            <button onClick={handleAlign}>Run Alignment</button>
            {error && <div>Error: {error}</div>}
            {data && (
                <div>
                    <h3>Alignment Result:</h3>
                    <pre>{JSON.stringify(data, null, 2)}</pre>
                </div>
            )}
        </div>
    );
};

Direct WASM Usage

For non-React environments or low-level control, you can call the functions directly after initialization:

import init, { align_sequences } from 'amoca-bio-wasm-lib';

async function runAlignment() {
    // Initialize the WASM module
    await init();

    // Call the WASM function directly
    const result = align_sequences(
        'ATGCATGC', 
        'ATGCTAGC', 
        'global', 
        false
    );
    
    console.log('Result:', result);
}

Supported Operations

The library exports the following high-performance functions (available via direct import or the executeWasmFunction hook):

| hook type | Direct Function | Description | | :--- | :--- | :--- | | align | align_sequences | Global (Needleman-Wunsch) or Local (Smith-Waterman) alignment | | identity | pairwise_identity | Fast pairwise identity percentage calculation | | kmers | count_sequence_kmers | Frequency counting of k-mers in a sequence | | - | kmer_frequency_spectrum | Distribution spectrum of k-mer frequencies | | jaccard | sequence_jaccard | Jaccard similarity based on shared k-mers | | minimizers | find_minimizers | Find minimizer seeds for indexing | | rna | predict_rna_structure | Secondary structure prediction using Nussinov algorithm | | - | max_base_pairs | Quickly calculate the theoretical maximum base pairs | | gc | gc_content | Total GC content percentage | | sliding_gc | sliding_gc | GC content across a window (profile) | | orfs | find_orfs | Find Open Reading Frames in all 6 frames | | motif | find_motif | Fast exact motif searching using KMP | | composition | nucleotide_composition | Comprehensive base composition analysis |

API

useAmoca

  • Returns:
    • data: The result of the last executed operation.
    • error: Error message if any.
    • loading: Boolean indicating if WASM is loading or an operation is in progress.
    • isWasmReady: Boolean indicating if the WASM module is initialized.
    • executeWasmFunction(input: WasmOperation): Function to run WASM operations.
  • Description: This hook manages the interaction with the AMOCA bio-wasm functionalities, handling state and side effects.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.