align

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NeedlemanWunsch

func NeedlemanWunsch(stringA string, stringB string, scoring Scoring) (int, string, string)

NeedlemanWunsch performs global alignment between two strings using the Needleman-Wunsch algorithm. It returns the final score and the optimal alignments of the two strings in O(nm) time and O(nm) space. https://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm

Example
package main

import (
	"fmt"

	"github.com/TimothyStiles/poly/align"
)

func main() {
	a := "GATTACA"
	b := "GCATGCU"
	scoring := align.NewScoring()
	score, alignA, alignB := align.NeedlemanWunsch(a, b, scoring)
	fmt.Printf("score: %d, A: %s, B: %s", score, alignA, alignB)
}

Types

type Scoring

type Scoring struct {
	Match      int
	Mismatch   int
	GapPenalty int
}

Scoring is a struct that holds the scoring matrix for match, mismatch, and gap penalties.

func NewScoring

func NewScoring() Scoring

NewScoring returns a new Scoring struct with default values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL