Example #1
0
func main() {
	optaln := new(algorithms.OptAli)
	log.Println(optaln.CalculateDistance("SimpleTest", "SimplTest"))

	optaln = new(algorithms.OptAli)
	log.Println(optaln.CalculateDistance("ATCGT", "TGGTG"))

	optaln = new(algorithms.OptAli)
	log.Println(optaln.CalculateDistance("GACTTAC", "CGTGAATTCAT"))

	damleu := new(algorithms.DamLev)
	log.Println(damleu.CalculateDistanceWithAlphabet("SimpleTest", "SimplTest", 20))

	damleu = new(algorithms.DamLev)
	log.Println(damleu.CalculateDistanceWithAlphabet("ATCGT", "TGGTG", 20))

	//gap, missmatchscore, exactscore

	neewun := algorithms.NewNeeWun(-2, 1, 1)
	log.Println(neewun.CalculateDistance("ATCGT", "TGGTG"))

	smiwat := algorithms.NewSmiWat(-4, 3, 5)
	log.Println(smiwat.CalculateDistance("GACTTAC", "CGTGAATTCAT"))

}
func TestCalculateDistanceDamLevWithAlphabet(t *testing.T) {
	damleu1 := new(algorithms.DamLev)
	result1 := damleu1.CalculateDistanceWithAlphabet("SimpleTest", "SimplTest", 20)
	assert.Equal(t, 1, result1, "Calculation for DamLeu is not correct!")

	damleu2 := new(algorithms.DamLev)
	result2 := damleu2.CalculateDistanceWithAlphabet("ATCGT", "TGGTG", 20)
	assert.Equal(t, 3, result2, "Calculation for DamLeu is not correct!")
}