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

rnafold-quantum-wasm

v1.0.0

Published

Standalone TypeScript/JavaScript client for Quantum-Inspired RNA Folding using WebAssembly (Pyodide). No server required!

Readme

RNA Fold Quantum WASM Client

A standalone TypeScript/JavaScript client for Quantum-Inspired RNA Folding using WebAssembly.

All calculations run locally using WebAssembly (Pyodide) - no localhost server required!

Features

  • 🚀 Standalone: Runs entirely in Node.js or browser - no server needed
  • WebAssembly: Fast Python RNA folding algorithms via Pyodide
  • 🧬 Quantum-Inspired: Uses quantum-inspired sampling for structure generation
  • 📦 Zero Dependencies: No need to install Python or any external tools
  • 🔧 Easy to Use: Simple TypeScript/JavaScript API

Installation

npm install rnafold-quantum-wasm

Quick Start

import { RnaFoldQuantumClient } from 'rnafold-quantum-wasm';

async function main() {
  // Create client (WebAssembly mode by default)
  const client = new RnaFoldQuantumClient();

  // Initialize (loads Pyodide and Python modules)
  await client.initialize();

  // Run the quantum RNA folding pipeline
  const result = await client.runPipeline({
    targetName: 'SARS-CoV-2 Spike Protein',
    disease: 'COVID-19',
    sequenceLength: 50,
    numCandidates: 20
  });

  console.log(`Found ${result.num_leads} lead candidates!`);
  console.log('Top lead:', result.leads[0]);
}

main();

API Reference

Constructor

new RnaFoldQuantumClient(options?: { useWasm?: boolean; baseUrl?: string })

Options:

  • useWasm (default: true): Use WebAssembly for local calculations
  • baseUrl: Server URL (only needed if useWasm is false)

Methods

initialize(): Promise<void>

Initialize the client. Must be called before other methods when using WASM mode.

await client.initialize();

runPipeline(options): Promise<RnaFoldResult>

Run the full quantum RNA folding pipeline.

Parameters:

{
  targetName?: string,      // Target protein name (default: 'unknown')
  disease?: string,          // Disease indication (default: 'unknown')
  sequenceLength?: number,   // RNA sequence length (default: 50)
  numCandidates?: number     // Number of candidates (default: 20)
}

Returns:

{
  success: boolean,
  target_name: string,
  disease: string,
  num_leads: number,
  leads: Array<{
    id: string,
    sequence: string,
    structure: string,      // Dot-bracket notation
    mfe: number,            // Minimum free energy (kcal/mol)
    stability_score: number,
    base_pairs: number,
    generation_method: string
  }>,
  metrics: {
    total_candidates: number,
    sequence_length: number,
    avg_stability: number,
    avg_mfe: number
  }
}

Example:

const result = await client.runPipeline({
  targetName: 'HIV-1 TAR',
  disease: 'HIV',
  sequenceLength: 60,
  numCandidates: 30
});

console.log(`Generated ${result.num_leads} leads`);
console.log(`Average MFE: ${result.metrics.avg_mfe} kcal/mol`);

predictStructure(sequence): Promise<StructureResult>

Predict secondary structure for a single RNA sequence.

Parameters:

  • sequence: RNA sequence string (A, U, G, C)

Returns:

{
  sequence: string,
  structure: string,    // Dot-bracket notation
  mfe: number,          // Minimum free energy
  base_pairs: number    // Number of base pairs
}

Example:

const result = await client.predictStructure('AUCGAUCGAUCG');
console.log('Structure:', result.structure);  // e.g., "((.......))"
console.log('MFE:', result.mfe, 'kcal/mol');

generateCandidates(length, numCandidates): Promise<Candidate[]>

Generate RNA candidates using quantum-inspired sampling.

Parameters:

  • length: Length of RNA sequences to generate
  • numCandidates: Number of candidates to generate

Example:

const candidates = await client.generateCandidates(40, 15);

candidates.forEach(c => {
  console.log(`${c.id}: ${c.sequence}`);
  console.log(`  Structure: ${c.structure}`);
  console.log(`  Stability: ${c.stability_score}`);
});

Examples

Basic Structure Prediction

import { RnaFoldQuantumClient } from 'rnafold-quantum-wasm';

const client = new RnaFoldQuantumClient();
await client.initialize();

const result = await client.predictStructure('GGGAAACCC');
console.log(result);
// {
//   sequence: 'GGGAAACCC',
//   structure: '(((...)))',
//   mfe: -4.2,
//   base_pairs: 3
// }

Generate Multiple Candidates

const candidates = await client.generateCandidates(30, 10);

// Sort by stability
candidates.sort((a, b) => b.stability_score - a.stability_score);

console.log('Most stable candidate:');
console.log('Sequence:', candidates[0].sequence);
console.log('Structure:', candidates[0].structure);
console.log('MFE:', candidates[0].mfe, 'kcal/mol');

Full Pipeline for Drug Discovery

const result = await client.runPipeline({
  targetName: 'KRAS G12C',
  disease: 'Lung Cancer',
  sequenceLength: 55,
  numCandidates: 50
});

// Export top leads
const topLeads = result.leads.slice(0, 5);
console.log('Top 5 Lead Candidates:');

topLeads.forEach((lead, i) => {
  console.log(`\n${i + 1}. ${lead.id}`);
  console.log(`   Sequence: ${lead.sequence}`);
  console.log(`   Structure: ${lead.structure}`);
  console.log(`   MFE: ${lead.mfe} kcal/mol`);
  console.log(`   Stability: ${lead.stability_score.toFixed(2)}`);
  console.log(`   Method: ${lead.generation_method}`);
});

How It Works

This package uses Pyodide to run Python RNA folding algorithms directly in JavaScript/TypeScript:

  1. Pyodide Loading: On first use, Pyodide (Python compiled to WebAssembly) is loaded
  2. Python Module: A simplified RNA folding module is loaded into the Python environment
  3. Algorithm Execution: Algorithms run in WASM for near-native performance
  4. Result Marshalling: Results are converted from Python to JavaScript objects

Algorithms Included

  • Nussinov Algorithm: Dynamic programming for RNA secondary structure prediction
  • Turner Energy Model: Simplified free energy calculations
  • Quantum-Inspired Sampling: Biased sequence generation for stable structures

Performance

  • First Run: ~2-5 seconds (Pyodide initialization)
  • Subsequent Runs: <100ms per prediction
  • Memory: ~50MB for Pyodide runtime

Limitations

This is a simplified version suitable for:

  • Educational purposes
  • Rapid prototyping
  • Initial candidate screening
  • Computational biology research

For production drug discovery, consider using the full Python backend with:

  • Full VQE quantum energy calculations
  • Molecular docking
  • Advanced thermodynamic analysis
  • Experimental validation

Migration from v1.x

v1.x (Server mode):

const client = new RnaFoldQuantumClient('http://localhost:5000');
const { job_id } = await client.runPipeline(formData);

v2.x (Standalone mode):

const client = new RnaFoldQuantumClient(); // Default: WASM mode
await client.initialize();
const result = await client.runPipeline({ targetName: 'MyTarget' });

License

ISC

Contributing

Issues and pull requests welcome!