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

@bioscript/seq-align

v0.2.3

Published

Pairwise sequence alignment algorithms (Needleman-Wunsch, Smith-Waterman) with BLOSUM and PAM scoring matrices.

Readme

@bioscript/seq-align

Sequence alignment algorithms for bioinformatics.

Features

  • Global Alignment - Needleman-Wunsch for end-to-end alignment
  • Local Alignment - Smith-Waterman for conserved regions
  • Semi-Global - End-gap-free alignment for primers/probes
  • Overlap Alignment - Suffix-prefix matching for assembly
  • Banded Alignment - Fast alignment for >90% identity
  • Hirschberg - Memory-efficient O(min(m,n)) space
  • 13 Scoring Matrices - BLOSUM, PAM, DNA matrices
  • Type Safe - Full TypeScript support
  • Zero Dependencies - Pure TypeScript

Installation

npm install @bioscript/seq-align

Quick Start

import { needlemanWunsch, smithWaterman } from '@bioscript/seq-align';

// Global alignment
const global = needlemanWunsch('HEAGAWGHEE', 'PAWHEAE', {
  matrix: 'BLOSUM62',
  gapOpen: -10,
  gapExtend: -1,
});

console.log(global.alignedSeq1);     // 'HEAGAWGHEE'
console.log(global.alignedSeq2);     // '--PAW-HEAE'
console.log(global.identityPercent); // 42.86%

// Local alignment
const local = smithWaterman('HEAGAWGHEEHEAGAWGHEE', 'PAWHEAE', {
  matrix: 'BLOSUM62',
});

console.log(local.alignedSeq1);  // Best matching region
console.log(local.startPos1);    // Start position

API

needlemanWunsch(seq1, seq2, options?)

Global alignment for complete sequences.

Options:

  • matrix - Scoring matrix (default: 'BLOSUM62')
  • gapOpen - Gap opening penalty (default: -10)
  • gapExtend - Gap extension penalty (default: -1)
const result = needlemanWunsch('ACGTACGT', 'ACGTAGCT', {
  matrix: 'DNA_SIMPLE',
  gapOpen: -5,
  gapExtend: -2,
});

smithWaterman(seq1, seq2, options?)

Local alignment for finding best matching regions.

Options: Same as needlemanWunsch, plus:

  • minScore - Minimum score threshold (default: 0)
const result = smithWaterman('HEAGAWGHEE', 'AWGHE', {
  matrix: 'BLOSUM62',
  minScore: 20,
});

semiGlobal(seq1, seq2, options?)

Semi-global alignment with free end gaps.

const result = semiGlobal('ATCGATCG', 'GGGGGATCGATCGAAAA', {
  matrix: 'DNA_SIMPLE',
});

overlapAlign(seq1, seq2, options?)

Overlap alignment for sequence assembly.

const result = overlapAlign('ACGTACGTACGT', 'ACGTACGTGGGG', {
  matrix: 'DNA_SIMPLE',
});

bandedAlign(seq1, seq2, options?)

Fast banded alignment for closely related sequences.

Options: Same as needlemanWunsch, plus:

  • bandwidth - Half-width of diagonal band (default: 10)
const result = bandedAlign(seq1, seq2, {
  matrix: 'DNA_SIMPLE',
  bandwidth: 10,
});

hirschberg(seq1, seq2, options?)

Memory-efficient global alignment for very long sequences. Uses a linear gap model (gapOpen per gapped column); gapExtend is ignored. Scores are not directly comparable to Needleman-Wunsch when gapOpen !== gapExtend.

const result = hirschberg(longSeq1, longSeq2, {
  matrix: 'DNA_SIMPLE',
});

Scoring Matrices

BLOSUM: BLOSUM45, BLOSUM50, BLOSUM62, BLOSUM80, BLOSUM90

PAM: PAM30, PAM70, PAM120, PAM250

DNA: DNA_SIMPLE, DNA_FULL

import { getMatrix, BLOSUM62 } from '@bioscript/seq-align';

const matrix = getMatrix('BLOSUM62');
const score = BLOSUM62.A.R; // -1

Return Type

All functions return AlignmentResult:

interface AlignmentResult {
  alignedSeq1: string;
  alignedSeq2: string;
  score: number;
  startPos1: number;
  startPos2: number;
  endPos1: number;
  endPos2: number;
  identity: number;
  identityPercent: number;
  alignmentLength: number;
}

License

MIT © 2026 Mykyta Forofontov